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:
authorJulian Eisel <eiseljulian@gmail.com>2019-08-03 00:37:31 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-08-03 00:37:31 +0300
commit88b79cacb249edc5998917aed7c3caa9ee83eacc (patch)
tree823d0aee8806126b4a1b1777fd72437fc9bb2f98
parent7a711e133c9bd1f7a6df8320a82ee69c749d3d2f (diff)
parent0d70afed196aaf77b7d430d165a7b2c72e3cc6a0 (diff)
Merge branch 'soc-2019-openxr' into temp-vr-draw-thread
-rw-r--r--build_files/build_environment/cmake/theora.cmake12
-rw-r--r--build_files/build_environment/cmake/versions.cmake4
-rwxr-xr-xbuild_files/build_environment/install_deps.sh2
-rw-r--r--build_files/cmake/Modules/GTestTesting.cmake4
-rw-r--r--build_files/windows/reset_variables.cmd1
-rw-r--r--build_files/windows/set_build_dir.cmd7
-rw-r--r--intern/cycles/CMakeLists.txt2
-rw-r--r--intern/cycles/blender/blender_session.cpp2
-rw-r--r--intern/cycles/kernel/osl/CMakeLists.txt2
-rw-r--r--intern/cycles/render/CMakeLists.txt2
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp25
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py14
-rw-r--r--release/scripts/startup/bl_ui/properties_grease_pencil_common.py11
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py2
-rw-r--r--release/scripts/startup/bl_ui/space_text.py8
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py6
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2
-rw-r--r--source/blender/blenkernel/BKE_collection.h2
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h1
-rw-r--r--source/blender/blenkernel/BKE_gpencil_modifier.h1
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c2
-rw-r--r--source/blender/blenkernel/intern/blendfile.c1
-rw-r--r--source/blender/blenkernel/intern/gpencil.c82
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c4
-rw-r--r--source/blender/blenkernel/intern/library_query.c2
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c18
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c8
-rw-r--r--source/blender/blenlib/intern/math_bits_inline.c34
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.c4
-rw-r--r--source/blender/collada/AnimationExporter.cpp2
-rw-r--r--source/blender/collada/AnimationImporter.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.h4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h2
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp5
-rw-r--r--source/blender/draw/engines/select/select_draw_utils.c42
-rw-r--r--source/blender/draw/engines/select/select_engine.c80
-rw-r--r--source/blender/draw/engines/select/select_private.h2
-rw-r--r--source/blender/editors/armature/armature_relations.c21
-rw-r--r--source/blender/editors/curve/editfont.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c368
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h4
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c7
-rw-r--r--source/blender/editors/include/ED_object.h14
-rw-r--r--source/blender/editors/include/ED_view3d.h10
-rw-r--r--source/blender/editors/interface/interface.c17
-rw-r--r--source/blender/editors/interface/interface_layout.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c156
-rw-r--r--source/blender/editors/mesh/editmesh_select.c32
-rw-r--r--source/blender/editors/object/object_add.c22
-rw-r--r--source/blender/editors/object/object_modes.c13
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve_undo.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c17
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c7
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c18
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c1
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_clip/clip_editor.c2
-rw-r--r--source/blender/editors/space_clip/clip_ops.c2
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c7
-rw-r--r--source/blender/editors/space_clip/tracking_ops_track.c7
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_preview.c2
-rw-r--r--source/blender/editors/space_text/text_undo.c184
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c95
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c61
-rw-r--r--source/blender/editors/transform/transform.c184
-rw-r--r--source/blender/editors/transform/transform.h12
-rw-r--r--source/blender/editors/transform/transform_constraints.c10
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c4
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/freestyle/CMakeLists.txt5
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c10
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c3
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c3
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp6
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h2
-rw-r--r--source/blender/makesrna/RNA_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_rna.c5
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c2
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c2
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c1
-rw-r--r--source/blender/python/gpu/gpu_py_types.c1
-rw-r--r--source/blender/render/intern/source/render_texture.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c42
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
-rw-r--r--source/creator/creator_args.c4
-rw-r--r--tests/python/CMakeLists.txt282
-rw-r--r--tests/python/bl_pyapi_bpy_utils_units.py14
111 files changed, 1260 insertions, 916 deletions
diff --git a/build_files/build_environment/cmake/theora.cmake b/build_files/build_environment/cmake/theora.cmake
index e5f94b15b02..5d41fab5740 100644
--- a/build_files/build_environment/cmake/theora.cmake
+++ b/build_files/build_environment/cmake/theora.cmake
@@ -16,20 +16,26 @@
#
# ***** END GPL LICENSE BLOCK *****
+if (UNIX)
+ set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV} && export HAVE_PDFLATEX=no)
+else()
+ set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV})
+endif()
+
ExternalProject_Add(external_theora
URL ${THEORA_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH SHA256=${THEORA_HASH}
PREFIX ${BUILD_DIR}/theora
- CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/theora
+ CONFIGURE_COMMAND ${THEORA_CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/theora
--disable-shared
--enable-static
--with-pic
--with-ogg=${LIBDIR}/ogg
--with-vorbis=${LIBDIR}/vorbis
--disable-examples
- BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make -j${MAKE_THREADS}
- INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make install
+ BUILD_COMMAND ${THEORA_CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make -j${MAKE_THREADS}
+ INSTALL_COMMAND ${THEORA_CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make install
INSTALL_DIR ${LIBDIR}/theora
)
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index 609a8926d2b..1d3da863898 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -143,11 +143,11 @@ set(OSL_VERSION 1.9.9)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH 44ad511e424965a10fce051a053b0605)
-set(PYTHON_VERSION 3.7.0)
+set(PYTHON_VERSION 3.7.4)
set(PYTHON_SHORT_VERSION 3.7)
set(PYTHON_SHORT_VERSION_NO_DOTS 37)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
-set(PYTHON_HASH eb8c2a6b1447d50813c02714af4681f3)
+set(PYTHON_HASH d33e4aae66097051c2eca45ee3604803)
set(TBB_VERSION 2018_U5)
set(TBB_URI https://github.com/01org/tbb/archive/${TBB_VERSION}.tar.gz)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 5cf005d60ce..e4f03480385 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -303,7 +303,7 @@ USE_CXX11=true
CLANG_FORMAT_VERSION_MIN="6.0"
-PYTHON_VERSION="3.7.0"
+PYTHON_VERSION="3.7.4"
PYTHON_VERSION_MIN="3.7"
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake
index eb06e00bf9e..47edbdf37a6 100644
--- a/build_files/cmake/Modules/GTestTesting.cmake
+++ b/build_files/cmake/Modules/GTestTesting.cmake
@@ -50,6 +50,10 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
INCLUDE_DIRECTORIES "${TEST_INC}")
if(${DO_ADD_TEST})
add_test(NAME ${NAME}_test COMMAND ${TESTS_OUTPUT_DIR}/${NAME}_test WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
+
+ # Don't fail tests on leaks since these often happen in external libraries
+ # that we can't fix.
+ set_tests_properties(${NAME}_test PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
endif()
endif()
endmacro()
diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd
index 631618040ec..8b74cec238d 100644
--- a/build_files/windows/reset_variables.cmd
+++ b/build_files/windows/reset_variables.cmd
@@ -7,7 +7,6 @@ set BUILD_VS_YEAR=
set BUILD_VS_LIBDIRPOST=
set BUILD_VS_LIBDIR=
set BUILD_VS_SVNDIR=
-set BUILD_NGE=
set KEY_NAME=
set MSBUILD_PLATFORM=
set MUST_CLEAN=
diff --git a/build_files/windows/set_build_dir.cmd b/build_files/windows/set_build_dir.cmd
index 8842a52eb5b..65b5923cd9a 100644
--- a/build_files/windows/set_build_dir.cmd
+++ b/build_files/windows/set_build_dir.cmd
@@ -1,4 +1,9 @@
-set BUILD_DIR=%BUILD_DIR%_%TARGET%%BUILD_NGE%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
+if NOT "%TARGET%" == "" (
+ set BUILD_DIR=%BUILD_DIR%_%TARGET%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
+) else (
+ set BUILD_DIR=%BUILD_DIR%_%BUILD_ARCH%_vc%BUILD_VS_VER%_%BUILD_TYPE%
+)
+
if NOT "%BUILD_DIR_OVERRRIDE%"=="" (
set BUILD_DIR=%BUILD_DIR_OVERRRIDE%
) \ No newline at end of file
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 87f88f7ed34..6a3ebd85378 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -178,11 +178,13 @@ if(CXX_HAS_AVX2)
endif()
if(WITH_CYCLES_OSL)
+ # LLVM and OSL need to build without RTTI
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
endif()
# Definitions and Includes
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index dcbb101b01d..d38a97dc4ea 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -527,7 +527,7 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
builtin_images_load();
/* Attempt to free all data which is held by Blender side, since at this
- * point we knwo that we've got everything to render current view layer.
+ * point we know that we've got everything to render current view layer.
*/
/* At the moment we only free if we are not doing multi-view
* (or if we are rendering the last view). See T58142/D4239 for discussion.
diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt
index 28d9ca854db..35cca2da8ad 100644
--- a/intern/cycles/kernel/osl/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/CMakeLists.txt
@@ -29,8 +29,6 @@ set(LIB
cycles_render
)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
-
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt
index c79e5a23ea1..53196b013f6 100644
--- a/intern/cycles/render/CMakeLists.txt
+++ b/intern/cycles/render/CMakeLists.txt
@@ -85,8 +85,6 @@ if(WITH_CYCLES_OSL)
)
endif()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
-
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 31411c823ae..e46edeeac9a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -2194,23 +2194,28 @@ int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/)
#ifdef WITH_X11_XINPUT
+static bool is_filler_char(char c)
+{
+ return isspace(c) || c == '_' || c == '-' || c == ';' || c == ':';
+}
+
/* These C functions are copied from Wine 3.12's wintab.c */
static bool match_token(const char *haystack, const char *needle)
{
- const char *p, *q;
- for (p = haystack; *p;) {
- while (*p && isspace(*p))
- p++;
- if (!*p)
+ const char *h, *n;
+ for (h = haystack; *h;) {
+ while (*h && is_filler_char(*h))
+ h++;
+ if (!*h)
break;
- for (q = needle; *q && *p && tolower(*p) == tolower(*q); q++)
- p++;
- if (!*q && (isspace(*p) || !*p))
+ for (n = needle; *n && *h && tolower(*h) == tolower(*n); n++)
+ h++;
+ if (!*n && (is_filler_char(*h) || !*h))
return true;
- while (*p && !isspace(*p))
- p++;
+ while (*h && !is_filler_char(*h))
+ h++;
}
return false;
}
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3f0d02f0b9b..78fd2fe8008 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2424,8 +2424,20 @@ def km_sequencerpreview(params):
("sequencer.view_all_preview", {"type": 'HOME', "value": 'PRESS'}, None),
("sequencer.view_all_preview", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None),
("sequencer.view_ghost_border", {"type": 'O', "value": 'PRESS'}, None),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', "ctrl": True},
+ {"properties": [("ratio", 8.0)]}),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS', "ctrl": True},
+ {"properties": [("ratio", 4.0)]}),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS', "ctrl": True},
+ {"properties": [("ratio", 2.0)]}),
("sequencer.view_zoom_ratio", {"type": 'NUMPAD_1', "value": 'PRESS'},
{"properties": [("ratio", 1.0)]}),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS'},
+ {"properties": [("ratio", 0.5)]}),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS'},
+ {"properties": [("ratio", 0.25)]}),
+ ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'},
+ {"properties": [("ratio", 0.125)]}),
("sequencer.sample", {"type": params.action_mouse, "value": 'PRESS'}, None),
])
@@ -3004,7 +3016,7 @@ def km_grease_pencil_stroke_edit_mode(params):
# Context menu
op_menu("VIEW3D_MT_gpencil_edit_context_menu", params.context_menu_event),
# Separate
- op_menu("GPENCIL_MT_separate", {"type": 'P', "value": 'PRESS'}),
+ ("gpencil.stroke_separate", {"type": 'P', "value": 'PRESS'}, None),
# Split and joint strokes
("gpencil.stroke_split", {"type": 'V', "value": 'PRESS'}, None),
("gpencil.stroke_join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 112fb4361d6..1e5aac4cc0d 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -590,16 +590,6 @@ class GPENCIL_MT_snap(Menu):
layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
-class GPENCIL_MT_separate(Menu):
- bl_label = "Separate"
-
- def draw(self, _context):
- layout = self.layout
- layout.operator("gpencil.stroke_separate", text="Selected Points").mode = 'POINT'
- layout.operator("gpencil.stroke_separate", text="Selected Strokes").mode = 'STROKE'
- layout.operator("gpencil.stroke_separate", text="Active Layer").mode = 'LAYER'
-
-
class GPENCIL_MT_gpencil_draw_delete(Menu):
bl_label = "GPencil Draw Delete"
@@ -931,7 +921,6 @@ classes = (
GPENCIL_MT_pie_sculpt,
GPENCIL_MT_snap,
- GPENCIL_MT_separate,
GPENCIL_MT_cleanup,
GPENCIL_MT_gpencil_draw_delete,
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index b0fc5716f89..ff2dfca6cf8 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -180,8 +180,6 @@ class CLIP_HT_header(Header):
active_object = tracking.objects.active
if sc.view == 'CLIP':
- layout.template_running_jobs()
-
r = active_object.reconstruction
if r.is_valid and sc.view == 'CLIP':
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index 1c37e028199..cf264bf6149 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -82,19 +82,19 @@ class TEXT_HT_footer(Header):
if text.filepath:
if text.is_dirty:
row.label(
- text=iface_(f"File: *{text.filepath:s} (unsaved)"),
+ text=iface_("File: *%s (unsaved)" % text.filepath),
translate=False,
)
else:
row.label(
- text=iface_(f"File: {text.filepath:s}"),
+ text=iface_("File: %s" % text.filepath),
translate=False,
)
else:
row.label(
- text="Text: External"
+ text=iface_("Text: External")
if text.library
- else "Text: Internal",
+ else iface_("Text: Internal"),
)
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 651d30a029f..5a1398d0582 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -22,6 +22,8 @@ from bpy.types import (
Menu,
)
+from bpy.app.translations import pgettext_tip as tip_
+
__all__ = (
"ToolDef",
"ToolSelectPanelHelper",
@@ -782,7 +784,7 @@ def description_from_id(context, space_type, idname, *, use_operator=True):
if callable(description):
km = _keymap_from_item(context, item)
return description(context, item, km)
- return description
+ return tip_(description)
# Extract from the operator.
if use_operator:
@@ -798,7 +800,7 @@ def description_from_id(context, space_type, idname, *, use_operator=True):
if operator is not None:
import _bpy
- return _bpy.ops.get_rna_type(operator).description
+ return tip_(_bpy.ops.get_rna_type(operator).description)
return ""
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index fc0505d9681..ca65fa52ea3 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6292,7 +6292,7 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu):
layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
- layout.menu("GPENCIL_MT_separate", text="Separate")
+ layout.operator_menu_enum("gpencil.stroke_separate", "mode")
layout.operator("gpencil.stroke_split", text="Split")
op = layout.operator("gpencil.stroke_cyclical_set", text="Close")
op.type = 'CLOSE'
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 972ae5e8628..0ab101f065d 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -171,7 +171,7 @@ void BKE_main_collections_parent_relations_rebuild(struct Main *bmain);
typedef void (*BKE_scene_objects_Cb)(struct Object *ob, void *data);
typedef void (*BKE_scene_collections_Cb)(struct Collection *ob, void *data);
-/* Iteratorion over objects in collection. */
+/* Iteration over objects in collection. */
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode) \
{ \
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 60e9e6b91d3..9ec872f3676 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -217,6 +217,7 @@ bool BKE_gpencil_smooth_stroke_strength(struct bGPDstroke *gps, int point_index,
bool BKE_gpencil_smooth_stroke_thickness(struct bGPDstroke *gps, int point_index, float influence);
bool BKE_gpencil_smooth_stroke_uv(struct bGPDstroke *gps, int point_index, float influence);
bool BKE_gpencil_close_stroke(struct bGPDstroke *gps);
+void BKE_gpencil_dissolve_points(struct bGPDframe *gpf, struct bGPDstroke *gps, const short tag);
void BKE_gpencil_get_range_selected(struct bGPDlayer *gpl, int *r_initframe, int *r_endframe);
float BKE_gpencil_multiframe_falloff_calc(
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index 1f2f8ee57bf..7f55ee2beb4 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -140,6 +140,7 @@ typedef struct GpencilModifierTypeInfo {
struct Depsgraph *depsgraph,
struct Object *ob,
struct bGPDlayer *gpl,
+ struct bGPDframe *gpf,
struct bGPDstroke *gps);
/**
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 59812df246f..924cfad37d6 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -224,7 +224,9 @@ struct Mesh *BKE_mesh_new_from_object(struct Depsgraph *depsgraph,
struct Object *object,
bool preserve_all_data_layers);
-/* This is a version of BKE_mesh_new_from_object() which stores mesh in the given main database. */
+/* This is a version of BKE_mesh_new_from_object() which stores mesh in the given main database.
+ * However, that function enforces object type to be a geometry one, and ensures a mesh is always
+ * generated, be it empty. */
struct Mesh *BKE_mesh_new_from_object_to_bmain(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Object *object,
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index eafb91c85e1..83477a71d17 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -135,7 +135,7 @@ int BKE_scene_frame_snap_by_seconds(struct Scene *scene, double interval_in_seco
bool BKE_scene_validate_setscene(struct Main *bmain, struct Scene *sce);
float BKE_scene_frame_get(const struct Scene *scene);
-float BKE_scene_frame_get_from_ctime(const struct Scene *scene, const float frame);
+float BKE_scene_frame_to_ctime(const struct Scene *scene, const float frame);
void BKE_scene_frame_set(struct Scene *scene, double cfra);
struct TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(struct Scene *scene,
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 26a2018f015..1a34c5376f6 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -3940,7 +3940,7 @@ void BKE_animsys_evaluate_all_animation(Main *main,
* - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
* (i.e. scene/material/texture->nodetree) which we need a special exception
* for, otherwise they'd get skipped
- * - ntp = "node tree parent" = data-block where node tree stuff resides
+ * - 'ntp' stands for "node tree parent" = data-block where node tree stuff resides
*/
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
for (id = first; id; id = id->next) { \
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index bc62ad685ef..4ceae89dfbb 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -574,6 +574,7 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
"io_scene_gltf2",
"io_scene_obj",
"io_scene_x3d",
+ "cycles",
};
for (int i = 0; i < ARRAY_SIZE(addons); i++) {
bAddon *addon = BKE_addon_new();
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 133c6e7297b..731e9aff926 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2056,3 +2056,85 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
return true;
}
+
+/* Dissolve points in stroke */
+void BKE_gpencil_dissolve_points(bGPDframe *gpf, bGPDstroke *gps, const short tag)
+{
+ bGPDspoint *pt;
+ MDeformVert *dvert = NULL;
+ int i;
+
+ int tot = gps->totpoints; /* number of points in new buffer */
+ /* first pass: count points to remove */
+ /* Count how many points are selected (i.e. how many to remove) */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & tag) {
+ /* selected point - one of the points to remove */
+ tot--;
+ }
+ }
+
+ /* if no points are left, we simply delete the entire stroke */
+ if (tot <= 0) {
+ /* remove the entire stroke */
+ if (gps->points) {
+ MEM_freeN(gps->points);
+ }
+ if (gps->dvert) {
+ BKE_gpencil_free_stroke_weights(gps);
+ MEM_freeN(gps->dvert);
+ }
+ if (gps->triangles) {
+ MEM_freeN(gps->triangles);
+ }
+ BLI_freelinkN(&gpf->strokes, gps);
+ }
+ else {
+ /* just copy all points to keep into a smaller buffer */
+ bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * tot, "new gp stroke points copy");
+ bGPDspoint *npt = new_points;
+
+ MDeformVert *new_dvert = NULL;
+ MDeformVert *ndvert = NULL;
+
+ if (gps->dvert != NULL) {
+ new_dvert = MEM_callocN(sizeof(MDeformVert) * tot, "new gp stroke weights copy");
+ ndvert = new_dvert;
+ }
+
+ (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if ((pt->flag & tag) == 0) {
+ *npt = *pt;
+ npt++;
+
+ if (gps->dvert != NULL) {
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
+ }
+ }
+ if (gps->dvert != NULL) {
+ dvert++;
+ }
+ }
+
+ /* free the old buffer */
+ if (gps->points) {
+ MEM_freeN(gps->points);
+ }
+ if (gps->dvert) {
+ BKE_gpencil_free_stroke_weights(gps);
+ MEM_freeN(gps->dvert);
+ }
+
+ /* save the new buffer */
+ gps->points = new_points;
+ gps->dvert = new_dvert;
+ gps->totpoints = tot;
+
+ /* triangles cache needs to be recalculated */
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+ gps->tot_triangles = 0;
+ }
+}
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 34daba385f6..f1ad801b951 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -343,7 +343,7 @@ bool BKE_gpencil_has_time_modifiers(Object *ob)
void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
Object *ob,
bGPDlayer *gpl,
- bGPDframe *UNUSED(gpf),
+ bGPDframe *gpf,
bGPDstroke *gps,
bool is_render)
{
@@ -360,7 +360,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
}
if (mti && mti->deformStroke) {
- mti->deformStroke(md, depsgraph, ob, gpl, gps);
+ mti->deformStroke(md, depsgraph, ob, gpl, gpf, gps);
/* subdivide always requires update */
if (md->type == eGpencilModifierType_Subdiv) {
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index db4265d0894..bf77c1417ea 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -376,7 +376,7 @@ static void library_foreach_ID_link(Main *bmain,
int i;
if (flag & IDWALK_RECURSE) {
- /* For now, recursion implies read-only. */
+ /* For now, recursion implies read-only. */
flag |= IDWALK_READONLY;
data.ids_handled = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index fec83ebc899..ee060a117dc 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1216,10 +1216,14 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
Object *object,
bool preserve_all_data_layers)
{
+ BLI_assert(ELEM(object->type, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_MESH));
+
Mesh *mesh = BKE_mesh_new_from_object(depsgraph, object, preserve_all_data_layers);
if (mesh == NULL) {
- /* Unable to convert the object to a mesh. */
- return NULL;
+ /* Unable to convert the object to a mesh, return an empty one. */
+ Mesh *mesh_in_bmain = BKE_mesh_add(bmain, ((ID *)object->data)->name + 2);
+ id_us_min(&mesh_in_bmain->id);
+ return mesh_in_bmain;
}
/* Make sure mesh only points original datablocks, also increase users of materials and other
@@ -1233,14 +1237,14 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
BKE_library_foreach_ID_link(
NULL, &mesh->id, foreach_libblock_make_original_callback, NULL, IDWALK_NOP);
- /* Append the mesh to bmain.
- * We do it a bit longer way since there is no simple and clear way of adding existing datablock
- * to the bmain. So we allocate new empty mesh in the bmain (which guarantess all the naming and
- * orders and flags) and move the temporary mesh in place there. */
+ /* Append the mesh to 'bmain'.
+ * We do it a bit longer way since there is no simple and clear way of adding existing data-block
+ * to the 'bmain'. So we allocate new empty mesh in the 'bmain' (which guarantees all the naming
+ * and orders and flags) and move the temporary mesh in place there. */
Mesh *mesh_in_bmain = BKE_mesh_add(bmain, mesh->id.name + 2);
/* NOTE: BKE_mesh_nomain_to_mesh() does not copy materials and instead it preserves them in the
- * destinaion mesh. So we "steal" all related fields before calling it.
+ * destination mesh. So we "steal" all related fields before calling it.
*
* TODO(sergey): We really better have a function which gets and ID and accepts it for the bmain.
*/
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 64616af945f..9cc49e39231 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3559,7 +3559,7 @@ ModifierData *object_add_particle_system(Main *bmain, Scene *scene, Object *ob,
psys->totpart = 0;
psys->flag = PSYS_CURRENT;
- psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1);
+ psys->cfra = BKE_scene_frame_to_ctime(scene, CFRA + 1);
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index bf33e076e32..90ae512074d 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3559,7 +3559,7 @@ void BKE_ptcache_id_time(
if (timescale) {
time = BKE_scene_frame_get(scene);
- nexttime = BKE_scene_frame_get_from_ctime(scene, CFRA + 1.0f);
+ nexttime = BKE_scene_frame_to_ctime(scene, CFRA + 1.0f);
*timescale = MAX2(nexttime - time, 0.0f);
}
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index c9b18dfc7e6..ec73406c14c 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1607,7 +1607,7 @@ static void rigidbody_update_sim_ob(
/* create dummy 'point' which represents last known position of object as result of sim */
/* XXX: this can create some inaccuracies with sim position,
- * but is probably better than using unsimulated vals? */
+ * but is probably better than using un-simulated values? */
RB_body_get_position(rbo->shared->physics_object, eff_loc);
RB_body_get_linear_velocity(rbo->shared->physics_object, eff_vel);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index a447b828bb1..b582b4f54bd 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1347,11 +1347,11 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
*/
float BKE_scene_frame_get(const Scene *scene)
{
- return BKE_scene_frame_get_from_ctime(scene, scene->r.cfra);
+ return BKE_scene_frame_to_ctime(scene, scene->r.cfra);
}
/* This function is used to obtain arbitrary fractional frames */
-float BKE_scene_frame_get_from_ctime(const Scene *scene, const float frame)
+float BKE_scene_frame_to_ctime(const Scene *scene, const float frame)
{
float ctime = frame;
ctime += scene->r.subframe;
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index cc44cd66f23..aceb8b7e4ad 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -545,20 +545,20 @@ static void brightcontrast_apply_threaded(int width,
float brightness = data->bright / 100.0f;
float contrast = data->contrast;
float delta = contrast / 200.0f;
-
- a = 1.0f - delta * 2.0f;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (contrast > 0) {
- a = 1.0f / a;
+ a = 1.0f - delta * 2.0f;
+ a = 1.0f / max_ff(a, FLT_EPSILON);
b = a * (brightness - delta);
}
else {
delta *= -1;
- b = a * (brightness + delta);
+ a = max_ff(1.0f - delta * 2.0f, 0.0f);
+ b = a * brightness + delta;
}
for (y = 0; y < height; y++) {
diff --git a/source/blender/blenlib/intern/math_bits_inline.c b/source/blender/blenlib/intern/math_bits_inline.c
index ec2408e30a1..a6883c2aaba 100644
--- a/source/blender/blenlib/intern/math_bits_inline.c
+++ b/source/blender/blenlib/intern/math_bits_inline.c
@@ -28,7 +28,7 @@
#include "BLI_math_bits.h"
-MINLINE int bitscan_forward_i(int a)
+MINLINE unsigned int bitscan_forward_uint(unsigned int a)
{
BLI_assert(a != 0);
#ifdef _MSC_VER
@@ -36,28 +36,28 @@ MINLINE int bitscan_forward_i(int a)
_BitScanForward(&ctz, a);
return ctz;
#else
- return __builtin_ctz((unsigned int)a);
+ return (unsigned int)__builtin_ctz(a);
#endif
}
-MINLINE unsigned int bitscan_forward_uint(unsigned int a)
+MINLINE int bitscan_forward_i(int a)
{
- return (unsigned int)bitscan_forward_i((int)a);
+ return (int)bitscan_forward_uint((unsigned int)a);
}
-MINLINE int bitscan_forward_clear_i(int *a)
+MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a)
{
- int i = bitscan_forward_i(*a);
+ unsigned int i = bitscan_forward_uint(*a);
*a &= (*a) - 1;
return i;
}
-MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a)
+MINLINE int bitscan_forward_clear_i(int *a)
{
- return (unsigned int)bitscan_forward_clear_i((int *)a);
+ return (int)bitscan_forward_clear_uint((unsigned int *)a);
}
-MINLINE int bitscan_reverse_i(int a)
+MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
{
BLI_assert(a != 0);
#ifdef _MSC_VER
@@ -65,26 +65,26 @@ MINLINE int bitscan_reverse_i(int a)
_BitScanReverse(&clz, a);
return clz;
#else
- return __builtin_clz((unsigned int)a);
+ return (unsigned int)__builtin_clz(a);
#endif
}
-MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
+MINLINE int bitscan_reverse_i(int a)
{
- return (unsigned int)bitscan_reverse_i((int)a);
+ return (int)bitscan_reverse_uint((unsigned int)a);
}
-MINLINE int bitscan_reverse_clear_i(int *a)
+MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a)
{
- int i = bitscan_reverse_i(*a);
+ unsigned int i = bitscan_reverse_uint(*a);
/* TODO(sergey): This could probably be optimized. */
- *a &= ~(1 << (sizeof(int) * 8 - i - 1));
+ *a &= ~(1 << (sizeof(unsigned int) * 8 - i - 1));
return i;
}
-MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a)
+MINLINE int bitscan_reverse_clear_i(int *a)
{
- return (unsigned int)bitscan_reverse_clear_i((int *)a);
+ return (int)bitscan_reverse_clear_uint((unsigned int *)a);
}
MINLINE unsigned int highest_order_bit_uint(unsigned int n)
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 709e6dc17b6..e42a9bc9f95 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -370,9 +370,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->keyhandles_new == HD_AUTO) {
userdef->keyhandles_new = HD_AUTO_ANIM;
}
-
- /* enable (Cycles) addon by default */
- BKE_addon_ensure(&userdef->addons, "cycles");
}
if (!USER_VERSION_ATLEAST(267, 0)) {
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index 2ca9c7e6340..49c71bf8298 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -45,7 +45,9 @@ typedef struct BMEdgeLoopStore {
} BMEdgeLoopStore;
#define BM_EDGELOOP_IS_CLOSED (1 << 0)
-#define EDGELOOP_EPS 0.00001f
+
+/* Use a small value since we need normals even for very small loops. */
+#define EDGELOOP_EPS 1e-10f
/* -------------------------------------------------------------------- */
/* BM_mesh_edgeloops_find & Util Functions */
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index a2c629bd0f1..a15c215d2e2 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -336,7 +336,7 @@ void AnimationExporter::export_curve_animation(Object *ob, BCAnimationCurve &cur
/*
* Some curves can not be exported as is and need some conversion
- * For more information see implementation oif get_modified_export_curve()
+ * For more information see implementation of get_modified_export_curve()
* note: if mcurve is not NULL then it must be deleted at end of this method;
*/
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 3bdc11291d5..54177560eb5 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -966,7 +966,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob,
}
/*
- * This function returns the aspet ration from the Collada camera.
+ * This function returns the aspect ration from the Collada camera.
*
* Note:COLLADA allows to specify either XFov, or YFov alone.
* In that case the aspect ratio can be determined from
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 41ae6f1c5b2..89464030cac 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -195,7 +195,7 @@ class ExecutionGroup {
/**
* \brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position.
- * \note Only gives useful results ater the determination of the chunksize
+ * \note Only gives useful results after the determination of the chunksize
* \see determineChunkSize()
*/
void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const;
@@ -406,7 +406,7 @@ class ExecutionGroup {
/**
* \brief Determine the rect (minx, maxx, miny, maxy) of a chunk.
- * \note Only gives useful results ater the determination of the chunksize
+ * \note Only gives useful results after the determination of the chunksize
* \see determineChunkSize()
*/
void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 009b1fb28cd..1977a31b15b 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -33,7 +33,7 @@ class ExecutionGroup;
* In order to get to an efficient model for execution, several steps are being done. these steps
* are explained below.
*
- * \section EM_Step1 Step 1: translating blender node system to the new compsitor system
+ * \section EM_Step1 Step 1: translating blender node system to the new compositor system
* Blenders node structure is based on C structs (DNA). These structs are not efficient in the new
* architecture. We want to use classes in order to simplify the system. during this step the
* blender node_tree is evaluated and converted to a CPP node system.
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h
index 2bb3e5bc1ab..e907559d6e7 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.h
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.h
@@ -85,7 +85,7 @@ class BokehImageOperation : public NodeOperation {
bool m_deleteData;
/**
- * \brief determine the coordinate of a flap cornder
+ * \brief determine the coordinate of a flap corner.
*
* \param r: result in bokehimage space are stored [x,y]
* \param flapNumber: the flap number to calculate
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index d0bab5aa4d9..b6c22029899 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -62,12 +62,13 @@ void BrightnessOperation::executePixelSampled(float output[4],
* Extracted of OpenCV demhist.c
*/
if (contrast > 0) {
- a = 1.0f / (1.0f - delta * 2.0f);
+ a = 1.0f - delta * 2.0f;
+ a = 1.0f / max_ff(a, FLT_EPSILON);
b = a * (brightness - delta);
}
else {
delta *= -1;
- a = 1.0f - delta * 2.0f;
+ a = max_ff(1.0f - delta * 2.0f, 0.0f);
b = a * brightness + delta;
}
if (this->m_use_premultiply) {
diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c
index 08c6c2ac865..c3615cb5a81 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -40,6 +40,25 @@
/** \name Draw Utilities
* \{ */
+short select_id_get_object_select_mode(Scene *scene, Object *ob)
+{
+ short r_select_mode = 0;
+ if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
+ Mesh *me_orig = DEG_get_original_object(ob)->data;
+ if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) {
+ r_select_mode = SCE_SELECT_FACE;
+ }
+ if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) {
+ r_select_mode |= SCE_SELECT_VERTEX;
+ }
+ }
+ else {
+ r_select_mode = scene->toolsettings->selectmode;
+ }
+
+ return r_select_mode;
+}
+
static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt)
{
if (select_mode & SCE_SELECT_FACE) {
@@ -71,9 +90,10 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
- struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+ struct GPUBatch *geom_faces;
DRWShadingGroup *face_shgrp;
if (select_mode & SCE_SELECT_FACE) {
+ geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat);
DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)&initial_offset);
@@ -84,9 +104,8 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
*r_face_offset = initial_offset + em->bm->totface;
}
else {
- face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif);
- DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0);
-
+ geom_faces = DRW_mesh_batch_cache_get_surface(me);
+ face_shgrp = stl->g_data->shgrp_face_unif;
*r_face_offset = initial_offset;
}
DRW_shgroup_call(face_shgrp, geom_faces, ob);
@@ -137,8 +156,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
}
else {
/* Only draw faces to mask out verts, we don't want their selection ID's. */
- face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif);
- DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0);
+ face_shgrp = stl->g_data->shgrp_face_unif;
*r_face_offset = initial_offset;
}
DRW_shgroup_call(face_shgrp, geom_faces, ob);
@@ -157,7 +175,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
if (select_mode & SCE_SELECT_VERTEX) {
struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
DRWShadingGroup *vert_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_vert);
- DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", 1);
+ DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *r_edge_offset);
DRW_shgroup_call(vert_shgrp, geom_verts, ob);
*r_vert_offset = *r_edge_offset + me->totvert;
}
@@ -190,16 +208,6 @@ void select_id_draw_object(void *vedata,
r_face_offset);
}
else {
- if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
- Mesh *me_orig = DEG_get_original_object(ob)->data;
- select_mode = 0;
- if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) {
- select_mode = SCE_SELECT_FACE;
- }
- if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) {
- select_mode |= SCE_SELECT_VERTEX;
- }
- }
draw_select_id_mesh(
stl, ob, select_mode, initial_offset, r_vert_offset, r_edge_offset, r_face_offset);
}
diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c
index 68b4a8084f0..1f00a116499 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -153,31 +153,56 @@ static void select_cache_init(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
SELECTID_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
+
+ if (e_data.context.select_mode == -1) {
+ e_data.context.select_mode = select_id_get_object_select_mode(draw_ctx->scene,
+ OBACT(draw_ctx->view_layer));
+ BLI_assert(e_data.context.select_mode != 0);
+ }
+
{
psl->select_id_face_pass = DRW_pass_create("Face Pass", DRW_STATE_DEFAULT);
- stl->g_data->shgrp_face_unif = DRW_shgroup_create(sh_data->select_id_uniform,
- psl->select_id_face_pass);
- stl->g_data->shgrp_face_flat = DRW_shgroup_create(sh_data->select_id_flat,
- psl->select_id_face_pass);
+ if (e_data.context.select_mode & SCE_SELECT_FACE) {
+ stl->g_data->shgrp_face_flat = DRW_shgroup_create(sh_data->select_id_flat,
+ psl->select_id_face_pass);
+
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_state_enable(stl->g_data->shgrp_face_flat, DRW_STATE_CLIP_PLANES);
+ }
+ }
+ else {
+ stl->g_data->shgrp_face_unif = DRW_shgroup_create(sh_data->select_id_uniform,
+ psl->select_id_face_pass);
+ DRW_shgroup_uniform_int_copy(stl->g_data->shgrp_face_unif, "id", 0);
+
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_state_enable(stl->g_data->shgrp_face_unif, DRW_STATE_CLIP_PLANES);
+ }
+ }
- psl->select_id_edge_pass = DRW_pass_create(
- "Edge Pass", DRW_STATE_DEFAULT | DRW_STATE_FIRST_VERTEX_CONVENTION);
+ if (e_data.context.select_mode & SCE_SELECT_EDGE) {
+ psl->select_id_edge_pass = DRW_pass_create(
+ "Edge Pass", DRW_STATE_DEFAULT | DRW_STATE_FIRST_VERTEX_CONVENTION);
- stl->g_data->shgrp_edge = DRW_shgroup_create(sh_data->select_id_flat,
- psl->select_id_edge_pass);
+ stl->g_data->shgrp_edge = DRW_shgroup_create(sh_data->select_id_flat,
+ psl->select_id_edge_pass);
- psl->select_id_vert_pass = DRW_pass_create("Vert Pass", DRW_STATE_DEFAULT);
- stl->g_data->shgrp_vert = DRW_shgroup_create(sh_data->select_id_flat,
- psl->select_id_vert_pass);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_state_enable(stl->g_data->shgrp_edge, DRW_STATE_CLIP_PLANES);
+ }
+ }
- DRW_shgroup_uniform_float_copy(stl->g_data->shgrp_vert, "sizeVertex", G_draw.block.sizeVertex);
+ if (e_data.context.select_mode & SCE_SELECT_VERTEX) {
+ psl->select_id_vert_pass = DRW_pass_create("Vert Pass", DRW_STATE_DEFAULT);
+ stl->g_data->shgrp_vert = DRW_shgroup_create(sh_data->select_id_flat,
+ psl->select_id_vert_pass);
+ DRW_shgroup_uniform_float_copy(
+ stl->g_data->shgrp_vert, "sizeVertex", G_draw.block.sizeVertex);
- if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
- DRW_shgroup_state_enable(stl->g_data->shgrp_face_unif, DRW_STATE_CLIP_PLANES);
- DRW_shgroup_state_enable(stl->g_data->shgrp_face_flat, DRW_STATE_CLIP_PLANES);
- DRW_shgroup_state_enable(stl->g_data->shgrp_edge, DRW_STATE_CLIP_PLANES);
- DRW_shgroup_state_enable(stl->g_data->shgrp_vert, DRW_STATE_CLIP_PLANES);
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
+ DRW_shgroup_state_enable(stl->g_data->shgrp_vert, DRW_STATE_CLIP_PLANES);
+ }
}
}
@@ -188,13 +213,6 @@ static void select_cache_init(void *vedata)
static void select_cache_populate(void *vedata, Object *ob)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- short select_mode = e_data.context.select_mode;
-
- if (select_mode == -1) {
- ToolSettings *ts = draw_ctx->scene->toolsettings;
- select_mode = ts->selectmode;
- }
-
struct BaseOffset *base_ofs =
&e_data.context.base_array_index_offsets[e_data.context.last_base_drawn++];
@@ -203,7 +221,7 @@ static void select_cache_populate(void *vedata, Object *ob)
select_id_draw_object(vedata,
draw_ctx->v3d,
ob,
- select_mode,
+ e_data.context.select_mode,
offset,
&base_ofs->vert,
&base_ofs->edge,
@@ -230,11 +248,15 @@ static void select_draw_scene(void *vedata)
DRW_view_set_active(stl->g_data->view_faces);
DRW_draw_pass(psl->select_id_face_pass);
- DRW_view_set_active(stl->g_data->view_edges);
- DRW_draw_pass(psl->select_id_edge_pass);
+ if (e_data.context.select_mode & SCE_SELECT_EDGE) {
+ DRW_view_set_active(stl->g_data->view_edges);
+ DRW_draw_pass(psl->select_id_edge_pass);
+ }
- DRW_view_set_active(stl->g_data->view_verts);
- DRW_draw_pass(psl->select_id_vert_pass);
+ if (e_data.context.select_mode & SCE_SELECT_VERTEX) {
+ DRW_view_set_active(stl->g_data->view_verts);
+ DRW_draw_pass(psl->select_id_vert_pass);
+ }
}
static void select_engine_free(void)
diff --git a/source/blender/draw/engines/select/select_private.h b/source/blender/draw/engines/select/select_private.h
index 9b0addb0fb8..e2b5163c88a 100644
--- a/source/blender/draw/engines/select/select_private.h
+++ b/source/blender/draw/engines/select/select_private.h
@@ -79,6 +79,8 @@ struct BaseOffset {
uint vert;
};
+short select_id_get_object_select_mode(Scene *scene, Object *ob);
+
void select_id_draw_object(void *vedata,
View3D *v3d,
Object *ob,
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index 8722e575d15..b3588404cf2 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -64,8 +64,11 @@
#include "armature_intern.h"
-/* *************************************** Join *************************************** */
-/* NOTE: no operator define here as this is exported to the Object-level operator */
+/* -------------------------------------------------------------------- */
+/** \name Edit Armature Join
+ *
+ * \note No operator define here as this is exported to the Object-level operator.
+ * \{ */
static void joined_armature_fix_links_constraints(Main *bmain,
Object *ob,
@@ -434,7 +437,11 @@ int join_armature_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-/* *********************************** Separate *********************************************** */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Edit Armature Separate
+ * \{ */
/* Helper function for armature separating - link fixing */
static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *newArm)
@@ -712,7 +719,11 @@ void ARMATURE_OT_separate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* ********************************* Parenting ************************************************* */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Edit Armature Parenting
+ * \{ */
/* armature parenting options */
#define ARM_PAR_CONNECT 1
@@ -1007,3 +1018,5 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
"ClearType",
"What way to clear parenting");
}
+
+/** \} */
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index c912cea5937..f0c1abff201 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -606,7 +606,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const
base = view_layer->basact;
/* seems to assume view align ? TODO - look into this, could be an operator option */
- ED_object_base_init_transform(C, base, NULL, rot);
+ ED_object_base_init_transform_on_add(base->object, NULL, rot);
BKE_object_where_is_calc(depsgraph, scene, obedit);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index c6d0d6e3ce2..277628f4363 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1810,238 +1810,208 @@ static int gp_delete_selected_strokes(bContext *C)
static int gp_dissolve_selected_points(bContext *C, eGP_DissolveMode mode)
{
Object *ob = CTX_data_active_object(C);
- bGPdata *gpd = ED_gpencil_data_get_active(C);
- const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+ bGPdata *gpd = (bGPdata *)ob->data;
bool changed = false;
int first = 0;
int last = 0;
- CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
- bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
+ GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
+ /* the stroke must have at least one point selected for any operator */
+ if (gps->flag & GP_STROKE_SELECT) {
+ bGPDspoint *pt;
+ MDeformVert *dvert = NULL;
+ int i;
- for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
- if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
+ int tot = gps->totpoints; /* number of points in new buffer */
- bGPDstroke *gps, *gpsn;
+ /* first pass: count points to remove */
+ switch (mode) {
+ case GP_DISSOLVE_POINTS:
+ /* Count how many points are selected (i.e. how many to remove) */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ /* selected point - one of the points to remove */
+ tot--;
+ }
+ }
+ break;
+ case GP_DISSOLVE_BETWEEN:
+ /* need to find first and last point selected */
+ first = -1;
+ last = 0;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ if (first < 0) {
+ first = i;
+ }
+ last = i;
+ }
+ }
+ /* count unselected points in the range */
+ for (i = first, pt = gps->points + first; i < last; i++, pt++) {
+ if ((pt->flag & GP_SPOINT_SELECT) == 0) {
+ tot--;
+ }
+ }
+ break;
+ case GP_DISSOLVE_UNSELECT:
+ /* count number of unselected points */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if ((pt->flag & GP_SPOINT_SELECT) == 0) {
+ tot--;
+ }
+ }
+ break;
+ default:
+ return false;
+ break;
+ }
- if (gpf == NULL) {
- continue;
+ /* if no points are left, we simply delete the entire stroke */
+ if (tot <= 0) {
+ /* remove the entire stroke */
+ if (gps->points) {
+ MEM_freeN(gps->points);
+ }
+ if (gps->dvert) {
+ BKE_gpencil_free_stroke_weights(gps);
+ MEM_freeN(gps->dvert);
}
+ if (gps->triangles) {
+ MEM_freeN(gps->triangles);
+ }
+ BLI_freelinkN(&gpf_->strokes, gps);
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ }
+ else {
+ /* just copy all points to keep into a smaller buffer */
+ bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * tot,
+ "new gp stroke points copy");
+ bGPDspoint *npt = new_points;
- /* simply delete points from selected strokes
- * NOTE: we may still have to remove the stroke if it ends up having no points!
- */
- for (gps = gpf->strokes.first; gps; gps = gpsn) {
- gpsn = gps->next;
+ MDeformVert *new_dvert = NULL;
+ MDeformVert *ndvert = NULL;
- /* 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_color_use(ob, gpl, gps) == false) {
- continue;
- }
+ if (gps->dvert != NULL) {
+ new_dvert = MEM_callocN(sizeof(MDeformVert) * tot, "new gp stroke weights copy");
+ ndvert = new_dvert;
+ }
- /* the stroke must have at least one point selected for any operator */
- if (gps->flag & GP_STROKE_SELECT) {
- bGPDspoint *pt;
- MDeformVert *dvert = NULL;
- int i;
-
- int tot = gps->totpoints; /* number of points in new buffer */
-
- /* first pass: count points to remove */
- switch (mode) {
- case GP_DISSOLVE_POINTS:
- /* Count how many points are selected (i.e. how many to remove) */
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if (pt->flag & GP_SPOINT_SELECT) {
- /* selected point - one of the points to remove */
- tot--;
- }
- }
- break;
- case GP_DISSOLVE_BETWEEN:
- /* need to find first and last point selected */
- first = -1;
- last = 0;
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if (pt->flag & GP_SPOINT_SELECT) {
- if (first < 0) {
- first = i;
- }
- last = i;
- }
- }
- /* count unselected points in the range */
- for (i = first, pt = gps->points + first; i < last; i++, pt++) {
- if ((pt->flag & GP_SPOINT_SELECT) == 0) {
- tot--;
- }
- }
- break;
- case GP_DISSOLVE_UNSELECT:
- /* count number of unselected points */
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if ((pt->flag & GP_SPOINT_SELECT) == 0) {
- tot--;
- }
+ switch (mode) {
+ case GP_DISSOLVE_POINTS:
+ (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if ((pt->flag & GP_SPOINT_SELECT) == 0) {
+ *npt = *pt;
+ npt++;
+
+ if (gps->dvert != NULL) {
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
}
- break;
- default:
- return false;
- break;
+ }
+ if (gps->dvert != NULL) {
+ dvert++;
+ }
}
+ break;
+ case GP_DISSOLVE_BETWEEN:
+ /* copy first segment */
+ (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
+ for (i = 0, pt = gps->points; i < first; i++, pt++) {
+ *npt = *pt;
+ npt++;
- /* if no points are left, we simply delete the entire stroke */
- if (tot <= 0) {
- /* remove the entire stroke */
- if (gps->points) {
- MEM_freeN(gps->points);
+ if (gps->dvert != NULL) {
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
+ dvert++;
}
- if (gps->dvert) {
- BKE_gpencil_free_stroke_weights(gps);
- MEM_freeN(gps->dvert);
+ }
+ /* copy segment (selected points) */
+ (gps->dvert != NULL) ? dvert = gps->dvert + first : NULL;
+ for (i = first, pt = gps->points + first; i < last; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ *npt = *pt;
+ npt++;
+
+ if (gps->dvert != NULL) {
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
+ }
}
- if (gps->triangles) {
- MEM_freeN(gps->triangles);
+ if (gps->dvert != NULL) {
+ dvert++;
}
- BLI_freelinkN(&gpf->strokes, gps);
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
- else {
- /* just copy all points to keep into a smaller buffer */
- bGPDspoint *new_points = MEM_callocN(sizeof(bGPDspoint) * tot,
- "new gp stroke points copy");
- bGPDspoint *npt = new_points;
-
- MDeformVert *new_dvert = NULL;
- MDeformVert *ndvert = NULL;
+ /* copy last segment */
+ (gps->dvert != NULL) ? dvert = gps->dvert + last : NULL;
+ for (i = last, pt = gps->points + last; i < gps->totpoints; i++, pt++) {
+ *npt = *pt;
+ npt++;
if (gps->dvert != NULL) {
- new_dvert = MEM_callocN(sizeof(MDeformVert) * tot, "new gp stroke weights copy");
- ndvert = new_dvert;
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
+ dvert++;
}
+ }
- switch (mode) {
- case GP_DISSOLVE_POINTS:
- (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if ((pt->flag & GP_SPOINT_SELECT) == 0) {
- *npt = *pt;
- npt++;
-
- if (gps->dvert != NULL) {
- *ndvert = *dvert;
- ndvert->dw = MEM_dupallocN(dvert->dw);
- ndvert++;
- }
- }
- if (gps->dvert != NULL) {
- dvert++;
- }
- }
- break;
- case GP_DISSOLVE_BETWEEN:
- /* copy first segment */
- (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
- for (i = 0, pt = gps->points; i < first; i++, pt++) {
- *npt = *pt;
- npt++;
-
- if (gps->dvert != NULL) {
- *ndvert = *dvert;
- ndvert->dw = MEM_dupallocN(dvert->dw);
- ndvert++;
- dvert++;
- }
- }
- /* copy segment (selected points) */
- (gps->dvert != NULL) ? dvert = gps->dvert + first : NULL;
- for (i = first, pt = gps->points + first; i < last; i++, pt++) {
- if (pt->flag & GP_SPOINT_SELECT) {
- *npt = *pt;
- npt++;
-
- if (gps->dvert != NULL) {
- *ndvert = *dvert;
- ndvert->dw = MEM_dupallocN(dvert->dw);
- ndvert++;
- }
- }
- if (gps->dvert != NULL) {
- dvert++;
- }
- }
- /* copy last segment */
- (gps->dvert != NULL) ? dvert = gps->dvert + last : NULL;
- for (i = last, pt = gps->points + last; i < gps->totpoints; i++, pt++) {
- *npt = *pt;
- npt++;
-
- if (gps->dvert != NULL) {
- *ndvert = *dvert;
- ndvert->dw = MEM_dupallocN(dvert->dw);
- ndvert++;
- dvert++;
- }
- }
-
- break;
- case GP_DISSOLVE_UNSELECT:
- /* copy any selected point */
- (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if (pt->flag & GP_SPOINT_SELECT) {
- *npt = *pt;
- npt++;
-
- if (gps->dvert != NULL) {
- *ndvert = *dvert;
- ndvert->dw = MEM_dupallocN(dvert->dw);
- ndvert++;
- }
- }
- if (gps->dvert != NULL) {
- dvert++;
- }
- }
- break;
- }
+ break;
+ case GP_DISSOLVE_UNSELECT:
+ /* copy any selected point */
+ (gps->dvert != NULL) ? dvert = gps->dvert : NULL;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ *npt = *pt;
+ npt++;
- /* free the old buffer */
- if (gps->points) {
- MEM_freeN(gps->points);
+ if (gps->dvert != NULL) {
+ *ndvert = *dvert;
+ ndvert->dw = MEM_dupallocN(dvert->dw);
+ ndvert++;
+ }
}
- if (gps->dvert) {
- BKE_gpencil_free_stroke_weights(gps);
- MEM_freeN(gps->dvert);
+ if (gps->dvert != NULL) {
+ dvert++;
}
+ }
+ break;
+ }
- /* save the new buffer */
- gps->points = new_points;
- gps->dvert = new_dvert;
- gps->totpoints = tot;
+ /* free the old buffer */
+ if (gps->points) {
+ MEM_freeN(gps->points);
+ }
+ if (gps->dvert) {
+ BKE_gpencil_free_stroke_weights(gps);
+ MEM_freeN(gps->dvert);
+ }
- /* triangles cache needs to be recalculated */
- gps->flag |= GP_STROKE_RECALC_GEOMETRY;
- gps->tot_triangles = 0;
+ /* save the new buffer */
+ gps->points = new_points;
+ gps->dvert = new_dvert;
+ gps->totpoints = tot;
- /* deselect the stroke, since none of its selected points will still be selected */
- gps->flag &= ~GP_STROKE_SELECT;
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- pt->flag &= ~GP_SPOINT_SELECT;
- }
- }
+ /* triangles cache needs to be recalculated */
+ gps->flag |= GP_STROKE_RECALC_GEOMETRY;
+ gps->tot_triangles = 0;
- changed = true;
- }
+ /* deselect the stroke, since none of its selected points will still be selected */
+ gps->flag &= ~GP_STROKE_SELECT;
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ pt->flag &= ~GP_SPOINT_SELECT;
}
}
+
+ changed = true;
}
}
- CTX_DATA_END;
+ GP_EDITABLE_STROKES_END(gpstroke_iter);
if (changed) {
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index a8a3c2f9306..1c20da4bed3 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -610,7 +610,9 @@ struct GP_EditableStrokes_Iter {
ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, gpstroke_iter.diff_mat); \
invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
/* loop over strokes */ \
- for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gps->next) { \
+ bGPDstroke *gpsn_; \
+ for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
+ gpsn_ = gps->next; \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) \
continue; \
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index bdc65e7172a..816517d6ef9 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1127,7 +1127,12 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
BKE_brush_gpencil_presets(C);
}
- tgpi->brush = paint->brush;
+
+ /* Set Draw brush. */
+ Brush *brush = BKE_paint_toolslots_brush_get(paint, 0);
+ BKE_brush_tool_set(brush, paint, 0);
+ BKE_paint_brush_set(paint, brush);
+ tgpi->brush = brush;
/* control points */
tgpi->gpd->runtime.cp_points = MEM_callocN(sizeof(bGPDcontrolpoint) * MAX_CP,
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 5f9534a1f1c..7b9a96e4d07 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -166,11 +166,13 @@ void ED_object_vpaintmode_enter_ex(struct Main *bmain,
struct wmWindowManager *wm,
struct Scene *scene,
struct Object *ob);
+void ED_object_vpaintmode_enter(struct bContext *C, struct Depsgraph *depsgraph);
void ED_object_wpaintmode_enter_ex(struct Main *bmain,
struct Depsgraph *depsgraph,
struct wmWindowManager *wm,
struct Scene *scene,
struct Object *ob);
+void ED_object_wpaintmode_enter(struct bContext *C, struct Depsgraph *depsgraph);
void ED_object_vpaintmode_exit_ex(struct Object *ob);
void ED_object_vpaintmode_exit(struct bContext *C);
@@ -183,18 +185,21 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain,
struct Object *ob,
const bool force_dyntopo,
struct ReportList *reports);
+void ED_object_sculptmode_enter(struct bContext *C,
+ struct Depsgraph *depsgraph,
+ struct ReportList *reports);
void ED_object_sculptmode_exit_ex(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
+void ED_object_sculptmode_exit(struct bContext *C, struct Depsgraph *depsgraph);
void ED_object_location_from_view(struct bContext *C, float loc[3]);
void ED_object_rotation_from_quat(float rot[3], const float quat[4], const char align_axis);
void ED_object_rotation_from_view(struct bContext *C, float rot[3], const char align_axis);
-void ED_object_base_init_transform(struct bContext *C,
- struct Base *base,
- const float loc[3],
- const float rot[3]);
+void ED_object_base_init_transform_on_add(struct Object *obejct,
+ const float loc[3],
+ const float rot[3]);
float ED_object_new_primitive_matrix(struct bContext *C,
struct Object *editob,
const float loc[3],
@@ -267,6 +272,7 @@ bool ED_object_mode_compat_set(struct bContext *C,
struct ReportList *reports);
void ED_object_mode_toggle(struct bContext *C, eObjectMode mode);
void ED_object_mode_set(struct bContext *C, eObjectMode mode);
+void ED_object_mode_exit(struct bContext *C, struct Depsgraph *depsgraph);
bool ED_object_mode_generic_enter(struct bContext *C, eObjectMode object_mode);
void ED_object_mode_generic_exit(struct Main *bmain,
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 9bf85b8268a..204011fe46a 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -209,6 +209,16 @@ void mesh_foreachScreenEdge(struct ViewContext *vc,
int index),
void *userData,
const eV3DProjTest clip_flag);
+
+void mesh_foreachScreenEdge_clip_bb_segment(struct ViewContext *vc,
+ void (*func)(void *userData,
+ struct BMEdge *eed,
+ const float screen_co_a[2],
+ const float screen_co_b[2],
+ int index),
+ void *userData,
+ const eV3DProjTest clip_flag);
+
void mesh_foreachScreenFace(
struct ViewContext *vc,
void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index),
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index a2138a1b3a5..f9c65249918 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -932,12 +932,7 @@ static bool ui_but_is_rna_undo(const uiBut *but)
* (underline key in menu) */
static void ui_menu_block_set_keyaccels(uiBlock *block)
{
- uiBut *but;
-
uint menu_key_mask = 0;
- uchar menu_key;
- const char *str_pt;
- int pass;
int tot_missing = 0;
/* only do it before bounding */
@@ -945,11 +940,11 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
return;
}
- for (pass = 0; pass < 2; pass++) {
+ for (int pass = 0; pass < 2; pass++) {
/* 2 Passes, on for first letter only, second for any letter if first fails
* fun first pass on all buttons so first word chars always get first priority */
- for (but = block->buttons.first; but; but = but->next) {
+ for (uiBut *but = block->buttons.first; but; but = but->next) {
if (!ELEM(but->type,
UI_BTYPE_BUT,
UI_BTYPE_BUT_MENU,
@@ -960,8 +955,10 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
/* pass */
}
else if (but->menu_key == '\0') {
- if (but->str) {
- for (str_pt = but->str; *str_pt;) {
+ if (but->str && but->str[0]) {
+ const char *str_pt = but->str;
+ uchar menu_key;
+ do {
menu_key = tolower(*str_pt);
if ((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1 << (menu_key - 'a'))) {
menu_key_mask |= 1 << (menu_key - 'a');
@@ -982,7 +979,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
/* just step over every char second pass and find first usable key */
str_pt++;
}
- }
+ } while (*str_pt);
if (*str_pt) {
but->menu_key = menu_key;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index af992a89caa..25fedf8519a 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5228,7 +5228,7 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout,
pt->draw_header(C, panel);
panel->layout = NULL;
}
- uiItemL(row, pt->label, ICON_NONE);
+ uiItemL(row, CTX_IFACE_(pt->translation_context, pt->label), ICON_NONE);
}
panel->layout = layout;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 1fc1af9815f..654483c2182 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6057,13 +6057,13 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
break;
case B_STOPSEQ:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+ WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
break;
case B_STOPCLIP:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+ WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
break;
case B_STOPFILE:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+ WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
break;
case B_STOPOTHER:
G.is_break = true;
@@ -6116,80 +6116,96 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
UI_block_func_handle_set(block, do_running_jobs, NULL);
- if (sa->spacetype == SPACE_SEQ) {
- if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY)) {
- owner = sa;
+ Scene *scene;
+ /* another scene can be rendering too, for example via compositor */
+ for (scene = CTX_data_main(C)->scenes.first; scene; scene = scene->id.next) {
+ if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
+ handle_event = B_STOPOTHER;
+ icon = ICON_NONE;
+ owner = scene;
}
- handle_event = B_STOPSEQ;
- icon = ICON_SEQUENCE;
- }
- else if (sa->spacetype == SPACE_CLIP) {
- if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY)) {
- owner = sa;
+ else {
+ continue;
}
- handle_event = B_STOPCLIP;
- icon = ICON_TRACKER;
- }
- else if (sa->spacetype == SPACE_FILE) {
- if (WM_jobs_test(wm, sa, WM_JOB_TYPE_FILESEL_READDIR)) {
- owner = sa;
+
+ if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PROXY)) {
+ handle_event = B_STOPSEQ;
+ icon = ICON_SEQUENCE;
+ owner = scene;
+ break;
}
- handle_event = B_STOPFILE;
- icon = ICON_FILEBROWSER;
- }
- else {
- Scene *scene;
- /* another scene can be rendering too, for example via compositor */
- for (scene = CTX_data_main(C)->scenes.first; scene; scene = scene->id.next) {
- if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
- handle_event = B_STOPRENDER;
- icon = ICON_SCENE;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
- handle_event = B_STOPCOMPO;
- icon = ICON_RENDERLAYERS;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
- WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
- /* Skip bake jobs in compositor to avoid compo header displaying
- * progress bar which is not being updated (bake jobs only need
- * to update NC_IMAGE context.
- */
- if (sa->spacetype != SPACE_NODE) {
- handle_event = B_STOPOTHER;
- icon = ICON_IMAGE;
- break;
- }
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) {
- handle_event = B_STOPOTHER;
- icon = ICON_MOD_DYNAMICPAINT;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) {
- handle_event = B_STOPOTHER;
- icon = ICON_PHYSICS;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) {
- handle_event = B_STOPOTHER;
- icon = ICON_MOD_FLUIDSIM;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) {
- handle_event = B_STOPOTHER;
- icon = ICON_MOD_OCEAN;
- break;
- }
- else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PREVIEW)) {
+ handle_event = B_STOPSEQ;
+ icon = ICON_SEQUENCE;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) {
+ handle_event = B_STOPCLIP;
+ icon = ICON_TRACKER;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_PREFETCH)) {
+ handle_event = B_STOPCLIP;
+ icon = ICON_TRACKER;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_TRACK_MARKERS)) {
+ handle_event = B_STOPCLIP;
+ icon = ICON_TRACKER;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) {
+ handle_event = B_STOPCLIP;
+ icon = ICON_TRACKER;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_FILESEL_READDIR)) {
+ handle_event = B_STOPFILE;
+ icon = ICON_FILEBROWSER;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
+ handle_event = B_STOPRENDER;
+ icon = ICON_SCENE;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
+ handle_event = B_STOPCOMPO;
+ icon = ICON_RENDERLAYERS;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
+ WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
+ /* Skip bake jobs in compositor to avoid compo header displaying
+ * progress bar which is not being updated (bake jobs only need
+ * to update NC_IMAGE context.
+ */
+ if (sa->spacetype != SPACE_NODE) {
handle_event = B_STOPOTHER;
- icon = ICON_NONE;
+ icon = ICON_IMAGE;
break;
}
}
- owner = scene;
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) {
+ handle_event = B_STOPOTHER;
+ icon = ICON_MOD_DYNAMICPAINT;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) {
+ handle_event = B_STOPOTHER;
+ icon = ICON_PHYSICS;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) {
+ handle_event = B_STOPOTHER;
+ icon = ICON_MOD_FLUIDSIM;
+ break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) {
+ handle_event = B_STOPOTHER;
+ icon = ICON_MOD_OCEAN;
+ break;
+ }
}
if (owner) {
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 12b5a36c510..844811390ea 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -238,20 +238,6 @@ static BMElem *edbm_select_id_bm_elem_get(Base **bases, const uint sel_id, uint
* to avoid the bias interfering with distance comparisons when mixing types.
* \{ */
-#define FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, select_mode_required) \
- short select_mode = select_mode_required; \
- bool fake_select_mode = (select_mode & (vc)->scene->toolsettings->selectmode) == 0; \
- if (fake_select_mode) { \
- (vc)->v3d->flag |= V3D_INVALID_BACKBUF; \
- } \
- ((void)0)
-
-#define FAKE_SELECT_MODE_END(vc, fake_select_mode) \
- if (fake_select_mode) { \
- (vc)->v3d->flag |= V3D_INVALID_BACKBUF; \
- } \
- ((void)0)
-
#define FIND_NEAR_SELECT_BIAS 5
#define FIND_NEAR_CYCLE_THRESHOLD_MIN 3
@@ -331,9 +317,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
{
- FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_VERTEX);
-
- DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, select_mode);
+ DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, SCE_SELECT_VERTEX);
index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px);
@@ -343,8 +327,6 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
else {
eve = NULL;
}
-
- FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
if (eve) {
@@ -557,9 +539,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
{
- FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_EDGE);
-
- DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, select_mode);
+ DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, SCE_SELECT_EDGE);
index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, &dist_px);
@@ -569,8 +549,6 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
else {
eed = NULL;
}
-
- FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
if (r_eed_zbuf) {
@@ -767,9 +745,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
BMFace *efa;
{
- FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, SCE_SELECT_FACE);
-
- DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, select_mode);
+ DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, SCE_SELECT_FACE);
index = ED_select_buffer_sample_point(vc->mval);
@@ -779,8 +755,6 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
else {
efa = NULL;
}
-
- FAKE_SELECT_MODE_END(vc, fake_select_mode);
}
if (r_efa_zbuf) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 137af917f9a..7e031866dec 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -232,29 +232,17 @@ void ED_object_rotation_from_view(bContext *C, float rot[3], const char align_ax
}
}
-void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3], const float rot[3])
+void ED_object_base_init_transform_on_add(Object *object, const float loc[3], const float rot[3])
{
- Object *ob = base->object;
- Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
-
- if (!scene) {
- return;
- }
-
if (loc) {
- copy_v3_v3(ob->loc, loc);
+ copy_v3_v3(object->loc, loc);
}
if (rot) {
- copy_v3_v3(ob->rot, rot);
+ copy_v3_v3(object->rot, rot);
}
- Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
- Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
- BKE_object_transform_copy(object_eval, ob);
- BKE_object_where_is_calc(depsgraph, scene_eval, object_eval);
- BKE_object_transform_copy(ob, object_eval);
+ BKE_object_to_mat4(object, object->obmat);
}
/* Uses context to figure out transform for primitive.
@@ -494,7 +482,7 @@ Object *ED_object_add_type(bContext *C,
ED_object_base_activate(C, view_layer->basact);
/* more editor stuff */
- ED_object_base_init_transform(C, view_layer->basact, loc, rot);
+ ED_object_base_init_transform_on_add(ob, loc, rot);
/* TODO(sergey): This is weird to manually tag objects for update, better to
* use DEG_id_tag_update here perhaps.
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 271d8effd30..80e7e6312aa 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -186,6 +186,19 @@ void ED_object_mode_set(bContext *C, eObjectMode mode)
wm->op_undo_depth--;
}
+void ED_object_mode_exit(bContext *C, Depsgraph *depsgraph)
+{
+ struct Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ FOREACH_OBJECT_BEGIN (view_layer, ob) {
+ if (ob->mode & OB_MODE_ALL_MODE_DATA) {
+ ED_object_mode_generic_exit(bmain, depsgraph, scene, ob);
+ }
+ }
+ FOREACH_OBJECT_END;
+}
+
/** \} */
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index e6870cda19d..da522d22a02 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1943,7 +1943,7 @@ void PARTICLE_OT_select_roots(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_select_action(ot, SEL_SELECT, true);
+ WM_operator_properties_select_action(ot, SEL_SELECT, false);
}
/************************ select tip operator ************************/
@@ -2014,7 +2014,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- WM_operator_properties_select_action(ot, SEL_SELECT, true);
+ WM_operator_properties_select_action(ot, SEL_SELECT, false);
}
/*********************** select random operator ************************/
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index 7e283274383..bd62a59e73f 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -168,6 +168,7 @@ void ED_paintcurve_undo_push_end(void)
{
UndoStack *ustack = ED_undo_stack_get();
BKE_undosys_step_push(ustack, NULL, NULL);
+ WM_file_tag_modified();
}
/** \} */
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index 2a1158ec804..c7ec4f3f2b9 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -48,6 +48,8 @@
#include "GPU_draw.h"
+#include "WM_api.h"
+
#include "paint_intern.h"
/* -------------------------------------------------------------------- */
@@ -617,6 +619,7 @@ void ED_image_undo_push_end(void)
{
UndoStack *ustack = ED_undo_stack_get();
BKE_undosys_step_push(ustack, NULL, NULL);
+ WM_file_tag_modified();
}
/** \} */
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 9215a90c446..32b89f5676f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1171,11 +1171,28 @@ void ED_object_vpaintmode_enter_ex(
{
ed_vwpaintmode_enter_generic(bmain, depsgraph, wm, scene, ob, OB_MODE_VERTEX_PAINT);
}
+void ED_object_vpaintmode_enter(struct bContext *C, Depsgraph *depsgraph)
+{
+ Main *bmain = CTX_data_main(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+}
+
void ED_object_wpaintmode_enter_ex(
Main *bmain, Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(bmain, depsgraph, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
}
+void ED_object_wpaintmode_enter(struct bContext *C, Depsgraph *depsgraph)
+{
+ Main *bmain = CTX_data_main(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+}
/** \} */
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index fed477ace14..9a6251e2f98 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -372,19 +372,20 @@ static int vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
float contrast = RNA_float_get(op->ptr, "contrast");
brightness /= 100.0f;
float delta = contrast / 200.0f;
- gain = 1.0f - delta * 2.0f;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (contrast > 0) {
- gain = 1.0f / ((gain != 0.0f) ? gain : FLT_EPSILON);
+ gain = 1.0f - delta * 2.0f;
+ gain = 1.0f / max_ff(gain, FLT_EPSILON);
offset = gain * (brightness - delta);
}
else {
delta *= -1;
- offset = gain * (brightness + delta);
+ gain = max_ff(1.0f - delta * 2.0f, 0.0f);
+ offset = gain * brightness + delta;
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c8709d40f96..eeda7a7aeaf 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -6152,6 +6152,15 @@ void ED_object_sculptmode_enter_ex(Main *bmain,
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
}
+void ED_object_sculptmode_enter(struct bContext *C, Depsgraph *depsgraph, ReportList *reports)
+{
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports);
+}
+
void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
{
const int mode_flag = OB_MODE_SCULPT;
@@ -6198,6 +6207,15 @@ void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scen
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
}
+void ED_object_sculptmode_exit(bContext *C, Depsgraph *depsgraph)
+{
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
+}
+
static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index dde1e51e764..d4c97faa0a6 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1012,6 +1012,7 @@ void sculpt_undo_push_end(void)
if (wm->op_undo_depth == 0) {
UndoStack *ustack = ED_undo_stack_get();
BKE_undosys_step_push(ustack, NULL, NULL);
+ WM_file_tag_modified();
}
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 10d38055085..51231ccf634 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -305,7 +305,7 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- /* NOTE: We will be forefully evaluating dependency graph at every frame, so no need to ensure
+ /* NOTE: We will be forcefully evaluating dependency graph at every frame, so no need to ensure
* current scene state is evaluated as it will be lost anyway. */
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
int oldfra = scene->r.cfra;
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index b0b6aa47df1..fbefc884589 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -1153,7 +1153,7 @@ void clip_start_prefetch_job(const bContext *C)
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- CTX_wm_area(C),
+ CTX_data_scene(C),
"Prefetching",
WM_JOB_PROGRESS,
WM_JOB_TYPE_CLIP_PREFETCH);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 5f04d0863a7..af998fda6f9 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1458,7 +1458,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- sa,
+ scene,
"Building Proxies",
WM_JOB_PROGRESS,
WM_JOB_TYPE_CLIP_BUILD_PROXY);
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 806df4dbaff..96b00ec5463 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -191,7 +191,6 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
static int solve_camera_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
SolveCameraJob *scj;
- ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -199,7 +198,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
wmJob *wm_job;
char error_msg[256] = "\0";
- if (WM_jobs_test(CTX_wm_manager(C), sa, WM_JOB_TYPE_ANY)) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) {
/* only one solve is allowed at a time */
return OPERATOR_CANCELLED;
}
@@ -224,7 +223,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
/* Setup job. */
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- sa,
+ CTX_data_scene(C),
"Solve Camera",
WM_JOB_PROGRESS,
WM_JOB_TYPE_CLIP_SOLVE_CAMERA);
@@ -246,7 +245,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
/* No running solver, remove handler and pass through. */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) {
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index e9a685f9e21..9536c64c415 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -288,7 +288,6 @@ static void track_markers_freejob(void *tmv)
static int track_markers(bContext *C, wmOperator *op, bool use_job)
{
TrackMarkersJob *tmj;
- ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
wmJob *wm_job;
@@ -296,7 +295,7 @@ static int track_markers(bContext *C, wmOperator *op, bool use_job)
bool sequence = RNA_boolean_get(op->ptr, "sequence");
int framenr = ED_space_clip_get_clip_frame_number(sc);
- if (WM_jobs_test(CTX_wm_manager(C), sa, WM_JOB_TYPE_ANY)) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
/* Only one tracking is allowed at a time. */
return OPERATOR_CANCELLED;
}
@@ -319,7 +318,7 @@ static int track_markers(bContext *C, wmOperator *op, bool use_job)
if (use_job && sequence) {
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- sa,
+ CTX_data_scene(C),
"Track Markers",
WM_JOB_PROGRESS,
WM_JOB_TYPE_CLIP_TRACK_MARKERS);
@@ -372,7 +371,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
/* No running tracking, remove handler and pass through. */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index e06ee620ea7..f7dda1defe8 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -2917,7 +2917,7 @@ void filelist_readjob_start(FileList *filelist, const bContext *C)
/* setup job */
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- CTX_wm_area(C),
+ CTX_data_scene(C),
"Listing Dirs...",
WM_JOB_PROGRESS,
WM_JOB_TYPE_FILESEL_READDIR);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 2cdadfbd2ab..ed0303564c6 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -194,7 +194,7 @@ static void seq_proxy_build_job(const bContext *C)
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- sa,
+ scene,
"Building Proxies",
WM_JOB_PROGRESS,
WM_JOB_TYPE_SEQ_BUILD_PROXY);
@@ -2813,10 +2813,12 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
static int sequencer_view_all_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
- View2D *v2d = UI_view2d_fromcontext(C);
+ rctf box;
+
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- UI_view2d_smooth_view(C, ar, &v2d->tot, smooth_viewtx);
+ boundbox_seq(CTX_data_scene(C), &box);
+ UI_view2d_smooth_view(C, ar, &box, smooth_viewtx);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index 81ddd0dd8cc..8ec3ed850d2 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -134,7 +134,7 @@ void sequencer_preview_add_sound(const bContext *C, Sequence *seq)
PreviewJobAudio *audiojob = MEM_callocN(sizeof(PreviewJobAudio), "preview_audio");
wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
- sa,
+ CTX_data_scene(C),
"Strip Previews",
WM_JOB_PROGRESS,
WM_JOB_TYPE_SEQ_BUILD_PREVIEW);
diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c
index 6ecb2b731b0..a6393291f9a 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -61,19 +61,69 @@
#define ARRAY_CHUNK_SIZE 128
+/**
+ * Only stores the state of a text buffer.
+ */
+typedef struct TextState {
+ BArrayState *buf_array_state;
+
+ int cursor_line, cursor_line_select;
+ int cursor_column, cursor_column_select;
+} TextState;
+
+static void text_state_encode(TextState *state, Text *text, BArrayStore *buffer_store)
+{
+ int buf_len = 0;
+ uchar *buf = (uchar *)txt_to_buf_for_undo(text, &buf_len);
+ state->buf_array_state = BLI_array_store_state_add(buffer_store, buf, buf_len, NULL);
+ MEM_freeN(buf);
+
+ state->cursor_line = txt_get_span(text->lines.first, text->curl);
+ state->cursor_column = text->curc;
+
+ if (txt_has_sel(text)) {
+ state->cursor_line_select = (text->curl == text->sell) ?
+ state->cursor_line :
+ txt_get_span(text->lines.first, text->sell);
+ state->cursor_column_select = text->selc;
+ }
+ else {
+ state->cursor_line_select = state->cursor_line;
+ state->cursor_column_select = state->cursor_column;
+ }
+}
+
+static void text_state_decode(TextState *state, Text *text)
+{
+ size_t buf_len;
+ {
+ const uchar *buf = BLI_array_store_state_data_get_alloc(state->buf_array_state, &buf_len);
+ txt_from_buf_for_undo(text, (const char *)buf, buf_len);
+ MEM_freeN((void *)buf);
+ }
+
+ const bool has_select = ((state->cursor_line != state->cursor_line_select) ||
+ (state->cursor_column != state->cursor_column_select));
+ if (has_select) {
+ txt_move_to(text, state->cursor_line_select, state->cursor_column_select, false);
+ }
+ txt_move_to(text, state->cursor_line, state->cursor_column, has_select);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Implements ED Undo System
+ * \{ */
+
typedef struct TextUndoStep {
UndoStep step;
UndoRefID_Text text_ref;
- struct {
- BArrayState *state;
- int buf_len;
- } data;
-
- struct {
- int line, line_select;
- int column, column_select;
- } cursor;
-
+ /**
+ * First state is optional (initial state),
+ * the second is the state after the operation is done.
+ */
+ TextState states[2];
} TextUndoStep;
static struct {
@@ -81,6 +131,21 @@ static struct {
int users;
} g_text_buffers = {NULL};
+static size_t text_undosys_step_encode_to_state(TextState *state, Text *text)
+{
+ BLI_assert(BLI_array_is_zeroed(state, 1));
+ if (g_text_buffers.buffer_store == NULL) {
+ g_text_buffers.buffer_store = BLI_array_store_create(1, ARRAY_CHUNK_SIZE);
+ }
+ g_text_buffers.users += 1;
+ const size_t total_size_prev = BLI_array_store_calc_size_compacted_get(
+ g_text_buffers.buffer_store);
+
+ text_state_encode(state, text, g_text_buffers.buffer_store);
+
+ return BLI_array_store_calc_size_compacted_get(g_text_buffers.buffer_store) - total_size_prev;
+}
+
static bool text_undosys_poll(bContext *UNUSED(C))
{
/* Only use when operators initialized. */
@@ -91,10 +156,27 @@ static bool text_undosys_poll(bContext *UNUSED(C))
static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)
{
TextUndoStep *us = (TextUndoStep *)us_p;
- BLI_assert(BLI_array_is_zeroed(&us->data, 1));
+ BLI_assert(BLI_array_is_zeroed(us->states, ARRAY_SIZE(us->states)));
- UNUSED_VARS(C, us);
- /* XXX, use to set the undo type only. */
+ Text *text = CTX_data_edit_text(C);
+
+ /* Avoid writing the initial state where possible,
+ * failing to do this won't cause bugs, it's just inefficient. */
+ bool write_init = true;
+ UndoStack *ustack = ED_undo_stack_get();
+ if (ustack->step_active) {
+ if (ustack->step_active->type == BKE_UNDOSYS_TYPE_TEXT) {
+ TextUndoStep *us_active = (TextUndoStep *)ustack->step_active;
+ if (STREQ(text->id.name, us_active->text_ref.name)) {
+ write_init = false;
+ }
+ }
+ }
+
+ if (write_init) {
+ us->step.data_size = text_undosys_step_encode_to_state(&us->states[0], text);
+ }
+ us->text_ref.ptr = text;
}
static bool text_undosys_step_encode(struct bContext *C,
@@ -103,67 +185,31 @@ static bool text_undosys_step_encode(struct bContext *C,
{
TextUndoStep *us = (TextUndoStep *)us_p;
- Text *text = CTX_data_edit_text(C);
-
- int buf_len = 0;
-
- uchar *buf = (uchar *)txt_to_buf_for_undo(text, &buf_len);
- if (g_text_buffers.buffer_store == NULL) {
- g_text_buffers.buffer_store = BLI_array_store_create(1, ARRAY_CHUNK_SIZE);
- }
- g_text_buffers.users += 1;
- const size_t total_size_prev = BLI_array_store_calc_size_compacted_get(
- g_text_buffers.buffer_store);
-
- us->data.state = BLI_array_store_state_add(g_text_buffers.buffer_store, buf, buf_len, NULL);
- MEM_freeN(buf);
+ Text *text = us->text_ref.ptr;
+ BLI_assert(text == CTX_data_edit_text(C));
- us->cursor.line = txt_get_span(text->lines.first, text->curl);
- us->cursor.column = text->curc;
-
- if (txt_has_sel(text)) {
- us->cursor.line_select = (text->curl == text->sell) ?
- us->cursor.line :
- txt_get_span(text->lines.first, text->sell);
- us->cursor.column_select = text->selc;
- }
- else {
- us->cursor.line_select = us->cursor.line;
- us->cursor.column_select = us->cursor.column;
- }
+ us->step.data_size += text_undosys_step_encode_to_state(&us->states[1], text);
us_p->is_applied = true;
- us->text_ref.ptr = text;
-
- us->step.data_size = BLI_array_store_calc_size_compacted_get(g_text_buffers.buffer_store) -
- total_size_prev;
-
return true;
}
-static void text_undosys_step_decode(struct bContext *C,
- struct Main *UNUSED(bmain),
- UndoStep *us_p,
- int UNUSED(dir),
- bool UNUSED(is_final))
+static void text_undosys_step_decode(
+ struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool is_final)
{
TextUndoStep *us = (TextUndoStep *)us_p;
Text *text = us->text_ref.ptr;
- size_t buf_len;
- {
- const uchar *buf = BLI_array_store_state_data_get_alloc(us->data.state, &buf_len);
- txt_from_buf_for_undo(text, (const char *)buf, buf_len);
- MEM_freeN((void *)buf);
+ TextState *state;
+ if ((us->states[0].buf_array_state != NULL) && (dir == -1) && !is_final) {
+ state = &us->states[0];
}
-
- const bool has_select = ((us->cursor.line != us->cursor.line_select) ||
- (us->cursor.column != us->cursor.column_select));
- if (has_select) {
- txt_move_to(text, us->cursor.line_select, us->cursor.column_select, false);
+ else {
+ state = &us->states[1];
}
- txt_move_to(text, us->cursor.line, us->cursor.column, has_select);
+
+ text_state_decode(state, text);
SpaceText *st = CTX_wm_space_text(C);
if (st) {
@@ -179,12 +225,16 @@ static void text_undosys_step_free(UndoStep *us_p)
{
TextUndoStep *us = (TextUndoStep *)us_p;
- BLI_array_store_state_remove(g_text_buffers.buffer_store, us->data.state);
-
- g_text_buffers.users -= 1;
- if (g_text_buffers.users == 0) {
- BLI_array_store_destroy(g_text_buffers.buffer_store);
- g_text_buffers.buffer_store = NULL;
+ for (int i = 0; i < ARRAY_SIZE(us->states); i++) {
+ TextState *state = &us->states[i];
+ if (state->buf_array_state) {
+ BLI_array_store_state_remove(g_text_buffers.buffer_store, state->buf_array_state);
+ g_text_buffers.users -= 1;
+ if (g_text_buffers.users == 0) {
+ BLI_array_store_destroy(g_text_buffers.buffer_store);
+ g_text_buffers.buffer_store = NULL;
+ }
+ }
}
}
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 4c03995307a..39cbc67f996 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -155,12 +155,8 @@ void ED_view3d_clipping_enable(void)
/**
* \note Only use in object mode.
*/
-static void validate_object_select_id(struct Depsgraph *depsgraph,
- Scene *scene,
- ViewLayer *view_layer,
- ARegion *ar,
- View3D *v3d,
- Object *obact)
+static void validate_object_select_id(
+ struct Depsgraph *depsgraph, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Object *obact)
{
Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
@@ -188,8 +184,7 @@ static void validate_object_select_id(struct Depsgraph *depsgraph,
}
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
- DRW_draw_select_id_object(
- depsgraph, view_layer, ar, v3d, obact, scene->toolsettings->selectmode);
+ DRW_draw_select_id_object(depsgraph, view_layer, ar, v3d, obact, -1);
}
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
@@ -224,8 +219,7 @@ void ED_view3d_select_id_validate(ViewContext *vc)
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
* made on the backbuffer in this case. */
if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
- validate_object_select_id(
- vc->depsgraph, vc->scene, vc->view_layer, vc->ar, vc->v3d, vc->obact);
+ validate_object_select_id(vc->depsgraph, vc->view_layer, vc->ar, vc->v3d, vc->obact);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 2636062ed8b..f6fa6f6fb45 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -29,6 +29,7 @@
#include "BLI_utildefines.h"
#include "BLI_rect.h"
+#include "BLI_math_geom.h"
#include "BKE_action.h"
#include "BKE_armature.h"
@@ -201,7 +202,7 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData,
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
float screen_co_a[2];
float screen_co_b[2];
- eV3DProjTest clip_flag_nowin = data->clip_flag &= ~V3D_PROJ_TEST_CLIP_WIN;
+ eV3DProjTest clip_flag_nowin = data->clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
if (ED_view3d_project_float_object(data->vc.ar, v0co, screen_co_a, clip_flag_nowin) !=
V3D_PROJ_RET_OK) {
@@ -259,6 +260,98 @@ void mesh_foreachScreenEdge(ViewContext *vc,
/* ------------------------------------------------------------------------ */
+/**
+ * Only call for bound-box clipping.
+ * Otherwise call #mesh_foreachScreenEdge__mapFunc
+ */
+static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData,
+ int index,
+ const float v0co[3],
+ const float v1co[3])
+{
+ foreachScreenEdge_userData *data = userData;
+ BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index);
+
+ BLI_assert(data->clip_flag & V3D_PROJ_TEST_CLIP_BB);
+
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ float v0co_clip[3];
+ float v1co_clip[3];
+
+ if (!clip_segment_v3_plane_n(v0co, v1co, data->vc.rv3d->clip_local, 4, v0co_clip, v1co_clip)) {
+ return;
+ }
+
+ float screen_co_a[2];
+ float screen_co_b[2];
+
+ /* Clipping already handled, no need to check in projection. */
+ eV3DProjTest clip_flag_nowin = data->clip_flag &
+ ~(V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_BB);
+
+ if (ED_view3d_project_float_object(data->vc.ar, v0co_clip, screen_co_a, clip_flag_nowin) !=
+ V3D_PROJ_RET_OK) {
+ return;
+ }
+ if (ED_view3d_project_float_object(data->vc.ar, v1co_clip, screen_co_b, clip_flag_nowin) !=
+ V3D_PROJ_RET_OK) {
+ return;
+ }
+
+ if (data->clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
+ if (!BLI_rctf_isect_segment(&data->win_rect, screen_co_a, screen_co_b)) {
+ return;
+ }
+ }
+
+ data->func(data->userData, eed, screen_co_a, screen_co_b, index);
+ }
+}
+
+/**
+ * A version of #mesh_foreachScreenEdge that clips the segment when
+ * there is a clipping bounding box.
+ */
+void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
+ void (*func)(void *userData,
+ BMEdge *eed,
+ const float screen_co_a[2],
+ const float screen_co_b[2],
+ int index),
+ void *userData,
+ eV3DProjTest clip_flag)
+{
+ foreachScreenEdge_userData data;
+
+ Mesh *me = editbmesh_get_eval_cage_from_orig(
+ vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
+
+ ED_view3d_check_mats_rv3d(vc->rv3d);
+
+ data.vc = *vc;
+
+ data.win_rect.xmin = 0;
+ data.win_rect.ymin = 0;
+ data.win_rect.xmax = vc->ar->winx;
+ data.win_rect.ymax = vc->ar->winy;
+
+ data.func = func;
+ data.userData = userData;
+ data.clip_flag = clip_flag;
+
+ BM_mesh_elem_table_ensure(vc->em->bm, BM_EDGE);
+
+ if ((clip_flag & V3D_PROJ_TEST_CLIP_BB) && (vc->rv3d->clipbb != NULL)) {
+ ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups. */
+ BKE_mesh_foreach_mapped_edge(me, mesh_foreachScreenEdge_clip_bb_segment__mapFunc, &data);
+ }
+ else {
+ BKE_mesh_foreach_mapped_edge(me, mesh_foreachScreenEdge__mapFunc, &data);
+ }
+}
+
+/* ------------------------------------------------------------------------ */
+
static void mesh_foreachScreenFace__mapFunc(void *userData,
int index,
const float cent[3],
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 36eb07e9a2f..b4bc2748de5 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -202,7 +202,9 @@ struct EditSelectBuf_Cache {
BLI_bitmap *select_bitmap;
};
-static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewContext *vc)
+static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel,
+ ViewContext *vc,
+ short select_mode)
{
if (vc->obedit) {
esel->bases = BKE_view_layer_array_from_bases_in_edit_mode(
@@ -220,12 +222,9 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont
esel->bases_len = 0;
}
}
- DRW_draw_select_id(vc->depsgraph,
- vc->ar,
- vc->v3d,
- esel->bases,
- esel->bases_len,
- vc->scene->toolsettings->selectmode);
+
+ DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, esel->bases, esel->bases_len, select_mode);
+
for (int i = 0; i < esel->bases_len; i++) {
esel->bases[i]->object->runtime.select_id = i;
}
@@ -244,13 +243,14 @@ static void editselect_buf_cache_free_voidp(void *esel_voidp)
}
static void editselect_buf_cache_init_with_generic_userdata(wmGenericUserData *wm_userdata,
- ViewContext *vc)
+ ViewContext *vc,
+ short select_mode)
{
struct EditSelectBuf_Cache *esel = MEM_callocN(sizeof(*esel), __func__);
wm_userdata->data = esel;
wm_userdata->free_fn = editselect_buf_cache_free_voidp;
wm_userdata->use_free = true;
- editselect_buf_cache_init(esel, vc);
+ editselect_buf_cache_init(esel, vc, select_mode);
}
/** \} */
@@ -826,7 +826,7 @@ static bool do_lasso_select_mesh(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (use_zbuf) {
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, ts->selectmode);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
@@ -851,11 +851,14 @@ static bool do_lasso_select_mesh(ViewContext *vc,
vc->obedit->runtime.select_id, SCE_SELECT_EDGE) :
0,
};
- mesh_foreachScreenEdge(
- vc, do_lasso_select_mesh__doSelectEdge_pass0, &data_for_edge, V3D_PROJ_TEST_CLIP_NEAR);
+
+ const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_NEAR |
+ (use_zbuf ? 0 : V3D_PROJ_TEST_CLIP_BB);
+ mesh_foreachScreenEdge_clip_bb_segment(
+ vc, do_lasso_select_mesh__doSelectEdge_pass0, &data_for_edge, clip_flag);
if (data.is_done == false) {
- mesh_foreachScreenEdge(
- vc, do_lasso_select_mesh__doSelectEdge_pass1, &data_for_edge, V3D_PROJ_TEST_CLIP_NEAR);
+ mesh_foreachScreenEdge_clip_bb_segment(
+ vc, do_lasso_select_mesh__doSelectEdge_pass1, &data_for_edge, clip_flag);
}
}
@@ -1134,7 +1137,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (use_zbuf) {
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_VERTEX);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
@@ -1193,7 +1196,7 @@ static bool do_lasso_select_paintface(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (esel == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_FACE);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
@@ -2549,7 +2552,7 @@ static bool do_paintvert_box_select(ViewContext *vc,
else if (use_zbuf) {
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_VERTEX);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
@@ -2604,7 +2607,7 @@ static bool do_paintface_box_select(ViewContext *vc,
else {
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_FACE);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
@@ -2802,7 +2805,7 @@ static bool do_mesh_box_select(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (use_zbuf) {
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, ts->selectmode);
esel = wm_userdata->data;
const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
@@ -2827,11 +2830,14 @@ static bool do_mesh_box_select(ViewContext *vc,
vc->obedit->runtime.select_id, SCE_SELECT_EDGE) :
0,
};
- mesh_foreachScreenEdge(
- vc, do_mesh_box_select__doSelectEdge_pass0, &cb_data, V3D_PROJ_TEST_CLIP_NEAR);
+
+ const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_NEAR |
+ (use_zbuf ? 0 : V3D_PROJ_TEST_CLIP_BB);
+ mesh_foreachScreenEdge_clip_bb_segment(
+ vc, do_mesh_box_select__doSelectEdge_pass0, &cb_data, clip_flag);
if (data.is_done == false) {
- mesh_foreachScreenEdge(
- vc, do_mesh_box_select__doSelectEdge_pass1, &cb_data, V3D_PROJ_TEST_CLIP_NEAR);
+ mesh_foreachScreenEdge_clip_bb_segment(
+ vc, do_mesh_box_select__doSelectEdge_pass1, &cb_data, clip_flag);
}
}
@@ -3383,7 +3389,7 @@ static bool mesh_circle_select(ViewContext *vc,
if (use_zbuf) {
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, ts->selectmode);
}
}
struct EditSelectBuf_Cache *esel = wm_userdata->data;
@@ -3413,7 +3419,8 @@ static bool mesh_circle_select(ViewContext *vc,
}
}
else {
- mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
+ mesh_foreachScreenEdge_clip_bb_segment(
+ vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_BB);
}
}
@@ -3461,7 +3468,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
}
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_FACE);
}
{
@@ -3515,7 +3522,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
if (use_zbuf) {
if (wm_userdata->data == NULL) {
- editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
+ editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_VERTEX);
}
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 5ef86c71d2d..973c1c0b7f7 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2093,15 +2093,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if ((prop = RNA_struct_find_property(op->ptr, "value"))) {
- float values[4];
-
- copy_v4_v4(values, (t->flag & T_AUTOVALUES) ? t->auto_values : t->values);
-
if (RNA_property_array_check(prop)) {
- RNA_property_float_set_array(op->ptr, prop, values);
+ RNA_property_float_set_array(op->ptr, prop, t->values_final);
}
else {
- RNA_property_float_set(op->ptr, prop, values[0]);
+ RNA_property_float_set(op->ptr, prop, t->values_final[0]);
}
}
@@ -2488,8 +2484,8 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->redraw = TREDRAW_HARD;
}
else {
- copy_v4_v4(t->auto_values, values);
- t->flag |= T_AUTOVALUES;
+ copy_v4_v4(t->values, values);
+ t->flag |= T_INPUT_IS_VALUES_FINAL;
}
}
@@ -3374,7 +3370,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
values.scale = values.scale / data->warp_init_dist;
}
- copy_v2_v2(t->values, values.vector);
+ copy_v2_v2(t->values_final, values.vector);
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -3615,7 +3611,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &value);
- t->values[0] = value;
+ t->values_final[0] = value;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -3946,10 +3942,10 @@ static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, f
/* scale stroke thickness */
if (td->val) {
- snapGridIncrement(t, t->values);
- applyNumInput(&t->num, t->values);
+ snapGridIncrement(t, t->values_final);
+ applyNumInput(&t->num, t->values_final);
- float ratio = t->values[0];
+ float ratio = t->values_final[0];
*td->val = td->ival * ratio * gps->runtime.multi_frame_falloff;
CLAMP_MIN(*td->val, 0.001f);
}
@@ -3976,24 +3972,24 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
int i;
char str[UI_MAX_DRAW_STR];
- if (t->flag & T_AUTOVALUES) {
- copy_v3_v3(t->values, t->auto_values);
+ if (t->flag & T_INPUT_IS_VALUES_FINAL) {
+ copy_v3_v3(t->values_final, t->values);
}
else {
float ratio = t->values[0];
- copy_v3_fl(t->values, ratio);
+ copy_v3_fl(t->values_final, ratio);
- snapGridIncrement(t, t->values);
+ snapGridIncrement(t, t->values_final);
- if (applyNumInput(&t->num, t->values)) {
- constraintNumInput(t, t->values);
+ if (applyNumInput(&t->num, t->values_final)) {
+ constraintNumInput(t, t->values_final);
}
- applySnapping(t, t->values);
+ applySnapping(t, t->values_final);
}
- size_to_mat3(mat, t->values);
+ size_to_mat3(mat, t->values_final);
if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
@@ -4002,16 +3998,16 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
int j = 0;
for (i = 0; i < 3; i++) {
if (!(t->con.mode & (CON_AXIS0 << i))) {
- t->values[i] = 1.0f;
+ t->values_final[i] = 1.0f;
}
else {
- pvec[j++] = t->values[i];
+ pvec[j++] = t->values_final[i];
}
}
headerResize(t, pvec, str);
}
else {
- headerResize(t, t->values, str);
+ headerResize(t, t->values_final, str);
}
copy_m3_m3(t->mat, mat); // used in gizmo
@@ -4032,8 +4028,8 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
}
/* evil hack - redo resize if cliping needed */
- if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) {
- size_to_mat3(mat, t->values);
+ if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 1)) {
+ size_to_mat3(mat, t->values_final);
if (t->con.mode & CON_APPLY) {
t->con.applySize(t, NULL, NULL, mat);
@@ -4103,29 +4099,28 @@ static void initSkinResize(TransInfo *t)
static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
{
- float size[3], mat[3][3];
+ float mat[3][3];
int i;
char str[UI_MAX_DRAW_STR];
- copy_v3_fl(size, t->values[0]);
-
- snapGridIncrement(t, size);
-
- if (applyNumInput(&t->num, size)) {
- constraintNumInput(t, size);
+ if (t->flag & T_INPUT_IS_VALUES_FINAL) {
+ copy_v3_v3(t->values_final, t->values);
}
+ else {
+ copy_v3_fl(t->values_final, t->values[0]);
- applySnapping(t, size);
+ snapGridIncrement(t, t->values_final);
- if (t->flag & T_AUTOVALUES) {
- copy_v3_v3(size, t->auto_values);
- }
+ if (applyNumInput(&t->num, t->values_final)) {
+ constraintNumInput(t, t->values_final);
+ }
- copy_v3_v3(t->values, size);
+ applySnapping(t, t->values_final);
+ }
- size_to_mat3(mat, size);
+ size_to_mat3(mat, t->values_final);
- headerResize(t, size, str);
+ headerResize(t, t->values_final, str);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@@ -4219,7 +4214,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(ratio, 0.0f, 1.0f);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -4685,7 +4680,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
final = large_rotation_limit(final);
}
- t->values[0] = final;
+ t->values_final[0] = final;
headerRotation(t, str, final);
@@ -4782,7 +4777,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, phi);
- copy_v2_v2(t->values, phi);
+ copy_v2_v2(t->values_final, phi);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
@@ -4935,6 +4930,8 @@ static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
BKE_lnor_space_custom_normal_to_data(
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->nloc, lnor_ed->clnors_data);
}
+
+ t->values_final[0] = angle;
}
recalcData(t);
@@ -5291,43 +5288,45 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
{
char str[UI_MAX_DRAW_STR];
- float value_final[3];
+ float values_final[3];
- if (t->flag & T_AUTOVALUES) {
- copy_v3_v3(t->values, t->auto_values);
+ if (t->flag & T_INPUT_IS_VALUES_FINAL) {
+ copy_v3_v3(t->values_final, t->values);
}
else {
+ copy_v3_v3(t->values_final, t->values);
if ((t->con.mode & CON_APPLY) == 0) {
- snapGridIncrement(t, t->values);
+ snapGridIncrement(t, t->values_final);
}
- if (applyNumInput(&t->num, t->values)) {
- removeAspectRatio(t, t->values);
+ if (applyNumInput(&t->num, t->values_final)) {
+ removeAspectRatio(t, t->values_final);
}
- applySnapping(t, t->values);
+ applySnapping(t, t->values_final);
}
+ copy_v3_v3(values_final, t->values_final);
if (t->con.mode & CON_APPLY) {
float pvec[3] = {0.0f, 0.0f, 0.0f};
- t->con.applyVec(t, NULL, NULL, t->values, value_final, pvec);
+ t->con.applyVec(t, NULL, NULL, t->values_final, values_final, pvec);
headerTranslation(t, pvec, str);
/* only so we have re-usable value with redo, see T46741. */
- mul_v3_m3v3(t->values, t->con.imtx, value_final);
+ mul_v3_m3v3(t->values_final, t->con.imtx, values_final);
}
else {
- headerTranslation(t, t->values, str);
- copy_v3_v3(value_final, t->values);
+ headerTranslation(t, t->values_final, str);
+ copy_v3_v3(values_final, t->values_final);
}
/* don't use 't->values' now on */
- applyTranslationValue(t, value_final);
+ applyTranslationValue(t, values_final);
/* evil hack - redo translation if clipping needed */
- if (t->flag & T_CLIP_UV && clipUVTransform(t, value_final, 0)) {
- applyTranslationValue(t, value_final);
+ if (t->flag & T_CLIP_UV && clipUVTransform(t, values_final, 0)) {
+ applyTranslationValue(t, values_final);
/* In proportional edit it can happen that */
/* vertices in the radius of the brush end */
@@ -5389,7 +5388,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &distance);
- t->values[0] = -distance;
+ t->values_final[0] = -distance;
/* header print for NumInput */
ofs += BLI_strncpy_rlen(str + ofs, TIP_("Shrink/Fatten:"), sizeof(str) - ofs);
@@ -5488,7 +5487,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &final);
- t->values[0] = final;
+ t->values_final[0] = final;
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
@@ -5498,7 +5497,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
BLI_snprintf(str, sizeof(str), TIP_("Tilt: %s° %s"), &c[0], t->proptext);
/* XXX For some reason, this seems needed for this op, else RNA prop is not updated... :/ */
- t->values[0] = final;
+ t->values_final[0] = final;
}
else {
BLI_snprintf(str, sizeof(str), TIP_("Tilt: %.2f° %s"), RAD2DEGF(final), t->proptext);
@@ -5570,7 +5569,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &ratio);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -5655,7 +5654,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &ratio);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -5768,7 +5767,7 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &ratio);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -5850,7 +5849,7 @@ static void applyGPOpacity(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &ratio);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -5924,7 +5923,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &distance);
- t->values[0] = distance;
+ t->values_final[0] = distance;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -6023,7 +6022,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &weight);
- t->values[0] = weight;
+ t->values_final[0] = weight;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -6113,7 +6112,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &crease);
- t->values[0] = crease;
+ t->values_final[0] = crease;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -6273,7 +6272,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
constraintNumInput(t, size);
}
- copy_v3_v3(t->values, size);
+ copy_v3_v3(t->values_final, size);
size_to_mat3(mat, size);
@@ -6344,7 +6343,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &ratio);
- t->values[0] = ratio;
+ t->values_final[0] = ratio;
/* header print for NumInput */
if (hasNumInput(&t->num)) {
@@ -8158,7 +8157,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &final);
- t->values[0] = final;
+ t->values_final[0] = final;
/* header string */
ofs += BLI_strncpy_rlen(str + ofs, TIP_("Edge Slide: "), sizeof(str) - ofs);
@@ -8769,7 +8768,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &final);
- t->values[0] = final;
+ t->values_final[0] = final;
/* header string */
ofs += BLI_strncpy_rlen(str + ofs, TIP_("Vert Slide: "), sizeof(str) - ofs);
@@ -8840,7 +8839,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &final);
- t->values[0] = final;
+ t->values_final[0] = final;
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
@@ -8997,6 +8996,7 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
float size[3], mat[3][3];
int i;
char str[UI_MAX_DRAW_STR];
+ copy_v3_v3(t->values_final, t->values);
/*
* OPTIMIZATION:
@@ -9213,18 +9213,19 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
float pvec[3] = {0.0f, 0.0f, 0.0f};
float tvec[3];
t->con.applyVec(t, NULL, NULL, t->values, tvec, pvec);
- copy_v3_v3(t->values, tvec);
+ copy_v3_v3(t->values_final, tvec);
}
else {
// snapGridIncrement(t, t->values);
applyNumInput(&t->num, t->values);
+ copy_v3_v3(t->values_final, t->values);
}
- t->values[0] = floorf(t->values[0] + 0.5f);
- t->values[1] = floorf(t->values[1] + 0.5f);
+ t->values_final[0] = floorf(t->values_final[0] + 0.5f);
+ t->values_final[1] = floorf(t->values_final[1] + 0.5f);
- headerSeqSlide(t, t->values, str);
- applySeqSlideValue(t, t->values);
+ headerSeqSlide(t, t->values_final, str);
+ applySeqSlideValue(t, t->values_final);
recalcData(t);
@@ -9410,7 +9411,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR])
const Scene *scene = t->scene;
const short autosnap = getAnimEdit_SnapMode(t);
const double secf = FPS;
- float val = t->values[0];
+ float val = t->values_final[0];
/* apply snapping + frame->seconds conversions */
if (autosnap == SACTSNAP_STEP) {
@@ -9457,6 +9458,7 @@ static void applyTimeTranslateValue(TransInfo *t)
const double secf = FPS;
float deltax, val /* , valprev */;
+ t->values_final[0] = t->values[0];
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@@ -9474,7 +9476,7 @@ static void applyTimeTranslateValue(TransInfo *t)
/* check if any need to apply nla-mapping */
if (adt && (t->spacetype != SPACE_SEQ)) {
- deltax = t->values[0];
+ deltax = t->values_final[0];
if (autosnap == SACTSNAP_TSTEP) {
deltax = (float)(floor(((double)deltax / secf) + 0.5) * secf);
@@ -9488,7 +9490,7 @@ static void applyTimeTranslateValue(TransInfo *t)
*(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
}
else {
- deltax = val = t->values[0];
+ deltax = val = t->values_final[0];
if (autosnap == SACTSNAP_TSTEP) {
val = (float)(floor(((double)deltax / secf) + 0.5) * secf);
@@ -9524,7 +9526,7 @@ static void applyTimeTranslate(TransInfo *t, const int mval[2])
/* handle numeric-input stuff */
t->vec[0] = t->values[0];
applyNumInput(&t->num, &t->vec[0]);
- t->values[0] = t->vec[0];
+ t->values_final[0] = t->vec[0];
headerTimeTranslate(t, str);
applyTimeTranslateValue(t);
@@ -9623,7 +9625,7 @@ static void headerTimeSlide(TransInfo *t, const float sval, char str[UI_MAX_DRAW
const float *range = t->custom.mode.data;
float minx = range[0];
float maxx = range[1];
- float cval = t->values[0];
+ float cval = t->values_final[0];
float val;
val = 2.0f * (cval - sval) / (maxx - minx);
@@ -9641,11 +9643,12 @@ static void applyTimeSlideValue(TransInfo *t, float sval)
const float *range = t->custom.mode.data;
float minx = range[0];
float maxx = range[1];
+ t->values_final[0] = t->values[0];
/* set value for drawing black line */
if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
- float cvalf = t->values[0];
+ float cvalf = t->values_final[0];
saction->timeslide = cvalf;
}
@@ -9660,7 +9663,7 @@ static void applyTimeSlideValue(TransInfo *t, float sval)
* (this is only valid when not in NLA)
*/
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
- float cval = t->values[0];
+ float cval = t->values_final[0];
/* only apply to data if in range */
if ((sval > minx) && (sval < maxx)) {
@@ -9711,14 +9714,14 @@ static void applyTimeSlide(TransInfo *t, const int mval[2])
UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
UI_view2d_region_to_view(v2d, t->mouse.imval[0], t->mouse.imval[1], &sval[0], &sval[1]);
- /* t->values[0] stores cval[0], which is the current mouse-pointer location (in frames) */
+ /* t->values_final[0] stores cval[0], which is the current mouse-pointer location (in frames) */
// XXX Need to be able to repeat this
- /* t->values[0] = cval[0]; */ /* UNUSED (reset again later). */
+ /* t->values_final[0] = cval[0]; */ /* UNUSED (reset again later). */
/* handle numeric-input stuff */
t->vec[0] = 2.0f * (cval[0] - sval[0]) / (maxx - minx);
applyNumInput(&t->num, &t->vec[0]);
- t->values[0] = (maxx - minx) * t->vec[0] / 2.0f + sval[0];
+ t->values_final[0] = (maxx - minx) * t->vec[0] / 2.0f + sval[0];
headerTimeSlide(t, sval[0], str);
applyTimeSlideValue(t, sval[0]);
@@ -9787,7 +9790,7 @@ static void headerTimeScale(TransInfo *t, char str[UI_MAX_DRAW_STR])
outputNumInput(&(t->num), tvec, &t->scene->unit);
}
else {
- BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values[0]);
+ BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values_final[0]);
}
BLI_snprintf(str, UI_MAX_DRAW_STR, TIP_("ScaleX: %s"), &tvec[0]);
@@ -9800,6 +9803,7 @@ static void applyTimeScaleValue(TransInfo *t)
const short autosnap = getAnimEdit_SnapMode(t);
const double secf = FPS;
+ t->values_final[0] = t->values[0];
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@@ -9811,7 +9815,7 @@ static void applyTimeScaleValue(TransInfo *t)
*/
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
float startx = CFRA;
- float fac = t->values[0];
+ float fac = t->values_final[0];
if (autosnap == SACTSNAP_TSTEP) {
fac = (float)(floor((double)fac / secf + 0.5) * secf);
@@ -9844,7 +9848,7 @@ static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
/* handle numeric-input stuff */
t->vec[0] = t->values[0];
applyNumInput(&t->num, &t->vec[0]);
- t->values[0] = t->vec[0];
+ t->values_final[0] = t->vec[0];
headerTimeScale(t, str);
applyTimeScaleValue(t);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 833792379ae..b023199fa1b 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -662,10 +662,16 @@ typedef struct TransInfo {
short prop_mode;
+ /** Value taken as input, either through mouse coordinates or entered as a parameter. */
float values[4];
+
/** Offset applied ontop of modal input. */
float values_modal_offset[4];
- float auto_values[4];
+
+ /** Final value of the transformation (displayed in the redo panel).
+ * If the operator is executed directly (not modal), this value is usually the
+ * value of the input parameter, except when a constrain is entered. */
+ float values_final[4];
/* Axis members for modes that use an axis separate from the orientation (rotate & shear). */
@@ -764,7 +770,9 @@ enum {
/** Don't use mirror even if the data-block option is set. */
T_NO_MIRROR = 1 << 19,
- T_AUTOVALUES = 1 << 20,
+ /** To indicate that the value set in the `value` parameter is the final
+ * value of the transformation, modified only by the constrain. */
+ T_INPUT_IS_VALUES_FINAL = 1 << 20,
/** To specify if we save back settings at the end. */
T_MODAL = 1 << 21,
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 3a204d0d157..f78f5c5e623 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -57,7 +57,7 @@
static void drawObjectConstraint(TransInfo *t);
/* ************************** CONSTRAINTS ************************* */
-static void constraintAutoValues(TransInfo *t, float vec[3])
+static void constraintValuesFinal(TransInfo *t, float vec[3])
{
int mode = t->con.mode;
if (mode & CON_APPLY) {
@@ -147,10 +147,10 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
removeAspectRatio(t, vec);
}
- /* autovalues is operator param, use that directly but not if snapping is forced */
- if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0) {
- copy_v3_v3(vec, t->auto_values);
- constraintAutoValues(t, vec);
+ /* If `t->values` is operator param, use that directly but not if snapping is forced */
+ if (t->flag & T_INPUT_IS_VALUES_FINAL && (t->tsnap.status & SNAP_FORCED) == 0) {
+ copy_v3_v3(vec, t->values);
+ constraintValuesFinal(t, vec);
/* inverse transformation at the end */
}
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 1015b47c304..4ae64c7ca5f 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -114,6 +114,10 @@ static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_co
case MAN2D_AXIS_TRANS_Y:
col_id = TH_AXIS_Y;
break;
+ default:
+ BLI_assert(0);
+ col_id = TH_AXIS_Y;
+ break;
}
UI_GetThemeColor4fv(col_id, r_col);
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index c6c2a441d94..5e9add74b42 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1140,8 +1140,12 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
ot->cancel = transform_cancel;
ot->poll = ED_operator_sequencer_active;
- RNA_def_float_vector_xyz(
+ /* properties */
+ PropertyRNA *prop;
+
+ prop = RNA_def_float_vector(
ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
WM_operatortype_props_advanced_begin(ot);
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index 253fcecc81c..ba5172c7916 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -575,6 +575,11 @@ set(INC_SYS
add_definitions(-DWITH_FREESTYLE)
+if(WITH_PYTHON_SAFETY)
+ # For bpy_rna.h access.
+ add_definitions(-DWITH_PYTHON_SAFETY)
+endif()
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 1ef1068ee52..4297cbb545c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -107,6 +107,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *UNUSED(gpl),
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
@@ -140,7 +141,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
/* compute armature effects on this frame */
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md_eval, depsgraph, object_eval, gpl, gps);
+ deformStroke(md_eval, depsgraph, object_eval, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
index d54ec75862b..13329e4176d 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
@@ -65,6 +65,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
@@ -128,7 +129,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
gpencil_apply_modifier_material(
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_COLOR_CREATE_COLORS));
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index daca46c3a9a..d56b3217c9f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -190,6 +190,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
@@ -285,7 +286,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
/* compute hook effects on this frame */
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index da2b4214da1..aa5015bac35 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -70,6 +70,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
@@ -134,7 +135,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
/* compute lattice effects on this frame */
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index e891b6dea12..2c4d99adeee 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -72,8 +72,12 @@ static bool dependsOnTime(GpencilModifierData *md)
}
/* aply noise effect based on stroke direction */
-static void deformStroke(
- GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+static void deformStroke(GpencilModifierData *md,
+ Depsgraph *depsgraph,
+ Object *ob,
+ bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
+ bGPDstroke *gps)
{
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
bGPDspoint *pt0, *pt1;
@@ -239,7 +243,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 345a6c34f23..399fc407455 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -64,6 +64,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
OffsetGpencilModifierData *mmd = (OffsetGpencilModifierData *)md;
@@ -116,7 +117,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 587cf527118..36a1c3db700 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -67,6 +67,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
OpacityGpencilModifierData *mmd = (OpacityGpencilModifierData *)md;
@@ -146,7 +147,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
gpencil_apply_modifier_material(
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_OPACITY_CREATE_COLORS));
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 5e5c60645ad..746a689c08e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -57,6 +57,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
SimplifyGpencilModifierData *mmd = (SimplifyGpencilModifierData *)md;
@@ -95,7 +96,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
index 866f229cc51..7c639bd8af0 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
@@ -60,6 +60,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
SmoothGpencilModifierData *mmd = (SmoothGpencilModifierData *)md;
@@ -123,7 +124,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
index a30ad2b898a..c8962cd58c9 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
@@ -59,6 +59,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md;
@@ -89,7 +90,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index 4a2a1783127..bf4f45b10af 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@ -83,6 +83,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
@@ -143,7 +144,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
}
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
index 289cae955ba..d70d975c3a7 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
@@ -65,6 +65,7 @@ static void deformStroke(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
bGPDstroke *gps)
{
TintGpencilModifierData *mmd = (TintGpencilModifierData *)md;
@@ -134,7 +135,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
- deformStroke(md, depsgraph, ob, gpl, gps);
+ deformStroke(md, depsgraph, ob, gpl, gpf, gps);
gpencil_apply_modifier_material(
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_TINT_CREATE_COLORS));
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 0401c485c2a..883919d76ec 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1729,9 +1729,9 @@ static void execute_scene(struct Depsgraph *depsgraph,
IK_Channel *ikchan;
if (ikparam->flag & ITASC_SIMULATION) {
for (i = 0, ikchan = ikscene->channels; i < ikscene->numchan; i++, ++ikchan) {
- // In simulation mode we don't allow external constraint to change our bones, mark the channel
- // done also tell Blender that this channel is part of IK tree
- // (cleared on each BKE_pose_where_is()
+ // In simulation mode we don't allow external constraint to change our bones,
+ // mark the channel done also tell Blender that this channel is part of IK tree.
+ // Cleared on each BKE_pose_where_is()
ikchan->pchan->flag |= (POSE_DONE | POSE_CHAIN);
ikchan->jointValid = 0;
}
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index b58a47b0930..ca7ceb048ae 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -175,7 +175,7 @@ typedef struct wmWindowManager {
/** Indicates whether interface is locked for user interaction. */
char is_interface_locked;
- char par[7];
+ char _pad[7];
struct wmMsgBus *message_bus;
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index c6f1fd337ed..39889f77a96 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -253,8 +253,13 @@ typedef enum PropertyFlag {
PROP_REGISTER_OPTIONAL = PROP_REGISTER | (1 << 5),
/**
- * Use for arrays or for any data that should not have a reference kept
- * most common case is functions that return arrays where the array.
+ * Use for allocated function return values of arrays or strings
+ * for any data that should not have a reference kept.
+ *
+ * It can be used for properties which are dynamically allocated too.
+ *
+ * \note Currently dynamic sized thick wrapped data isn't supported.
+ * This would be a useful addition and avoid a fixed maximum sized as in done at the moment.
*/
PROP_THICK_WRAP = (1 << 23),
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 3ca4792f9b4..f17e9ce28fe 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -3076,8 +3076,9 @@ void RNA_def_rna(BlenderRNA *brna)
/* FloatProperty */
srna = RNA_def_struct(brna, "FloatProperty", "Property");
- RNA_def_struct_ui_text(
- srna, "Float Definition", "RNA floating point number (single precision) property definition");
+ RNA_def_struct_ui_text(srna,
+ "Float Definition",
+ "RNA floating point number (single precision) property definition");
rna_def_number_property(srna, PROP_FLOAT);
/* StringProperty */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index fd8791cf193..9af9895d461 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -877,7 +877,7 @@ static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->data;
- return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra);
+ return BKE_scene_frame_to_ctime(scene, (float)scene->r.cfra);
}
static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index b54fdf5aadb..c1ef31a80cd 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -3066,7 +3066,7 @@ static void rna_def_brightcontrast_modifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "contrast");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_range(prop, -100.0f, 100.0f);
RNA_def_property_ui_text(prop, "Contrast", "Adjust the difference in luminosity between pixels");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index abb4c5cae32..c9e0171c9f2 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -233,7 +233,7 @@ static void createVertRingMap(const int mvert_tot,
*
* This Laplacian Matrix is described in the paper:
* Desbrun M. et.al, Implicit fairing of irregular meshes using diffusion and curvature flow,
- * SIGGRAPH '99, pag 317-324, New York, USA
+ * SIGGRAPH '99, page 317-324, New York, USA
*
* The computation of Laplace Beltrami operator on Hybrid Triangle/Quad Meshes is described in the
* paper: Pinzon A., Romero E., Shape Inflation With an Adapted Laplacian Operator For
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 64f5f14eaa8..ac47422fe2f 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -491,7 +491,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
* extra space by abusing the vert array before its filled with new verts.
* The new array for vert_connect must be at least sizeof(ScrewVertConnect) * totvert
* and the size of our resulting meshes array is sizeof(MVert) * totvert * 3
- * so its safe to use the second 2 thrids of MVert the array for vert_connect,
+ * so its safe to use the second 2 thirds of MVert the array for vert_connect,
* just make sure ScrewVertConnect struct is no more than twice as big as MVert,
* at the moment there is no chance of that being a problem,
* unless MVert becomes half its current size.
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 5d6989af4c3..cccf75513f9 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -37,7 +37,6 @@
#include "gpu_py_vertex_format.h"
/* -------------------------------------------------------------------- */
-
/** \name Enum Conversion.
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_types.c b/source/blender/python/gpu/gpu_py_types.c
index f7909e38f7b..165af47b4b8 100644
--- a/source/blender/python/gpu/gpu_py_types.c
+++ b/source/blender/python/gpu/gpu_py_types.c
@@ -29,7 +29,6 @@
#include "gpu_py_types.h" /* own include */
/* -------------------------------------------------------------------- */
-
/** \name GPU Types Module
* \{ */
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 67555b70be2..be53a1cb067 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -896,8 +896,6 @@ static int cubemap_glob(const float n[3], float x, float y, float z, float *adr1
/* ------------------------------------------------------------------------- */
-/* ------------------------------------------------------------------------- */
-
static void do_2d_mapping(
const MTex *mtex, float texvec[3], const float n[3], float dxt[3], float dyt[3])
{
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 10773cf58e1..6a5800f4288 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1061,6 +1061,7 @@ void wm_homefile_read(bContext *C,
}
}
+/* -------------------------------------------------------------------- */
/** \name WM History File API
* \{ */
@@ -1189,6 +1190,10 @@ static void wm_history_file_update(void)
/** \} */
+/* -------------------------------------------------------------------- */
+/** \name Save Main .blend File (internal)
+ * \{ */
+
/* screen can be NULL */
static ImBuf *blend_file_thumb(const bContext *C,
Scene *scene,
@@ -1422,7 +1427,11 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
return ok;
}
-/************************ autosave ****************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Auto-Save API
+ * \{ */
void wm_autosave_location(char *filepath)
{
@@ -1550,6 +1559,9 @@ void wm_autosave_read(bContext *C, ReportList *reports)
WM_file_read(C, filename, reports);
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Initialize WM_OT_open_xxx properties
*
* Check if load_ui was set by the caller.
@@ -1593,8 +1605,8 @@ void WM_file_tag_modified(void)
}
}
+/* -------------------------------------------------------------------- */
/** \name Preferences/startup save & load.
- *
* \{ */
/**
@@ -2035,8 +2047,8 @@ void WM_OT_read_factory_settings(wmOperatorType *ot)
/** \} */
-/** \name Open main .blend file.
- *
+/* -------------------------------------------------------------------- */
+/** \name Open Main .blend File Utilities
* \{ */
/**
@@ -2062,8 +2074,7 @@ static bool wm_file_read_opwrap(bContext *C,
return success;
}
-/* Generic operator state utilities
- *********************************************/
+/* Generic operator state utilities */
static void create_operator_state(wmOperatorType *ot, int first_state)
{
@@ -2101,8 +2112,11 @@ static int operator_state_dispatch(bContext *C, wmOperator *op, OperatorDispatch
return OPERATOR_CANCELLED;
}
-/* Open Mainfile operator
- ********************************************/
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Open Main .blend File Operator
+ * \{ */
enum {
OPEN_MAINFILE_STATE_DISCARD_CHANGES,
@@ -2326,8 +2340,8 @@ void WM_OT_open_mainfile(wmOperatorType *ot)
/** \} */
-/** \name Reload (revert) main .blend file.
- *
+/* -------------------------------------------------------------------- */
+/** \name Reload (revert) Main .blend File Operator
* \{ */
static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
@@ -2381,8 +2395,8 @@ void WM_OT_revert_mainfile(wmOperatorType *ot)
/** \} */
+/* -------------------------------------------------------------------- */
/** \name Recover last session & auto-save.
- *
* \{ */
void WM_recover_last_session(bContext *C, ReportList *reports)
@@ -2478,8 +2492,8 @@ void WM_OT_recover_auto_save(wmOperatorType *ot)
/** \} */
-/** \name Save main .blend file.
- *
+/* -------------------------------------------------------------------- */
+/** \name Save Main .blend File Operator
* \{ */
static void wm_filepath_default(char *filepath)
@@ -2707,8 +2721,8 @@ void WM_OT_save_mainfile(wmOperatorType *ot)
/** \} */
+/* -------------------------------------------------------------------- */
/** \name Auto-execution of scripts warning popup
- *
* \{ */
static void wm_block_autorun_warning_ignore(bContext *C, void *arg_block, void *UNUSED(arg))
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 114a8e7c1f1..38600dcb018 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1825,7 +1825,8 @@ static const char *wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
char idname[BKE_ST_MAXNAME];
RNA_string_get(ptr, "name", idname);
MenuType *mt = WM_menutype_find(idname, true);
- return (mt) ? mt->label : ot->name;
+ return (mt) ? CTX_IFACE_(mt->translation_context, mt->label) :
+ CTX_IFACE_(ot->translation_context, ot->name);
}
static void WM_OT_call_menu(wmOperatorType *ot)
@@ -1889,7 +1890,8 @@ static const char *wm_call_panel_get_name(wmOperatorType *ot, PointerRNA *ptr)
char idname[BKE_ST_MAXNAME];
RNA_string_get(ptr, "name", idname);
PanelType *pt = WM_paneltype_find(idname, true);
- return (pt) ? pt->label : ot->name;
+ return (pt) ? CTX_IFACE_(pt->translation_context, pt->label) :
+ CTX_IFACE_(ot->translation_context, ot->name);
}
static void WM_OT_call_panel(wmOperatorType *ot)
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index b5edd0c4b77..c67af94e8f1 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -383,11 +383,11 @@ fail:
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Utilities Python Context Macro (#BPY_CTX_SETUP)
+ * \{ */
# ifdef WITH_PYTHON
-/** \name Utilities Python Context Macro (#BPY_CTX_SETUP)
- * \{ */
struct BlendePyContextStore {
wmWindowManager *wm;
Scene *scene;
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 737f4666aae..4793010885e 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -45,96 +45,113 @@ endif()
# set(TEST_BLENDER_EXE_BARE ${TEST_BLENDER_EXE})
# set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} ${TEST_BLENDER_EXE_PARAMS} )
+# Run Blender command with parameters.
+function(add_blender_test testname)
+ add_test(
+ NAME ${testname}
+ COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS} ${ARGN}
+ )
+
+ # Don't fail tests on leaks since these often happen in external libraries
+ # that we can't fix.
+ set_tests_properties(${testname} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
+endfunction()
+
+# Run Python script outside Blender.
+function(add_python_test testname testscript)
+ if(MSVC)
+ add_test(
+ NAME ${testname}
+ COMMAND
+ "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
+ ${testscript} ${ARGN}
+ )
+ else()
+ add_test(
+ NAME ${testname}
+ COMMAND ${testscript} ${ARGN}
+ )
+ endif()
+
+ set_tests_properties(${testname} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
+endfunction()
# ------------------------------------------------------------------------------
# GENERAL PYTHON CORRECTNESS TESTS
-add_test(
- NAME script_load_keymap
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_load_keymap
--python ${CMAKE_CURRENT_LIST_DIR}/bl_keymap_completeness.py
)
-add_test(
- NAME script_load_addons
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_load_addons
--python ${CMAKE_CURRENT_LIST_DIR}/bl_load_addons.py
)
-add_test(
- NAME script_load_modules
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_load_modules
--python ${CMAKE_CURRENT_LIST_DIR}/bl_load_py_modules.py
)
# test running operators doesn't segfault under various conditions
if(USE_EXPERIMENTAL_TESTS)
- add_test(
- NAME script_run_operators
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+ add_blender_test(
+ script_run_operators
--python ${CMAKE_CURRENT_LIST_DIR}/bl_run_operators.py
)
endif()
# ------------------------------------------------------------------------------
# PY API TESTS
-add_test(
- NAME script_pyapi_bpy_path
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_pyapi_bpy_path
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_path.py
)
-add_test(
- NAME script_pyapi_bpy_utils_units
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_pyapi_bpy_utils_units
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_utils_units.py
)
-add_test(
- NAME script_pyapi_mathutils
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_pyapi_mathutils
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_mathutils.py
)
-add_test(
- NAME script_pyapi_idprop
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_pyapi_idprop
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop.py
)
-add_test(
- NAME script_pyapi_idprop_datablock
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ script_pyapi_idprop_datablock
--python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop_datablock.py
)
# ------------------------------------------------------------------------------
# MODELING TESTS
-add_test(
- NAME bmesh_bevel
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ bmesh_bevel
${TEST_SRC_DIR}/modeling/bevel_regression.blend
--python-text run_tests
)
-add_test(
- NAME bmesh_boolean
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ bmesh_boolean
${TEST_SRC_DIR}/modeling/bool_regression.blend
--python-text run_tests
)
-add_test(
- NAME bmesh_split_faces
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ bmesh_split_faces
${TEST_SRC_DIR}/modeling/split_faces_test.blend
--python-text run_tests
)
# ------------------------------------------------------------------------------
# MODIFIERS TESTS
-add_test(
- NAME object_modifier_array
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ object_modifier_array
${TEST_SRC_DIR}/modifier_stack/array_test.blend
--python-text run_tests.py
)
@@ -145,27 +162,24 @@ add_test(
# OBJ Import tests
# disabled until updated & working
if(FALSE)
-add_test(
- NAME import_obj_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_obj_cube
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\)
--md5=39cce4bacac2d1b18fc470380279bc15 --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_obj_cube.blend
)
-add_test(
- NAME import_obj_nurbs_cyclic
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_obj_nurbs_cyclic
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\)
--md5=ad3c307e5883224a0492378cd32691ab --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_obj_nurbs_cyclic.blend
)
-add_test(
- NAME import_obj_makehuman
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_obj_makehuman
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\)
--md5=c9f78b185e58358daa4ecaecfa75464e --md5_method=SCENE
@@ -174,9 +188,8 @@ add_test(
endif()
# OBJ Export tests
-add_test(
- NAME export_obj_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_obj_cube
${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_cube.obj',use_selection=False\)
@@ -185,9 +198,8 @@ add_test(
--md5=95832f81160f07101dc566cb286a9f76 --md5_method=FILE
)
-add_test(
- NAME export_obj_nurbs
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_obj_nurbs
${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\)
@@ -198,9 +210,8 @@ add_test(
# disabled until updated & working
if(FALSE)
-add_test(
- NAME export_obj_all_objects
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_obj_all_objects
${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/io_tests/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\)
@@ -213,27 +224,24 @@ endif()
# PLY Import tests
-add_test(
- NAME import_ply_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_ply_cube
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/cube_ascii.ply'\)
--md5=527134343c27fc0ea73115b85fbfd3ac --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_ply_cube.blend
)
-add_test(
- NAME import_ply_bunny
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_ply_bunny
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/bunny2.ply'\)
--md5=6ea5b8533400a17accf928b8fd024eaa --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_ply_bunny.blend
)
-add_test(
- NAME import_ply_small_holes
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_ply_small_holes
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/many_small_holes.ply'\)
--md5=c3093e26ecae5b6d59fbbcf2a0d0b39f --md5_method=SCENE
@@ -243,9 +251,8 @@ add_test(
# PLY Export
# disabled until updated & working
if(FALSE)
-add_test(
- NAME export_ply_cube_all_data
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_ply_cube_all_data
${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_cube_all_data.ply'\)
@@ -253,9 +260,8 @@ add_test(
--md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE
)
-add_test(
- NAME export_ply_suzanne_all_data
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_ply_suzanne_all_data
${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_suzanne_all_data.ply'\)
@@ -264,9 +270,8 @@ add_test(
)
endif()
-add_test(
- NAME export_ply_vertices # lame, add a better one
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_ply_vertices # lame, add a better one
${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/io_tests/export_ply_vertices.ply'\)
@@ -278,27 +283,24 @@ add_test(
# STL Import tests
# disabled until updated & working
if(FALSE)
-add_test(
- NAME import_stl_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_stl_cube
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/cube.stl'\)
--md5=8ceb5bb7e1cb5f4342fa1669988c66b4 --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_stl_cube.blend
)
-add_test(
- NAME import_stl_conrod
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_stl_conrod
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/conrod.stl'\)
--md5=690a4b8eb9002dcd8631c5a575ea7348 --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_stl_conrod.blend
)
-add_test(
- NAME import_stl_knot_max_simplified
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_stl_knot_max_simplified
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/knot_max_simplified.stl'\)
--md5=baf82803f45a84ec4ddbad9cef57dd3e --md5_method=SCENE
@@ -309,9 +311,8 @@ endif()
# STL Export
# disabled until updated & working
if(FALSE)
-add_test(
- NAME export_stl_cube_all_data
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_stl_cube_all_data
${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/io_tests/export_stl_cube_all_data.stl'\)
@@ -319,9 +320,8 @@ add_test(
--md5=64cb97c0cabb015e1c3f76369835075a --md5_method=FILE
)
-add_test(
- NAME export_stl_suzanne_all_data
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_stl_suzanne_all_data
${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/io_tests/export_stl_suzanne_all_data.stl'\)
@@ -329,9 +329,8 @@ add_test(
--md5=e9b23c97c139ad64961c635105bb9192 --md5_method=FILE
)
-add_test(
- NAME export_stl_vertices # lame, add a better one
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_stl_vertices # lame, add a better one
${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/io_tests/export_stl_vertices.stl'\)
@@ -344,27 +343,24 @@ endif()
# X3D Import
# disabled until updated & working
if(FALSE)
-add_test(
- NAME import_x3d_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_x3d_cube
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\)
--md5=3fae9be004199c145941cd3f9f80ad7b --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_x3d_cube.blend
)
-add_test(
- NAME import_x3d_teapot
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_x3d_teapot
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\)
--md5=8ee196c71947dce4199d55698501691e --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_x3d_teapot.blend
)
-add_test(
- NAME import_x3d_suzanne_material
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_x3d_suzanne_material
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\)
--md5=3edea1353257d8b5a5f071942f417be6 --md5_method=SCENE
@@ -372,9 +368,8 @@ add_test(
)
# X3D Export
-add_test(
- NAME export_x3d_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_x3d_cube
${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/io_tests/export_x3d_cube.x3d',use_selection=False\)
@@ -382,9 +377,8 @@ add_test(
--md5=05312d278fe41da33560fdfb9bdb268f --md5_method=FILE
)
-add_test(
- NAME export_x3d_nurbs
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_x3d_nurbs
${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/io_tests/export_x3d_nurbs.x3d',use_selection=False\)
@@ -392,9 +386,8 @@ add_test(
--md5=4286d4a2aa507ef78b22ddcbdcc88481 --md5_method=FILE
)
-add_test(
- NAME export_x3d_all_objects
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_x3d_all_objects
${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/io_tests/export_x3d_all_objects.x3d',use_selection=False\)
@@ -408,27 +401,24 @@ endif()
# 3DS Import
# disabled until updated & working
if(FALSE)
-add_test(
- NAME import_3ds_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_3ds_cube
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/cube.3ds'\)
--md5=cb5a45c35a343c3f5beca2a918472951 --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_3ds_cube.blend
)
-add_test(
- NAME import_3ds_hierarchy_lara
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_3ds_hierarchy_lara
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_lara.3ds'\)
--md5=766c873d9fdb5f190e43796cfbae63b6 --md5_method=SCENE
--write-blend=${TEST_OUT_DIR}/io_tests/import_3ds_hierarchy_lara.blend
)
-add_test(
- NAME import_3ds_hierarchy_greek_trireme
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ import_3ds_hierarchy_greek_trireme
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_greek_trireme.3ds'\)
--md5=b62ee30101e8999cb91ef4f8a8760056 --md5_method=SCENE
@@ -439,9 +429,8 @@ endif()
# 3DS Export
# disabled until updated & working
if(FALSE)
-add_test(
- NAME export_3ds_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_3ds_cube
${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/io_tests/export_3ds_cube.3ds',use_selection=False\)
@@ -449,9 +438,8 @@ add_test(
--md5=a31f5071b6c6dc7445b9099cdc7f63b3 --md5_method=FILE
)
-add_test(
- NAME export_3ds_nurbs
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_3ds_nurbs
${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/io_tests/export_3ds_nurbs.3ds',use_selection=False\)
@@ -459,9 +447,8 @@ add_test(
--md5=5bdd21be3c80d814fbc83cb25edb08c2 --md5_method=FILE
)
-add_test(
- NAME export_3ds_all_objects
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_3ds_all_objects
${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/io_tests/export_3ds_all_objects.3ds',use_selection=False\)
@@ -476,9 +463,8 @@ endif()
# 'use_metadata=False' for reliable md5's
# disabled until updated & working
if(FALSE)
-add_test(
- NAME export_fbx_cube
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_fbx_cube
${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/io_tests/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
@@ -486,9 +472,8 @@ add_test(
--md5=59a35577462f95f9a0b4e6035226ce9b --md5_method=FILE
)
-add_test(
- NAME export_fbx_nurbs
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_fbx_nurbs
${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/io_tests/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
@@ -496,9 +481,8 @@ add_test(
--md5=d31875f18f613fa0c3b16e978f87f6f8 --md5_method=FILE
)
-add_test(
- NAME export_fbx_all_objects
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+add_blender_test(
+ export_fbx_all_objects
${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/io_tests/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
@@ -507,23 +491,6 @@ add_test(
)
endif()
-# Run Python script outside Blender.
-function(add_python_test testname testscript)
- if(MSVC)
- add_test(
- NAME ${testname}
- COMMAND
- "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
- ${testscript} ${ARGN}
- )
- else()
- add_test(
- NAME ${testname}
- COMMAND ${testscript} ${ARGN}
- )
- endif()
-endfunction()
-
if(WITH_CYCLES OR WITH_OPENGL_RENDER_TESTS)
if(NOT OPENIMAGEIO_IDIFF)
MESSAGE(STATUS "Disabling render tests because OIIO idiff does not exist")
@@ -633,9 +600,8 @@ if(WITH_ALEMBIC)
--alembic-root "${ALEMBIC_ROOT_DIR}"
)
- add_test(
- NAME script_alembic_import
- COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
+ add_blender_test(
+ script_alembic_import
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
--
--testdir "${TEST_SRC_DIR}/alembic"
diff --git a/tests/python/bl_pyapi_bpy_utils_units.py b/tests/python/bl_pyapi_bpy_utils_units.py
index 88d5cb941bd..d5d9c9c707b 100644
--- a/tests/python/bl_pyapi_bpy_utils_units.py
+++ b/tests/python/bl_pyapi_bpy_utils_units.py
@@ -37,13 +37,13 @@ class UnitsTesting(unittest.TestCase):
('IMPERIAL', 'LENGTH', 3, False, False, 0.3048, "1'"),
('IMPERIAL', 'LENGTH', 3, False, True, 0.3048, "1ft"),
('IMPERIAL', 'LENGTH', 4, True, False, 0.3048 * 2 + 0.0254 * 5.5, "2' 5.5\""),
- ('IMPERIAL', 'LENGTH', 3, False, False, 1609.344 * 1e6, "1000000mi"),
- ('IMPERIAL', 'LENGTH', 6, False, False, 1609.344 * 1e6, "1000000mi"),
- ('METRIC', 'LENGTH', 3, True, False, 1000 * 2 + 0.001 * 15, "2km 2cm"),
- ('METRIC', 'LENGTH', 5, True, False, 1234.56789, "1km 234.6m"),
- ('METRIC', 'LENGTH', 6, True, False, 1234.56789, "1km 234.57m"),
- ('METRIC', 'LENGTH', 9, False, False, 1234.56789, "1.234568km"),
- ('METRIC', 'LENGTH', 9, True, False, 1000.000123456789, "1km 0.123mm"),
+ ('IMPERIAL', 'LENGTH', 3, False, False, 1609.344 * 1e6, "1000000 mi"),
+ ('IMPERIAL', 'LENGTH', 6, False, False, 1609.344 * 1e6, "1000000 mi"),
+ ('METRIC', 'LENGTH', 3, True, False, 1000 * 2 + 0.001 * 15, "2 km 2 cm"),
+ ('METRIC', 'LENGTH', 5, True, False, 1234.56789, "1 km 234.6 m"),
+ ('METRIC', 'LENGTH', 6, True, False, 1234.56789, "1 km 234.57 m"),
+ ('METRIC', 'LENGTH', 9, False, False, 1234.56789, "1.234568 km"),
+ ('METRIC', 'LENGTH', 9, True, False, 1000.000123456789, "1 km 0.123 mm"),
)
def test_units_inputs(self):