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:
authorMichael Kowalski <makowalski@nvidia.com>2022-11-08 03:37:51 +0300
committerMichael Kowalski <makowalski@nvidia.com>2022-11-08 03:37:51 +0300
commita400935d29f54b9bd821d093873eb4643a279e59 (patch)
tree5dbd37ed111ee47c0dbe5696b834c3a16e96435c
parent036e10e5462b95ec6a12e9dd4a900ba7ff05032c (diff)
parentd8dab1ba978e32af9af581fbd4c4bc0682278703 (diff)
Merge branch 'tmp-vfx-platform-2023' into tmp-dynamic-usdtmp-dynamic-usd
-rw-r--r--CMakeLists.txt25
-rw-r--r--build_files/build_environment/CMakeLists.txt17
-rw-r--r--build_files/build_environment/cmake/cve_check.csv.in6
-rw-r--r--build_files/build_environment/cmake/download.cmake7
-rw-r--r--build_files/build_environment/cmake/dpcpp.cmake7
-rw-r--r--build_files/build_environment/cmake/harvest.cmake3
-rw-r--r--build_files/build_environment/cmake/mesa.cmake1
-rw-r--r--build_files/build_environment/cmake/minizipng.cmake19
-rw-r--r--build_files/build_environment/cmake/opencolorio.cmake14
-rw-r--r--build_files/build_environment/cmake/options.cmake4
-rw-r--r--build_files/build_environment/cmake/opus.cmake1
-rw-r--r--build_files/build_environment/cmake/python.cmake18
-rw-r--r--build_files/build_environment/cmake/setup_mingw64.cmake6
-rw-r--r--build_files/build_environment/cmake/shaderc.cmake63
-rw-r--r--build_files/build_environment/cmake/shaderc_deps.cmake51
-rw-r--r--build_files/build_environment/cmake/ssl.cmake66
-rw-r--r--build_files/build_environment/cmake/usd.cmake4
-rw-r--r--build_files/build_environment/cmake/versions.cmake83
-rw-r--r--build_files/build_environment/cmake/vulkan.cmake55
-rw-r--r--build_files/build_environment/cmake/yamlcpp.cmake1
-rw-r--r--build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake12
-rw-r--r--build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake3
-rw-r--r--build_files/build_environment/patches/openvdb.diff28
-rw-r--r--build_files/build_environment/patches/osl.diff49
-rw-r--r--build_files/build_environment/patches/python_windows.diff22
-rw-r--r--build_files/build_environment/patches/usd.diff100
-rw-r--r--build_files/cmake/Modules/FindOpenEXR.cmake3
-rw-r--r--build_files/cmake/Modules/FindUSD.cmake3
-rw-r--r--build_files/cmake/config/blender_developer.cmake6
-rw-r--r--build_files/cmake/macros.cmake46
-rw-r--r--build_files/cmake/platform/platform_unix.cmake18
-rw-r--r--build_files/cmake/platform/platform_win32.cmake41
-rw-r--r--build_files/config/pipeline_config.yaml2
-rwxr-xr-xbuild_files/utils/make_bpy_wheel.py11
-rwxr-xr-xbuild_files/utils/make_update.py86
-rwxr-xr-xbuild_files/utils/make_utils.py2
-rw-r--r--build_files/windows/parse_arguments.cmd2
-rw-r--r--build_files/windows/reset_variables.cmd1
-rw-r--r--doc/doxygen/Doxyfile2
-rw-r--r--doc/python_api/requirements.txt6
-rw-r--r--doc/python_api/sphinx_doc_gen.py6
-rw-r--r--extern/hipew/src/hipew.c2
-rw-r--r--extern/mantaflow/CMakeLists.txt3
-rw-r--r--intern/cycles/blender/addon/properties.py17
-rw-r--r--intern/cycles/blender/addon/ui.py14
-rw-r--r--intern/cycles/blender/session.cpp6
-rw-r--r--intern/cycles/device/CMakeLists.txt3
-rw-r--r--intern/cycles/device/oneapi/device_impl.cpp24
-rw-r--r--intern/cycles/integrator/path_trace_work_gpu.cpp4
-rw-r--r--intern/cycles/kernel/CMakeLists.txt7
-rw-r--r--intern/cycles/kernel/camera/projection.h26
-rw-r--r--intern/cycles/kernel/types.h1
-rw-r--r--intern/cycles/scene/camera.cpp1
-rw-r--r--intern/cycles/test/CMakeLists.txt1
-rw-r--r--intern/cycles/test/util_md5_test.cpp16
-rw-r--r--intern/cycles/util/md5.cpp9
-rw-r--r--intern/cycles/util/types_float3.h5
-rw-r--r--intern/ffmpeg/tests/ffmpeg_codecs.cc2
-rw-r--r--intern/ghost/CMakeLists.txt4
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.cpp2
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.h2
-rw-r--r--intern/ghost/intern/GHOST_System.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp1249
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.h6
-rw-r--r--intern/ghost/intern/GHOST_Window.h8
-rw-r--r--intern/ghost/intern/GHOST_WindowWayland.cpp5
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h2
-rw-r--r--intern/guardedalloc/intern/leak_detector.cc2
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_client.c5
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_cursor.c2
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_egl.c2
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_libdecor.c2
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_utils.c9
-rw-r--r--intern/wayland_dynload/intern/wayland_dynload_utils.h3
-rw-r--r--make.bat12
m---------release/datafiles/locale0
m---------release/scripts/addons0
-rw-r--r--release/scripts/modules/rna_manual_reference.py96
-rw-r--r--release/scripts/startup/bl_ui/node_add_menu.py8
-rw-r--r--release/scripts/startup/bl_ui/node_add_menu_geometry.py23
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py7
-rw-r--r--source/blender/blenkernel/BKE_armature.h4
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog.hh11
-rw-r--r--source/blender/blenkernel/BKE_asset_catalog_path.hh2
-rw-r--r--source/blender/blenkernel/BKE_asset_library.hh11
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h4
-rw-r--r--source/blender/blenkernel/BKE_bpath.h33
-rw-r--r--source/blender/blenkernel/BKE_context.h46
-rw-r--r--source/blender/blenkernel/BKE_duplilist.h12
-rw-r--r--source/blender/blenkernel/BKE_dynamicpaint.h2
-rw-r--r--source/blender/blenkernel/BKE_gpencil_geom.h6
-rw-r--r--source/blender/blenkernel/BKE_key.h4
-rw-r--r--source/blender/blenkernel/BKE_mesh.h7
-rw-r--r--source/blender/blenkernel/BKE_mesh_legacy_convert.h7
-rw-r--r--source/blender/blenkernel/BKE_nla.h8
-rw-r--r--source/blender/blenkernel/BKE_node.h18
-rw-r--r--source/blender/blenkernel/BKE_object.h12
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h1
-rw-r--r--source/blender/blenkernel/BKE_screen.h1
-rw-r--r--source/blender/blenkernel/BKE_sound.h2
-rw-r--r--source/blender/blenkernel/BKE_tracking.h4
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc8
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/appdir.c22
-rw-r--r--source/blender/blenkernel/intern/armature.c10
-rw-r--r--source/blender/blenkernel/intern/armature_deform.c4
-rw-r--r--source/blender/blenkernel/intern/armature_update.c8
-rw-r--r--source/blender/blenkernel/intern/asset_catalog.cc36
-rw-r--r--source/blender/blenkernel/intern/asset_catalog_path.cc2
-rw-r--r--source/blender/blenkernel/intern/asset_library.cc30
-rw-r--r--source/blender/blenkernel/intern/asset_library_service.cc38
-rw-r--r--source/blender/blenkernel/intern/asset_library_service.hh3
-rw-r--r--source/blender/blenkernel/intern/asset_library_service_test.cc2
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/blendfile.c2
-rw-r--r--source/blender/blenkernel/intern/boids.c2
-rw-r--r--source/blender/blenkernel/intern/camera.c20
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/constraint.c91
-rw-r--r--source/blender/blenkernel/intern/context.c60
-rw-r--r--source/blender/blenkernel/intern/curve_deform.c4
-rw-r--r--source/blender/blenkernel/intern/curve_to_mesh_convert.cc4
-rw-r--r--source/blender/blenkernel/intern/curves.cc4
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c24
-rw-r--r--source/blender/blenkernel/intern/effect.c22
-rw-r--r--source/blender/blenkernel/intern/fcurve_driver.c14
-rw-r--r--source/blender/blenkernel/intern/fluid.c30
-rw-r--r--source/blender/blenkernel/intern/geometry_set_instances.cc4
-rw-r--r--source/blender/blenkernel/intern/gpencil.c18
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc17
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c2
-rw-r--r--source/blender/blenkernel/intern/icons.cc2
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/lattice.c6
-rw-r--r--source/blender/blenkernel/intern/lattice_deform.c6
-rw-r--r--source/blender/blenkernel/intern/layer.c2
-rw-r--r--source/blender/blenkernel/intern/lib_id.c2
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c4
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c4
-rw-r--r--source/blender/blenkernel/intern/material.c65
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.cc11
-rw-r--r--source/blender/blenkernel/intern/mesh.cc32
-rw-r--r--source/blender/blenkernel/intern/mesh_calc_edges.cc2
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc8
-rw-r--r--source/blender/blenkernel/intern/mesh_legacy_convert.cc252
-rw-r--r--source/blender/blenkernel/intern/mesh_mirror.c10
-rw-r--r--source/blender/blenkernel/intern/mesh_remesh_voxel.cc181
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.cc212
-rw-r--r--source/blender/blenkernel/intern/nla.c3
-rw-r--r--source/blender/blenkernel/intern/node.cc65
-rw-r--r--source/blender/blenkernel/intern/object.cc121
-rw-r--r--source/blender/blenkernel/intern/object_dupli.cc56
-rw-r--r--source/blender/blenkernel/intern/object_update.cc16
-rw-r--r--source/blender/blenkernel/intern/paint.cc11
-rw-r--r--source/blender/blenkernel/intern/particle.c28
-rw-r--r--source/blender/blenkernel/intern/particle_child.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c38
-rw-r--r--source/blender/blenkernel/intern/pointcache.c10
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c24
-rw-r--r--source/blender/blenkernel/intern/scene.cc8
-rw-r--r--source/blender/blenkernel/intern/screen.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c25
-rw-r--r--source/blender/blenkernel/intern/sound.c17
-rw-r--r--source/blender/blenkernel/intern/subdiv_mesh.cc4
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c6
-rw-r--r--source/blender/blenkernel/intern/tracking_solver.c8
-rw-r--r--source/blender/blenkernel/intern/unit.c2
-rw-r--r--source/blender/blenkernel/intern/vfont.c4
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c42
-rw-r--r--source/blender/blenlib/BLI_color_mix.hh2
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_path_util.h20
-rw-r--r--source/blender/blenlib/BLI_string_utils.h393
-rw-r--r--source/blender/blenlib/BLI_uvproject.h2
-rw-r--r--source/blender/blenlib/intern/fileops.c2
-rw-r--r--source/blender/blenlib/intern/kdtree_impl.h6
-rw-r--r--source/blender/blenlib/intern/list_sort_impl.h49
-rw-r--r--source/blender/blenlib/intern/path_util.c211
-rw-r--r--source/blender/blenlib/intern/string_utils.c14
-rw-r--r--source/blender/blenlib/intern/uvproject.c2
-rw-r--r--source/blender/blenlib/tests/BLI_path_util_test.cc502
-rw-r--r--source/blender/blenloader/intern/readfile.cc2
-rw-r--r--source/blender/blenloader/intern/versioning_260.c1
-rw-r--r--source/blender/blenloader/intern/versioning_300.cc19
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c3
-rw-r--r--source/blender/bmesh/operators/bmo_bridge.c122
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c2
-rw-r--r--source/blender/bmesh/tools/bmesh_wireframe.c2
-rw-r--r--source/blender/compositor/operations/COM_ConvertOperation.h4
-rw-r--r--source/blender/compositor/realtime_compositor/CMakeLists.txt139
-rw-r--r--source/blender/compositor/realtime_compositor/COM_context.hh11
-rw-r--r--source/blender/compositor/realtime_compositor/COM_result.hh12
-rw-r--r--source/blender/compositor/realtime_compositor/COM_static_cache_manager.hh77
-rw-r--r--source/blender/compositor/realtime_compositor/COM_texture_pool.hh4
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/COM_cached_resource.hh31
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/COM_morphological_distance_feather_weights.hh61
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_blur_weights.hh52
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_separable_blur_weights.hh53
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/intern/morphological_distance_feather_weights.cc159
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_blur_weights.cc115
-rw-r--r--source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_separable_blur_weights.cc93
-rw-r--r--source/blender/compositor/realtime_compositor/intern/context.cc6
-rw-r--r--source/blender/compositor/realtime_compositor/intern/conversion_operation.cc8
-rw-r--r--source/blender/compositor/realtime_compositor/intern/evaluator.cc1
-rw-r--r--source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc2
-rw-r--r--source/blender/compositor/realtime_compositor/intern/result.cc8
-rw-r--r--source/blender/compositor/realtime_compositor/intern/static_cache_manager.cc74
-rw-r--r--source/blender/compositor/realtime_compositor/intern/texture_pool.cc2
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_alpha_crop.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_bilateral_blur.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_bilateral_blur.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_blur.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_blur.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_blur_variable_size.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_blur_variable_size.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_bokeh_image.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_bokeh_image.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_box_mask.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_box_mask.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_convert.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_convert.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_despeckle.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_despeckle.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_directional_blur.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_directional_blur.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_edge_filter.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_edge_filter.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_ellipse_mask.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_ellipse_mask.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_filter.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_filter.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_flip.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_flip.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_image_crop.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_image_crop.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_morphological_distance.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_feather.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_morphological_distance_feather.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_threshold.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_morphological_distance_threshold.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_morphological_step.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_morphological_step.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_normalize.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_normalize.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_parallel_reduction.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_parallel_reduction.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_projector_lens_distortion.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_projector_lens_distortion.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_realize_on_domain.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_screen_lens_distortion.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_set_alpha.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_split_viewer.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_blur.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_symmetric_blur.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_separable_blur.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_symmetric_separable_blur.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_photoreceptor.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_tone_map_photoreceptor.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_simple.glsl (renamed from source/blender/gpu/shaders/compositor/compositor_tone_map_simple.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_alpha_crop_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_bilateral_blur_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_blur_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_variable_size_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_blur_variable_size_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_bokeh_image_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_box_mask_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_despeckle_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_directional_blur_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_edge_filter_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_ellipse_mask_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_flip_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_image_crop_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_feather_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_threshold_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_morphological_step_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_normalize_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_projector_lens_distortion_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_screen_lens_distortion_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_set_alpha_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_viewer_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_split_viewer_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_symmetric_blur_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_symmetric_separable_blur_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_tone_map_photoreceptor_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh (renamed from source/blender/gpu/shaders/compositor/infos/compositor_tone_map_simple_info.hh)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_alpha_over.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_blur_common.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_blur_common.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_bright_contrast.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_channel_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_chroma_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_balance.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_balance.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_correction.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_correction.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_spill.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_spill.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_to_luminance.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_difference_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_distance_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_exposure.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_exposure.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_gamma.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_gamma.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_correct.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_saturation_value.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_invert.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_invert.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_luminance_matte.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_main.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_main.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_map_value.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_map_value.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_normal.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_normal.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_posterize.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_posterize.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_separate_combine.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_set_alpha.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_store_output.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_store_output.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl)0
-rw-r--r--source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_type_conversion.glsl (renamed from source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl)0
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc4
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc2
-rw-r--r--source/blender/draw/CMakeLists.txt2
-rw-r--r--source/blender/draw/engines/basic/basic_engine.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c12
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.h2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c40
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c4
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c4
-rw-r--r--source/blender/draw/engines/eevee/eevee_shadows.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_volumes.c2
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_light.cc2
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_pipeline.cc4
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_velocity.cc6
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_cache_utils.c10
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_data.c8
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_shader_fx.c30
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl8
-rw-r--r--source/blender/draw/engines/overlay/overlay_armature.cc55
-rw-r--r--source/blender/draw/engines/overlay/overlay_edit_text.cc6
-rw-r--r--source/blender/draw/engines/overlay/overlay_extra.cc84
-rw-r--r--source/blender/draw/engines/overlay/overlay_facing.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_fade.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_gpencil.cc6
-rw-r--r--source/blender/draw/engines/overlay/overlay_image.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_lattice.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_metaball.cc8
-rw-r--r--source/blender/draw/engines/overlay/overlay_mode_transfer.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_outline.cc4
-rw-r--r--source/blender/draw/engines/overlay/overlay_sculpt.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_viewer_attribute.cc4
-rw-r--r--source/blender/draw/engines/overlay/overlay_wireframe.cc20
-rw-r--r--source/blender/draw/engines/select/select_engine.c10
-rw-r--r--source/blender/draw/engines/workbench/workbench_engine.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_shadow.c5
-rw-r--r--source/blender/draw/engines/workbench/workbench_volume.c4
-rw-r--r--source/blender/draw/intern/draw_cache_impl_curves.cc4
-rw-r--r--source/blender/draw/intern/draw_cache_impl_gpencil.cc4
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.cc8
-rw-r--r--source/blender/draw/intern/draw_cache_impl_pointcloud.cc120
-rw-r--r--source/blender/draw/intern/draw_command.cc22
-rw-r--r--source/blender/draw/intern/draw_command.hh37
-rw-r--r--source/blender/draw/intern/draw_curves.cc2
-rw-r--r--source/blender/draw/intern/draw_hair.cc6
-rw-r--r--source/blender/draw/intern/draw_manager.c6
-rw-r--r--source/blender/draw/intern/draw_manager_data.cc26
-rw-r--r--source/blender/draw/intern/draw_manager_shader.c4
-rw-r--r--source/blender/draw/intern/draw_manager_text.cc34
-rw-r--r--source/blender/draw/intern/draw_pass.hh26
-rw-r--r--source/blender/draw/intern/draw_pbvh.cc17
-rw-r--r--source/blender/draw/intern/draw_resource.hh4
-rw-r--r--source/blender/draw/intern/draw_volume.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc4
-rw-r--r--source/blender/draw/tests/draw_pass_test.cc7
-rw-r--r--source/blender/editors/animation/anim_draw.c230
-rw-r--r--source/blender/editors/animation/anim_motion_paths.c4
-rw-r--r--source/blender/editors/animation/keyframing.c4
-rw-r--r--source/blender/editors/armature/armature_add.c10
-rw-r--r--source/blender/editors/armature/armature_edit.c20
-rw-r--r--source/blender/editors/armature/armature_relations.c4
-rw-r--r--source/blender/editors/armature/armature_select.c8
-rw-r--r--source/blender/editors/armature/armature_skinning.c8
-rw-r--r--source/blender/editors/armature/armature_utils.c8
-rw-r--r--source/blender/editors/armature/meshlaplacian.c4
-rw-r--r--source/blender/editors/armature/pose_transform.c14
-rw-r--r--source/blender/editors/asset/ED_asset_list.h1
-rw-r--r--source/blender/editors/asset/intern/asset_list.cc14
-rw-r--r--source/blender/editors/curve/editcurve.c20
-rw-r--r--source/blender/editors/curve/editcurve_paint.c18
-rw-r--r--source/blender/editors/curve/editcurve_pen.c10
-rw-r--r--source/blender/editors/curve/editcurve_select.c4
-rw-r--r--source/blender/editors/curves/intern/curves_ops.cc4
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_presets.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_armature.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_bake_animation.cc4
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c11
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_mesh.cc2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_sculpt_paint.c35
-rw-r--r--source/blender/editors/gpencil/gpencil_trace_ops.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c16
-rw-r--r--source/blender/editors/gpencil/gpencil_uv.c4
-rw-r--r--source/blender/editors/include/UI_interface.h9
-rw-r--r--source/blender/editors/interface/eyedroppers/eyedropper_depth.c2
-rw-r--r--source/blender/editors/interface/interface.cc15
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_intern.h10
-rw-r--r--source/blender/editors/interface/interface_layout.c8
-rw-r--r--source/blender/editors/interface/interface_ops.cc3
-rw-r--r--source/blender/editors/interface/interface_panel.cc10
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.cc302
-rw-r--r--source/blender/editors/interface/views/interface_view.cc2
-rw-r--r--source/blender/editors/mesh/editface.cc4
-rw-r--r--source/blender/editors/mesh/editmesh_add_gizmo.c4
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c4
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c4
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c24
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_screw.c8
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin.c2
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c2
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c18
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c2
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c28
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_elem.c8
-rw-r--r--source/blender/editors/mesh/editmesh_select.cc18
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c32
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c8
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/mesh/mesh_data.cc6
-rw-r--r--source/blender/editors/mesh/meshtools.cc6
-rw-r--r--source/blender/editors/object/object_add.cc22
-rw-r--r--source/blender/editors/object/object_bake.c2
-rw-r--r--source/blender/editors/object/object_bake_api.c43
-rw-r--r--source/blender/editors/object/object_constraint.c6
-rw-r--r--source/blender/editors/object/object_hook.c20
-rw-r--r--source/blender/editors/object/object_modifier.cc10
-rw-r--r--source/blender/editors/object/object_relations.c22
-rw-r--r--source/blender/editors/object/object_remesh.cc22
-rw-r--r--source/blender/editors/object/object_transform.cc50
-rw-r--r--source/blender/editors/object/object_utils.c24
-rw-r--r--source/blender/editors/object/object_warp.c2
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c6
-rw-r--r--source/blender/editors/physics/particle_edit.c28
-rw-r--r--source/blender/editors/physics/particle_object.c14
-rw-r--r--source/blender/editors/physics/physics_fluid.c10
-rw-r--r--source/blender/editors/physics/physics_pointcache.c6
-rw-r--r--source/blender/editors/render/render_internal.cc22
-rw-r--r--source/blender/editors/render/render_preview.cc33
-rw-r--r--source/blender/editors/render/render_shading.cc2
-rw-r--r--source/blender/editors/screen/area.c2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_brush.cc4
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_ops.cc19
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c20
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c20
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c17
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.cc12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c91
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_detail.c14
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.cc2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_mesh.c10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c6
-rw-r--r--source/blender/editors/space_action/action_draw.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_editor.c28
-rw-r--r--source/blender/editors/space_clip/clip_ops.c16
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c2
-rw-r--r--source/blender/editors/space_clip/tracking_ops_track.c6
-rw-r--r--source/blender/editors/space_file/file_ops.c28
-rw-r--r--source/blender/editors/space_file/filelist.cc89
-rw-r--r--source/blender/editors/space_file/filesel.c4
-rw-r--r--source/blender/editors/space_file/fsmenu.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_nla/nla_draw.c2
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_node/add_menu_assets.cc314
-rw-r--r--source/blender/editors/space_node/node_add.cc143
-rw-r--r--source/blender/editors/space_node/node_edit.cc10
-rw-r--r--source/blender/editors/space_node/node_group.cc93
-rw-r--r--source/blender/editors/space_node/node_intern.hh17
-rw-r--r--source/blender/editors/space_node/node_ops.cc1
-rw-r--r--source/blender/editors/space_node/space_node.cc3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_channels_draw.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_drag_drop.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_preview.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_proxy.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_thumbnails.c4
-rw-r--r--source/blender/editors/space_view3d/space_view3d.cc10
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.cc2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_armature.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_forcefield.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_light.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.cc6
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.cc16
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_smoothview.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.cc28
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c53
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform.h3
-rw-r--r--source/blender/editors/transform/transform_convert.c6
-rw-r--r--source/blender/editors/transform/transform_convert_armature.c9
-rw-r--r--source/blender/editors/transform/transform_convert_curve.c2
-rw-r--r--source/blender/editors/transform/transform_convert_lattice.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mball.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mesh.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mesh_edge.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mesh_skin.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mesh_vert_cdata.c2
-rw-r--r--source/blender/editors/transform/transform_convert_nla.c6
-rw-r--r--source/blender/editors/transform/transform_convert_object.c14
-rw-r--r--source/blender/editors/transform/transform_convert_object_texspace.c4
-rw-r--r--source/blender/editors/transform/transform_convert_particle.c2
-rw-r--r--source/blender/editors/transform/transform_convert_sculpt.c12
-rw-r--r--source/blender/editors/transform/transform_generics.c6
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c50
-rw-r--r--source/blender/editors/transform/transform_mode.c2
-rw-r--r--source/blender/editors/transform/transform_mode_edge_slide.c2
-rw-r--r--source/blender/editors/transform/transform_mode_vert_slide.c15
-rw-r--r--source/blender/editors/transform/transform_orientations.c16
-rw-r--r--source/blender/editors/transform/transform_snap.c4
-rw-r--r--source/blender/editors/transform/transform_snap_object.cc8
-rw-r--r--source/blender/editors/uvedit/uvedit_select.c16
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c20
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp2
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp6
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/Noise.cpp1
-rw-r--r--source/blender/freestyle/intern/image/ImagePyramid.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_Operators.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp2
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp2
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.cpp1
-rw-r--r--source/blender/freestyle/intern/scene_graph/SceneHash.cpp2
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h2
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/Canvas.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/ContextFunctions.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRenderer.cpp2
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/OccluderSource.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapTesselator.h4
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.cpp2
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.cpp3
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp2
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp2
-rw-r--r--source/blender/geometry/intern/realize_instances.cc2
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c8
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c2
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c6
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c2
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilweight_angle.c6
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc20
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c14
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c8
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c2
-rw-r--r--source/blender/gpu/CMakeLists.txt123
-rw-r--r--source/blender/gpu/GPU_framebuffer.h3
-rw-r--r--source/blender/gpu/GPU_platform.h1
-rw-r--r--source/blender/gpu/intern/gpu_context.cc14
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc5
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer_private.hh5
-rw-r--r--source/blender/gpu/intern/gpu_shader_create_info.cc1
-rw-r--r--source/blender/gpu/intern/gpu_shader_dependency.cc2
-rw-r--r--source/blender/gpu/metal/mtl_shader_generator.hh2
-rw-r--r--source/blender/gpu/metal/mtl_texture_util.mm2
-rw-r--r--source/blender/gpu/vulkan/vk_backend.cc107
-rw-r--r--source/blender/gpu/vulkan/vk_backend.hh42
-rw-r--r--source/blender/gpu/vulkan/vk_batch.cc27
-rw-r--r--source/blender/gpu/vulkan/vk_batch.hh24
-rw-r--r--source/blender/gpu/vulkan/vk_context.cc48
-rw-r--r--source/blender/gpu/vulkan/vk_context.hh34
-rw-r--r--source/blender/gpu/vulkan/vk_drawlist.cc20
-rw-r--r--source/blender/gpu/vulkan/vk_drawlist.hh20
-rw-r--r--source/blender/gpu/vulkan/vk_framebuffer.cc62
-rw-r--r--source/blender/gpu/vulkan/vk_framebuffer.hh50
-rw-r--r--source/blender/gpu/vulkan/vk_index_buffer.cc33
-rw-r--r--source/blender/gpu/vulkan/vk_index_buffer.hh28
-rw-r--r--source/blender/gpu/vulkan/vk_query.cc28
-rw-r--r--source/blender/gpu/vulkan/vk_query.hh22
-rw-r--r--source/blender/gpu/vulkan/vk_shader.cc102
-rw-r--r--source/blender/gpu/vulkan/vk_shader.hh48
-rw-r--r--source/blender/gpu/vulkan/vk_storage_buffer.cc42
-rw-r--r--source/blender/gpu/vulkan/vk_storage_buffer.hh30
-rw-r--r--source/blender/gpu/vulkan/vk_texture.cc70
-rw-r--r--source/blender/gpu/vulkan/vk_texture.hh39
-rw-r--r--source/blender/gpu/vulkan/vk_uniform_buffer.cc24
-rw-r--r--source/blender/gpu/vulkan/vk_uniform_buffer.hh25
-rw-r--r--source/blender/gpu/vulkan/vk_vertex_buffer.cc58
-rw-r--r--source/blender/gpu/vulkan/vk_vertex_buffer.hh32
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c4
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp16
-rw-r--r--source/blender/imbuf/IMB_imbuf.h6
-rw-r--r--source/blender/imbuf/intern/indexer.c24
-rw-r--r--source/blender/imbuf/intern/webp.c2
-rw-r--r--source/blender/io/alembic/exporter/abc_export_capi.cc6
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_hair.cc4
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_points.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_axis_conversion.cc8
-rw-r--r--source/blender/io/alembic/intern/abc_reader_object.cc2
-rw-r--r--source/blender/io/alembic/intern/alembic_capi.cc8
-rw-r--r--source/blender/io/collada/AnimationImporter.cpp6
-rw-r--r--source/blender/io/collada/ArmatureImporter.cpp4
-rw-r--r--source/blender/io/collada/ControllerExporter.cpp4
-rw-r--r--source/blender/io/collada/DocumentImporter.cpp4
-rw-r--r--source/blender/io/collada/MeshImporter.cpp2
-rw-r--r--source/blender/io/collada/SkinInfo.cpp6
-rw-r--r--source/blender/io/collada/collada_utils.cpp8
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc2
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_base.cc8
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc2
-rw-r--r--source/blender/io/gpencil/intern/gpencil_io_export_svg.cc2
-rw-r--r--source/blender/io/usd/CMakeLists.txt7
-rw-r--r--source/blender/io/usd/intern/usd_capi_export.cc12
-rw-r--r--source/blender/io/usd/intern/usd_capi_import.cc9
-rw-r--r--source/blender/io/usd/intern/usd_reader_mesh.cc18
-rw-r--r--source/blender/io/usd/intern/usd_writer_hair.cc2
-rw-r--r--source/blender/io/usd/intern/usd_writer_mesh.cc11
-rw-r--r--source/blender/io/usd/tests/usd_imaging_test.cc7
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc16
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc17
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh5
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc8
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_mesh.cc1
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h4
-rw-r--r--source/blender/makesdna/DNA_layer_types.h6
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h1
-rw-r--r--source/blender/makesdna/DNA_meta_types.h4
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h70
-rw-r--r--source/blender/makesdna/DNA_node_types.h10
-rw-r--r--source/blender/makesdna/DNA_object_defaults.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h12
-rw-r--r--source/blender/makesdna/DNA_particle_types.h2
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h6
-rw-r--r--source/blender/makesdna/DNA_workspace_types.h6
-rw-r--r--source/blender/makesdna/intern/dna_rename_defs.h2
-rw-r--r--source/blender/makesrna/RNA_enum_items.h1
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt5
-rw-r--r--source/blender/makesrna/intern/rna_armature.c2
-rw-r--r--source/blender/makesrna/intern/rna_asset.c7
-rw-r--r--source/blender/makesrna/intern/rna_brush.c4
-rw-r--r--source/blender/makesrna/intern/rna_color.c30
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c2
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c8
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c8
-rw-r--r--source/blender/makesrna/intern/rna_nla.c2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c37
-rw-r--r--source/blender/makesrna/intern/rna_object.c7
-rw-r--r--source/blender/makesrna/intern/rna_particle.c2
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/modifiers/intern/MOD_array.c6
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.cc34
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c16
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c4
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c4
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c8
-rw-r--r--source/blender/modifiers/intern/MOD_mask.cc2
-rw-r--r--source/blender/modifiers/intern/MOD_mesh_to_volume.cc4
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c4
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.cc8
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c2
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c8
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_extrude.c2
-rw-r--r--source/blender/modifiers/intern/MOD_solidify_nonmanifold.c7
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c2
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c4
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c2
-rw-r--r--source/blender/modifiers/intern/MOD_util.cc10
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.cc6
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.cc4
-rw-r--r--source/blender/modifiers/intern/MOD_volume_displace.cc7
-rw-r--r--source/blender/modifiers/intern/MOD_volume_to_mesh.cc4
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c6
-rw-r--r--source/blender/modifiers/intern/MOD_wave.cc4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.cc6
-rw-r--r--source/blender/nodes/composite/CMakeLists.txt1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alpha_over.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_antialiasing.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.cc229
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehblur.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_boxmask.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channel_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_color_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_color_spill.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.cc6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_denoise.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_despeckle.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diff_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.cc189
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distance_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.cc8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_luma_matte.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_map_value.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_output_file.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_split_viewer.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sunbeams.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switchview.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vec_blur.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_boolean_math.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_combine_color.cc4
-rw-r--r--source/blender/nodes/function/nodes/node_fn_compare.cc4
-rw-r--r--source/blender/nodes/function/nodes/node_fn_input_bool.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_input_color.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_input_int.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_input_string.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_input_vector.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_random_value.cc4
-rw-r--r--source/blender/nodes/function/nodes/node_fn_rotate_euler.cc2
-rw-r--r--source/blender/nodes/function/nodes/node_fn_separate_color.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_boolean.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_collection_info.cc10
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_common.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc342
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_set_handle_type.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_image_texture.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc12
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc8
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_object_info.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_proximity.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_raycast.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_sample_index.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_curve_normal.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_switch.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_triangulate.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_viewer.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc4
-rw-r--r--source/blender/nodes/intern/node_common.cc12
-rw-r--r--source/blender/nodes/intern/node_exec.cc2
-rw-r--r--source/blender/nodes/intern/node_exec.h4
-rw-r--r--source/blender/nodes/shader/node_shader_tree.cc3
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_add_shader.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_background.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bevel.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_blackbody.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bump.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_clamp.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_color_ramp.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.cc12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_displacement.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_emission.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_fresnel.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_gamma.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geometry.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hair_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_holdout.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ies_light.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_invert.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_layer_weight.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_falloff.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_path.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_map_range.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_shader.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_object_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_aov.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_light.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_material.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_world.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_point_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_script.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc12
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_squeeze.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tangent.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_brick.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_coord.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_uvmap.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_math.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_transform.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vertex_color.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_info.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_principled.cc4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wavelength.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wireframe.cc2
-rw-r--r--source/blender/nodes/texture/node_texture_tree.c3
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_at.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_checker.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_combine_color.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_coord.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c11
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_distance.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_invert.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_rotate.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_scale.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_separate_color.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_translate.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToNor.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_viewer.c2
-rw-r--r--source/blender/python/gpu/gpu_py_platform.c4
-rw-r--r--source/blender/python/intern/bpy_gizmo_wrap.h2
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.h5
-rw-r--r--source/blender/python/intern/bpy_rna.c4
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c4
-rw-r--r--source/blender/render/RE_multires_bake.h4
-rw-r--r--source/blender/render/RE_pipeline.h2
-rw-r--r--source/blender/render/intern/bake.c2
-rw-r--r--source/blender/render/intern/engine.cc6
-rw-r--r--source/blender/render/intern/multires_bake.c4
-rw-r--r--source/blender/render/intern/pipeline.cc113
-rw-r--r--source/blender/render/intern/pipeline.h9
-rw-r--r--source/blender/render/intern/render_result.cc8
-rw-r--r--source/blender/render/intern/render_result.h5
-rw-r--r--source/blender/render/intern/render_types.h8
-rw-r--r--source/blender/render/intern/texture_pointdensity.c12
-rw-r--r--source/blender/sequencer/SEQ_proxy.h4
-rw-r--r--source/blender/sequencer/SEQ_render.h10
-rw-r--r--source/blender/sequencer/intern/disk_cache.c16
-rw-r--r--source/blender/sequencer/intern/image_cache.c7
-rw-r--r--source/blender/sequencer/intern/image_cache.h2
-rw-r--r--source/blender/sequencer/intern/proxy.c8
-rw-r--r--source/blender/sequencer/intern/proxy_job.c4
-rw-r--r--source/blender/sequencer/intern/render.c10
-rw-r--r--source/blender/windowmanager/WM_api.h42
-rw-r--r--source/blender/windowmanager/WM_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.cc2
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c18
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
-rw-r--r--source/blender/windowmanager/wm.h4
-rw-r--r--source/blender/windowmanager/wm_event_system.h8
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_session.c2
-rw-r--r--source/creator/CMakeLists.txt38
-rw-r--r--source/creator/creator_args.c10
m---------source/tools0
-rw-r--r--tests/CMakeLists.txt19
-rw-r--r--tests/blender_as_python_module/CMakeLists.txt2
-rw-r--r--tests/python/CMakeLists.txt2
998 files changed, 9405 insertions, 4871 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2f34ca3dd2..30a186318ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -177,8 +177,11 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
-mark_as_advanced(WITH_PYTHON) # don't want people disabling this unless they really know what they are doing.
-mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
+# Don't want people disabling this unless they really know what they are doing.
+mark_as_advanced(WITH_PYTHON)
+# Some distributions see this as a security issue, rather than have them patch it,
+# make a build option.
+mark_as_advanced(WITH_PYTHON_SECURITY)
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some efficiency, only enable for development)." OFF)
mark_as_advanced(WITH_PYTHON_SAFETY)
@@ -489,8 +492,8 @@ if(NOT APPLE)
option(WITH_CYCLES_ONEAPI_BINARIES "Enable Ahead-Of-Time compilation for Cycles oneAPI device" OFF)
# https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compilation/ahead-of-time-compilation.html
- # acm-g10 is the architecture for the first Arc Alchemist GPUs but we'll keep using dg2 until IGC dependency is updated to support acm-g10.
- set(CYCLES_ONEAPI_SPIR64_GEN_DEVICES "dg2" CACHE STRING "oneAPI Intel GPU architectures to build binaries for")
+ # acm-g10 is the target for the first Intel Arc Alchemist GPUs.
+ set(CYCLES_ONEAPI_SPIR64_GEN_DEVICES "acm-g10" CACHE STRING "oneAPI Intel GPU architectures to build binaries for")
set(CYCLES_ONEAPI_SYCL_TARGETS spir64 spir64_gen CACHE STRING "oneAPI targets to build AOT binaries for")
mark_as_advanced(CYCLES_ONEAPI_SPIR64_GEN_DEVICES)
@@ -550,6 +553,7 @@ endif()
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
option(WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF)
+# NOTE: All callers of this must add `TEST_PYTHON_EXE_EXTRA_ARGS` before any other arguments.
set(TEST_PYTHON_EXE "" CACHE PATH "Python executable to run unit tests")
mark_as_advanced(TEST_PYTHON_EXE)
@@ -569,6 +573,12 @@ mark_as_advanced(
WITH_GPU_BUILDTIME_SHADER_BUILDER
)
+# Vulkan
+option(WITH_VULKAN_BACKEND "Enable Vulkan as graphics backend (only for development)" OFF)
+mark_as_advanced(
+ WITH_VULKAN_BACKEND
+)
+
# Metal
if(APPLE)
@@ -1223,6 +1233,13 @@ endif()
# -----------------------------------------------------------------------------
+# Configure Vulkan.
+
+if(WITH_VULKAN_BACKEND)
+ add_definitions(-DWITH_VULKAN_BACKEND)
+endif()
+
+# -----------------------------------------------------------------------------
# Configure Metal
if(WITH_METAL_BACKEND)
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index ef3c0388c29..a50a2af1755 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-####################################################################################################
+##################################################################################################
#
# This is a build system used by platform maintainers to build library dependencies on
# Windows, macOS and Linux.
@@ -22,7 +22,7 @@
# Install compiler cmake autoconf automake libtool yasm tcl
# Run "make deps" from main Blender directory
#
-####################################################################################################
+##################################################################################################
project("BlenderDependencies")
cmake_minimum_required(VERSION 3.5)
@@ -32,7 +32,8 @@ endif()
include(ExternalProject)
include(cmake/check_software.cmake)
include(cmake/options.cmake)
-# versions.cmake needs to be included after options.cmake due to the BLENDER_PLATFORM_ARM variable being needed.
+# `versions.cmake` needs to be included after `options.cmake`
+# due to the `BLENDER_PLATFORM_ARM` variable being needed.
include(cmake/versions.cmake)
include(cmake/boost_build_options.cmake)
include(cmake/download.cmake)
@@ -43,7 +44,7 @@ if(ENABLE_MINGW64)
else()
set(mingw_LIBDIR ${LIBDIR})
endif()
-
+include(cmake/ssl.cmake)
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
@@ -90,7 +91,7 @@ include(cmake/usd.cmake)
include(cmake/openvdb.cmake)
include(cmake/potrace.cmake)
include(cmake/haru.cmake)
-# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
+# Boost needs to be included after `python.cmake` due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
include(cmake/pugixml.cmake)
include(cmake/ispc.cmake)
@@ -120,6 +121,7 @@ endif()
include(cmake/expat.cmake)
include(cmake/pystring.cmake)
include(cmake/yamlcpp.cmake)
+include(cmake/minizipng.cmake)
include(cmake/opencolorio.cmake)
if(BLENDER_PLATFORM_ARM)
@@ -167,7 +169,6 @@ if(UNIX)
include(cmake/bzip2.cmake)
include(cmake/ffi.cmake)
include(cmake/lzma.cmake)
- include(cmake/ssl.cmake)
include(cmake/sqlite.cmake)
endif()
@@ -179,6 +180,8 @@ if(UNIX AND NOT APPLE)
include(cmake/wayland.cmake)
include(cmake/wayland_libdecor.cmake)
endif()
-
+include(cmake/shaderc_deps.cmake)
+include(cmake/shaderc.cmake)
+include(cmake/vulkan.cmake)
include(cmake/harvest.cmake)
include(cmake/cve_check.cmake)
diff --git a/build_files/build_environment/cmake/cve_check.csv.in b/build_files/build_environment/cmake/cve_check.csv.in
index 734a24f8c77..946dda5ab17 100644
--- a/build_files/build_environment/cmake/cve_check.csv.in
+++ b/build_files/build_environment/cmake/cve_check.csv.in
@@ -17,6 +17,12 @@ vendor,product,version,cve_number,remarks,comment
@TIFF_ID@,CVE-2022-2521,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-2953,Ignored,issue in tiff command line tool not used by blender
@TIFF_ID@,CVE-2022-34526,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3570,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3597,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3598,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3599,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3626,Ignored,issue in tiff command line tool not used by blender
+@TIFF_ID@,CVE-2022-3627,Ignored,issue in tiff command line tool not used by blender
@XML2_ID@,CVE-2016-3709,Ignored,not affecting blender and not considered a security issue upstream
@GMP_ID@,CVE-2021-43618,Mitigated,patched using upstream commit 561a9c25298e
@SQLITE_ID@,CVE-2022-35737,Ignored,only affects SQLITE_ENABLE_STAT4 compile option not used by blender or python
diff --git a/build_files/build_environment/cmake/download.cmake b/build_files/build_environment/cmake/download.cmake
index ea3d2768784..f2681bd33d6 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -87,6 +87,7 @@ download_source(OPENSUBDIV)
download_source(SDL)
download_source(OPENCOLLADA)
download_source(OPENCOLORIO)
+download_source(MINIZIPNG)
download_source(LLVM)
download_source(OPENMP)
download_source(OPENIMAGEIO)
@@ -165,3 +166,9 @@ download_source(OCLOC)
download_source(AOM)
download_source(FRIBIDI)
download_source(HARFBUZZ)
+download_source(SHADERC)
+download_source(SHADERC_SPIRV_TOOLS)
+download_source(SHADERC_SPIRV_HEADERS)
+download_source(SHADERC_GLSLANG)
+download_source(VULKAN_HEADERS)
+download_source(VULKAN_LOADER)
diff --git a/build_files/build_environment/cmake/dpcpp.cmake b/build_files/build_environment/cmake/dpcpp.cmake
index 27203a77d71..ef6fc9c40c9 100644
--- a/build_files/build_environment/cmake/dpcpp.cmake
+++ b/build_files/build_environment/cmake/dpcpp.cmake
@@ -84,8 +84,11 @@ ExternalProject_Add(external_dpcpp
SOURCE_SUBDIR llvm
LIST_SEPARATOR ^^
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/dpcpp ${DPCPP_CMAKE_FLAGS} ${DPCPP_EXTRA_ARGS}
- #CONFIGURE_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/configure.py ${DPCPP_CONFIGURE_ARGS}
- #BUILD_COMMAND echo "." #${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/compile.py
+ # CONFIGURE_COMMAND
+ # ${PYTHON_BINARY}
+ # ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/configure.py ${DPCPP_CONFIGURE_ARGS}
+ # BUILD_COMMAND
+ # echo "." # ${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/compile.py
INSTALL_COMMAND ${CMAKE_COMMAND} --build . -- deploy-sycl-toolchain
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/dpcpp/src/external_dpcpp < ${PATCH_DIR}/dpcpp.diff
INSTALL_DIR ${LIBDIR}/dpcpp
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 2714979d869..6616c675e9b 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -192,6 +192,9 @@ harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
+harvest(openpgl/include openpgl/include "*.h")
+harvest(openpgl/lib openpgl/lib "*.a")
+harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
diff --git a/build_files/build_environment/cmake/mesa.cmake b/build_files/build_environment/cmake/mesa.cmake
index 8a40e8dc0de..9c0d613daa5 100644
--- a/build_files/build_environment/cmake/mesa.cmake
+++ b/build_files/build_environment/cmake/mesa.cmake
@@ -52,4 +52,5 @@ ExternalProject_Add(external_mesa
add_dependencies(
external_mesa
ll
+ external_zlib
)
diff --git a/build_files/build_environment/cmake/minizipng.cmake b/build_files/build_environment/cmake/minizipng.cmake
new file mode 100644
index 00000000000..ae121a7a8aa
--- /dev/null
+++ b/build_files/build_environment/cmake/minizipng.cmake
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set(MINIZIPNG_EXTRA_ARGS
+ -DMZ_FETCH_LIBS=OFF
+ -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
+ -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
+ # Because OCIO hardcodes a non standard include path
+ -DCMAKE_INSTALL_INCLUDEDIR=${LIBDIR}/minizipng/include/minizip-ng
+)
+
+ExternalProject_Add(external_minizipng
+ URL file://${PACKAGE_DIR}/${MINIZIPNG_FILE}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH ${MINIZIPNG_HASH_TYPE}=${MINIZIPNG_HASH}
+ PREFIX ${BUILD_DIR}/minizipng
+ CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/minizipng ${DEFAULT_CMAKE_FLAGS} ${MINIZIPNG_EXTRA_ARGS}
+ INSTALL_DIR ${LIBDIR}/minizipng
+)
diff --git a/build_files/build_environment/cmake/opencolorio.cmake b/build_files/build_environment/cmake/opencolorio.cmake
index 4bdf56081bc..79d1ffa9c2e 100644
--- a/build_files/build_environment/cmake/opencolorio.cmake
+++ b/build_files/build_environment/cmake/opencolorio.cmake
@@ -15,8 +15,14 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dexpat_ROOT=${LIBDIR}/expat
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
+ -Dyaml-cpp_VERSION=${YAMLCPP_VERSION}
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
+ -Dminizip-ng_ROOT=${LIBDIR}/minizipng
+ -Dminizip-ng_INCLUDE_DIR=${LIBDIR}/minizipng/include
+ -Dminizip-ng_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
+ -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
+ -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
)
if(BLENDER_PLATFORM_ARM)
@@ -30,7 +36,6 @@ if(WIN32)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpatMD
- -Dyaml-cpp_LIBRARY=${LIBDIR}/expat/lib/libyaml-cppmd.lib
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}
-DCMAKE_CXX_FLAGS=-DIMATH_DLL
)
@@ -57,6 +62,8 @@ add_dependencies(
external_expat
external_imath
external_pystring
+ external_zlib
+ external_minizipng
)
if(WIN32)
@@ -64,16 +71,17 @@ if(WIN32)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/include ${HARVEST_TARGET}/opencolorio/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
- COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/yaml-cpp.lib ${HARVEST_TARGET}/opencolorio/lib/yaml-cpp.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/minizipng/lib/libminizip.lib ${HARVEST_TARGET}/opencolorio/lib/libminizip.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
- COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/yaml-cppd.lib ${HARVEST_TARGET}/opencolorio/lib/yaml-cppd.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
DEPENDEES install
diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake
index 50867fadff4..3d3e34e8444 100644
--- a/build_files/build_environment/cmake/options.cmake
+++ b/build_files/build_environment/cmake/options.cmake
@@ -21,8 +21,8 @@ else()
endif()
set(DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" CACHE STRING "Path for downloaded files")
-# This path must be hard-coded like this, so that the GNUmakefile knows where it is and can pass it to make_source_archive.py:
-set(PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages")
+
+set(PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages" CACHE PATH "default path for downloaded packages")
option(PACKAGE_USE_UPSTREAM_SOURCES "Use sources upstream to download the package sources, when OFF the blender mirror will be used" ON)
file(TO_CMAKE_PATH ${DOWNLOAD_DIR} DOWNLOAD_DIR)
diff --git a/build_files/build_environment/cmake/opus.cmake b/build_files/build_environment/cmake/opus.cmake
index f4f77749e00..c5d1d207805 100644
--- a/build_files/build_environment/cmake/opus.cmake
+++ b/build_files/build_environment/cmake/opus.cmake
@@ -9,6 +9,7 @@ ExternalProject_Add(external_opus
--disable-shared
--enable-static
--with-pic
+ --disable-maintainer-mode
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make install
INSTALL_DIR ${LIBDIR}/opus
diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake
index c56f1e62419..c9a0d5ab6af 100644
--- a/build_files/build_environment/cmake/python.cmake
+++ b/build_files/build_environment/cmake/python.cmake
@@ -16,10 +16,12 @@ if(WIN32)
set(PYTHON_EXTERNALS_FOLDER ${BUILD_DIR}/python/src/external_python/externals)
set(ZLIB_SOURCE_FOLDER ${BUILD_DIR}/zlib/src/external_zlib)
+ set(SSL_SOURCE_FOLDER ${BUILD_DIR}/ssl/src/external_ssl)
set(DOWNLOADS_EXTERNALS_FOLDER ${DOWNLOAD_DIR}/externals)
cmake_to_dos_path(${PYTHON_EXTERNALS_FOLDER} PYTHON_EXTERNALS_FOLDER_DOS)
cmake_to_dos_path(${ZLIB_SOURCE_FOLDER} ZLIB_SOURCE_FOLDER_DOS)
+ cmake_to_dos_path(${SSL_SOURCE_FOLDER} SSL_SOURCE_FOLDER_DOS)
cmake_to_dos_path(${DOWNLOADS_EXTERNALS_FOLDER} DOWNLOADS_EXTERNALS_FOLDER_DOS)
ExternalProject_Add(external_python
@@ -31,11 +33,14 @@ if(WIN32)
# that beyond placing some code in their externals dir before it tries.
# the foldernames *HAVE* to match the ones inside pythons get_externals.cmd.
# python 3.10.8 still ships zlib 1.2.12, replace it with our 1.2.13
- # copy until they update.
+ # copy until they update. Same rules apply to openssl foldernames HAVE to match
+ # regardless of the version actually in there.
CONFIGURE_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.12 ${ZLIB_SOURCE_FOLDER_DOS} &&
- ${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.12/zconf.h
- BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p x64 -c ${BUILD_MODE}
+ mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1q ${SSL_SOURCE_FOLDER_DOS} &&
+ ${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.12/zconf.h &&
+ ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
+ BUILD_COMMAND ${CONFIGURE_ENV_MSVC} && cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && set LDFLAGS=/DEBUG && call prepare_ssl.bat && call build.bat -e -p x64 -c ${BUILD_MODE}
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
add_dependencies(
@@ -96,15 +101,18 @@ else()
INSTALL_DIR ${LIBDIR}/python)
endif()
+add_dependencies(
+ external_python
+ external_ssl
+ external_zlib
+)
if(UNIX)
add_dependencies(
external_python
external_bzip2
external_ffi
external_lzma
- external_ssl
external_sqlite
- external_zlib
)
endif()
diff --git a/build_files/build_environment/cmake/setup_mingw64.cmake b/build_files/build_environment/cmake/setup_mingw64.cmake
index fa65212e056..6f53edb38ea 100644
--- a/build_files/build_environment/cmake/setup_mingw64.cmake
+++ b/build_files/build_environment/cmake/setup_mingw64.cmake
@@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-####################################################################################################################
+##################################################################################################
# Mingw64 Builds
-####################################################################################################################
+##################################################################################################
# This installs mingw64+msys to compile ffmpeg/iconv/libsndfile/fftw3
-####################################################################################################################
+##################################################################################################
message("LIBDIR = ${LIBDIR}")
macro(cmake_to_msys_path MsysPath ResultingPath)
diff --git a/build_files/build_environment/cmake/shaderc.cmake b/build_files/build_environment/cmake/shaderc.cmake
new file mode 100644
index 00000000000..a5275837372
--- /dev/null
+++ b/build_files/build_environment/cmake/shaderc.cmake
@@ -0,0 +1,63 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+set(SHADERC_EXTRA_ARGS
+ -DSHADERC_SKIP_TESTS=On
+ -DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
+ -DSHADERC_SPIRV_HEADERS_DIR=${BUILD_DIR}/shaderc_spirv_headers/src/external_shaderc_spirv_headers
+ -DSHADERC_GLSLANG_DIR=${BUILD_DIR}/shaderc_glslang/src/external_shaderc_glslang
+ -DCMAKE_DEBUG_POSTFIX=_d
+ -DPYTHON_EXECUTABLE=${PYTHON_BINARY}
+)
+
+ExternalProject_Add(external_shaderc
+ URL file://${PACKAGE_DIR}/${SHADERC_FILE}
+ URL_HASH ${SHADERC_HASH_TYPE}=${SHADERC_HASH}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ PREFIX ${BUILD_DIR}/shaderc
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/shaderc ${DEFAULT_CMAKE_FLAGS} ${SHADERC_EXTRA_ARGS}
+ INSTALL_DIR ${LIBDIR}/shaderc
+)
+
+add_dependencies(
+ external_shaderc
+ external_shaderc_spirv_tools
+ external_shaderc_spirv_headers
+ external_shaderc_glslang
+)
+
+
+if(WIN32)
+ if(BUILD_MODE STREQUAL Release)
+ ExternalProject_Add_Step(external_shaderc after_install
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/shaderc/include ${HARVEST_TARGET}/shaderc/include
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared.dll
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared.lib
+
+ DEPENDEES install
+ )
+ endif()
+ if(BUILD_MODE STREQUAL Debug)
+ ExternalProject_Add_Step(external_shaderc after_install
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/bin/shaderc_shared_d.dll ${HARVEST_TARGET}/shaderc/bin/shaderc_shared_d.dll
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/shaderc/lib/shaderc_shared_d.lib ${HARVEST_TARGET}/shaderc/lib/shaderc_shared_d.lib
+ DEPENDEES install
+ )
+ endif()
+endif()
+
+
diff --git a/build_files/build_environment/cmake/shaderc_deps.cmake b/build_files/build_environment/cmake/shaderc_deps.cmake
new file mode 100644
index 00000000000..bfe14a55f5b
--- /dev/null
+++ b/build_files/build_environment/cmake/shaderc_deps.cmake
@@ -0,0 +1,51 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# These are build time requirements for shaderc. We only have to unpack these
+# shaderc will build them.
+
+ExternalProject_Add(external_shaderc_glslang
+ URL file://${PACKAGE_DIR}/${SHADERC_GLSLANG_FILE}
+ URL_HASH ${SHADERC_GLSLANG_HASH_TYPE}=${SHADERC_GLSLANG_HASH}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ PREFIX ${BUILD_DIR}/shaderc_glslang
+ CONFIGURE_COMMAND echo .
+ BUILD_COMMAND echo .
+ INSTALL_COMMAND echo .
+)
+
+ExternalProject_Add(external_shaderc_spirv_headers
+ URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_HEADERS_FILE}
+ URL_HASH ${SHADERC_SPIRV_HEADERS_HASH_TYPE}=${SHADERC_SPIRV_HEADERS_HASH}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ PREFIX ${BUILD_DIR}/shaderc_spirv_headers
+ CONFIGURE_COMMAND echo .
+ BUILD_COMMAND echo .
+ INSTALL_COMMAND echo .
+)
+
+ExternalProject_Add(external_shaderc_spirv_tools
+ URL file://${PACKAGE_DIR}/${SHADERC_SPIRV_TOOLS_FILE}
+ URL_HASH ${SHADERC_SPIRV_TOOLS_HASH_TYPE}=${SHADERC_SPIRV_TOOLS_HASH}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ PREFIX ${BUILD_DIR}/shaderc_spirv_tools
+ CONFIGURE_COMMAND echo .
+ BUILD_COMMAND echo .
+ INSTALL_COMMAND echo .
+)
+
diff --git a/build_files/build_environment/cmake/ssl.cmake b/build_files/build_environment/cmake/ssl.cmake
index 628187dc0ac..6241e2d44e6 100644
--- a/build_files/build_environment/cmake/ssl.cmake
+++ b/build_files/build_environment/cmake/ssl.cmake
@@ -3,33 +3,47 @@
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)
-if(APPLE)
- set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
- set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
+if(WIN32)
+ # Python will build this with its preferred build options and patches. We only need to unpack openssl
+ ExternalProject_Add(external_ssl
+ URL file://${PACKAGE_DIR}/${SSL_FILE}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
+ PREFIX ${BUILD_DIR}/ssl
+ CONFIGURE_COMMAND echo "."
+ BUILD_COMMAND echo "."
+ INSTALL_COMMAND echo "."
+ INSTALL_DIR ${LIBDIR}/ssl
+ )
else()
- if(BLENDER_PLATFORM_ARM)
- set(SSL_OS_COMPILER "blender-linux-aarch64")
- elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
- set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
- set(SSL_OS_COMPILER "blender-linux-x86_64")
+ if(APPLE)
+ set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
+ set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
else()
- set(SSL_OS_COMPILER "blender-linux-x86")
+ if(BLENDER_PLATFORM_ARM)
+ set(SSL_OS_COMPILER "blender-linux-aarch64")
+ elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
+ set(SSL_OS_COMPILER "blender-linux-x86_64")
+ else()
+ set(SSL_OS_COMPILER "blender-linux-x86")
+ endif()
endif()
-endif()
-ExternalProject_Add(external_ssl
- URL file://${PACKAGE_DIR}/${SSL_FILE}
- DOWNLOAD_DIR ${DOWNLOAD_DIR}
- URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
- PREFIX ${BUILD_DIR}/ssl
- PATCH_COMMAND ${SSL_PATCH_CMD}
- CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
- --openssldir=${LIBDIR}/ssl
- no-shared
- no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
- --config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
- ${SSL_OS_COMPILER}
- BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
- INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
- INSTALL_DIR ${LIBDIR}/ssl
-)
+ ExternalProject_Add(external_ssl
+ URL file://${PACKAGE_DIR}/${SSL_FILE}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
+ PREFIX ${BUILD_DIR}/ssl
+ PATCH_COMMAND ${SSL_PATCH_CMD}
+ CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
+ --openssldir=${LIBDIR}/ssl
+ no-shared
+ no-idea no-mdc2 no-rc5 no-zlib no-ssl3 enable-unit-test no-ssl3-method enable-rfc3779 enable-cms
+ --config=${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl.conf
+ ${SSL_OS_COMPILER}
+ BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make -j${MAKE_THREADS}
+ INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && make install
+ INSTALL_DIR ${LIBDIR}/ssl
+ )
+endif() \ No newline at end of file
diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake
index 8601bd91f25..4abb368e740 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -122,8 +122,8 @@ if(WIN32)
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib/python ${HARVEST_TARGET}/usd/lib/debug/python
- COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.dll
- COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_ms_d.dll
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_ms_d.lib
DEPENDEES install
)
endif()
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index d822a380cab..eed43529381 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -114,9 +114,9 @@ set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
-set(OPENSUBDIV_VERSION v3_4_4)
+set(OPENSUBDIV_VERSION v3_5_0)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
-set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
+set(OPENSUBDIV_HASH 230f5cd2911d6240e58a3773b9c6e5e4)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
@@ -133,12 +133,18 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
-set(OPENCOLORIO_VERSION 2.1.1)
+set(OPENCOLORIO_VERSION 2.2.0)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
-set(OPENCOLORIO_HASH 604f562e073f23d88ce89ed4f7f709ba)
+set(OPENCOLORIO_HASH d58a5980adba2d89a363100a09daa5f3)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
+set(MINIZIPNG_VERSION 3.0.7)
+set(MINIZIPNG_URI https://github.com/zlib-ng/minizip-ng/archive/${MINIZIPNG_VERSION}.tar.gz)
+set(MINIZIPNG_HASH 09dcc8a9def348e1be9659e384c2cd55)
+set(MINIZIPNG_HASH_TYPE MD5)
+set(MINIZIPNG_FILE minizip-ng-${MINIZIPNG_VERSION}.tar.gz)
+
set(LLVM_VERSION 12.0.0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
@@ -212,9 +218,9 @@ set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
-set(OPENVDB_VERSION 9.1.0)
+set(OPENVDB_VERSION 10.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
-set(OPENVDB_HASH 8918de645a737734e577e16753325703)
+set(OPENVDB_HASH 64301c737e16b26c8f3085a31e6397e9)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
@@ -225,8 +231,9 @@ set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
set(CERTIFI_VERSION 2021.10.8)
set(REQUESTS_VERSION 2.27.1)
set(CYTHON_VERSION 0.29.30)
-# The version of the zstd library used to build the Python package should match ZSTD_VERSION defined below.
-# At this time of writing, 0.17.0 was already released, but built against zstd 1.5.1, while we use 1.5.0.
+# The version of the zstd library used to build the Python package should match ZSTD_VERSION
+# defined below. At this time of writing, 0.17.0 was already released,
+# but built against zstd 1.5.1, while we use 1.5.0.
set(ZSTANDARD_VERSION 0.16.0)
set(AUTOPEP8_VERSION 1.6.0)
set(PYCODESTYLE_VERSION 2.8.0)
@@ -359,9 +366,9 @@ set(XML2_HASH_TYPE MD5)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.xz)
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
-set(YAMLCPP_VERSION 0.6.3)
+set(YAMLCPP_VERSION 0.7.0)
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
-set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
+set(YAMLCPP_HASH 74d646a3cc1b5d519829441db96744f0)
set(YAMLCPP_HASH_TYPE MD5)
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
@@ -372,10 +379,10 @@ set(PYSTRING_HASH f2c68786b359f5e4e62bed53bc4fb86d)
set(PYSTRING_HASH_TYPE MD5)
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
-set(EXPAT_VERSION 2_4_9)
-set(EXPAT_VERSION_DOTS 2.4.9)
+set(EXPAT_VERSION 2_5_0)
+set(EXPAT_VERSION_DOTS 2.5.0)
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
-set(EXPAT_HASH b59a2aa796be1ee177bbab3b7231dfa5)
+set(EXPAT_HASH d375fa3571c0abb945873f5061a8f2e2)
set(EXPAT_HASH_TYPE MD5)
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
set(EXPAT_CPE "cpe:2.3:a:libexpat_project:libexpat:${EXPAT_VERSION_DOTS}:*:*:*:*:*:*:*")
@@ -457,9 +464,9 @@ set(EMBREE_HASH 52d0be294d6c88ba7a6c9e046796e7be)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
-set(USD_VERSION 22.03)
+set(USD_VERSION 22.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
-set(USD_HASH e0e441a05057692a83124a1195b09eed)
+set(USD_HASH 8c89459e48a2ef0e7ae9e7e490377507)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
@@ -559,10 +566,10 @@ set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
-set(OPENPGL_VERSION v0.4.0-beta)
-set(OPENPGL_SHORT_VERSION 0.4.0)
+set(OPENPGL_VERSION v0.4.1-beta)
+set(OPENPGL_SHORT_VERSION 0.4.1)
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
-set(OPENPGL_HASH 1f090f88ab2bad028e8b3619aa926f4f97cf7b2c175b904704d2fec8593dd3cd)
+set(OPENPGL_HASH db63f5dac5cfa8c110ede241f0c413f00db0c4748697381c4fa23e0f9e82a754)
set(OPENPGL_HASH_TYPE SHA256)
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
@@ -720,3 +727,43 @@ set(HARFBUZZ_URI https://github.com/harfbuzz/harfbuzz/archive/refs/tags/${HARFBU
set(HARFBUZZ_HASH 5352ff2eec538ea9a63a485cf01ad8332a3f63aa79921c5a2e301cef185caea1)
set(HARFBUZZ_HASH_TYPE SHA256)
set(HARFBUZZ_FILE harfbuzz-${HARFBUZZ_VERSION}.tar.gz)
+
+set(SHADERC_VERSION v2022.3)
+set(SHADERC_URI https://github.com/google/shaderc/archive/${SHADERC_VERSION}.tar.gz)
+set(SHADERC_HASH 5cb762af57637caf997d5f46baa4e8a4)
+set(SHADERC_HASH_TYPE MD5)
+set(SHADERC_FILE shaderc-${SHADERC_VERSION}.tar.gz)
+
+# The versions of shaderc's dependencies can be found in the root of shaderc's
+# source in a file called DEPS.
+
+set(SHADERC_SPIRV_TOOLS_VERSION eb0a36633d2acf4de82588504f951ad0f2cecacb)
+set(SHADERC_SPIRV_TOOLS_URI https://github.com/KhronosGroup/SPIRV-Tools/archive/${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
+set(SHADERC_SPIRV_TOOLS_HASH a4bdb8161f0e959c75d0d82d367c24f2)
+set(SHADERC_SPIRV_TOOLS_HASH_TYPE MD5)
+set(SHADERC_SPIRV_TOOLS_FILE SPIRV-Tools-${SHADERC_SPIRV_TOOLS_VERSION}.tar.gz)
+
+set(SHADERC_SPIRV_HEADERS_VERSION 85a1ed200d50660786c1a88d9166e871123cce39)
+set(SHADERC_SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
+set(SHADERC_SPIRV_HEADERS_HASH 10d5e8160f39344a641523810b075568)
+set(SHADERC_SPIRV_HEADERS_HASH_TYPE MD5)
+set(SHADERC_SPIRV_HEADERS_FILE SPIRV-Headers-${SHADERC_SPIRV_HEADERS_VERSION}.tar.gz)
+
+set(SHADERC_GLSLANG_VERSION 89db4e1caa273a057ea46deba709c6e50001b314)
+set(SHADERC_GLSLANG_URI https://github.com/KhronosGroup/glslang/archive/${SHADERC_GLSLANG_VERSION}.tar.gz)
+set(SHADERC_GLSLANG_HASH 3b3c79ad8e9132ffcb8b63cc29c532e2)
+set(SHADERC_GLSLANG_HASH_TYPE MD5)
+set(SHADERC_GLSLANG_FILE glslang-${SHADERC_GLSLANG_VERSION}.tar.gz)
+
+set(VULKAN_VERSION v1.2.198)
+
+set(VULKAN_HEADERS_URI https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
+set(VULKAN_HEADERS_HASH 64fe73e887c963ad546bfc7f9505fa1d)
+set(VULKAN_HEADERS_HASH_TYPE MD5)
+set(VULKAN_HEADERS_FILE Vulkan-Headers-${VULKAN_VERSION}.tar.gz)
+
+set(VULKAN_LOADER_URI https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/${VULKAN_VERSION}.tar.gz)
+set(VULKAN_LOADER_HASH 015170a74f648fd2b41e209b6bf1ebc4)
+set(VULKAN_LOADER_HASH_TYPE MD5)
+set(VULKAN_LOADER_FILE Vulkan-Loader-${VULKAN_VERSION}.tar.gz)
+
diff --git a/build_files/build_environment/cmake/vulkan.cmake b/build_files/build_environment/cmake/vulkan.cmake
new file mode 100644
index 00000000000..1fd94dd59be
--- /dev/null
+++ b/build_files/build_environment/cmake/vulkan.cmake
@@ -0,0 +1,55 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(VULKAN_HEADERS_EXTRA_ARGS)
+
+ExternalProject_Add(external_vulkan_headers
+ URL file://${PACKAGE_DIR}/${VULKAN_HEADERS_FILE}
+ URL_HASH ${VULKAN_HEADERS_HASH_TYPE}=${VULKAN_HEADERS_HASH}
+ PREFIX ${BUILD_DIR}/vulkan_headers
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_headers -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_HEADERS_EXTRA_ARGS}
+ INSTALL_DIR ${LIBDIR}/vulkan_headers
+)
+
+set(VULKAN_LOADER_EXTRA_ARGS
+ -DVULKAN_HEADERS_INSTALL_DIR=${LIBDIR}/vulkan_headers
+)
+
+ExternalProject_Add(external_vulkan_loader
+ URL file://${PACKAGE_DIR}/${VULKAN_LOADER_FILE}
+ URL_HASH ${VULKAN_LOADER_HASH_TYPE}=${VULKAN_LOADER_HASH}
+ PREFIX ${BUILD_DIR}/vulkan_loader
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/vulkan_loader -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${VULKAN_LOADER_EXTRA_ARGS}
+ INSTALL_DIR ${LIBDIR}/vulkan_loader
+)
+
+add_dependencies(
+ external_vulkan_loader
+ external_vulkan_headers
+)
+
+if(WIN32)
+ if(BUILD_MODE STREQUAL Release)
+ ExternalProject_Add_Step(external_vulkan_loader after_install
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_loader/ ${HARVEST_TARGET}/vulkan
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/vulkan_headers/ ${HARVEST_TARGET}/vulkan
+ DEPENDEES install
+ )
+ endif()
+endif()
+
diff --git a/build_files/build_environment/cmake/yamlcpp.cmake b/build_files/build_environment/cmake/yamlcpp.cmake
index abf6387fe36..d3be8854c57 100644
--- a/build_files/build_environment/cmake/yamlcpp.cmake
+++ b/build_files/build_environment/cmake/yamlcpp.cmake
@@ -18,6 +18,7 @@ ExternalProject_Add(external_yamlcpp
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${YAMLCPP_HASH_TYPE}=${YAMLCPP_HASH}
PREFIX ${BUILD_DIR}/yamlcpp
+ CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/yamlcpp ${DEFAULT_CMAKE_FLAGS} ${YAMLCPP_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/yamlcpp
)
diff --git a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
index 7611ca21708..c74ff788a75 100644
--- a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
+++ b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake
@@ -177,7 +177,8 @@ if(ILMBASE_INCLUDE_DIR)
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
else()
- # Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
+ # Old versions (before 2.0?) do not have any version string,
+ # just assuming 2.0 should be fine though.
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
endif()
@@ -195,8 +196,13 @@ else()
# elseif(${ILMBASE_VERSION} VERSION_LESS "2.1")
set(IlmBase_Libraries Half Iex Imath IlmThread)
# else()
-# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION})
-# set(IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver})
+ # string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION})
+ # set(IlmBase_Libraries
+ # Half
+ # Iex-${_ilmbase_libs_ver}
+ # Imath-${_ilmbase_libs_ver}
+ # IlmThread-${_ilmbase_libs_ver}
+ # )
endif()
diff --git a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
index 8b08b047eac..040dfe1c16f 100644
--- a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
+++ b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake
@@ -175,7 +175,8 @@ if(OPENEXR_INCLUDE_DIR)
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
else()
- # Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
+ # Old versions (before 2.0?) do not have any version string,
+ # just assuming 2.0 should be fine though.
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
endif()
diff --git a/build_files/build_environment/patches/openvdb.diff b/build_files/build_environment/patches/openvdb.diff
index 9ad231e0c6d..9896460c26c 100644
--- a/build_files/build_environment/patches/openvdb.diff
+++ b/build_files/build_environment/patches/openvdb.diff
@@ -75,16 +75,18 @@ diff -Naur openvdb-8.0.0/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/v
+
+ END
+END
-diff -Naur orig/openvdb_ax/openvdb_ax/CMakeLists.txt openvdb/openvdb_ax/openvdb_ax/CMakeLists.txt
---- orig/openvdb_ax/openvdb_ax/CMakeLists.txt 2022-06-09 08:50:40 -0600
-+++ openvdb/openvdb_ax/openvdb_ax/CMakeLists.txt 2022-08-08 22:11:02 -0600
-@@ -305,6 +305,9 @@
- # Configure shared build
-
- if(OPENVDB_AX_SHARED)
-+ if(WIN32)
-+ list(APPEND OPENVDB_AX_PUBLIC_DEFINES -DOPENVDB_AX_DLL)
-+ endif()
- target_compile_definitions(openvdb_ax_shared PUBLIC ${OPENVDB_AX_PUBLIC_DEFINES})
- target_compile_definitions(openvdb_ax_shared PRIVATE ${OPENVDB_AX_PRIVATE_DEFINES})
- target_compile_options(openvdb_ax_shared PUBLIC ${OPENVDB_AX_PUBLIC_OPTIONS})
+diff -Naur orig/openvdb/openvdb/tree/ValueAccessor.h openvdb/openvdb/openvdb/tree/ValueAccessor.h
+--- orig/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 13:58:26 -0600
++++ openvdb/openvdb/openvdb/tree/ValueAccessor.h 2022-11-02 18:55:09 -0600
+@@ -872,7 +872,10 @@
+ using LeafNodeType = typename NodeType::LeafNodeType;
+ using CoordLimits = std::numeric_limits<Int32>;
+
+- static_assert(std::is_same<NodeType, LeafNodeType>::value);
++ // Blender: Technically not an issue in OpenVDB, but USD 21.11 still builds
++ // as C++14 which does not support terse asserts yet. Add a message to
++ // explicitly select the C++14 supported static assert.
++ static_assert(std::is_same<NodeType, LeafNodeType>::value, "cache item node type is not leaf node type");
+
+ CacheItem(TreeCacheT& parent)
+ : mParent(&parent)
diff --git a/build_files/build_environment/patches/osl.diff b/build_files/build_environment/patches/osl.diff
index 6c7f528f035..75f7b13a165 100644
--- a/build_files/build_environment/patches/osl.diff
+++ b/build_files/build_environment/patches/osl.diff
@@ -24,27 +24,6 @@ diff -Naur OpenShadingLanguage-1.12.6.2/src/cmake/externalpackages.cmake externa
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
-diff -Naur OpenShadingLanguage-1.12.6.2/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
---- OpenShadingLanguage-1.12.6.2/src/include/OSL/llvm_util.h 2022-09-30 17:43:53 -0600
-+++ external_osl/src/include/OSL/llvm_util.h 2022-10-15 15:37:24 -0600
-@@ -9,6 +9,8 @@
- #include <unordered_set>
- #include <vector>
-
-+#define OSL_HAS_BLENDER_CLEANUP_FIX
-+
- #ifdef LLVM_NAMESPACE
- namespace llvm = LLVM_NAMESPACE;
- #endif
-@@ -455,7 +457,7 @@
- llvm::BasicBlock* masked_return_block() const;
-
- bool is_masking_required() const { return m_is_masking_required; }
--
-+ static void Cleanup ();
- struct ScopedMasking {
- ScopedMasking() {}
-
diff -Naur OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
--- OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp 2022-09-30 17:43:53 -0600
+++ external_osl/src/liboslcomp/oslcomp.cpp 2022-10-15 14:49:26 -0600
@@ -62,31 +41,3 @@ diff -Naur OpenShadingLanguage-1.12.6.2/src/liboslcomp/oslcomp.cpp external_osl/
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
-diff -Naur orig/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
---- orig/src/cmake/externalpackages.cmake 2022-01-07 18:36:45 -0700
-+++ external_osl/src/cmake/externalpackages.cmake 2022-08-02 08:10:27 -0600
-@@ -36,12 +36,10 @@
-
- ###########################################################################
- # Boost setup
--if (LINKSTATIC)
-- set (Boost_USE_STATIC_LIBS ON)
--else ()
-- if (MSVC)
-- add_definitions (-DBOOST_ALL_DYN_LINK=1)
-- endif ()
-+# Blender links most things static, but not boost
-+set (Boost_USE_STATIC_LIBS OFF)
-+if (MSVC)
-+ add_definitions (-DBOOST_ALL_DYN_LINK=1)
- endif ()
- if (BOOST_CUSTOM)
- set (Boost_FOUND true)
-@@ -80,6 +78,7 @@
-
-
- checked_find_package (ZLIB REQUIRED) # Needed by several packages
-+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
-
- # IlmBase & OpenEXR
- checked_find_package (OpenEXR REQUIRED \ No newline at end of file
diff --git a/build_files/build_environment/patches/python_windows.diff b/build_files/build_environment/patches/python_windows.diff
new file mode 100644
index 00000000000..5b6434f1440
--- /dev/null
+++ b/build_files/build_environment/patches/python_windows.diff
@@ -0,0 +1,22 @@
+--- a/PCbuild/prepare_ssl.bat 2022-10-30 11:48:14 -0600
++++ b/PCbuild/prepare_ssl.bat 2022-10-30 11:53:16 -0600
+@@ -47,12 +47,13 @@
+ if "%PERL%" == "" where perl > "%TEMP%\perl.loc" 2> nul && set /P PERL= <"%TEMP%\perl.loc" & del "%TEMP%\perl.loc"
+ if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exit /b 4)
+
+-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32
+-if errorlevel 1 exit /b
++REM Blender: we only need x64, ssl is kind of a long build, so just build what we need
++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=Win32
++REMif errorlevel 1 exit /b
+ %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=x64
+ if errorlevel 1 exit /b
+-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM
+-if errorlevel 1 exit /b
+-%MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
+-if errorlevel 1 exit /b
++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM
++REM if errorlevel 1 exit /b
++REM %MSBUILD% "%PCBUILD%\openssl.vcxproj" /p:Configuration=Release /p:Platform=ARM64
++REM if errorlevel 1 exit /b
+
diff --git a/build_files/build_environment/patches/usd.diff b/build_files/build_environment/patches/usd.diff
index 881d856ca25..39d34160d28 100644
--- a/build_files/build_environment/patches/usd.diff
+++ b/build_files/build_environment/patches/usd.diff
@@ -1,7 +1,7 @@
-diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
---- usd.orig/cmake/defaults/Packages.cmake 2019-10-24 22:39:53.000000000 +0200
-+++ external_usd/cmake/defaults/Packages.cmake 2019-11-28 13:00:33.185957483 +0100
-@@ -64,7 +64,7 @@
+diff -Naur orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
+--- orig/cmake/defaults/Packages.cmake 2022-10-27 12:56:33 -0600
++++ external_usd/cmake/defaults/Packages.cmake 2022-10-27 13:05:08 -0600
+@@ -129,7 +129,7 @@
endif()
# --TBB
@@ -10,10 +10,9 @@ diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defau
add_definitions(${TBB_DEFINITIONS})
# --math
-
-diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake
---- usd_orig/cmake/defaults/msvcdefaults.cmake 2022-02-18 14:49:09 -0700
-+++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-03-14 11:41:50 -0600
+diff -Naur orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake
+--- orig/cmake/defaults/msvcdefaults.cmake 2022-10-27 12:56:33 -0600
++++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-10-27 13:05:08 -0600
@@ -120,9 +120,6 @@
# for all translation units.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /bigobj")
@@ -24,38 +23,10 @@ diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/default
# Enable multiprocessor builds.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /MP")
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Gm-")
-
-diff --git a/pxr/base/work/singularTask.h b/pxr/base/work/singularTask.h
---- a/pxr/base/work/singularTask.h
-+++ b/pxr/base/work/singularTask.h
-@@ -120,7 +120,7 @@
- // case we go again to ensure the task can do whatever it
- // was awakened to do. Once we successfully take the count
- // to zero, we stop.
-- size_t old = count;
-+ std::size_t old = count;
- do { _fn(); } while (
- !count.compare_exchange_strong(old, 0));
- });
-
-diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHelpers.h
---- a/pxr/usd/sdr/shaderMetadataHelpers.h
-+++ b/pxr/usd/sdr/shaderMetadataHelpers.h
-@@ -32,6 +32,8 @@
- #include "pxr/base/tf/token.h"
- #include "pxr/usd/sdr/declare.h"
-
-+#include <limits>
-+
- PXR_NAMESPACE_OPEN_SCOPE
-
- /// \namespace ShaderMetadataHelpers
-
-diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
-index 517561f..fda5a1f 100644
---- a/pxr/base/arch/timing.h
-+++ b/pxr/base/arch/timing.h
-@@ -91,6 +91,10 @@ ArchGetTickTime()
+diff -Naur orig/pxr/base/arch/timing.h external_usd/pxr/base/arch/timing.h
+--- orig/pxr/base/arch/timing.h 2022-10-27 12:56:34 -0600
++++ external_usd/pxr/base/arch/timing.h 2022-10-27 13:05:08 -0600
+@@ -84,6 +84,10 @@
inline uint64_t
ArchGetStartTickTime()
{
@@ -66,7 +37,7 @@ index 517561f..fda5a1f 100644
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
-@@ -123,6 +127,7 @@ ArchGetStartTickTime()
+@@ -116,6 +120,7 @@
#error "Unsupported architecture."
#endif
return t;
@@ -74,7 +45,7 @@ index 517561f..fda5a1f 100644
}
/// Get a "stop" tick time for measuring an interval of time. See
-@@ -132,6 +137,10 @@ ArchGetStartTickTime()
+@@ -125,6 +130,10 @@
inline uint64_t
ArchGetStopTickTime()
{
@@ -85,7 +56,7 @@ index 517561f..fda5a1f 100644
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
-@@ -162,11 +171,11 @@ ArchGetStopTickTime()
+@@ -155,11 +164,11 @@
#error "Unsupported architecture."
#endif
return t;
@@ -100,10 +71,26 @@ index 517561f..fda5a1f 100644
/// A simple timer class for measuring an interval of time using the
/// ArchTickTimer facilities.
-diff -Naur usd_orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CMakeLists.txt
---- usd_orig/pxr/usdImaging/CMakeLists.txt 2022-02-18 14:49:09 -0700
-+++ external_usd/pxr/usdImaging/CMakeLists.txt 2022-08-05 10:06:44 -0600
-@@ -6,7 +6,7 @@
+diff -Naur orig/pxr/imaging/hioOpenVDB/CMakeLists.txt external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt
+--- orig/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 12:56:35 -0600
++++ external_usd/pxr/imaging/hioOpenVDB/CMakeLists.txt 2022-10-27 13:05:08 -0600
+@@ -20,6 +20,12 @@
+ LIST(APPEND __VDB_IMATH_LIBS ${OPENEXR_Half_LIBRARY})
+ endif()
+
++if (WIN32)
++ # OpenVDB uses constants from <cmath> that aren't available on
++ # Windows unless this is defined.
++ add_definitions(-D_USE_MATH_DEFINES)
++endif()
++
+ pxr_library(hioOpenVDB
+ LIBRARIES
+ ar
+diff -Naur orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CMakeLists.txt
+--- orig/pxr/usdImaging/CMakeLists.txt 2022-10-27 12:56:37 -0600
++++ external_usd/pxr/usdImaging/CMakeLists.txt 2022-10-27 13:05:08 -0600
+@@ -7,7 +7,7 @@
usdVolImaging
usdAppUtils
usdviewq
@@ -111,7 +98,7 @@ diff -Naur usd_orig/pxr/usdImaging/CMakeLists.txt external_usd/pxr/usdImaging/CM
+# bin
plugin
)
-
+
diff -Naur orig/cmake/macros/Private.cmake external_usd/cmake/macros/Private.cmake
--- orig/cmake/macros/Private.cmake 2022-02-18 14:49:09 -0700
+++ external_usd/cmake/macros/Private.cmake 2022-08-05 10:42:03 -0600
@@ -127,20 +114,3 @@ diff -Naur orig/cmake/macros/Private.cmake external_usd/cmake/macros/Private.cma
set(LIBRARY_NAME "_${NAME}_d")
else()
set(LIBRARY_NAME "_${NAME}")
-diff --git a/pxr/imaging/hioOpenVDB/CMakeLists.txt b/pxr/imaging/hioOpenVDB/CMakeLists.txt
-index e3db1d1319..2a2dfd5e72 100644
---- a/pxr/imaging/hioOpenVDB/CMakeLists.txt
-+++ b/pxr/imaging/hioOpenVDB/CMakeLists.txt
-@@ -7,6 +7,12 @@ if (NOT ${PXR_BUILD_GPU_SUPPORT})
- return()
- endif()
-
-+if (WIN32)
-+ # OpenVDB uses constants from <cmath> that aren't available on
-+ # Windows unless this is defined.
-+ add_definitions(-D_USE_MATH_DEFINES)
-+endif()
-+
- pxr_library(hioOpenVDB
- LIBRARIES
- ar \ No newline at end of file
diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake
index 9107b562711..1cc3e50ba92 100644
--- a/build_files/cmake/Modules/FindOpenEXR.cmake
+++ b/build_files/cmake/Modules/FindOpenEXR.cmake
@@ -26,7 +26,8 @@ IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
ENDIF()
-# Old versions (before 2.0?) do not have any version string, just assuming this should be fine though.
+# Old versions (before 2.0?) do not have any version string,
+# just assuming this should be fine though.
SET(_openexr_libs_ver_init "2.0")
SET(_openexr_SEARCH_DIRS
diff --git a/build_files/cmake/Modules/FindUSD.cmake b/build_files/cmake/Modules/FindUSD.cmake
index f975b20806e..7b776560866 100644
--- a/build_files/cmake/Modules/FindUSD.cmake
+++ b/build_files/cmake/Modules/FindUSD.cmake
@@ -32,7 +32,8 @@ FIND_PATH(USD_INCLUDE_DIR
DOC "Universal Scene Description (USD) header files"
)
-# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
+# Since USD 21.11 the libraries are prefixed with "usd_", i.e.
+# "libusd_m.a" became "libusd_usd_m.a".
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
FIND_LIBRARY(USD_LIBRARY
NAMES
diff --git a/build_files/cmake/config/blender_developer.cmake b/build_files/cmake/config/blender_developer.cmake
index 1f1a100d958..ebc5727a79c 100644
--- a/build_files/cmake/config/blender_developer.cmake
+++ b/build_files/cmake/config/blender_developer.cmake
@@ -8,7 +8,11 @@
set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
-set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
+# Sadly ASAN is more often broken than working with MSVC do not enable it in the
+# developer profile for now.
+if(NOT WIN32)
+ set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
+endif()
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_GTESTS ON CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index c6bb0a68615..2a82292e447 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -57,6 +57,25 @@ macro(path_ensure_trailing_slash
unset(_path_sep)
endmacro()
+# Our own version of `cmake_path(IS_PREFIX ..)`.
+# This can be removed when 3.20 or greater is the minimum supported version.
+macro(path_is_prefix
+ path_prefix path result_var
+ )
+ # Remove when CMAKE version is bumped to "3.20" or greater.
+ # `cmake_path(IS_PREFIX ${path_prefix} ${path} NORMALIZE result_var)`
+ # Get the normalized paths (needed to remove `..`).
+ get_filename_component(_abs_prefix "${${path_prefix}}" ABSOLUTE)
+ get_filename_component(_abs_suffix "${${path}}" ABSOLUTE)
+ string(LENGTH "${_abs_prefix}" _len)
+ string(SUBSTRING "${_abs_suffix}" 0 "${_len}" _substr)
+ string(COMPARE EQUAL "${_abs_prefix}" "${_substr}" "${result_var}")
+ unset(_abs_prefix)
+ unset(_abs_suffix)
+ unset(_len)
+ unset(_substr)
+endmacro()
+
# foo_bar.spam --> foo_barMySuffix.spam
macro(file_suffix
file_name_new file_name file_suffix
@@ -997,7 +1016,8 @@ function(data_to_c_simple_icons
add_custom_command(
OUTPUT ${_file_from} ${_file_to}
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
- # COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from}
+ # COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py
+ # ${_path_from_abs} ${_file_from}
COMMAND "$<TARGET_FILE:datatoc_icon>" ${_path_from_abs} ${_file_from}
COMMAND "$<TARGET_FILE:datatoc>" ${_file_from} ${_file_to}
DEPENDS
@@ -1075,23 +1095,27 @@ function(msgfmt_simple
endfunction()
function(find_python_package
- package
- relative_include_dir
+ package
+ relative_include_dir
)
string(TOUPPER ${package} _upper_package)
- # set but invalid
+ # Set but invalid.
if((NOT ${PYTHON_${_upper_package}_PATH} STREQUAL "") AND
(NOT ${PYTHON_${_upper_package}_PATH} MATCHES NOTFOUND))
-# if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}/${package}")
-# message(WARNING "PYTHON_${_upper_package}_PATH is invalid, ${package} not found in '${PYTHON_${_upper_package}_PATH}' "
-# "WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing python")
-# set(WITH_PYTHON_INSTALL${_upper_package} OFF)
-# endif()
- # not set, so initialize
+ # if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}/${package}")
+ # message(
+ # WARNING
+ # "PYTHON_${_upper_package}_PATH is invalid, ${package} not found in "
+ # "'${PYTHON_${_upper_package}_PATH}' "
+ # "WITH_PYTHON_INSTALL_${_upper_package} option will be ignored when installing Python"
+ # )
+ # set(WITH_PYTHON_INSTALL${_upper_package} OFF)
+ # endif()
+ # Not set, so initialize.
else()
- string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
+ string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR)
# re-cache
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index b0448a31348..49b7f701de0 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -138,7 +138,7 @@ if(WITH_PYTHON)
# Installing into `site-packages`, warn when installing into `./../lib/`
# which script authors almost certainly don't want.
if(EXISTS ${LIBDIR})
- cmake_path(IS_PREFIX LIBDIR "${PYTHON_SITE_PACKAGES}" NORMALIZE _is_prefix)
+ path_is_prefix(LIBDIR PYTHON_SITE_PACKAGES _is_prefix)
if(_is_prefix)
message(WARNING "
Building Blender with the following configuration:
@@ -350,7 +350,8 @@ if(WITH_USD)
set_and_warn_library_found("USD" USD_FOUND WITH_USD)
if(WITH_USD)
add_bundled_libraries(usd/lib)
- endif()endif()
+ endif()
+endif()
if(WITH_BOOST)
# uses in build instructions to override include and library variables
@@ -440,7 +441,8 @@ if(WITH_OPENIMAGEIO)
set_and_warn_library_found("OPENIMAGEIO" OPENIMAGEIO_FOUND WITH_OPENIMAGEIO)
if(WITH_OPENIMAGEIO)
add_bundled_libraries(openimageio/lib)
- endif()endif()
+ endif()
+endif()
if(WITH_OPENCOLORIO)
find_package_wrapper(OpenColorIO 2.0.0)
@@ -492,13 +494,17 @@ if(WITH_OPENSUBDIV)
set_and_warn_library_found("OpenSubdiv" OPENSUBDIV_FOUND WITH_OPENSUBDIV)
if(WITH_OPENSUBDIV)
- add_bundled_libraries(opensubdiv/lib) endif()endif()
+ add_bundled_libraries(opensubdiv/lib)
+ endif()
+endif()
if(WITH_TBB)
find_package_wrapper(TBB)
set_and_warn_library_found("TBB" TBB_FOUND WITH_TBB)
if(WITH_TBB)
- add_bundled_libraries(tbb/lib) endif()endif()
+ add_bundled_libraries(tbb/lib)
+ endif()
+endif()
if(WITH_XR_OPENXR)
find_package(XR_OpenXR_SDK)
@@ -662,6 +668,7 @@ if(WITH_GHOST_WAYLAND)
set(wayland-scanner_FOUND ON)
set(wayland-cursor_FOUND ON)
endif()
+ mark_as_advanced(WAYLAND_PROTOCOLS_DIR)
set_and_warn_library_found("wayland-client" wayland-client_FOUND WITH_GHOST_WAYLAND)
set_and_warn_library_found("wayland-egl" wayland-egl_FOUND WITH_GHOST_WAYLAND)
@@ -696,6 +703,7 @@ if(WITH_GHOST_WAYLAND)
else()
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
endif()
+ mark_as_advanced(WAYLAND_SCANNER)
# When using dynamic loading, headers generated
# from older versions of `wayland-scanner` aren't compatible.
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 8c645357d6d..e66824da76d 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -83,7 +83,7 @@ string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi
- pathcch Shcore Dwmapi
+ pathcch Shcore Dwmapi Crypt32
)
if(WITH_INPUT_IME)
@@ -184,10 +184,11 @@ endif()
# Debug Symbol format
# sccache # MSVC_ASAN # format # why
-# ON # ON # Z7 # sccache will only play nice with Z7
-# ON # OFF # Z7 # sccache will only play nice with Z7
-# OFF # ON # Zi # Asan will not play nice with Edit and Continue
-# OFF # OFF # ZI # Neither asan nor sscache is enabled Edit and Continue is available
+# ON # ON # Z7 # sccache will only play nice with Z7.
+# ON # OFF # Z7 # sccache will only play nice with Z7.
+# OFF # ON # Zi # Asan will not play nice with Edit and Continue.
+# OFF # OFF # ZI # Neither ASAN nor sscache is enabled Edit and
+# Continue is available.
# Release Symbol format
# sccache # MSVC_ASAN # format # why
@@ -649,14 +650,27 @@ if(WITH_OPENCOLORIO)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_LIBRARIES
optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib
- optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
optimized ${OPENCOLORIO_LIBPATH}/libexpatMD.lib
optimized ${OPENCOLORIO_LIBPATH}/pystring.lib
debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib
- debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
)
+ if(EXISTS ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib) # 3.4 name
+ list(APPEND OPENCOLORIO_LIBRARIES
+ optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib
+ debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib
+ )
+ elseif(EXISTS ${OPENCOLORIO_LIBPATH}/yaml-cpp.lib) # 3.5 name
+ list(APPEND OPENCOLORIO_LIBRARIES
+ optimized ${OPENCOLORIO_LIBPATH}/yaml-cpp.lib
+ optimized ${OPENCOLORIO_LIBPATH}/libminizip.lib
+ debug ${OPENCOLORIO_LIBPATH}/yaml-cppd.lib
+ debug ${OPENCOLORIO_LIBPATH}/libminizip.lib
+ )
+ else()
+ message("FATAL YAML-CPP dependency not found")
+ endif()
endif()
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
endif()
@@ -854,14 +868,19 @@ endif()
if(WITH_USD)
windows_find_package(USD)
if(NOT USD_FOUND)
+ # 3.5 22.03 libs
set(USD_INCLUDE_DIRS ${LIBDIR}/usd/include)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_ms.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_ms_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib)
+ if(NOT EXISTS "${USD_RELEASE_LIB}") # 3.5 22.11 libs
+ set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_ms.lib)
+ set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_ms_d.lib)
+ endif()
# Older USD had different filenames, if the new ones are
# not found see if the older ones exist, to ease the
# transition period while landing libs.
- if(NOT EXISTS "${USD_RELEASE_LIB}")
+ if(NOT EXISTS "${USD_RELEASE_LIB}") # 3.3 static libs
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_m_d.lib)
endif()
@@ -993,6 +1012,8 @@ endif()
# Environment variables to run precompiled executables that needed libraries.
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ";" _library_paths)
-set(PLATFORM_ENV_BUILD "PATH=${LIBDIR}/OpenImageIO/bin\;${LIBDIR}/boost/lib\;${LIBDIR}/openexr/bin\;${LIBDIR}/imath/bin\;${PATH}")
-set(PLATFORM_ENV_INSTALL "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/;$ENV{PATH}")
+set(PLATFORM_ENV_BUILD_DIRS "${LIBDIR}/OpenImageIO/bin\;${LIBDIR}/boost/lib\;${LIBDIR}/openexr/bin\;${LIBDIR}/imath/bin\;${PATH}")
+set(PLATFORM_ENV_BUILD "PATH=${PLATFORM_ENV_BUILD_DIRS}")
+# Install needs the additional folders from PLATFORM_ENV_BUILD_DIRS as well, as tools like idiff and abcls use the release mode dlls
+set(PLATFORM_ENV_INSTALL "PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/blender.shared/\;${PLATFORM_ENV_BUILD_DIRS}\;$ENV{PATH}")
unset(_library_paths)
diff --git a/build_files/config/pipeline_config.yaml b/build_files/config/pipeline_config.yaml
index 6cd507bcc78..31c0282dad5 100644
--- a/build_files/config/pipeline_config.yaml
+++ b/build_files/config/pipeline_config.yaml
@@ -59,6 +59,8 @@ buildbot:
version: '5.2.21440'
optix:
version: '7.3.0'
+ ocloc:
+ version: '101.3430'
cmake:
default:
version: any
diff --git a/build_files/utils/make_bpy_wheel.py b/build_files/utils/make_bpy_wheel.py
index ba1d0f21937..81d267c6e10 100755
--- a/build_files/utils/make_bpy_wheel.py
+++ b/build_files/utils/make_bpy_wheel.py
@@ -208,12 +208,15 @@ def main() -> None:
dist_dir = os.path.join(install_dir, "dist")
for f in os.listdir(dist_dir):
if f.endswith(".whl"):
- # No apparent way to override this ABI version with setuptools, so rename.
- sys_py = "cp%d%d" % (sys.version_info.major, sys.version_info.minor)
- sys_py_abi = sys_py + sys.abiflags
blender_py = "cp%d%d" % (python_version_number[0], python_version_number[1])
- renamed_f = f.replace(sys_py_abi, blender_py).replace(sys_py, blender_py)
+ # No apparent way to override this ABI version with setuptools, so rename.
+ sys_py = "cp%d%d" % (sys.version_info.major, sys.version_info.minor)
+ if hasattr(sys, "abiflags"):
+ sys_py_abi = sys_py + sys.abiflags
+ renamed_f = f.replace(sys_py_abi, blender_py).replace(sys_py, blender_py)
+ else:
+ renamed_f = f.replace(sys_py, blender_py)
os.rename(os.path.join(dist_dir, f), os.path.join(output_dir, renamed_f))
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index 254cccda301..a0b61b18e60 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -18,8 +18,13 @@ import sys
import make_utils
from make_utils import call, check_output
+from typing import (
+ List,
+ Optional,
+)
-def print_stage(text):
+
+def print_stage(text: str) -> None:
print("")
print(text)
print("")
@@ -27,7 +32,7 @@ def print_stage(text):
# Parse arguments
-def parse_arguments():
+def parse_arguments() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("--no-libraries", action="store_true")
parser.add_argument("--no-blender", action="store_true")
@@ -40,13 +45,13 @@ def parse_arguments():
return parser.parse_args()
-def get_blender_git_root():
+def get_blender_git_root() -> str:
return check_output([args.git_command, "rev-parse", "--show-toplevel"])
# Setup for precompiled libraries and tests from svn.
-def svn_update(args, release_version):
+def svn_update(args: argparse.Namespace, release_version: Optional[str]) -> None:
svn_non_interactive = [args.svn_command, '--non-interactive']
lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
@@ -99,42 +104,42 @@ def svn_update(args, release_version):
call(svn_non_interactive + ["checkout", svn_url_tests, lib_tests_dirpath])
# Update precompiled libraries and tests
- print_stage("Updating Precompiled Libraries and Tests")
-
- if os.path.isdir(lib_dirpath):
- for dirname in os.listdir(lib_dirpath):
- dirpath = os.path.join(lib_dirpath, dirname)
-
- if dirname == ".svn":
- # Cleanup must be run from svn root directory if it exists.
- if not make_utils.command_missing(args.svn_command):
- call(svn_non_interactive + ["cleanup", lib_dirpath])
- continue
- elif dirname.startswith("."):
- # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories.
- continue
-
- svn_dirpath = os.path.join(dirpath, ".svn")
- svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
-
- if (
- os.path.isdir(dirpath) and
- (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath))
- ):
- if make_utils.command_missing(args.svn_command):
- sys.stderr.write("svn not found, can't update libraries\n")
- sys.exit(1)
-
- # Cleanup to continue with interrupted downloads.
- if os.path.exists(svn_dirpath):
- call(svn_non_interactive + ["cleanup", dirpath])
+
+ if not os.path.isdir(lib_dirpath):
+ print("Library path: %r, not found, skipping" % lib_dirpath)
+ else:
+ paths_local_and_remote = []
+ if os.path.exists(os.path.join(lib_dirpath, ".svn")):
+ print_stage("Updating Precompiled Libraries and Tests (one repository)")
+ paths_local_and_remote.append((lib_dirpath, svn_url))
+ else:
+ print_stage("Updating Precompiled Libraries and Tests (multiple repositories)")
+ # Separate paths checked out.
+ for dirname in os.listdir(lib_dirpath):
+ if dirname.startswith("."):
+ # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories.
+ continue
+
+ dirpath = os.path.join(lib_dirpath, dirname)
+ if not (os.path.isdir(dirpath) and os.path.exists(os.path.join(dirpath, ".svn"))):
+ continue
+
+ paths_local_and_remote.append((dirpath, svn_url + dirname))
+
+ if paths_local_and_remote:
+ if make_utils.command_missing(args.svn_command):
+ sys.stderr.write("svn not found, can't update libraries\n")
+ sys.exit(1)
+
+ for dirpath, svn_url_full in paths_local_and_remote:
+ call(svn_non_interactive + ["cleanup", dirpath])
# Switch to appropriate branch and update.
- call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False)
+ call(svn_non_interactive + ["switch", svn_url_full, dirpath], exit_on_error=False)
call(svn_non_interactive + ["update", dirpath])
# Test if git repo can be updated.
-def git_update_skip(args, check_remote_exists=True):
+def git_update_skip(args: argparse.Namespace, check_remote_exists: bool = True) -> str:
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
@@ -166,13 +171,17 @@ def git_update_skip(args, check_remote_exists=True):
# Update blender repository.
-def blender_update(args):
+def blender_update(args: argparse.Namespace) -> None:
print_stage("Updating Blender Git Repository")
call([args.git_command, "pull", "--rebase"])
# Update submodules.
-def submodules_update(args, release_version, branch):
+def submodules_update(
+ args: argparse.Namespace,
+ release_version: Optional[str],
+ branch: Optional[str],
+) -> str:
print_stage("Updating Submodules")
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
@@ -214,7 +223,8 @@ def submodules_update(args, release_version, branch):
elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback):
submodule_branch = submodule_branch_fallback
else:
- submodule_branch = None
+ # Skip.
+ submodule_branch = ""
# Switch to branch and pull.
if submodule_branch:
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index 564930617ff..9b15eb363bc 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -80,7 +80,7 @@ def git_tag(git_command: str) -> Optional[str]:
return tag.strip().decode('utf8')
-def git_branch_release_version(branch: str, tag: str) -> Optional[str]:
+def git_branch_release_version(branch: str, tag: Optional[str]) -> Optional[str]:
re_match = re.search("^blender-v(.*)-release$", branch)
release_version = None
if re_match:
diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd
index eaf4a85f7ac..a2ff4c1ff95 100644
--- a/build_files/windows/parse_arguments.cmd
+++ b/build_files/windows/parse_arguments.cmd
@@ -80,9 +80,11 @@ if NOT "%1" == "" (
REM Non-Build Commands
) else if "%1" == "update" (
SET BUILD_UPDATE=1
+ SET BUILD_UPDATE_SVN=1
set BUILD_UPDATE_ARGS=
) else if "%1" == "code_update" (
SET BUILD_UPDATE=1
+ SET BUILD_UPDATE_SVN=0
set BUILD_UPDATE_ARGS="--no-libraries"
) else if "%1" == "ninja" (
SET BUILD_WITH_NINJA=1
diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd
index 8ba7b4d3307..37c5d1034ea 100644
--- a/build_files/windows/reset_variables.cmd
+++ b/build_files/windows/reset_variables.cmd
@@ -34,3 +34,4 @@ set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set DOC_PY=
+SET BUILD_UPDATE_SVN= \ No newline at end of file
diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile
index 18c16a60993..e1d8ac39bcf 100644
--- a/doc/doxygen/Doxyfile
+++ b/doc/doxygen/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = V3.4
+PROJECT_NUMBER = V3.5
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/doc/python_api/requirements.txt b/doc/python_api/requirements.txt
index bf120f24995..4b31c3f1344 100644
--- a/doc/python_api/requirements.txt
+++ b/doc/python_api/requirements.txt
@@ -1,13 +1,13 @@
-sphinx==5.2.3
+sphinx==5.3.0
# Sphinx dependencies that are important
Jinja2==3.1.2
Pygments==2.13.0
docutils==0.17.1
snowballstemmer==2.2.0
-babel==2.10.3
+babel==2.11.0
requests==2.28.1
# Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used.
-sphinx_rtd_theme==1.0.0
+sphinx_rtd_theme==1.1.0
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 7b5f13177ef..f51ab8d6591 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1459,15 +1459,15 @@ def pyrna2sphinx(basepath):
# If the link has been written, no need to inline the enum items.
enum_text = "" if enum_descr_override else pyrna_enum2sphinx(prop)
if prop.name or prop.description or enum_text:
- fw(ident + ":%s%s:\n\n" % (id_name, identifier))
+ fw(ident + ":%s%s: " % (id_name, identifier))
if prop.name or prop.description:
- fw(indent(", ".join(val for val in (prop.name, prop.description) if val), ident + " ") + "\n\n")
+ fw(", ".join(val for val in (prop.name, prop.description.replace("\n", "")) if val) + "\n")
# Special exception, can't use generic code here for enums.
if enum_text:
- write_indented_lines(ident + " ", fw, enum_text)
fw("\n")
+ write_indented_lines(ident + " ", fw, enum_text)
del enum_text
# end enum exception
diff --git a/extern/hipew/src/hipew.c b/extern/hipew/src/hipew.c
index ecf952e266f..7cafe7727f5 100644
--- a/extern/hipew/src/hipew.c
+++ b/extern/hipew/src/hipew.c
@@ -253,7 +253,7 @@ static int hipewHipInit(void) {
/* Default installation path. */
const char *hip_paths[] = {"", NULL};
#else
- const char *hip_paths[] = {"/opt/rocm/hip/lib/libamdhip64.so", NULL};
+ const char *hip_paths[] = {"libamdhip64.so", "/opt/rocm/hip/lib/libamdhip64.so", NULL};
#endif
static int initialized = 0;
static int result = 0;
diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt
index 908c5d2ffd9..06767e9af1e 100644
--- a/extern/mantaflow/CMakeLists.txt
+++ b/extern/mantaflow/CMakeLists.txt
@@ -25,7 +25,8 @@ set(MANTAVERSION "0.13")
add_definitions(-DWITH_FLUID=1)
# Compile Mantaflow dependencies too (e.g. cnpy for numpy file IO).
-# Make sure that dependencies exist before enabling this option by updating the source files in extern/
+# Make sure that dependencies exist before enabling this option
+# by updating the source files in `extern/`.
set(WITH_MANTA_DEPENDENCIES 0)
# Enable Mantaflow numpy support
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 425d123e9e6..f5cd88f6b6a 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -60,13 +60,14 @@ enum_filter_types = (
)
enum_panorama_types = (
- ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
- ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
+ ('EQUIRECTANGULAR', "Equirectangular", "Spherical camera for environment maps, also known as Lat Long panorama", 0),
+ ('EQUIANGULAR_CUBEMAP_FACE', "Equiangular Cubemap Face", "Single face of an equiangular cubemap", 5),
+ ('MIRRORBALL', "Mirror Ball", "Mirror ball mapping for environment maps", 3),
+ ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions", 1),
('FISHEYE_EQUISOLID', "Fisheye Equisolid",
- "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
- ('MIRRORBALL', "Mirror Ball", "Uses the mirror ball mapping"),
+ "Similar to most fisheye modern lens, takes sensor dimensions into consideration", 2),
('FISHEYE_LENS_POLYNOMIAL', "Fisheye Lens Polynomial",
- "Defines the lens projection as polynomial to allow real world camera lenses to be mimicked"),
+ "Defines the lens projection as polynomial to allow real world camera lenses to be mimicked", 4),
)
enum_curve_shape = (
@@ -1636,11 +1637,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.label(text="and AMD driver version 22.10 or newer", icon='BLANK1')
elif device_type == 'ONEAPI':
import sys
- col.label(text="Requires Intel GPU with Xe-HPG architecture", icon='BLANK1')
if sys.platform.startswith("win"):
+ col.label(text="Requires Intel GPU with Xe-HPG architecture", icon='BLANK1')
col.label(text="and Windows driver version 101.3430 or newer", icon='BLANK1')
elif sys.platform.startswith("linux"):
- col.label(text="and Linux driver version xx.xx.23904 or newer", icon='BLANK1')
+ col.label(text="Requires Intel GPU with Xe-HPG architecture and", icon='BLANK1')
+ col.label(text=" - Linux driver version xx.xx.23904 or newer", icon='BLANK1')
+ col.label(text=" - oneAPI Level-Zero Loader", icon='BLANK1')
elif device_type == 'METAL':
col.label(text="Requires Apple Silicon with macOS 12.2 or newer", icon='BLANK1')
col.label(text="or AMD with macOS 12.3 or newer", icon='BLANK1')
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index f763fe0eb0b..305accc8f1a 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -150,6 +150,16 @@ def get_effective_preview_denoiser(context):
return 'OIDN'
+def use_mnee(context):
+ # The MNEE kernel doesn't compile on macOS < 13.
+ if use_metal(context):
+ import platform
+ v, _, _ = platform.mac_ver()
+ if float(v) < 13.0:
+ return False
+ return True
+
+
class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
bl_label = "Sampling"
@@ -1235,7 +1245,7 @@ class CYCLES_OBJECT_PT_shading_caustics(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- return CyclesButtonsPanel.poll(context) and not use_metal(context) and context.object.type != 'LIGHT'
+ return CyclesButtonsPanel.poll(context) and use_mnee(context) and context.object.type != 'LIGHT'
def draw(self, context):
layout = self.layout
@@ -1449,7 +1459,7 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
sub.active = not (light.type == 'AREA' and clamp.is_portal)
sub.prop(clamp, "cast_shadow")
sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
- if not use_metal(context):
+ if use_mnee(context):
sub.prop(clamp, "is_caustics_light", text="Shadow Caustics")
if light.type == 'AREA':
diff --git a/intern/cycles/blender/session.cpp b/intern/cycles/blender/session.cpp
index f9a83b2dc4b..6641e2b8ac5 100644
--- a/intern/cycles/blender/session.cpp
+++ b/intern/cycles/blender/session.cpp
@@ -497,9 +497,9 @@ void BlenderSession::render_frame_finish()
session->full_buffer_written_cb = function_null;
/* The display driver is the source of drawing context for both drawing and possible graphics
- * interop objects in the path trace. Once the frame is finished the OpenGL context might be
- * freed form Blender side. Need to ensure that all GPU resources are freed prior to that
- * point.
+ * interoperability objects in the path trace. Once the frame is finished the OpenGL context
+ * might be freed form Blender side. Need to ensure that all GPU resources are freed prior to
+ * that point.
* Ideally would only do this when OpenGL context is actually destroyed, but there is no way to
* know when this happens (at least in the code at the time when this comment was written).
* The penalty of re-creating resources on every frame is unlikely to be noticed. */
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt
index 5296d819e42..bfca3ab6aea 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -224,7 +224,8 @@ include_directories(SYSTEM ${INC_SYS})
cycles_add_library(cycles_device "${LIB}" ${SRC})
if(WITH_CYCLES_DEVICE_ONEAPI)
- # Need to have proper rebuilding in case of changes in cycles_kernel_oneapi due external project behaviour
+ # Need to have proper rebuilding in case of changes
+ # in cycles_kernel_oneapi due external project behavior.
add_dependencies(cycles_device cycles_kernel_oneapi)
endif()
diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp
index 3588b75713b..d0ddd69289c 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -668,8 +668,9 @@ int OneapiDevice::parse_driver_build_version(const sycl::device &device)
std::vector<sycl::device> OneapiDevice::available_devices()
{
bool allow_all_devices = false;
- if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr)
+ if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr) {
allow_all_devices = true;
+ }
const std::vector<sycl::platform> &oneapi_platforms = sycl::platform::get_platforms();
@@ -686,15 +687,16 @@ std::vector<sycl::device> OneapiDevice::available_devices()
platform.get_devices(sycl::info::device_type::gpu);
for (const sycl::device &device : oneapi_devices) {
+ bool filter_out = false;
if (!allow_all_devices) {
- bool filter_out = false;
-
/* For now we support all Intel(R) Arc(TM) devices and likely any future GPU,
* assuming they have either more than 96 Execution Units or not 7 threads per EU.
* Official support can be broaden to older and smaller GPUs once ready. */
- if (device.is_gpu() && platform.get_backend() == sycl::backend::ext_oneapi_level_zero) {
- /* Filtered-out defaults in-case these values aren't available through too old L0
- * runtime. */
+ if (!device.is_gpu() || platform.get_backend() != sycl::backend::ext_oneapi_level_zero) {
+ filter_out = true;
+ }
+ else {
+ /* Filtered-out defaults in-case these values aren't available. */
int number_of_eus = 96;
int threads_per_eu = 7;
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
@@ -718,13 +720,9 @@ std::vector<sycl::device> OneapiDevice::available_devices()
}
}
}
- else if (!allow_all_devices) {
- filter_out = true;
- }
-
- if (!filter_out) {
- available_devices.push_back(device);
- }
+ }
+ if (!filter_out) {
+ available_devices.push_back(device);
}
}
}
diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp b/intern/cycles/integrator/path_trace_work_gpu.cpp
index 48f6cf3c903..547e8d50a22 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -100,8 +100,8 @@ void PathTraceWorkGPU::alloc_integrator_soa()
integrator_state_soa_volume_stack_size_ = max(integrator_state_soa_volume_stack_size_,
requested_volume_stack_size);
- /* Deterine the number of path states. Deferring this for as long as possible allows the backend
- * to make better decisions about memory availability. */
+ /* Determine the number of path states. Deferring this for as long as possible allows the
+ * back-end to make better decisions about memory availability. */
if (max_num_paths_ == 0) {
size_t single_state_size = estimate_single_state_size(kernel_features);
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 81c5f593974..3779fdc697a 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -866,8 +866,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
else()
list(APPEND sycl_compiler_flags -fPIC)
- # We avoid getting __FAST_MATH__ to be defined when building on CentOS 7 until the compilation crash
- # it triggers at either AoT or JIT stages gets fixed.
+ # We avoid getting __FAST_MATH__ to be defined when building on CentOS 7 until the compilation
+ # crash it triggers at either AoT or JIT stages gets fixed.
list(APPEND sycl_compiler_flags -fhonor-nans)
# add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and
@@ -881,7 +881,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
OUTPUT ${cycles_kernel_oneapi_lib}
COMMAND ${CMAKE_COMMAND} -E env
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
- "PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld
+ # `$ENV{PATH}` is for compiler to find `ld`.
+ "PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}"
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
DEPENDS ${cycles_oneapi_kernel_sources})
endif()
diff --git a/intern/cycles/kernel/camera/projection.h b/intern/cycles/kernel/camera/projection.h
index c9fe3a6c7fb..1d16aa35abe 100644
--- a/intern/cycles/kernel/camera/projection.h
+++ b/intern/cycles/kernel/camera/projection.h
@@ -201,11 +201,35 @@ ccl_device float2 direction_to_mirrorball(float3 dir)
return make_float2(u, v);
}
+/* Single face of a equiangular cube map projection as described in
+ https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/ */
+ccl_device float3 equiangular_cubemap_face_to_direction(float u, float v)
+{
+ u = (1.0f - u);
+
+ u = tanf(u * M_PI_2_F - M_PI_4_F);
+ v = tanf(v * M_PI_2_F - M_PI_4_F);
+
+ return make_float3(1.0f, u, v);
+}
+
+ccl_device float2 direction_to_equiangular_cubemap_face(float3 dir)
+{
+ float u = atan2f(dir.y, dir.x) * 2.0f / M_PI_F + 0.5f;
+ float v = atan2f(dir.z, dir.x) * 2.0f / M_PI_F + 0.5f;
+
+ u = 1.0f - u;
+
+ return make_float2(u, v);
+}
+
ccl_device_inline float3 panorama_to_direction(ccl_constant KernelCamera *cam, float u, float v)
{
switch (cam->panorama_type) {
case PANORAMA_EQUIRECTANGULAR:
return equirectangular_range_to_direction(u, v, cam->equirectangular_range);
+ case PANORAMA_EQUIANGULAR_CUBEMAP_FACE:
+ return equiangular_cubemap_face_to_direction(u, v);
case PANORAMA_MIRRORBALL:
return mirrorball_to_direction(u, v);
case PANORAMA_FISHEYE_EQUIDISTANT:
@@ -230,6 +254,8 @@ ccl_device_inline float2 direction_to_panorama(ccl_constant KernelCamera *cam, f
switch (cam->panorama_type) {
case PANORAMA_EQUIRECTANGULAR:
return direction_to_equirectangular_range(dir, cam->equirectangular_range);
+ case PANORAMA_EQUIANGULAR_CUBEMAP_FACE:
+ return direction_to_equiangular_cubemap_face(dir);
case PANORAMA_MIRRORBALL:
return direction_to_mirrorball(dir);
case PANORAMA_FISHEYE_EQUIDISTANT:
diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h
index 8f7cfd19169..24c5a6a4540 100644
--- a/intern/cycles/kernel/types.h
+++ b/intern/cycles/kernel/types.h
@@ -490,6 +490,7 @@ enum PanoramaType {
PANORAMA_FISHEYE_EQUISOLID = 2,
PANORAMA_MIRRORBALL = 3,
PANORAMA_FISHEYE_LENS_POLYNOMIAL = 4,
+ PANORAMA_EQUIANGULAR_CUBEMAP_FACE = 5,
PANORAMA_NUM_TYPES,
};
diff --git a/intern/cycles/scene/camera.cpp b/intern/cycles/scene/camera.cpp
index 240e5d9c128..255dd320ec7 100644
--- a/intern/cycles/scene/camera.cpp
+++ b/intern/cycles/scene/camera.cpp
@@ -84,6 +84,7 @@ NODE_DEFINE(Camera)
static NodeEnum panorama_type_enum;
panorama_type_enum.insert("equirectangular", PANORAMA_EQUIRECTANGULAR);
+ panorama_type_enum.insert("equiangular_cubemap_face", PANORAMA_EQUIANGULAR_CUBEMAP_FACE);
panorama_type_enum.insert("mirrorball", PANORAMA_MIRRORBALL);
panorama_type_enum.insert("fisheye_equidistant", PANORAMA_FISHEYE_EQUIDISTANT);
panorama_type_enum.insert("fisheye_equisolid", PANORAMA_FISHEYE_EQUISOLID);
diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt
index b126247de5f..c3ae81ed1db 100644
--- a/intern/cycles/test/CMakeLists.txt
+++ b/intern/cycles/test/CMakeLists.txt
@@ -34,6 +34,7 @@ set(SRC
render_graph_finalize_test.cpp
util_aligned_malloc_test.cpp
util_math_test.cpp
+ util_md5_test.cpp
util_path_test.cpp
util_string_test.cpp
util_task_test.cpp
diff --git a/intern/cycles/test/util_md5_test.cpp b/intern/cycles/test/util_md5_test.cpp
new file mode 100644
index 00000000000..abc147b70a1
--- /dev/null
+++ b/intern/cycles/test/util_md5_test.cpp
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2011-2022 Blender Foundation */
+
+#include "testing/testing.h"
+
+#include "util/md5.h"
+
+CCL_NAMESPACE_BEGIN
+
+TEST(util, util_md5_string)
+{
+ /* The hash is calculated using `echo -n "Hello, World\!" | md5 | tr '[:lower:]' '[:upper:]'`. */
+ EXPECT_EQ(util_md5_string("Hello, World!"), "65A8E27D8879283831B664BD8B7F0AD4");
+}
+
+CCL_NAMESPACE_END
diff --git a/intern/cycles/util/md5.cpp b/intern/cycles/util/md5.cpp
index 1c7e6b9bf3e..3342d7a509a 100644
--- a/intern/cycles/util/md5.cpp
+++ b/intern/cycles/util/md5.cpp
@@ -347,13 +347,18 @@ void MD5Hash::finish(uint8_t digest[16])
string MD5Hash::get_hex()
{
+ constexpr char kHexDigits[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
uint8_t digest[16];
char buf[16 * 2 + 1];
finish(digest);
- for (int i = 0; i < 16; i++)
- sprintf(buf + i * 2, "%02X", (unsigned int)digest[i]);
+ for (int i = 0; i < 16; i++) {
+ buf[i * 2 + 0] = kHexDigits[digest[i] / 0x10];
+ buf[i * 2 + 1] = kHexDigits[digest[i] % 0x10];
+ }
buf[sizeof(buf) - 1] = '\0';
return string(buf);
diff --git a/intern/cycles/util/types_float3.h b/intern/cycles/util/types_float3.h
index 87c6b1d3654..34430945c38 100644
--- a/intern/cycles/util/types_float3.h
+++ b/intern/cycles/util/types_float3.h
@@ -10,7 +10,12 @@
CCL_NAMESPACE_BEGIN
#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
+# ifdef __KERNEL_ONEAPI__
+/* Define float3 as packed for oneAPI. */
+struct float3
+# else
struct ccl_try_align(16) float3
+# endif
{
# ifdef __KERNEL_GPU__
/* Compact structure for GPU. */
diff --git a/intern/ffmpeg/tests/ffmpeg_codecs.cc b/intern/ffmpeg/tests/ffmpeg_codecs.cc
index e5c33202417..10cbe4b938b 100644
--- a/intern/ffmpeg/tests/ffmpeg_codecs.cc
+++ b/intern/ffmpeg/tests/ffmpeg_codecs.cc
@@ -40,7 +40,7 @@ bool test_acodec(const AVCodec *codec, AVSampleFormat fmt)
if (ctx) {
ctx->sample_fmt = fmt;
ctx->sample_rate = 48000;
- ctx->channel_layout = AV_CH_LAYOUT_MONO;
+ av_channel_layout_from_mask(&ctx->ch_layout, AV_CH_LAYOUT_MONO);
ctx->bit_rate = 128000;
int open = avcodec_open2(ctx, codec, NULL);
if (open >= 0) {
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index fb10530bfae..ea21d831b0c 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -385,9 +385,9 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
"${WAYLAND_PROTOCOLS_DIR}/unstable/primary-selection/primary-selection-unstable-v1.xml"
)
- add_definitions(-DWITH_GHOST_WAYLAND)
-
unset(INC_DST)
+
+ add_definitions(-DWITH_GHOST_WAYLAND)
endif()
if(WITH_INPUT_NDOF)
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 93708983f37..d9f2df21ee0 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -140,7 +140,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
/* End Inline GLEW. */
/* -------------------------------------------------------------------- */
#else
- /* Important to initialize only glxew (_not_ GLEW),
+ /* Important to initialize only GLXEW (_not_ GLEW),
* since this breaks w/ Mesa's `swrast`, see: T46431. */
glxewInit();
#endif /* USE_GLXEW_INIT_WORKAROUND */
diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h
index 85c8ed7b4bd..cb6d8a770cf 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.h
+++ b/intern/ghost/intern/GHOST_ImeWin32.h
@@ -266,7 +266,7 @@ class GHOST_ImeWin32 {
* Parameters
* * window_handle [in] (HWND)
* Represents the window handle of the caller.
- * * caret_rect [in] (const gfx::Rect&)
+ * * caret_rect [in] (`const gfx::Rect&`)
* Represent the rectangle of the input caret.
* This rectangle is used for controlling the positions of IME windows.
* * complete [in] (bool)
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 810f828a8a1..924a4bff790 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -76,7 +76,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
GHOST_TimerProcPtr timerProc,
- GHOST_TUserDataPtr userData = NULL);
+ GHOST_TUserDataPtr userData = nullptr);
/**
* Removes a timer.
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 23f7c5060c0..3a0ba5cd21a 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -96,13 +96,12 @@ static void gwl_registry_entry_remove_all(GWL_Display *display);
struct GWL_RegistryHandler;
static int gwl_registry_handler_interface_slot_max();
+static int gwl_registry_handler_interface_slot_from_string(const char *interface);
static const struct GWL_RegistryHandler *gwl_registry_handler_from_interface_slot(
int interface_slot);
/* -------------------------------------------------------------------- */
-/** \name Local Defines
- *
- * Control local functionality, compositors specific workarounds.
+/** \name Workaround Compositor Specific Bugs
* \{ */
/**
@@ -142,7 +141,7 @@ static bool use_gnome_confine_hack = false;
/**
* KDE (plasma 5.26.1) has a bug where the cursor surface needs to be committed
* (via `wl_surface_commit`) when it was hidden and is being set to visible again, see: T102048.
- * TODO: report this bug up-stream.
+ * See: https://bugs.kde.org/show_bug.cgi?id=461001
*/
#define USE_KDE_TABLET_HIDDEN_CURSOR_HACK
@@ -155,6 +154,18 @@ static bool use_gnome_confine_hack = false;
# define USE_GNOME_NEEDS_LIBDECOR_HACK
#endif
+/* -------------------------------------------------------------------- */
+/** \name Local Defines
+ *
+ * Control local functionality, compositors specific workarounds.
+ * \{ */
+
+/**
+ * Fix short-cut part of keyboard reading code not properly handling some keys, see: T102194.
+ * \note This is similar to X11 workaround by the same name, see: T47228.
+ */
+#define USE_NON_LATIN_KB_WORKAROUND
+
#define WL_NAME_UNSET uint32_t(-1)
/** \} */
@@ -197,6 +208,19 @@ static bool use_gnome_confine_hack = false;
*/
#define KEY_GRAVE 41
+#ifdef USE_NON_LATIN_KB_WORKAROUND
+# define KEY_1 2
+# define KEY_2 3
+# define KEY_3 4
+# define KEY_4 5
+# define KEY_5 6
+# define KEY_6 7
+# define KEY_7 8
+# define KEY_8 9
+# define KEY_9 10
+# define KEY_0 11
+#endif
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -279,15 +303,6 @@ static void gwl_simple_buffer_free_data(GWL_SimpleBuffer *buffer)
buffer->data_size = 0;
}
-static void gwl_simple_buffer_set_and_take_ownership(GWL_SimpleBuffer *buffer,
- const char *data,
- size_t data_size)
-{
- free(const_cast<char *>(buffer->data));
- buffer->data = data;
- buffer->data_size = data_size;
-}
-
static void gwl_simple_buffer_set_from_string(GWL_SimpleBuffer *buffer, const char *str)
{
free(const_cast<char *>(buffer->data));
@@ -297,14 +312,6 @@ static void gwl_simple_buffer_set_from_string(GWL_SimpleBuffer *buffer, const ch
buffer->data = data;
}
-static char *gwl_simple_buffer_as_string(const GWL_SimpleBuffer *buffer)
-{
- char *buffer_str = static_cast<char *>(malloc(buffer->data_size + 1));
- memcpy(buffer_str, buffer->data, buffer->data_size);
- buffer_str[buffer->data_size] = '\0';
- return buffer_str;
-}
-
/** \} */
/* -------------------------------------------------------------------- */
@@ -328,7 +335,7 @@ struct GWL_Cursor {
bool is_hardware = true;
/** When true, a custom image is used to display the cursor (stored in `wl_image`). */
bool is_custom = false;
- struct wl_surface *wl_surface = nullptr;
+ struct wl_surface *wl_surface_cursor = nullptr;
struct wl_buffer *wl_buffer = nullptr;
struct wl_cursor_image wl_image = {0};
struct wl_cursor_theme *wl_theme = nullptr;
@@ -376,10 +383,14 @@ struct GWL_TabletTool {
struct GWL_DataOffer {
struct wl_data_offer *id = nullptr;
std::unordered_set<std::string> types;
- std::atomic<bool> in_use = false;
struct {
/**
+ * Prevents freeing after #wl_data_device_listener.leave,
+ * before #wl_data_device_listener.drop.
+ */
+ bool in_use = false;
+ /**
* Bit-mask with available drop options.
* #WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY, #WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE.. etc.
* The application that initializes the drag may set these depending on modifiers held
@@ -468,7 +479,7 @@ struct GWL_SeatStatePointer {
* The wl_surface last used with this pointing device
* (events with this pointing device will be sent here).
*/
- struct wl_surface *wl_surface = nullptr;
+ struct wl_surface *wl_surface_window = nullptr;
GHOST_Buttons buttons = GHOST_Buttons();
};
@@ -530,7 +541,7 @@ struct GWL_SeatStateKeyboard {
* The wl_surface last used with this pointing device
* (events with this pointing device will be sent here).
*/
- struct wl_surface *wl_surface = nullptr;
+ struct wl_surface *wl_surface_window = nullptr;
};
/**
@@ -580,7 +591,6 @@ static void gwl_xdg_decor_system_destroy(struct GWL_Display *display, GWL_XDG_De
struct GWL_PrimarySelection_DataOffer {
struct zwp_primary_selection_offer_v1 *id = nullptr;
- std::atomic<bool> in_use = false;
std::unordered_set<std::string> types;
};
@@ -678,12 +688,22 @@ struct GWL_Seat {
* Keep a state with no modifiers active, use for symbol lookups.
*/
struct xkb_state *xkb_state_empty = nullptr;
+
+ /**
+ * Keep a state with shift enabled, use to access predictable number access for AZERTY keymaps.
+ * If shift is not supported by the key-map, this is set to NULL.
+ */
+ struct xkb_state *xkb_state_empty_with_shift = nullptr;
/**
* Keep a state with number-lock enabled, use to access predictable key-pad symbols.
* If number-lock is not supported by the key-map, this is set to NULL.
*/
struct xkb_state *xkb_state_empty_with_numlock = nullptr;
+#ifdef USE_NON_LATIN_KB_WORKAROUND
+ bool xkb_use_non_latin_workaround = false;
+#endif
+
/** Keys held matching `xkb_state`. */
struct GWL_KeyboardDepressedState key_depressed;
@@ -710,7 +730,7 @@ struct GWL_Seat {
GHOST_ITimerTask *timer = nullptr;
} key_repeat;
- struct wl_surface *wl_surface_focus_dnd = nullptr;
+ struct wl_surface *wl_surface_window_focus_dnd = nullptr;
struct wl_data_device *wl_data_device = nullptr;
/** Drag & Drop. */
@@ -766,8 +786,16 @@ struct GWL_RegistryEntry;
struct GWL_Display {
GHOST_SystemWayland *system = nullptr;
+ /**
+ * True when initializing registration, while updating all other entries wont cause problems,
+ * it will preform many redundant update calls.
+ */
+ bool registry_skip_update_all = false;
+
+ /** Registry entries, kept to allow updating & removal at run-time. */
struct GWL_RegistryEntry *registry_entry = nullptr;
+ struct wl_registry *wl_registry = nullptr;
struct wl_display *wl_display = nullptr;
struct wl_compositor *wl_compositor = nullptr;
@@ -781,22 +809,44 @@ struct GWL_Display {
struct wl_shm *wl_shm = nullptr;
std::vector<GWL_Output *> outputs;
std::vector<GWL_Seat *> seats;
+ /**
+ * Support a single active seat at once, this isn't an exact or correct mapping from WAYLAND.
+ * Only allow input from different seats, not full concurrent multi-seat support.
+ *
+ * The main purpose of having an active seat is an alternative from always using the first
+ * seat which prevents events from any other seat.
+ *
+ * NOTE(@campbellbarton): This could be extended and developed further extended to support
+ * an active seat per window (for e.g.), basic support is sufficient for now as currently isn't
+ * a widely used feature.
+ */
+ int seats_active_index = 0;
+ /* Managers. */
struct wl_data_device_manager *wl_data_device_manager = nullptr;
struct zwp_tablet_manager_v2 *wp_tablet_manager = nullptr;
struct zwp_relative_pointer_manager_v1 *wp_relative_pointer_manager = nullptr;
- struct zwp_pointer_constraints_v1 *wp_pointer_constraints = nullptr;
- struct zwp_pointer_gestures_v1 *wp_pointer_gestures = nullptr;
-
struct zwp_primary_selection_device_manager_v1 *wp_primary_selection_device_manager = nullptr;
- GWL_SimpleBuffer clipboard;
- GWL_SimpleBuffer clipboard_primary;
- std::mutex clipboard_mutex;
+ struct zwp_pointer_constraints_v1 *wp_pointer_constraints = nullptr;
+ struct zwp_pointer_gestures_v1 *wp_pointer_gestures = nullptr;
};
+/**
+ * Free the #GWL_Display and it's related members.
+ *
+ * \note This may run on a partially initialized struct,
+ * so it can't be assumed all members are set.
+ */
static void gwl_display_destroy(GWL_Display *display)
{
+ /* For typical WAYLAND use this will always be set.
+ * However when WAYLAND isn't running, this will early-exit and be null. */
+ if (display->wl_registry) {
+ wl_registry_destroy(display->wl_registry);
+ display->wl_registry = nullptr;
+ }
+
/* Unregister items in reverse order. */
gwl_registry_entry_remove_all(display);
@@ -824,13 +874,38 @@ static void gwl_display_destroy(GWL_Display *display)
wl_display_disconnect(display->wl_display);
}
- {
- std::lock_guard lock{display->clipboard_mutex};
- gwl_simple_buffer_free_data(&display->clipboard);
- gwl_simple_buffer_free_data(&display->clipboard_primary);
+ delete display;
+}
+
+static int gwl_display_seat_index(GWL_Display *display, const GWL_Seat *seat)
+{
+ std::vector<GWL_Seat *>::iterator iter = std::find(
+ display->seats.begin(), display->seats.end(), seat);
+ const int index = (iter != display->seats.cend()) ? std::distance(display->seats.begin(), iter) :
+ -1;
+ GHOST_ASSERT(index != -1, "invalid internal state");
+ return index;
+}
+
+static GWL_Seat *gwl_display_seat_active_get(const GWL_Display *display)
+{
+ if (UNLIKELY(display->seats.empty())) {
+ return nullptr;
}
+ return display->seats[display->seats_active_index];
+}
- delete display;
+static bool gwl_display_seat_active_set(GWL_Display *display, const GWL_Seat *seat)
+{
+ if (UNLIKELY(display->seats.empty())) {
+ return false;
+ }
+ const int index = gwl_display_seat_index(display, seat);
+ if (index == display->seats_active_index) {
+ return false;
+ }
+ display->seats_active_index = index;
+ return true;
}
/** \} */
@@ -840,22 +915,42 @@ static void gwl_display_destroy(GWL_Display *display)
* \{ */
struct GWL_RegisteryAdd_Params {
- struct GWL_Display *display = nullptr;
- struct wl_registry *wl_registry = nullptr;
uint32_t name = 0;
- uint32_t version = 0;
/** Index within `gwl_registry_handlers`. */
int interface_slot = 0;
+ uint32_t version = 0;
};
/**
* Add callback for object registry.
+ * \note Any operations that depend on other interfaces being registered must be performed in the
+ * #GWL_RegistryHandler_UpdateFn callback as the order interfaces are added is out of our control.
+ *
* \param display: The display which holes a reference to the global object.
* \param params: Various arguments needed for registration.
*/
using GWL_RegistryHandler_AddFn = void (*)(GWL_Display *display,
const GWL_RegisteryAdd_Params *params);
+struct GWL_RegisteryUpdate_Params {
+ uint32_t name = 0;
+ /** Index within `gwl_registry_handlers`. */
+ int interface_slot = 0;
+ uint32_t version = 0;
+
+ /** Set to #GWL_RegistryEntry.user_data. */
+ void *user_data = nullptr;
+};
+
+/**
+ * Optional update callback to refresh internal data when another interface has been added/removed.
+ *
+ * \param display: The display which holes a reference to the global object.
+ * \param params: Various arguments needed for updating.
+ */
+using GWL_RegistryHandler_UpdateFn = void (*)(GWL_Display *display,
+ const GWL_RegisteryUpdate_Params *params);
+
/**
* Remove callback for object registry.
* \param display: The display which holes a reference to the global object.
@@ -872,7 +967,11 @@ struct GWL_RegistryHandler {
/** Pointer to the name (not the name it's self), needed as the values aren't set on startup. */
const char *const *interface_p = nullptr;
+ /** Add the interface. */
GWL_RegistryHandler_AddFn add_fn = nullptr;
+ /** Optional update the interface (when other interfaces have been added/removed). */
+ GWL_RegistryHandler_UpdateFn update_fn = nullptr;
+ /** Remove the interface. */
GWL_RegistryEntry_RemoveFn remove_fn = nullptr;
};
@@ -899,6 +998,10 @@ struct GWL_RegistryEntry {
*/
uint32_t name = WL_NAME_UNSET;
/**
+ * Version passed by the add callback.
+ */
+ uint32_t version;
+ /**
* The index in `gwl_registry_handlers`,
* useful for accessing the interface name (for logging for example).
*/
@@ -906,14 +1009,14 @@ struct GWL_RegistryEntry {
};
static void gwl_registry_entry_add(GWL_Display *display,
- const int interface_slot,
- const uint32_t name,
+ const GWL_RegisteryAdd_Params *params,
void *user_data)
{
GWL_RegistryEntry *reg = new GWL_RegistryEntry;
- reg->interface_slot = interface_slot;
- reg->name = name;
+ reg->interface_slot = params->interface_slot;
+ reg->name = params->name;
+ reg->version = params->version;
reg->user_data = user_data;
reg->next = display->registry_entry;
@@ -1005,6 +1108,49 @@ static void gwl_registry_entry_remove_all(GWL_Display *display)
display->registry_entry = nullptr;
}
+/**
+ * Run GWL_RegistryHandler.update_fn an all registered interface instances.
+ * This is needed to refresh the state of interfaces that may reference other interfaces.
+ * Called when interfaces are added/removed.
+ *
+ * \param interface_slot_exclude: Skip updating slots of this type.
+ * Note that while harmless dependencies only exist between different types,
+ * so there is no reason to update all other outputs that an output was removed (for e.g.).
+ * Pass as -1 to update all slots.
+ *
+ * NOTE(@campbellbarton): Updating all other items on a single change is typically worth avoiding.
+ * In practice this isn't a problem as so there are so few elements in `display->registry_entry`,
+ * so few use update functions and adding/removal at runtime is rarely called (plugging/unplugging)
+ * hardware for e.g. So while it's possible to store dependency links to avoid unnecessary
+ * looping over data - it ends up being a non issue.
+ */
+static void gwl_registry_entry_update_all(GWL_Display *display, const int interface_slot_exclude)
+{
+ GHOST_ASSERT(interface_slot_exclude == -1 || (uint(interface_slot_exclude) <
+ uint(gwl_registry_handler_interface_slot_max())),
+ "Invalid exclude slot");
+
+ for (GWL_RegistryEntry *reg = display->registry_entry; reg; reg = reg->next) {
+ if (reg->interface_slot == interface_slot_exclude) {
+ continue;
+ }
+ const GWL_RegistryHandler *handler = gwl_registry_handler_from_interface_slot(
+ reg->interface_slot);
+ if (handler->update_fn == nullptr) {
+ continue;
+ }
+
+ GWL_RegisteryUpdate_Params params = {
+ .name = reg->name,
+ .interface_slot = reg->interface_slot,
+ .version = reg->version,
+
+ .user_data = reg->user_data,
+ };
+ handler->update_fn(display, &params);
+ }
+}
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -1201,7 +1347,7 @@ static GHOST_TTabletMode tablet_tool_map_type(enum zwp_tablet_tool_v2_type wp_ta
static const int default_cursor_size = 24;
-static const std::unordered_map<GHOST_TStandardCursor, const char *> cursors = {
+static const std::unordered_map<GHOST_TStandardCursor, const char *> ghost_wl_cursors = {
{GHOST_kStandardCursorDefault, "left_ptr"},
{GHOST_kStandardCursorRightArrow, "right_ptr"},
{GHOST_kStandardCursorLeftArrow, "left_ptr"},
@@ -1242,23 +1388,23 @@ static const std::unordered_map<GHOST_TStandardCursor, const char *> cursors = {
{GHOST_kStandardCursorCopy, "copy"},
};
-static constexpr const char *mime_text_plain = "text/plain";
-static constexpr const char *mime_text_utf8 = "text/plain;charset=utf-8";
-static constexpr const char *mime_text_uri = "text/uri-list";
+static constexpr const char *ghost_wl_mime_text_plain = "text/plain";
+static constexpr const char *ghost_wl_mime_text_utf8 = "text/plain;charset=utf-8";
+static constexpr const char *ghost_wl_mime_text_uri = "text/uri-list";
-static const std::unordered_map<std::string, GHOST_TDragnDropTypes> mime_dnd = {
- {mime_text_plain, GHOST_kDragnDropTypeString},
- {mime_text_utf8, GHOST_kDragnDropTypeString},
- {mime_text_uri, GHOST_kDragnDropTypeFilenames},
+static const char *ghost_wl_mime_preference_order[] = {
+ ghost_wl_mime_text_uri,
+ ghost_wl_mime_text_utf8,
+ ghost_wl_mime_text_plain,
};
-
-static const std::vector<std::string> mime_preference_order = {
- mime_text_uri,
- mime_text_utf8,
- mime_text_plain,
+/* Aligned to `ghost_wl_mime_preference_order`. */
+static const GHOST_TDragnDropTypes ghost_wl_mime_preference_order_type[] = {
+ GHOST_kDragnDropTypeString,
+ GHOST_kDragnDropTypeString,
+ GHOST_kDragnDropTypeFilenames,
};
-static const std::vector<std::string> mime_send = {
+static const char *ghost_wl_mime_send[] = {
"UTF8_STRING",
"COMPOUND_TEXT",
"TEXT",
@@ -1388,7 +1534,7 @@ static void keyboard_depressed_state_key_event(GWL_Seat *seat,
static void keyboard_depressed_state_push_events_from_change(
GWL_Seat *seat, const GWL_KeyboardDepressedState &key_depressed_prev)
{
- GHOST_IWindow *win = ghost_wl_surface_user_data(seat->keyboard.wl_surface);
+ GHOST_IWindow *win = ghost_wl_surface_user_data(seat->keyboard.wl_surface_window);
GHOST_SystemWayland *system = seat->system;
/* Separate key up and down into separate passes so key down events always come after key up.
@@ -1475,7 +1621,7 @@ static void relative_pointer_handle_relative_motion(
const wl_fixed_t /*dy_unaccel*/)
{
GWL_Seat *seat = static_cast<GWL_Seat *>(data);
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
CLOG_INFO(LOG, 2, "relative_motion");
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const wl_fixed_t scale = win->scale();
@@ -1508,7 +1654,7 @@ static CLG_LogRef LOG_WL_DATA_SOURCE = {"ghost.wl.handle.data_source"};
static void dnd_events(const GWL_Seat *const seat, const GHOST_TEventType event)
{
/* NOTE: `seat->data_offer_dnd_mutex` must already be locked. */
- if (wl_surface *wl_surface_focus = seat->wl_surface_focus_dnd) {
+ if (wl_surface *wl_surface_focus = seat->wl_surface_window_focus_dnd) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const wl_fixed_t scale = win->scale();
const int event_xy[2] = {
@@ -1517,9 +1663,10 @@ static void dnd_events(const GWL_Seat *const seat, const GHOST_TEventType event)
};
const uint64_t time = seat->system->getMilliSeconds();
- for (const std::string &type : mime_preference_order) {
- seat->system->pushEvent(new GHOST_EventDragnDrop(
- time, event, mime_dnd.at(type), win, UNPACK2(event_xy), nullptr));
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_wl_mime_preference_order_type); i++) {
+ const GHOST_TDragnDropTypes type = ghost_wl_mime_preference_order_type[i];
+ seat->system->pushEvent(
+ new GHOST_EventDragnDrop(time, event, type, win, UNPACK2(event_xy), nullptr));
}
}
}
@@ -1528,7 +1675,7 @@ static void dnd_events(const GWL_Seat *const seat, const GHOST_TEventType event)
* Read from `fd` into a buffer which is returned.
* \return the buffer or null on failure.
*/
-static const char *read_file_as_buffer(const int fd, size_t *r_len)
+static char *read_file_as_buffer(const int fd, const bool nil_terminate, size_t *r_len)
{
struct ByteChunk {
ByteChunk *next;
@@ -1564,14 +1711,23 @@ static const char *read_file_as_buffer(const int fd, size_t *r_len)
char *buf = nullptr;
if (ok) {
- buf = static_cast<char *>(malloc(len));
+ buf = static_cast<char *>(malloc(len + (nil_terminate ? 1 : 0)));
if (UNLIKELY(buf == nullptr)) {
CLOG_WARN(LOG, "unable to allocate file buffer: %zu bytes", len);
ok = false;
}
}
- *r_len = ok ? len : 0;
+ if (ok) {
+ *r_len = len;
+ if (nil_terminate) {
+ buf[len] = '\0';
+ }
+ }
+ else {
+ *r_len = 0;
+ }
+
char *buf_stride = buf;
while (chunk_first) {
if (ok) {
@@ -1588,53 +1744,62 @@ static const char *read_file_as_buffer(const int fd, size_t *r_len)
return buf;
}
-static const char *read_buffer_from_data_offer(GWL_DataOffer *data_offer,
- const char *mime_receive,
- std::mutex *mutex,
- size_t *r_len)
+static char *read_buffer_from_data_offer(GWL_DataOffer *data_offer,
+ const char *mime_receive,
+ std::mutex *mutex,
+ const bool nil_terminate,
+ size_t *r_len)
{
int pipefd[2];
- if (UNLIKELY(pipe(pipefd) != 0)) {
+ const bool pipefd_ok = pipe(pipefd) == 0;
+ if (pipefd_ok) {
+ wl_data_offer_receive(data_offer->id, mime_receive, pipefd[1]);
+ close(pipefd[1]);
+ }
+ else {
CLOG_WARN(LOG, "error creating pipe: %s", std::strerror(errno));
- return nullptr;
}
- wl_data_offer_receive(data_offer->id, mime_receive, pipefd[1]);
- close(pipefd[1]);
- data_offer->in_use.store(false);
+ /* Only for DND (A no-op to disable for clipboard data-offer). */
+ data_offer->dnd.in_use = false;
if (mutex) {
mutex->unlock();
}
/* WARNING: `data_offer` may be freed from now on. */
-
- const char *buf = read_file_as_buffer(pipefd[0], r_len);
- close(pipefd[0]);
+ char *buf = nullptr;
+ if (pipefd_ok) {
+ buf = read_file_as_buffer(pipefd[0], nil_terminate, r_len);
+ close(pipefd[0]);
+ }
return buf;
}
-static const char *read_buffer_from_primary_selection_offer(
- GWL_PrimarySelection_DataOffer *data_offer,
- const char *mime_receive,
- std::mutex *mutex,
- size_t *r_len)
+static char *read_buffer_from_primary_selection_offer(GWL_PrimarySelection_DataOffer *data_offer,
+ const char *mime_receive,
+ std::mutex *mutex,
+ const bool nil_terminate,
+ size_t *r_len)
{
int pipefd[2];
- if (UNLIKELY(pipe(pipefd) != 0)) {
+ const bool pipefd_ok = pipe(pipefd) == 0;
+ if (pipefd_ok) {
+ zwp_primary_selection_offer_v1_receive(data_offer->id, mime_receive, pipefd[1]);
+ close(pipefd[1]);
+ }
+ else {
CLOG_WARN(LOG, "error creating pipe: %s", std::strerror(errno));
- return nullptr;
}
- zwp_primary_selection_offer_v1_receive(data_offer->id, mime_receive, pipefd[1]);
- close(pipefd[1]);
-
- data_offer->in_use.store(false);
if (mutex) {
mutex->unlock();
}
/* WARNING: `data_offer` may be freed from now on. */
- const char *buf = read_file_as_buffer(pipefd[0], r_len);
- close(pipefd[0]);
+ char *buf = nullptr;
+ if (pipefd_ok) {
+ buf = read_file_as_buffer(pipefd[0], nil_terminate, r_len);
+ close(pipefd[0]);
+ }
return buf;
}
@@ -1657,15 +1822,22 @@ static void data_source_handle_send(void *data,
const int32_t fd)
{
GWL_Seat *seat = static_cast<GWL_Seat *>(data);
- std::lock_guard lock{seat->data_source_mutex};
CLOG_INFO(LOG, 2, "send");
- const char *const buffer = seat->data_source->buffer_out.data;
- if (UNLIKELY(write(fd, buffer, seat->data_source->buffer_out.data_size) < 0)) {
- CLOG_WARN(LOG, "error writing to clipboard: %s", std::strerror(errno));
- }
- close(fd);
+ auto write_file_fn = [](GWL_Seat *seat, const int fd) {
+ if (UNLIKELY(write(fd,
+ seat->data_source->buffer_out.data,
+ seat->data_source->buffer_out.data_size) < 0)) {
+ CLOG_WARN(LOG, "error writing to clipboard: %s", std::strerror(errno));
+ }
+ close(fd);
+ seat->data_source_mutex.unlock();
+ };
+
+ seat->data_source_mutex.lock();
+ std::thread write_thread(write_file_fn, seat, fd);
+ write_thread.detach();
}
static void data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source)
@@ -1816,7 +1988,7 @@ static void data_device_handle_enter(void *data,
seat->data_offer_dnd = static_cast<GWL_DataOffer *>(wl_data_offer_get_user_data(id));
GWL_DataOffer *data_offer = seat->data_offer_dnd;
- data_offer->in_use.store(true);
+ data_offer->dnd.in_use = true;
data_offer->dnd.xy[0] = x;
data_offer->dnd.xy[1] = y;
@@ -1825,11 +1997,15 @@ static void data_device_handle_enter(void *data,
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE,
WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
- for (const std::string &type : mime_preference_order) {
- wl_data_offer_accept(id, serial, type.c_str());
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_wl_mime_preference_order); i++) {
+ const char *type = ghost_wl_mime_preference_order[i];
+ wl_data_offer_accept(id, serial, type);
}
- seat->wl_surface_focus_dnd = wl_surface;
+ seat->wl_surface_window_focus_dnd = wl_surface;
+
+ seat->system->seat_active_set(seat);
+
dnd_events(seat, GHOST_kEventDraggingEntered);
}
@@ -1841,9 +2017,9 @@ static void data_device_handle_leave(void *data, struct wl_data_device * /*wl_da
CLOG_INFO(LOG, 2, "leave");
dnd_events(seat, GHOST_kEventDraggingExited);
- seat->wl_surface_focus_dnd = nullptr;
+ seat->wl_surface_window_focus_dnd = nullptr;
- if (seat->data_offer_dnd && !seat->data_offer_dnd->in_use.load()) {
+ if (seat->data_offer_dnd && !seat->data_offer_dnd->dnd.in_use) {
wl_data_offer_destroy(seat->data_offer_dnd->id);
delete seat->data_offer_dnd;
seat->data_offer_dnd = nullptr;
@@ -1874,27 +2050,35 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat
GWL_DataOffer *data_offer = seat->data_offer_dnd;
- const std::string mime_receive = *std::find_first_of(mime_preference_order.begin(),
- mime_preference_order.end(),
- data_offer->types.begin(),
- data_offer->types.end());
+ /* Use a blank string for `mime_receive` to prevent crashes, although could also be `nullptr`.
+ * Failure to set this to a known type just means the file won't have any special handling.
+ * GHOST still generates a dropped file event.
+ * NOTE: this string can be compared with `mime_text_plain`, `mime_text_uri` etc...
+ * as the this always points to the same values. */
+ const char *mime_receive = "";
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_wl_mime_preference_order); i++) {
+ const char *type = ghost_wl_mime_preference_order[i];
+ if (data_offer->types.count(type)) {
+ mime_receive = type;
+ break;
+ }
+ }
- CLOG_INFO(LOG, 2, "drop mime_recieve=%s", mime_receive.c_str());
+ CLOG_INFO(LOG, 2, "drop mime_recieve=%s", mime_receive);
auto read_uris_fn = [](GWL_Seat *const seat,
GWL_DataOffer *data_offer,
- wl_surface *wl_surface,
- const std::string mime_receive) {
+ wl_surface *wl_surface_window,
+ const char *mime_receive) {
const wl_fixed_t xy[2] = {UNPACK2(data_offer->dnd.xy)};
size_t data_buf_len = 0;
const char *data_buf = read_buffer_from_data_offer(
- data_offer, mime_receive.c_str(), nullptr, &data_buf_len);
+ data_offer, mime_receive, nullptr, false, &data_buf_len);
std::string data = data_buf ? std::string(data_buf, data_buf_len) : "";
free(const_cast<char *>(data_buf));
- CLOG_INFO(
- LOG, 2, "drop_read_uris mime_receive=%s, data=%s", mime_receive.c_str(), data.c_str());
+ CLOG_INFO(LOG, 2, "drop_read_uris mime_receive=%s, data=%s", mime_receive, data.c_str());
wl_data_offer_finish(data_offer->id);
wl_data_offer_destroy(data_offer->id);
@@ -1907,13 +2091,13 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat
GHOST_SystemWayland *const system = seat->system;
- if (mime_receive == mime_text_uri) {
+ if (mime_receive == ghost_wl_mime_text_uri) {
static constexpr const char *file_proto = "file://";
/* NOTE: some applications CRLF (`\r\n`) GTK3 for e.g. & others don't `pcmanfm-qt`.
* So support both, once `\n` is found, strip the preceding `\r` if found. */
static constexpr const char *lf = "\n";
- GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface);
+ GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_window);
std::vector<std::string> uris;
size_t pos = 0;
@@ -1952,7 +2136,7 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat
wl_fixed_to_int(scale * xy[1]),
flist));
}
- else if (ELEM(mime_receive, mime_text_plain, mime_text_utf8)) {
+ else if (ELEM(mime_receive, ghost_wl_mime_text_plain, ghost_wl_mime_text_utf8)) {
/* TODO: enable use of internal functions 'txt_insert_buf' and
* 'text_update_edited' to behave like dropped text was pasted. */
CLOG_INFO(LOG, 2, "drop_read_uris_fn (text_plain, text_utf8), unhandled!");
@@ -1960,10 +2144,10 @@ static void data_device_handle_drop(void *data, struct wl_data_device * /*wl_dat
wl_display_roundtrip(system->wl_display());
};
- /* Pass in `seat->wl_surface_focus_dnd` instead of accessing it from `seat` since the leave
- * callback (#data_device_handle_leave) will clear the value once this function starts. */
+ /* Pass in `seat->wl_surface_window_focus_dnd` instead of accessing it from `seat` since the
+ * leave callback (#data_device_handle_leave) will clear the value once this function starts. */
std::thread read_thread(
- read_uris_fn, seat, data_offer, seat->wl_surface_focus_dnd, mime_receive);
+ read_uris_fn, seat, data_offer, seat->wl_surface_window_focus_dnd, mime_receive);
read_thread.detach();
}
@@ -1993,34 +2177,6 @@ static void data_device_handle_selection(void *data,
/* Get new data offer. */
data_offer = static_cast<GWL_DataOffer *>(wl_data_offer_get_user_data(id));
seat->data_offer_copy_paste = data_offer;
-
- auto read_selection_fn = [](GWL_Seat *seat) {
- GHOST_SystemWayland *const system = seat->system;
- seat->data_offer_copy_paste_mutex.lock();
-
- GWL_DataOffer *data_offer = seat->data_offer_copy_paste;
- std::string mime_receive;
- for (const std::string type : {mime_text_utf8, mime_text_plain}) {
- if (data_offer->types.count(type)) {
- mime_receive = type;
- break;
- }
- }
-
- size_t data_len = 0;
- const char *data = read_buffer_from_data_offer(
- data_offer, mime_receive.c_str(), &seat->data_offer_copy_paste_mutex, &data_len);
-
- {
- std::mutex &clipboard_mutex = system->clipboard_mutex();
- std::lock_guard lock{clipboard_mutex};
- GWL_SimpleBuffer *buf = system->clipboard_data(false);
- gwl_simple_buffer_set_and_take_ownership(buf, data, data_len);
- }
- };
-
- std::thread read_thread(read_selection_fn, seat);
- read_thread.detach();
}
static const struct wl_data_device_listener data_device_listener = {
@@ -2074,7 +2230,7 @@ static CLG_LogRef LOG_WL_CURSOR_SURFACE = {"ghost.wl.handle.cursor_surface"};
static bool update_cursor_scale(GWL_Cursor &cursor,
wl_shm *shm,
GWL_SeatStatePointer *seat_state_pointer,
- wl_surface *wl_cursor_surface)
+ wl_surface *wl_surface_cursor)
{
int scale = 0;
for (const GWL_Output *output : seat_state_pointer->outputs) {
@@ -2086,7 +2242,7 @@ static bool update_cursor_scale(GWL_Cursor &cursor,
if (scale > 0 && seat_state_pointer->theme_scale != scale) {
seat_state_pointer->theme_scale = scale;
if (!cursor.is_custom) {
- wl_surface_set_buffer_scale(wl_cursor_surface, scale);
+ wl_surface_set_buffer_scale(wl_surface_cursor, scale);
}
wl_cursor_theme_destroy(cursor.wl_theme);
cursor.wl_theme = wl_cursor_theme_load(
@@ -2179,7 +2335,9 @@ static void pointer_handle_enter(void *data,
seat->pointer_scroll.discrete_xy[1] = 0;
seat->pointer_scroll.axis_source = WL_POINTER_AXIS_SOURCE_WHEEL;
- seat->pointer.wl_surface = wl_surface;
+ seat->pointer.wl_surface_window = wl_surface;
+
+ seat->system->seat_active_set(seat);
win->setCursorShape(win->getCursorShape());
@@ -2198,7 +2356,7 @@ static void pointer_handle_leave(void *data,
struct wl_surface *wl_surface)
{
/* First clear the `pointer.wl_surface`, since the window won't exist when closing the window. */
- static_cast<GWL_Seat *>(data)->pointer.wl_surface = nullptr;
+ static_cast<GWL_Seat *>(data)->pointer.wl_surface_window = nullptr;
if (wl_surface && ghost_wl_surface_own(wl_surface)) {
CLOG_INFO(LOG, 2, "leave");
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface);
@@ -2219,7 +2377,7 @@ static void pointer_handle_motion(void *data,
seat->pointer.xy[0] = surface_x;
seat->pointer.xy[1] = surface_y;
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
CLOG_INFO(LOG, 2, "motion");
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const wl_fixed_t scale = win->scale();
@@ -2283,7 +2441,7 @@ static void pointer_handle_button(void *data,
seat->data_source_serial = serial;
seat->pointer.buttons.set(ebutton, state == WL_POINTER_BUTTON_STATE_PRESSED);
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(new GHOST_EventButton(
seat->system->getMilliSeconds(), etype, win, ebutton, GHOST_TABLET_DATA_NONE));
@@ -2334,7 +2492,7 @@ static void pointer_handle_frame(void *data, struct wl_pointer * /*wl_pointer*/)
/* Discrete X axis currently unsupported. */
if (seat->pointer_scroll.discrete_xy[1]) {
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const int32_t discrete = seat->pointer_scroll.discrete_xy[1];
seat->system->pushEvent(new GHOST_EventWheel(
@@ -2345,7 +2503,7 @@ static void pointer_handle_frame(void *data, struct wl_pointer * /*wl_pointer*/)
}
if (seat->pointer_scroll.smooth_xy[0] || seat->pointer_scroll.smooth_xy[1]) {
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const wl_fixed_t scale = win->scale();
seat->system->pushEvent(new GHOST_EventTrackpad(
@@ -2355,10 +2513,11 @@ static void pointer_handle_frame(void *data, struct wl_pointer * /*wl_pointer*/)
wl_fixed_to_int(scale * seat->pointer.xy[0]),
wl_fixed_to_int(scale * seat->pointer.xy[1]),
/* NOTE: scaling the delta doesn't seem necessary.
- * NOTE: inverting delta gives correct results, see: QTBUG-85767. */
+ * NOTE: inverting delta gives correct results, see: QTBUG-85767.
+ * NOTE: the preference to invert scrolling (in GNOME at least)
+ * has already been applied so there is no need to read this preference. */
-wl_fixed_to_int(seat->pointer_scroll.smooth_xy[0]),
-wl_fixed_to_int(seat->pointer_scroll.smooth_xy[1]),
- /* TODO: investigate a way to request this configuration from the system. */
false));
}
@@ -2475,9 +2634,21 @@ static void gesture_pinch_handle_begin(void *data,
seat->pointer_gesture_pinch = GWL_SeatStatePointerGesture_Pinch{};
GHOST_WindowWayland *win = nullptr;
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
win = ghost_wl_surface_user_data(wl_surface_focus);
}
+ /* NOTE(@campbellbarton): Blender's use of track-pad coordinates is inconsistent and needs work.
+ * This isn't specific to WAYLAND, in practice they tend to work well enough in most cases.
+ * Some operators scale by the UI scale, some don't.
+ * Even this window scale is not correct because it doesn't account for:
+ * 1) Fractional window scale.
+ * 2) Blender's UI scale preference (which GHOST doesn't know about).
+ *
+ * If support for this were all that was needed it could be handled in GHOST,
+ * however as the operators are not even using coordinates compatible with each other,
+ * it would be better to resolve this by passing rotation & zoom levels directly,
+ * instead of attempting to handle them as cursor coordinates.
+ */
const wl_fixed_t win_scale = win ? win->scale() : 1;
/* NOTE(@campbellbarton): Scale factors match Blender's operators & default preferences.
@@ -2519,7 +2690,7 @@ static void gesture_pinch_handle_update(void *data,
GHOST_WindowWayland *win = nullptr;
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
win = ghost_wl_surface_user_data(wl_surface_focus);
}
@@ -2641,8 +2812,9 @@ static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_listener
/* -------------------------------------------------------------------- */
/** \name Listener (Touch Seat), #wl_touch_listener
*
- * TODO(@campbellbarton): Only setup the callbacks for now as I don't have
- * hardware that generates touch events.
+ * NOTE(@campbellbarton): It's not clear if this interface is used by popular compositors.
+ * It looks like GNOME/KDE only support `zwp_pointer_gestures_v1_interface`.
+ * If this isn't used anywhere, it could be removed.
* \{ */
static CLG_LogRef LOG_WL_TOUCH = {"ghost.wl.handle.touch"};
@@ -2806,11 +2978,13 @@ static void tablet_tool_handle_proximity_in(void *data,
GWL_Seat *seat = tablet_tool->seat;
seat->cursor_source_serial = serial;
- seat->tablet.wl_surface = wl_surface;
+ seat->tablet.wl_surface_window = wl_surface;
seat->tablet.serial = serial;
seat->data_source_serial = serial;
+ seat->system->seat_active_set(seat);
+
/* Update #GHOST_TabletData. */
GHOST_TabletData &td = tablet_tool->data;
/* Reset, to avoid using stale tilt/pressure. */
@@ -2819,7 +2993,7 @@ static void tablet_tool_handle_proximity_in(void *data,
/* In case pressure isn't supported. */
td.Pressure = 1.0f;
- GHOST_WindowWayland *win = ghost_wl_surface_user_data(seat->tablet.wl_surface);
+ GHOST_WindowWayland *win = ghost_wl_surface_user_data(seat->tablet.wl_surface_window);
win->activate();
@@ -2849,7 +3023,7 @@ static void tablet_tool_handle_down(void *data,
seat->data_source_serial = serial;
seat->tablet.buttons.set(ebutton, true);
- if (wl_surface *wl_surface_focus = seat->tablet.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->tablet.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(new GHOST_EventButton(
seat->system->getMilliSeconds(), etype, win, ebutton, tablet_tool->data));
@@ -2867,7 +3041,7 @@ static void tablet_tool_handle_up(void *data, struct zwp_tablet_tool_v2 * /*zwp_
seat->tablet.buttons.set(ebutton, false);
- if (wl_surface *wl_surface_focus = seat->tablet.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->tablet.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(new GHOST_EventButton(
seat->system->getMilliSeconds(), etype, win, ebutton, tablet_tool->data));
@@ -2952,7 +3126,7 @@ static void tablet_tool_handle_wheel(void *data,
GWL_TabletTool *tablet_tool = static_cast<GWL_TabletTool *>(data);
GWL_Seat *seat = tablet_tool->seat;
- if (wl_surface *wl_surface_focus = seat->tablet.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->tablet.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(new GHOST_EventWheel(seat->system->getMilliSeconds(), win, clicks));
}
@@ -2994,7 +3168,7 @@ static void tablet_tool_handle_button(void *data,
seat->data_source_serial = serial;
seat->tablet.buttons.set(ebutton, state == WL_POINTER_BUTTON_STATE_PRESSED);
- if (wl_surface *wl_surface_focus = seat->tablet.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->tablet.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(new GHOST_EventButton(
seat->system->getMilliSeconds(), etype, win, ebutton, tablet_tool->data));
@@ -3010,7 +3184,7 @@ static void tablet_tool_handle_frame(void *data,
GWL_Seat *seat = tablet_tool->seat;
/* No need to check the surfaces origin, it's already known to be owned by GHOST. */
- if (wl_surface *wl_surface_focus = seat->tablet.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->tablet.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const wl_fixed_t scale = win->scale();
seat->system->pushEvent(new GHOST_EventCursor(seat->system->getMilliSeconds(),
@@ -3025,7 +3199,7 @@ static void tablet_tool_handle_frame(void *data,
}
if (tablet_tool->proximity == false) {
- seat->tablet.wl_surface = nullptr;
+ seat->tablet.wl_surface_window = nullptr;
}
}
@@ -3153,9 +3327,23 @@ static void keyboard_handle_keymap(void *data,
xkb_state_unref(seat->xkb_state_empty);
seat->xkb_state_empty = xkb_state_new(keymap);
+ for (int i = 0; i < MOD_INDEX_NUM; i++) {
+ const GWL_ModifierInfo &mod_info = g_modifier_info_table[i];
+ seat->xkb_keymap_mod_index[i] = xkb_keymap_mod_get_index(keymap, mod_info.xkb_id);
+ }
+
+ xkb_state_unref(seat->xkb_state_empty_with_shift);
+ seat->xkb_state_empty_with_shift = nullptr;
+ {
+ const xkb_mod_index_t mod_shift = seat->xkb_keymap_mod_index[MOD_INDEX_SHIFT];
+ if (mod_shift != XKB_MOD_INVALID) {
+ seat->xkb_state_empty_with_shift = xkb_state_new(keymap);
+ xkb_state_update_mask(seat->xkb_state_empty_with_shift, (1 << mod_shift), 0, 0, 0, 0, 0);
+ }
+ }
+
xkb_state_unref(seat->xkb_state_empty_with_numlock);
seat->xkb_state_empty_with_numlock = nullptr;
-
{
const xkb_mod_index_t mod2 = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
const xkb_mod_index_t num = xkb_keymap_mod_get_index(keymap, "NumLock");
@@ -3166,10 +3354,21 @@ static void keyboard_handle_keymap(void *data,
}
}
- for (int i = 0; i < MOD_INDEX_NUM; i++) {
- const GWL_ModifierInfo &mod_info = g_modifier_info_table[i];
- seat->xkb_keymap_mod_index[i] = xkb_keymap_mod_get_index(keymap, mod_info.xkb_id);
+#ifdef USE_NON_LATIN_KB_WORKAROUND
+ seat->xkb_use_non_latin_workaround = false;
+ if (seat->xkb_state_empty_with_shift) {
+ seat->xkb_use_non_latin_workaround = true;
+ for (xkb_keycode_t key_code = KEY_1 + EVDEV_OFFSET; key_code <= KEY_0 + EVDEV_OFFSET;
+ key_code++) {
+ const xkb_keysym_t sym_test = xkb_state_key_get_one_sym(seat->xkb_state_empty_with_shift,
+ key_code);
+ if (!(sym_test >= XKB_KEY_0 && sym_test <= XKB_KEY_9)) {
+ seat->xkb_use_non_latin_workaround = false;
+ break;
+ }
+ }
}
+#endif
keyboard_depressed_state_reset(seat);
@@ -3195,7 +3394,9 @@ static void keyboard_handle_enter(void *data,
GWL_Seat *seat = static_cast<GWL_Seat *>(data);
seat->keyboard.serial = serial;
- seat->keyboard.wl_surface = wl_surface;
+ seat->keyboard.wl_surface_window = wl_surface;
+
+ seat->system->seat_active_set(seat);
/* If there are any keys held when activating the window,
* modifiers will be compared against the seat state,
@@ -3238,7 +3439,7 @@ static void keyboard_handle_leave(void *data,
CLOG_INFO(LOG, 2, "leave");
GWL_Seat *seat = static_cast<GWL_Seat *>(data);
- seat->keyboard.wl_surface = nullptr;
+ seat->keyboard.wl_surface_window = nullptr;
/* Losing focus must stop repeating text. */
if (seat->key_repeat.timer) {
@@ -3258,6 +3459,8 @@ static void keyboard_handle_leave(void *data,
static xkb_keysym_t xkb_state_key_get_one_sym_without_modifiers(
struct xkb_state *xkb_state_empty,
struct xkb_state *xkb_state_empty_with_numlock,
+ struct xkb_state *xkb_state_empty_with_shift,
+ const bool xkb_use_non_latin_workaround,
const xkb_keycode_t key)
{
/* Use an empty keyboard state to access key symbol without modifiers. */
@@ -3271,12 +3474,31 @@ static xkb_keysym_t xkb_state_key_get_one_sym_without_modifiers(
/* Accounts for key-pad keys typically swapped for numbers when number-lock is enabled:
* `Home Left Up Right Down Prior Page_Up Next Page_Dow End Begin Insert Delete`. */
- if (xkb_state_empty_with_numlock && (sym >= XKB_KEY_KP_Home && sym <= XKB_KEY_KP_Delete)) {
- const xkb_keysym_t sym_test = xkb_state_key_get_one_sym(xkb_state_empty_with_numlock, key);
- if (sym_test != XKB_KEY_NoSymbol) {
- sym = sym_test;
+ if (sym >= XKB_KEY_KP_Home && sym <= XKB_KEY_KP_Delete) {
+ if (xkb_state_empty_with_numlock) {
+ const xkb_keysym_t sym_test = xkb_state_key_get_one_sym(xkb_state_empty_with_numlock, key);
+ if (sym_test != XKB_KEY_NoSymbol) {
+ sym = sym_test;
+ }
}
}
+ else {
+#ifdef USE_NON_LATIN_KB_WORKAROUND
+ if (key >= (KEY_1 + EVDEV_OFFSET) && key <= (KEY_0 + EVDEV_OFFSET)) {
+ if (xkb_state_empty_with_shift && xkb_use_non_latin_workaround) {
+ const xkb_keysym_t sym_test = xkb_state_key_get_one_sym(xkb_state_empty_with_shift, key);
+ if (sym_test != XKB_KEY_NoSymbol) {
+ /* Should never happen as enabling `xkb_use_non_latin_workaround` checks this. */
+ GHOST_ASSERT(sym_test >= XKB_KEY_0 && sym_test <= XKB_KEY_9, "Unexpected key");
+ sym = sym_test;
+ }
+ }
+ }
+#else
+ (void)xkb_state_empty_with_shift;
+ (void)xkb_use_non_latin_workaround;
+#endif
+ }
return sym;
}
@@ -3318,7 +3540,15 @@ static void keyboard_handle_key(void *data,
const xkb_keycode_t key_code = key + EVDEV_OFFSET;
const xkb_keysym_t sym = xkb_state_key_get_one_sym_without_modifiers(
- seat->xkb_state_empty, seat->xkb_state_empty_with_numlock, key_code);
+ seat->xkb_state_empty,
+ seat->xkb_state_empty_with_numlock,
+ seat->xkb_state_empty_with_shift,
+#ifdef USE_NON_LATIN_KB_WORKAROUND
+ seat->xkb_use_non_latin_workaround,
+#else
+ false,
+#endif
+ key_code);
if (sym == XKB_KEY_NoSymbol) {
CLOG_INFO(LOG, 2, "key (code=%d, state=%u, no symbol, skipped)", int(key_code), state);
return;
@@ -3399,7 +3629,7 @@ static void keyboard_handle_key(void *data,
keyboard_depressed_state_key_event(seat, gkey, etype);
- if (wl_surface *wl_surface_focus = seat->keyboard.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->keyboard.wl_surface_window) {
GHOST_IWindow *win = ghost_wl_surface_user_data(wl_surface_focus);
seat->system->pushEvent(
new GHOST_EventKey(seat->system->getMilliSeconds(), etype, win, gkey, false, utf8_buf));
@@ -3423,7 +3653,7 @@ static void keyboard_handle_key(void *data,
task->getUserData());
GWL_Seat *seat = payload->seat;
- if (wl_surface *wl_surface_focus = seat->keyboard.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->keyboard.wl_surface_window) {
GHOST_IWindow *win = ghost_wl_surface_user_data(wl_surface_focus);
GHOST_SystemWayland *system = seat->system;
/* Calculate this value every time in case modifier keys are pressed. */
@@ -3572,33 +3802,6 @@ static void primary_selection_device_handle_selection(
GWL_PrimarySelection_DataOffer *data_offer = static_cast<GWL_PrimarySelection_DataOffer *>(
zwp_primary_selection_offer_v1_get_user_data(id));
primary->data_offer = data_offer;
-
- auto read_selection_fn = [](GWL_PrimarySelection *primary) {
- GHOST_SystemWayland *system = static_cast<GHOST_SystemWayland *>(GHOST_ISystem::getSystem());
- primary->data_offer_mutex.lock();
-
- GWL_PrimarySelection_DataOffer *data_offer = primary->data_offer;
- std::string mime_receive;
- for (const std::string type : {mime_text_utf8, mime_text_plain}) {
- if (data_offer->types.count(type)) {
- mime_receive = type;
- break;
- }
- }
- size_t data_len = 0;
- const char *data = read_buffer_from_primary_selection_offer(
- data_offer, mime_receive.c_str(), &primary->data_offer_mutex, &data_len);
-
- {
- std::mutex &clipboard_mutex = system->clipboard_mutex();
- std::lock_guard lock{clipboard_mutex};
- GWL_SimpleBuffer *buf = system->clipboard_data(true);
- gwl_simple_buffer_set_and_take_ownership(buf, data, data_len);
- }
- };
-
- std::thread read_thread(read_selection_fn, primary);
- read_thread.detach();
}
static const struct zwp_primary_selection_device_v1_listener primary_selection_device_listener = {
@@ -3626,14 +3829,19 @@ static void primary_selection_source_send(void *data,
GWL_PrimarySelection *primary = static_cast<GWL_PrimarySelection *>(data);
- std::lock_guard lock{primary->data_source_mutex};
- GWL_PrimarySelection_DataSource *data_source = primary->data_source;
+ auto write_file_fn = [](GWL_PrimarySelection *primary, const int fd) {
+ if (UNLIKELY(write(fd,
+ primary->data_source->buffer_out.data,
+ primary->data_source->buffer_out.data_size) < 0)) {
+ CLOG_WARN(LOG, "error writing to primary clipboard: %s", std::strerror(errno));
+ }
+ close(fd);
+ primary->data_source_mutex.unlock();
+ };
- const char *const buffer = data_source->buffer_out.data;
- if (UNLIKELY(write(fd, buffer, data_source->buffer_out.data_size) < 0)) {
- CLOG_WARN(LOG, "error writing to primary clipboard: %s", std::strerror(errno));
- }
- close(fd);
+ primary->data_source_mutex.lock();
+ std::thread write_thread(write_file_fn, primary, fd);
+ write_thread.detach();
}
static void primary_selection_source_cancelled(void *data,
@@ -3670,7 +3878,7 @@ static void gwl_seat_capability_pointer_enable(GWL_Seat *seat)
return;
}
seat->wl_pointer = wl_seat_get_pointer(seat->wl_seat);
- seat->cursor.wl_surface = wl_compositor_create_surface(seat->system->wl_compositor());
+ seat->cursor.wl_surface_cursor = wl_compositor_create_surface(seat->system->wl_compositor());
seat->cursor.visible = true;
seat->cursor.wl_buffer = nullptr;
if (!get_cursor_settings(seat->cursor.theme_name, seat->cursor.theme_size)) {
@@ -3679,8 +3887,8 @@ static void gwl_seat_capability_pointer_enable(GWL_Seat *seat)
}
wl_pointer_add_listener(seat->wl_pointer, &pointer_listener, seat);
- wl_surface_add_listener(seat->cursor.wl_surface, &cursor_surface_listener, seat);
- ghost_wl_surface_tag_cursor_pointer(seat->cursor.wl_surface);
+ wl_surface_add_listener(seat->cursor.wl_surface_cursor, &cursor_surface_listener, seat);
+ ghost_wl_surface_tag_cursor_pointer(seat->cursor.wl_surface_cursor);
zwp_pointer_gestures_v1 *pointer_gestures = seat->system->wp_pointer_gestures();
if (pointer_gestures) {
@@ -3751,9 +3959,9 @@ static void gwl_seat_capability_pointer_disable(GWL_Seat *seat)
#endif
}
- if (seat->cursor.wl_surface) {
- wl_surface_destroy(seat->cursor.wl_surface);
- seat->cursor.wl_surface = nullptr;
+ if (seat->cursor.wl_surface_cursor) {
+ wl_surface_destroy(seat->cursor.wl_surface_cursor);
+ seat->cursor.wl_surface_cursor = nullptr;
}
if (seat->cursor.wl_theme) {
wl_cursor_theme_destroy(seat->cursor.wl_theme);
@@ -3805,7 +4013,8 @@ static void gwl_seat_capability_touch_disable(GWL_Seat *seat)
}
static void seat_handle_capabilities(void *data,
- struct wl_seat *wl_seat,
+ /* Only used in an assert. */
+ [[maybe_unused]] struct wl_seat *wl_seat,
const uint32_t capabilities)
{
CLOG_INFO(LOG,
@@ -3838,22 +4047,6 @@ static void seat_handle_capabilities(void *data,
else {
gwl_seat_capability_touch_disable(seat);
}
-
- /* TODO(@campbellbarton): this could be moved out elsewhere. */
- if (seat->system) {
- zwp_primary_selection_device_manager_v1 *primary_selection_device_manager =
- seat->system->wp_primary_selection_manager();
- if (primary_selection_device_manager) {
- if (seat->wp_primary_selection_device == nullptr) {
- seat->wp_primary_selection_device = zwp_primary_selection_device_manager_v1_get_device(
- primary_selection_device_manager, seat->wl_seat);
-
- zwp_primary_selection_device_v1_add_listener(seat->wp_primary_selection_device,
- &primary_selection_device_listener,
- &seat->primary_selection);
- }
- }
- }
}
static void seat_handle_name(void *data, struct wl_seat * /*wl_seat*/, const char *name)
@@ -4156,9 +4349,8 @@ static void gwl_registry_compositor_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->wl_compositor = static_cast<wl_compositor *>(
- wl_registry_bind(params->wl_registry, params->name, &wl_compositor_interface, 3));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &wl_compositor_interface, 3));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_compositor_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4176,11 +4368,10 @@ static void gwl_registry_xdg_wm_base_add(GWL_Display *display,
{
GWL_XDG_Decor_System &decor = *display->xdg_decor;
decor.shell = static_cast<xdg_wm_base *>(
- wl_registry_bind(params->wl_registry, params->name, &xdg_wm_base_interface, 1));
+ wl_registry_bind(display->wl_registry, params->name, &xdg_wm_base_interface, 1));
xdg_wm_base_add_listener(decor.shell, &shell_listener, nullptr);
decor.shell_name = params->name;
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_xdg_wm_base_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4201,10 +4392,9 @@ static void gwl_registry_xdg_decoration_manager_add(GWL_Display *display,
{
GWL_XDG_Decor_System &decor = *display->xdg_decor;
decor.manager = static_cast<zxdg_decoration_manager_v1 *>(wl_registry_bind(
- params->wl_registry, params->name, &zxdg_decoration_manager_v1_interface, 1));
+ display->wl_registry, params->name, &zxdg_decoration_manager_v1_interface, 1));
decor.manager_name = params->name;
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_xdg_decoration_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4224,14 +4414,8 @@ static void gwl_registry_xdg_output_manager_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->xdg_output_manager = static_cast<zxdg_output_manager_v1 *>(
- wl_registry_bind(params->wl_registry, params->name, &zxdg_output_manager_v1_interface, 2));
- for (GWL_Output *output : display->outputs) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(display->xdg_output_manager,
- output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
- }
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &zxdg_output_manager_v1_interface, 2));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_xdg_output_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4240,10 +4424,6 @@ static void gwl_registry_xdg_output_manager_remove(GWL_Display *display,
struct zxdg_output_manager_v1 **value_p = &display->xdg_output_manager;
zxdg_output_manager_v1_destroy(*value_p);
*value_p = nullptr;
-
- for (GWL_Output *output : display->outputs) {
- output->xdg_output = nullptr;
- }
}
/* #GWL_Display.wl_output */
@@ -4253,26 +4433,35 @@ static void gwl_registry_wl_output_add(GWL_Display *display, const GWL_Registery
GWL_Output *output = new GWL_Output;
output->system = display->system;
output->wl_output = static_cast<wl_output *>(
- wl_registry_bind(params->wl_registry, params->name, &wl_output_interface, 2));
+ wl_registry_bind(display->wl_registry, params->name, &wl_output_interface, 2));
ghost_wl_output_tag(output->wl_output);
wl_output_set_user_data(output->wl_output, output);
display->outputs.push_back(output);
wl_output_add_listener(output->wl_output, &output_listener, output);
-
+ gwl_registry_entry_add(display, params, static_cast<void *>(output));
+}
+static void gwl_registry_wl_output_update(GWL_Display *display,
+ const GWL_RegisteryUpdate_Params *params)
+{
+ GWL_Output *output = static_cast<GWL_Output *>(params->user_data);
if (display->xdg_output_manager) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(display->xdg_output_manager,
- output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
+ if (output->xdg_output == nullptr) {
+ output->xdg_output = zxdg_output_manager_v1_get_xdg_output(display->xdg_output_manager,
+ output->wl_output);
+ zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
+ }
+ }
+ else {
+ output->xdg_output = nullptr;
}
-
- gwl_registry_entry_add(
- display, params->interface_slot, params->name, static_cast<void *>(output));
}
static void gwl_registry_wl_output_remove(GWL_Display *display,
void *user_data,
const bool /*on_exit*/)
{
+ /* While windows & cursors hold references to outputs, there is no need to manually remove
+ * these references as the compositor will remove references via #wl_surface_listener.leave. */
GWL_Output *output = static_cast<GWL_Output *>(user_data);
wl_output_destroy(output->wl_output);
std::vector<GWL_Output *>::iterator iter = std::find(
@@ -4295,11 +4484,52 @@ static void gwl_registry_wl_seat_add(GWL_Display *display, const GWL_RegisteryAd
seat->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
seat->data_source = new GWL_DataSource;
seat->wl_seat = static_cast<wl_seat *>(
- wl_registry_bind(params->wl_registry, params->name, &wl_seat_interface, 5));
+ wl_registry_bind(display->wl_registry, params->name, &wl_seat_interface, 5));
display->seats.push_back(seat);
wl_seat_add_listener(seat->wl_seat, &seat_listener, seat);
+ gwl_registry_entry_add(display, params, static_cast<void *>(seat));
+}
+static void gwl_registry_wl_seat_update(GWL_Display *display,
+ const GWL_RegisteryUpdate_Params *params)
+{
+ GWL_Seat *seat = static_cast<GWL_Seat *>(params->user_data);
+
+ /* Register data device per seat for IPC between WAYLAND clients. */
+ if (display->wl_data_device_manager) {
+ if (seat->wl_data_device == nullptr) {
+ seat->wl_data_device = wl_data_device_manager_get_data_device(
+ display->wl_data_device_manager, seat->wl_seat);
+ wl_data_device_add_listener(seat->wl_data_device, &data_device_listener, seat);
+ }
+ }
+ else {
+ seat->wl_data_device = nullptr;
+ }
+
+ if (display->wp_tablet_manager) {
+ if (seat->wp_tablet_seat == nullptr) {
+ seat->wp_tablet_seat = zwp_tablet_manager_v2_get_tablet_seat(display->wp_tablet_manager,
+ seat->wl_seat);
+ zwp_tablet_seat_v2_add_listener(seat->wp_tablet_seat, &tablet_seat_listener, seat);
+ }
+ }
+ else {
+ seat->wp_tablet_seat = nullptr;
+ }
- gwl_registry_entry_add(display, params->interface_slot, params->name, static_cast<void *>(seat));
+ if (display->wp_primary_selection_device_manager) {
+ if (seat->wp_primary_selection_device == nullptr) {
+ seat->wp_primary_selection_device = zwp_primary_selection_device_manager_v1_get_device(
+ display->wp_primary_selection_device_manager, seat->wl_seat);
+
+ zwp_primary_selection_device_v1_add_listener(seat->wp_primary_selection_device,
+ &primary_selection_device_listener,
+ &seat->primary_selection);
+ }
+ }
+ else {
+ seat->wp_primary_selection_device = nullptr;
+ }
}
static void gwl_registry_wl_seat_remove(GWL_Display *display, void *user_data, const bool on_exit)
{
@@ -4370,6 +4600,7 @@ static void gwl_registry_wl_seat_remove(GWL_Display *display, void *user_data, c
/* Un-referencing checks for NULL case. */
xkb_state_unref(seat->xkb_state);
xkb_state_unref(seat->xkb_state_empty);
+ xkb_state_unref(seat->xkb_state_empty_with_shift);
xkb_state_unref(seat->xkb_state_empty_with_numlock);
xkb_context_unref(seat->xkb_context);
@@ -4384,6 +4615,9 @@ static void gwl_registry_wl_seat_remove(GWL_Display *display, void *user_data, c
GHOST_ASSERT(index != -1, "invalid internal state");
if (!on_exit) {
+ if (display->seats_active_index >= index) {
+ display->seats_active_index -= 1;
+ }
display->seats.erase(display->seats.begin() + index);
}
delete seat;
@@ -4394,9 +4628,8 @@ static void gwl_registry_wl_seat_remove(GWL_Display *display, void *user_data, c
static void gwl_registry_wl_shm_add(GWL_Display *display, const GWL_RegisteryAdd_Params *params)
{
display->wl_shm = static_cast<wl_shm *>(
- wl_registry_bind(params->wl_registry, params->name, &wl_shm_interface, 1));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &wl_shm_interface, 1));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wl_shm_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4413,9 +4646,8 @@ static void gwl_registry_wl_data_device_manager_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->wl_data_device_manager = static_cast<wl_data_device_manager *>(
- wl_registry_bind(params->wl_registry, params->name, &wl_data_device_manager_interface, 3));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &wl_data_device_manager_interface, 3));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wl_data_device_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4432,9 +4664,8 @@ static void gwl_registry_wp_tablet_manager_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->wp_tablet_manager = static_cast<zwp_tablet_manager_v2 *>(
- wl_registry_bind(params->wl_registry, params->name, &zwp_tablet_manager_v2_interface, 1));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &zwp_tablet_manager_v2_interface, 1));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wp_tablet_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4452,9 +4683,8 @@ static void gwl_registry_wp_relative_pointer_manager_add(GWL_Display *display,
{
display->wp_relative_pointer_manager = static_cast<zwp_relative_pointer_manager_v1 *>(
wl_registry_bind(
- params->wl_registry, params->name, &zwp_relative_pointer_manager_v1_interface, 1));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ display->wl_registry, params->name, &zwp_relative_pointer_manager_v1_interface, 1));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wp_relative_pointer_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4471,9 +4701,8 @@ static void gwl_registry_wp_pointer_constraints_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->wp_pointer_constraints = static_cast<zwp_pointer_constraints_v1 *>(wl_registry_bind(
- params->wl_registry, params->name, &zwp_pointer_constraints_v1_interface, 1));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ display->wl_registry, params->name, &zwp_pointer_constraints_v1_interface, 1));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wp_pointer_constraints_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4490,9 +4719,8 @@ static void gwl_registry_wp_pointer_gestures_add(GWL_Display *display,
const GWL_RegisteryAdd_Params *params)
{
display->wp_pointer_gestures = static_cast<zwp_pointer_gestures_v1 *>(
- wl_registry_bind(params->wl_registry, params->name, &zwp_pointer_gestures_v1_interface, 3));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ wl_registry_bind(display->wl_registry, params->name, &zwp_pointer_gestures_v1_interface, 3));
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wp_pointer_gestures_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4510,12 +4738,11 @@ static void gwl_registry_wp_primary_selection_device_manager_add(
{
display->wp_primary_selection_device_manager =
static_cast<zwp_primary_selection_device_manager_v1 *>(
- wl_registry_bind(params->wl_registry,
+ wl_registry_bind(display->wl_registry,
params->name,
&zwp_primary_selection_device_manager_v1_interface,
1));
-
- gwl_registry_entry_add(display, params->interface_slot, params->name, nullptr);
+ gwl_registry_entry_add(display, params, nullptr);
}
static void gwl_registry_wp_primary_selection_device_manager_remove(GWL_Display *display,
void * /*user_data*/,
@@ -4528,76 +4755,100 @@ static void gwl_registry_wp_primary_selection_device_manager_remove(GWL_Display
}
/**
- * Map interfaces to to initialization functions.
+ * Map interfaces to initialization functions.
+ *
+ * \note This list also defines the order interfaces are removed.
+ * On exit interface removal runs from last to first to avoid potential bugs
+ * caused by undefined order of removal.
*
- * \note This list also defines the order interfaces are freed: from last to first,
- * so the most fundamental objects such as the compositor are freed last.
+ * In general fundamental, low level objects such as the compositor and shared memory
+ * should be declared earlier and other interfaces that may use them should be declared later.
*/
static const GWL_RegistryHandler gwl_registry_handlers[] = {
+ /* Low level interfaces. */
{
&wl_compositor_interface.name,
gwl_registry_compositor_add,
+ nullptr,
gwl_registry_compositor_remove,
},
{
+ &wl_shm_interface.name,
+ gwl_registry_wl_shm_add,
+ nullptr,
+ gwl_registry_wl_shm_remove,
+ },
+ {
&xdg_wm_base_interface.name,
gwl_registry_xdg_wm_base_add,
+ nullptr,
gwl_registry_xdg_wm_base_remove,
},
+ /* Managers. */
{
&zxdg_decoration_manager_v1_interface.name,
gwl_registry_xdg_decoration_manager_add,
+ nullptr,
gwl_registry_xdg_decoration_manager_remove,
},
{
&zxdg_output_manager_v1_interface.name,
gwl_registry_xdg_output_manager_add,
+ nullptr,
gwl_registry_xdg_output_manager_remove,
},
{
- &wl_output_interface.name,
- gwl_registry_wl_output_add,
- gwl_registry_wl_output_remove,
- },
- {
- &wl_seat_interface.name,
- gwl_registry_wl_seat_add,
- gwl_registry_wl_seat_remove,
- },
- {
- &wl_shm_interface.name,
- gwl_registry_wl_shm_add,
- gwl_registry_wl_shm_remove,
- },
- {
&wl_data_device_manager_interface.name,
gwl_registry_wl_data_device_manager_add,
+ nullptr,
gwl_registry_wl_data_device_manager_remove,
},
{
+ &zwp_primary_selection_device_manager_v1_interface.name,
+ gwl_registry_wp_primary_selection_device_manager_add,
+ nullptr,
+ gwl_registry_wp_primary_selection_device_manager_remove,
+ },
+ {
&zwp_tablet_manager_v2_interface.name,
gwl_registry_wp_tablet_manager_add,
+ nullptr,
gwl_registry_wp_tablet_manager_remove,
},
{
&zwp_relative_pointer_manager_v1_interface.name,
gwl_registry_wp_relative_pointer_manager_add,
+ nullptr,
gwl_registry_wp_relative_pointer_manager_remove,
},
+ /* Higher level interfaces. */
{
&zwp_pointer_constraints_v1_interface.name,
gwl_registry_wp_pointer_constraints_add,
+ nullptr,
gwl_registry_wp_pointer_constraints_remove,
},
{
&zwp_pointer_gestures_v1_interface.name,
gwl_registry_wp_pointer_gestures_add,
+ nullptr,
gwl_registry_wp_pointer_gestures_remove,
},
+ /* Display outputs. */
{
- &zwp_primary_selection_device_manager_v1_interface.name,
- gwl_registry_wp_primary_selection_device_manager_add,
- gwl_registry_wp_primary_selection_device_manager_remove,
+ &wl_output_interface.name,
+ gwl_registry_wl_output_add,
+ gwl_registry_wl_output_update,
+ gwl_registry_wl_output_remove,
+ },
+ /* Seats.
+ * Keep the seat near the end to ensure other types are created first.
+ * as the seat creates data based on other interfaces. */
+ {
+ &wl_seat_interface.name,
+ gwl_registry_wl_seat_add,
+ gwl_registry_wl_seat_update,
+ gwl_registry_wl_seat_remove,
},
{nullptr, nullptr, nullptr},
};
@@ -4611,6 +4862,17 @@ static int gwl_registry_handler_interface_slot_max()
return ARRAY_SIZE(gwl_registry_handlers) - 1;
}
+static int gwl_registry_handler_interface_slot_from_string(const char *interface)
+{
+ for (const GWL_RegistryHandler *handler = gwl_registry_handlers; handler->interface_p != nullptr;
+ handler++) {
+ if (STREQ(interface, *handler->interface_p)) {
+ return int(handler - gwl_registry_handlers);
+ }
+ }
+ return -1;
+}
+
static const GWL_RegistryHandler *gwl_registry_handler_from_interface_slot(int interface_slot)
{
GHOST_ASSERT(uint32_t(interface_slot) < uint32_t(gwl_registry_handler_interface_slot_max()),
@@ -4619,40 +4881,35 @@ static const GWL_RegistryHandler *gwl_registry_handler_from_interface_slot(int i
}
static void global_handle_add(void *data,
- struct wl_registry *wl_registry,
+ [[maybe_unused]] struct wl_registry *wl_registry,
const uint32_t name,
const char *interface,
const uint32_t version)
{
/* Log last since it's useful to know if the interface was handled or not. */
-
GWL_Display *display = static_cast<GWL_Display *>(data);
- /* The interface name that is ensured not to be freed. */
- GWL_RegisteryAdd_Params params = {
- .wl_registry = wl_registry,
- .name = name,
- .version = version,
- .interface_slot = 0,
- };
+ GHOST_ASSERT(display->wl_registry == wl_registry, "Registry argument must match!");
- bool found = false, added = false;
- for (const GWL_RegistryHandler *handler = gwl_registry_handlers; handler->interface_p != nullptr;
- handler++) {
- if (!STREQ(interface, *handler->interface_p)) {
- continue;
- }
+ const int interface_slot = gwl_registry_handler_interface_slot_from_string(interface);
+ bool added = false;
+
+ if (interface_slot != -1) {
+ const GWL_RegistryHandler *handler = &gwl_registry_handlers[interface_slot];
const GWL_RegistryEntry *registry_entry_prev = display->registry_entry;
- params.interface_slot = int(handler - gwl_registry_handlers);
+
+ /* The interface name that is ensured not to be freed. */
+ GWL_RegisteryAdd_Params params = {
+ .name = name,
+ .interface_slot = interface_slot,
+ .version = version,
+ };
handler->add_fn(display, &params);
added = display->registry_entry != registry_entry_prev;
- found = true;
- break;
}
-
- /* Not found. */
- if (!found) {
+ else {
+ /* Not found. */
#ifdef USE_GNOME_NEEDS_LIBDECOR_HACK
if (STRPREFIX(interface, "gtk_shell")) { /* `gtk_shell1` at time of writing. */
/* Only require `libdecor` when built with X11 support,
@@ -4665,10 +4922,18 @@ static void global_handle_add(void *data,
CLOG_INFO(LOG,
2,
"add %s(interface=%s, version=%u, name=%u)",
- found ? (added ? "" : "(found but not added)") : "(skipped), ",
+ (interface_slot != -1) ? (added ? "" : "(found but not added)") : "(skipped), ",
interface,
version,
name);
+
+ /* Initialization avoids excessive calls by calling update after all have been initialized. */
+ if (added) {
+ if (display->registry_skip_update_all == false) {
+ /* See doc-string for rationale on updating all on add/removal. */
+ gwl_registry_entry_update_all(display, interface_slot);
+ }
+ }
}
/**
@@ -4681,18 +4946,27 @@ static void global_handle_add(void *data,
* using the bind request, the client should now destroy that object.
*/
static void global_handle_remove(void *data,
- struct wl_registry * /*wl_registry*/,
+ [[maybe_unused]] struct wl_registry *wl_registry,
const uint32_t name)
{
GWL_Display *display = static_cast<GWL_Display *>(data);
+ GHOST_ASSERT(display->wl_registry == wl_registry, "Registry argument must match!");
+
int interface_slot = 0;
- bool found = gwl_registry_entry_remove_by_name(display, name, &interface_slot);
+ const bool removed = gwl_registry_entry_remove_by_name(display, name, &interface_slot);
+
CLOG_INFO(LOG,
2,
- "remove (name=%u, interface=%s), %s",
+ "remove (name=%u, interface=%s)",
name,
- *gwl_registry_handlers[interface_slot].interface_p,
- found ? "(known)" : "(unknown)");
+ removed ? *gwl_registry_handlers[interface_slot].interface_p : "(unknown)");
+
+ if (removed) {
+ if (display->registry_skip_update_all == false) {
+ /* See doc-string for rationale on updating all on add/removal. */
+ gwl_registry_entry_update_all(display, interface_slot);
+ }
+ }
}
static const struct wl_registry_listener registry_listener = {
@@ -4727,13 +5001,21 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
display_->xdg_decor = new GWL_XDG_Decor_System;
/* Register interfaces. */
- struct wl_registry *registry = wl_display_get_registry(display_->wl_display);
- wl_registry_add_listener(registry, &registry_listener, display_);
- /* Call callback for registry listener. */
- wl_display_roundtrip(display_->wl_display);
- /* Call callbacks for registered listeners. */
- wl_display_roundtrip(display_->wl_display);
- wl_registry_destroy(registry);
+ {
+ display_->registry_skip_update_all = true;
+ struct wl_registry *registry = wl_display_get_registry(display_->wl_display);
+ display_->wl_registry = registry;
+ wl_registry_add_listener(registry, &registry_listener, display_);
+ /* First round-trip to receive all registry objects. */
+ wl_display_roundtrip(display_->wl_display);
+ /* Second round-trip to receive all output events. */
+ wl_display_roundtrip(display_->wl_display);
+
+ /* Account for dependencies between interfaces. */
+ gwl_registry_entry_update_all(display_, -1);
+
+ display_->registry_skip_update_all = false;
+ }
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
/* Ignore windowing requirements when running in background mode,
@@ -4785,23 +5067,6 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
throw std::runtime_error("Wayland: unable to access xdg_shell!");
}
}
-
- /* Register data device per seat for IPC between Wayland clients. */
- if (display_->wl_data_device_manager) {
- for (GWL_Seat *seat : display_->seats) {
- seat->wl_data_device = wl_data_device_manager_get_data_device(
- display_->wl_data_device_manager, seat->wl_seat);
- wl_data_device_add_listener(seat->wl_data_device, &data_device_listener, seat);
- }
- }
-
- if (display_->wp_tablet_manager) {
- for (GWL_Seat *seat : display_->seats) {
- seat->wp_tablet_seat = zwp_tablet_manager_v2_get_tablet_seat(display_->wp_tablet_manager,
- seat->wl_seat);
- zwp_tablet_seat_v2_add_listener(seat->wp_tablet_seat, &tablet_seat_listener, seat);
- }
- }
}
GHOST_SystemWayland::~GHOST_SystemWayland()
@@ -4861,12 +5126,11 @@ bool GHOST_SystemWayland::setConsoleWindowState(GHOST_TConsoleWindowState /*acti
GHOST_TSuccess GHOST_SystemWayland::getModifierKeys(GHOST_ModifierKeys &keys) const
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
-
const xkb_mod_mask_t state = xkb_state_serialize_mods(seat->xkb_state, XKB_STATE_MODS_DEPRESSED);
bool show_warning = true;
@@ -4923,10 +5187,10 @@ GHOST_TSuccess GHOST_SystemWayland::getModifierKeys(GHOST_ModifierKeys &keys) co
GHOST_TSuccess GHOST_SystemWayland::getButtons(GHOST_Buttons &buttons) const
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
GWL_SeatStatePointer *seat_state_pointer = gwl_seat_state_pointer_active(seat);
if (!seat_state_pointer) {
return GHOST_kFailure;
@@ -4936,13 +5200,131 @@ GHOST_TSuccess GHOST_SystemWayland::getButtons(GHOST_Buttons &buttons) const
return GHOST_kSuccess;
}
-char *GHOST_SystemWayland::getClipboard(bool selection) const
+/**
+ * Return a mime type which is supported by GHOST and exists in `types`
+ * (defined by the data offer).
+ */
+static const char *system_clipboard_text_mime_type(
+ const std::unordered_set<std::string> &data_offer_types)
{
- const GWL_SimpleBuffer *buf = clipboard_data(selection);
- if (buf->data == nullptr) {
+ const char *ghost_supported_types[] = {ghost_wl_mime_text_utf8, ghost_wl_mime_text_plain};
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_supported_types); i++) {
+ if (data_offer_types.count(ghost_supported_types[i])) {
+ return ghost_supported_types[i];
+ }
+ }
+ return nullptr;
+}
+
+static char *system_clipboard_get_primary_selection(GWL_Display *display)
+{
+ GWL_Seat *seat = gwl_display_seat_active_get(display);
+ if (UNLIKELY(!seat)) {
return nullptr;
}
- return gwl_simple_buffer_as_string(buf);
+ GWL_PrimarySelection *primary = &seat->primary_selection;
+ std::mutex &mutex = primary->data_offer_mutex;
+
+ mutex.lock();
+ bool mutex_locked = true;
+ char *data = nullptr;
+
+ GWL_PrimarySelection_DataOffer *data_offer = primary->data_offer;
+ if (data_offer != nullptr) {
+ const char *mime_receive = system_clipboard_text_mime_type(data_offer->types);
+ if (mime_receive) {
+ /* Receive the clipboard in a thread, performing round-trips while waiting.
+ * This is needed so pasting contents from our own `primary->data_source` doesn't hang. */
+ struct ThreadResult {
+ char *data = nullptr;
+ std::atomic<bool> done = false;
+ } thread_result;
+ auto read_clipboard_fn = [](GWL_PrimarySelection_DataOffer *data_offer,
+ const char *mime_receive,
+ std::mutex *mutex,
+ struct ThreadResult *thread_result) {
+ size_t data_len = 0;
+ thread_result->data = read_buffer_from_primary_selection_offer(
+ data_offer, mime_receive, mutex, true, &data_len);
+ thread_result->done = true;
+ };
+ std::thread read_thread(read_clipboard_fn, data_offer, mime_receive, &mutex, &thread_result);
+ read_thread.detach();
+
+ while (!thread_result.done) {
+ wl_display_roundtrip(display->wl_display);
+ }
+ data = thread_result.data;
+
+ /* Reading the data offer unlocks the mutex. */
+ mutex_locked = false;
+ }
+ }
+ if (mutex_locked) {
+ mutex.unlock();
+ }
+ return data;
+}
+
+static char *system_clipboard_get(GWL_Display *display)
+{
+ GWL_Seat *seat = gwl_display_seat_active_get(display);
+ if (UNLIKELY(!seat)) {
+ return nullptr;
+ }
+ std::mutex &mutex = seat->data_offer_copy_paste_mutex;
+
+ mutex.lock();
+ bool mutex_locked = true;
+ char *data = nullptr;
+
+ GWL_DataOffer *data_offer = seat->data_offer_copy_paste;
+ if (data_offer != nullptr) {
+ const char *mime_receive = system_clipboard_text_mime_type(data_offer->types);
+ if (mime_receive) {
+ /* Receive the clipboard in a thread, performing round-trips while waiting.
+ * This is needed so pasting contents from our own `seat->data_source` doesn't hang. */
+ struct ThreadResult {
+ char *data = nullptr;
+ std::atomic<bool> done = false;
+ } thread_result;
+ auto read_clipboard_fn = [](GWL_DataOffer *data_offer,
+ const char *mime_receive,
+ std::mutex *mutex,
+ struct ThreadResult *thread_result) {
+ size_t data_len = 0;
+ thread_result->data = read_buffer_from_data_offer(
+ data_offer, mime_receive, mutex, true, &data_len);
+ thread_result->done = true;
+ };
+ std::thread read_thread(read_clipboard_fn, data_offer, mime_receive, &mutex, &thread_result);
+ read_thread.detach();
+
+ while (!thread_result.done) {
+ wl_display_roundtrip(display->wl_display);
+ }
+ data = thread_result.data;
+
+ /* Reading the data offer unlocks the mutex. */
+ mutex_locked = false;
+ }
+ }
+ if (mutex_locked) {
+ mutex.unlock();
+ }
+ return data;
+}
+
+char *GHOST_SystemWayland::getClipboard(bool selection) const
+{
+ char *data = nullptr;
+ if (selection) {
+ data = system_clipboard_get_primary_selection(display_);
+ }
+ else {
+ data = system_clipboard_get(display_);
+ }
+ return data;
}
static void system_clipboard_put_primary_selection(GWL_Display *display, const char *buffer)
@@ -4950,7 +5332,10 @@ static void system_clipboard_put_primary_selection(GWL_Display *display, const c
if (!display->wp_primary_selection_device_manager) {
return;
}
- GWL_Seat *seat = display->seats[0];
+ GWL_Seat *seat = gwl_display_seat_active_get(display);
+ if (UNLIKELY(!seat)) {
+ return;
+ }
GWL_PrimarySelection *primary = &seat->primary_selection;
std::lock_guard lock{primary->data_source_mutex};
@@ -4969,8 +5354,8 @@ static void system_clipboard_put_primary_selection(GWL_Display *display, const c
zwp_primary_selection_source_v1_add_listener(
data_source->wp_source, &primary_selection_source_listener, primary);
- for (const std::string &type : mime_send) {
- zwp_primary_selection_source_v1_offer(data_source->wp_source, type.c_str());
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_wl_mime_send); i++) {
+ zwp_primary_selection_source_v1_offer(data_source->wp_source, ghost_wl_mime_send[i]);
}
if (seat->wp_primary_selection_device) {
@@ -4981,8 +5366,13 @@ static void system_clipboard_put_primary_selection(GWL_Display *display, const c
static void system_clipboard_put(GWL_Display *display, const char *buffer)
{
- GWL_Seat *seat = display->seats[0];
-
+ if (!display->wl_data_device_manager) {
+ return;
+ }
+ GWL_Seat *seat = gwl_display_seat_active_get(display);
+ if (UNLIKELY(!seat)) {
+ return;
+ }
std::lock_guard lock{seat->data_source_mutex};
GWL_DataSource *data_source = seat->data_source;
@@ -4995,8 +5385,8 @@ static void system_clipboard_put(GWL_Display *display, const char *buffer)
wl_data_source_add_listener(data_source->wl_source, &data_source_listener, seat);
- for (const std::string &type : mime_send) {
- wl_data_source_offer(data_source->wl_source, type.c_str());
+ for (size_t i = 0; i < ARRAY_SIZE(ghost_wl_mime_send); i++) {
+ wl_data_source_offer(data_source->wl_source, ghost_wl_mime_send[i]);
}
if (seat->wl_data_device) {
@@ -5007,10 +5397,6 @@ static void system_clipboard_put(GWL_Display *display, const char *buffer)
void GHOST_SystemWayland::putClipboard(const char *buffer, bool selection) const
{
- if (UNLIKELY(!display_->wl_data_device_manager || display_->seats.empty())) {
- return;
- }
-
if (selection) {
system_clipboard_put_primary_selection(display_, buffer);
}
@@ -5063,12 +5449,12 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorPositionClientRelative(const GHOST_
int32_t &x,
int32_t &y) const
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
GWL_SeatStatePointer *seat_state_pointer = gwl_seat_state_pointer_active(seat);
- if (!seat_state_pointer || !seat_state_pointer->wl_surface) {
+ if (!seat_state_pointer || !seat_state_pointer->wl_surface_window) {
return GHOST_kFailure;
}
const GHOST_WindowWayland *win = static_cast<const GHOST_WindowWayland *>(window);
@@ -5079,26 +5465,26 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorPositionClientRelative(GHOST_IWindo
const int32_t x,
const int32_t y)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
GHOST_WindowWayland *win = static_cast<GHOST_WindowWayland *>(window);
return setCursorPositionClientRelative_impl(seat, win, x, y);
}
GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(int32_t &x, int32_t &y) const
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
GWL_SeatStatePointer *seat_state_pointer = gwl_seat_state_pointer_active(seat);
if (!seat_state_pointer) {
return GHOST_kFailure;
}
- if (wl_surface *wl_surface_focus = seat_state_pointer->wl_surface) {
+ if (wl_surface *wl_surface_focus = seat_state_pointer->wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
return getCursorPositionClientRelative_impl(seat_state_pointer, win, x, y);
}
@@ -5107,14 +5493,14 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(int32_t &x, int32_t &y) co
GHOST_TSuccess GHOST_SystemWayland::setCursorPosition(const int32_t x, const int32_t y)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
/* Intentionally different from `getCursorPosition` which supports both tablet & pointer.
* In the case of setting the cursor location, tablets don't support this. */
- if (wl_surface *wl_surface_focus = seat->pointer.wl_surface) {
+ if (wl_surface *wl_surface_focus = seat->pointer.wl_surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
return setCursorPositionClientRelative_impl(seat, win, x, y);
}
@@ -5288,7 +5674,7 @@ static void cursor_buffer_show(const GWL_Seat *seat)
const int32_t hotspot_y = int32_t(cursor->wl_image.hotspot_y) / scale;
if (seat->wl_pointer) {
wl_pointer_set_cursor(
- seat->wl_pointer, seat->pointer.serial, cursor->wl_surface, hotspot_x, hotspot_y);
+ seat->wl_pointer, seat->pointer.serial, cursor->wl_surface_cursor, hotspot_x, hotspot_y);
}
}
@@ -5372,10 +5758,10 @@ static void cursor_buffer_set(const GWL_Seat *seat, wl_buffer *buffer)
wl_image, cursor->is_custom ? cursor->custom_scale : seat->pointer.theme_scale);
const int32_t hotspot_x = int32_t(wl_image->hotspot_x) / scale;
const int32_t hotspot_y = int32_t(wl_image->hotspot_y) / scale;
- cursor_buffer_set_surface_impl(seat, buffer, cursor->wl_surface, scale);
+ cursor_buffer_set_surface_impl(seat, buffer, cursor->wl_surface_cursor, scale);
wl_pointer_set_cursor(seat->wl_pointer,
seat->pointer.serial,
- visible ? cursor->wl_surface : nullptr,
+ visible ? cursor->wl_surface_cursor : nullptr,
hotspot_x,
hotspot_y);
}
@@ -5461,15 +5847,15 @@ static bool cursor_is_software(const GHOST_TGrabCursorMode mode, const bool use_
GHOST_TSuccess GHOST_SystemWayland::setCursorShape(const GHOST_TStandardCursor shape)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- auto cursor_find = cursors.find(shape);
- const char *cursor_name = (cursor_find == cursors.end()) ?
- cursors.at(GHOST_kStandardCursorDefault) :
+ auto cursor_find = ghost_wl_cursors.find(shape);
+ const char *cursor_name = (cursor_find == ghost_wl_cursors.end()) ?
+ ghost_wl_cursors.at(GHOST_kStandardCursorDefault) :
(*cursor_find).second;
- GWL_Seat *seat = display_->seats[0];
GWL_Cursor *cursor = &seat->cursor;
if (!cursor->wl_theme) {
@@ -5503,8 +5889,8 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorShape(const GHOST_TStandardCursor s
GHOST_TSuccess GHOST_SystemWayland::hasCursorShape(const GHOST_TStandardCursor cursorShape)
{
- auto cursor_find = cursors.find(cursorShape);
- if (cursor_find == cursors.end()) {
+ auto cursor_find = ghost_wl_cursors.find(cursorShape);
+ if (cursor_find == ghost_wl_cursors.end()) {
return GHOST_kFailure;
}
const char *value = (*cursor_find).second;
@@ -5522,12 +5908,12 @@ GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
const int hotY,
const bool /*canInvertColor*/)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Cursor *cursor = &display_->seats[0]->cursor;
-
+ GWL_Cursor *cursor = &seat->cursor;
if (cursor->custom_data) {
munmap(cursor->custom_data, cursor->custom_data_size);
cursor->custom_data = nullptr;
@@ -5585,14 +5971,19 @@ GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
cursor->wl_image.hotspot_x = uint32_t(hotX);
cursor->wl_image.hotspot_y = uint32_t(hotY);
- cursor_buffer_set(display_->seats[0], buffer);
+ cursor_buffer_set(seat, buffer);
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
{
- GWL_Cursor *cursor = &display_->seats[0]->cursor;
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
+ return GHOST_kFailure;
+ }
+
+ GWL_Cursor *cursor = &seat->cursor;
if (cursor->custom_data == nullptr) {
return GHOST_kFailure;
}
@@ -5613,11 +6004,11 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorBitmap(GHOST_CursorBitmapRef *bitma
GHOST_TSuccess GHOST_SystemWayland::setCursorVisibility(const bool visible)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
- GWL_Seat *seat = display_->seats[0];
cursor_visible_set(seat, visible, seat->cursor.is_hardware, CURSOR_VISIBLE_ALWAYS_SET);
return GHOST_kSuccess;
}
@@ -5637,12 +6028,12 @@ bool GHOST_SystemWayland::supportsWindowPosition()
bool GHOST_SystemWayland::getCursorGrabUseSoftwareDisplay(const GHOST_TGrabCursorMode mode)
{
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return false;
}
#ifdef USE_GNOME_CONFINE_HACK
- GWL_Seat *seat = display_->seats[0];
const bool use_software_confine = seat->use_pointer_software_confine;
#else
const bool use_software_confine = false;
@@ -5830,6 +6221,11 @@ GHOST_WindowWayland *ghost_wl_surface_user_data(struct wl_surface *wl_surface)
* Functionality only used for the WAYLAND implementation.
* \{ */
+void GHOST_SystemWayland::seat_active_set(const struct GWL_Seat *seat)
+{
+ gwl_display_seat_active_set(display_, seat);
+}
+
void GHOST_SystemWayland::window_surface_unref(const wl_surface *wl_surface)
{
#define SURFACE_CLEAR_PTR(surface_test) \
@@ -5840,10 +6236,10 @@ void GHOST_SystemWayland::window_surface_unref(const wl_surface *wl_surface)
/* Only clear window surfaces (not cursors, off-screen surfaces etc). */
for (GWL_Seat *seat : display_->seats) {
- SURFACE_CLEAR_PTR(seat->pointer.wl_surface);
- SURFACE_CLEAR_PTR(seat->tablet.wl_surface);
- SURFACE_CLEAR_PTR(seat->keyboard.wl_surface);
- SURFACE_CLEAR_PTR(seat->wl_surface_focus_dnd);
+ SURFACE_CLEAR_PTR(seat->pointer.wl_surface_window);
+ SURFACE_CLEAR_PTR(seat->tablet.wl_surface_window);
+ SURFACE_CLEAR_PTR(seat->keyboard.wl_surface_window);
+ SURFACE_CLEAR_PTR(seat->wl_surface_window_focus_dnd);
}
#undef SURFACE_CLEAR_PTR
}
@@ -5861,7 +6257,8 @@ bool GHOST_SystemWayland::window_cursor_grab_set(const GHOST_TGrabCursorMode mod
return GHOST_kFailure;
}
- if (UNLIKELY(display_->seats.empty())) {
+ GWL_Seat *seat = gwl_display_seat_active_get(display_);
+ if (UNLIKELY(!seat)) {
return GHOST_kFailure;
}
/* No change, success. */
@@ -5869,8 +6266,6 @@ bool GHOST_SystemWayland::window_cursor_grab_set(const GHOST_TGrabCursorMode mod
return GHOST_kSuccess;
}
- GWL_Seat *seat = display_->seats[0];
-
#ifdef USE_GNOME_CONFINE_HACK
const bool was_software_confine = seat->use_pointer_software_confine;
const bool use_software_confine = setCursorGrab_use_software_confine(mode, wl_surface);
@@ -6031,16 +6426,6 @@ bool GHOST_SystemWayland::window_cursor_grab_set(const GHOST_TGrabCursorMode mod
return GHOST_kSuccess;
}
-struct GWL_SimpleBuffer *GHOST_SystemWayland::clipboard_data(bool selection) const
-{
- return selection ? &display_->clipboard_primary : &display_->clipboard;
-}
-
-struct std::mutex &GHOST_SystemWayland::clipboard_mutex() const
-{
- return display_->clipboard_mutex;
-}
-
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
bool GHOST_SystemWayland::use_libdecor_runtime()
{
diff --git a/intern/ghost/intern/GHOST_SystemWayland.h b/intern/ghost/intern/GHOST_SystemWayland.h
index 7c5459fc461..a8e8d8ddc45 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.h
+++ b/intern/ghost/intern/GHOST_SystemWayland.h
@@ -178,6 +178,9 @@ class GHOST_SystemWayland : public GHOST_System {
/* WAYLAND utility functions. */
+ /** Set this seat to be active. */
+ void seat_active_set(const struct GWL_Seat *seat);
+
/** Clear all references to this surface to prevent accessing NULL pointers. */
void window_surface_unref(const wl_surface *wl_surface);
@@ -189,9 +192,6 @@ class GHOST_SystemWayland : public GHOST_System {
wl_surface *wl_surface,
int scale);
- struct GWL_SimpleBuffer *clipboard_data(bool selection) const;
- struct std::mutex &clipboard_mutex() const;
-
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
static bool use_libdecor_runtime();
#endif
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 1c0991bba30..396691fa161 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -74,7 +74,7 @@ class GHOST_Window : public GHOST_IWindow {
*/
virtual bool getValid() const override
{
- return m_context != NULL;
+ return m_context != nullptr;
}
/**
@@ -283,8 +283,9 @@ class GHOST_Window : public GHOST_IWindow {
float getNativePixelSize(void) override
{
- if (m_nativePixelSize > 0.0f)
+ if (m_nativePixelSize > 0.0f) {
return m_nativePixelSize;
+ }
return 1.0f;
}
@@ -298,7 +299,8 @@ class GHOST_Window : public GHOST_IWindow {
}
#ifdef WITH_INPUT_IME
- virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override
+ virtual void beginIME(
+ int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
{
/* do nothing temporarily if not in windows */
}
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 6ee1fb8b27f..ad94a02b514 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -90,7 +90,10 @@ struct GWL_Window {
/** The scale value written to #wl_surface_set_buffer_scale. */
int scale = 0;
- /** The fractional scale used to calculate the DPI. */
+ /**
+ * The fractional scale used to calculate the DPI.
+ * (always set, even when scaling is rounded to whole units).
+ */
wl_fixed_t scale_fractional = 0;
#ifdef WITH_GHOST_WAYLAND_LIBDECOR
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index fdd77fb9eef..5ae33343949 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -271,7 +271,7 @@ void MEM_use_guarded_allocator(void);
template<typename T, typename... Args>
inline T *MEM_new(const char *allocation_name, Args &&...args)
{
- void *buffer = MEM_mallocN(sizeof(T), allocation_name);
+ void *buffer = MEM_mallocN_aligned(sizeof(T), alignof(T), allocation_name);
return new (buffer) T(std::forward<Args>(args)...);
}
diff --git a/intern/guardedalloc/intern/leak_detector.cc b/intern/guardedalloc/intern/leak_detector.cc
index 288d78fd206..5b565b15920 100644
--- a/intern/guardedalloc/intern/leak_detector.cc
+++ b/intern/guardedalloc/intern/leak_detector.cc
@@ -41,7 +41,7 @@ class MemLeakPrinter {
if (fail_on_memleak) {
/* There are many other ways to change the exit code to failure here:
- * - Make the destructor noexcept(false) and throw an exception.
+ * - Make the destructor `noexcept(false)` and throw an exception.
* - Call exit(EXIT_FAILURE).
* - Call terminate().
*/
diff --git a/intern/wayland_dynload/intern/wayland_dynload_client.c b/intern/wayland_dynload/intern/wayland_dynload_client.c
index 68ba5374aba..617a8878199 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_client.c
+++ b/intern/wayland_dynload/intern/wayland_dynload_client.c
@@ -44,7 +44,8 @@ bool wayland_dynload_client_init(const bool verbose)
#define WAYLAND_DYNLOAD_IFACE(symbol) \
{ \
const void *symbol_val; \
- if (!(symbol_val = dynamic_library_find_with_error(lib, #symbol, paths[path_found]))) { \
+ if (!(symbol_val = dynamic_library_find_with_error( \
+ lib, #symbol, paths[path_found], verbose))) { \
return false; \
} \
memcpy(&symbol, symbol_val, sizeof(symbol)); \
@@ -54,7 +55,7 @@ bool wayland_dynload_client_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_client.symbol = dynamic_library_find_with_error( \
- lib, #symbol, paths[path_found]))) { \
+ lib, #symbol, paths[path_found], verbose))) { \
return false; \
}
#include "wayland_dynload_client.h"
diff --git a/intern/wayland_dynload/intern/wayland_dynload_cursor.c b/intern/wayland_dynload/intern/wayland_dynload_cursor.c
index 3d0526c7ba6..cc62a43bc01 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_cursor.c
+++ b/intern/wayland_dynload/intern/wayland_dynload_cursor.c
@@ -36,7 +36,7 @@ bool wayland_dynload_cursor_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_cursor.symbol = dynamic_library_find_with_error( \
- lib, #symbol, paths[path_index]))) { \
+ lib, #symbol, paths[path_index], verbose))) { \
return false; \
}
#include "wayland_dynload_cursor.h"
diff --git a/intern/wayland_dynload/intern/wayland_dynload_egl.c b/intern/wayland_dynload/intern/wayland_dynload_egl.c
index cfc195c0408..d8e4dfe0dad 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_egl.c
+++ b/intern/wayland_dynload/intern/wayland_dynload_egl.c
@@ -36,7 +36,7 @@ bool wayland_dynload_egl_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_egl.symbol = dynamic_library_find_with_error( \
- lib, #symbol, paths[path_found]))) { \
+ lib, #symbol, paths[path_found], verbose))) { \
return false; \
}
#include "wayland_dynload_egl.h"
diff --git a/intern/wayland_dynload/intern/wayland_dynload_libdecor.c b/intern/wayland_dynload/intern/wayland_dynload_libdecor.c
index d8bdd27bb27..dafd1badfda 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_libdecor.c
+++ b/intern/wayland_dynload/intern/wayland_dynload_libdecor.c
@@ -36,7 +36,7 @@ bool wayland_dynload_libdecor_init(const bool verbose)
#define WAYLAND_DYNLOAD_FN(symbol) \
if (!(wayland_dynload_libdecor.symbol = dynamic_library_find_with_error( \
- lib, #symbol, paths[path_index]))) { \
+ lib, #symbol, paths[path_index], verbose))) { \
return false; \
}
#include "wayland_dynload_libdecor.h"
diff --git a/intern/wayland_dynload/intern/wayland_dynload_utils.c b/intern/wayland_dynload/intern/wayland_dynload_utils.c
index 743dac14eec..666de20c5d3 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_utils.c
+++ b/intern/wayland_dynload/intern/wayland_dynload_utils.c
@@ -30,11 +30,16 @@ DynamicLibrary dynamic_library_open_array_with_error(const char **paths,
return lib;
}
-void *dynamic_library_find_with_error(DynamicLibrary lib, const char *symbol, const char *path_lib)
+void *dynamic_library_find_with_error(DynamicLibrary lib,
+ const char *symbol,
+ const char *path_lib,
+ const bool verbose)
{
void *symbol_var = dynamic_library_find(lib, symbol);
if (symbol_var == NULL) {
- fprintf(stderr, "Unable to find '%s' in '%s'.\n", symbol, path_lib);
+ if (verbose) {
+ fprintf(stderr, "Unable to find '%s' in '%s'.\n", symbol, path_lib);
+ }
}
return symbol_var;
}
diff --git a/intern/wayland_dynload/intern/wayland_dynload_utils.h b/intern/wayland_dynload/intern/wayland_dynload_utils.h
index 785f32521e4..1814879615b 100644
--- a/intern/wayland_dynload/intern/wayland_dynload_utils.h
+++ b/intern/wayland_dynload/intern/wayland_dynload_utils.h
@@ -26,4 +26,5 @@ DynamicLibrary dynamic_library_open_array_with_error(const char **paths,
/** Find a symbol, printing an error when the symbol isn't found. */
void *dynamic_library_find_with_error(DynamicLibrary lib,
const char *symbol,
- const char *path_lib);
+ const char *path_lib,
+ bool verbose);
diff --git a/make.bat b/make.bat
index 0be70053ce1..394b2d0dad5 100644
--- a/make.bat
+++ b/make.bat
@@ -65,11 +65,13 @@ if "%BUILD_UPDATE%" == "1" (
REM First see if the SVN libs are there and check them out if they are not.
call "%BLENDER_DIR%\build_files\windows\check_libraries.cmd"
if errorlevel 1 goto EOF
- REM Then update SVN platform libraries, since updating python while python is
- REM running tends to be problematic. The python script that update_sources
- REM calls later on may still try to switch branches and run into trouble,
- REM but for *most* people this will side step the problem.
- call "%BLENDER_DIR%\build_files\windows\svn_update.cmd"
+ if "%BUILD_UPDATE_SVN%" == "1" (
+ REM Then update SVN platform libraries, since updating python while python is
+ REM running tends to be problematic. The python script that update_sources
+ REM calls later on may still try to switch branches and run into trouble,
+ REM but for *most* people this will side step the problem.
+ call "%BLENDER_DIR%\build_files\windows\svn_update.cmd"
+ )
REM Finally call the python script shared between all platforms that updates git
REM and does any other SVN work like update the tests or branch switches
REM if required.
diff --git a/release/datafiles/locale b/release/datafiles/locale
-Subproject 7be7aff5a18c550465b3f7634539ed4168af7c5
+Subproject fe221a8bc934385d9f302c46a5c7cbeacddafe3
diff --git a/release/scripts/addons b/release/scripts/addons
-Subproject eb09be71a96c4fe910fdc43373be5ec08b419d2
+Subproject 5a818af95080cccf04dfa8317f0e966bff515c6
diff --git a/release/scripts/modules/rna_manual_reference.py b/release/scripts/modules/rna_manual_reference.py
index 10925e78ef3..dfebf9132d2 100644
--- a/release/scripts/modules/rna_manual_reference.py
+++ b/release/scripts/modules/rna_manual_reference.py
@@ -58,6 +58,7 @@ url_manual_mapping = (
("bpy.types.cyclesrendersettings.preview_denoising_input_passes*", "render/cycles/render_settings/sampling.html#bpy-types-cyclesrendersettings-preview-denoising-input-passes"),
("bpy.types.cyclesrendersettings.preview_denoising_start_sample*", "render/cycles/render_settings/sampling.html#bpy-types-cyclesrendersettings-preview-denoising-start-sample"),
("bpy.types.fluiddomainsettings.sndparticle_sampling_trappedair*", "physics/fluid/type/domain/liquid/particles.html#bpy-types-fluiddomainsettings-sndparticle-sampling-trappedair"),
+ ("bpy.types.brush.automasking_boundary_edges_propagation_steps*", "sculpt_paint/sculpting/controls.html#bpy-types-brush-automasking-boundary-edges-propagation-steps"),
("bpy.types.fluiddomainsettings.sndparticle_sampling_wavecrest*", "physics/fluid/type/domain/liquid/particles.html#bpy-types-fluiddomainsettings-sndparticle-sampling-wavecrest"),
("bpy.types.lineartgpencilmodifier.use_image_boundary_trimming*", "grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-image-boundary-trimming"),
("bpy.types.materiallineart.use_intersection_priority_override*", "render/materials/line_art.html#bpy-types-materiallineart-use-intersection-priority-override"),
@@ -179,6 +180,7 @@ url_manual_mapping = (
("bpy.types.brushgpencilsettings.use_random_press_hue*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-random-press-hue"),
("bpy.types.brushgpencilsettings.use_random_press_sat*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-random-press-sat"),
("bpy.types.brushgpencilsettings.use_random_press_val*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-random-press-val"),
+ ("bpy.types.brushgpencilsettings.use_settings_outline*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-settings-outline"),
("bpy.types.brushgpencilsettings.use_stroke_random_uv*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-stroke-random-uv"),
("bpy.types.cyclesmaterialsettings.homogeneous_volume*", "render/cycles/material_settings.html#bpy-types-cyclesmaterialsettings-homogeneous-volume"),
("bpy.types.cyclesobjectsettings.is_caustics_receiver*", "render/cycles/object_settings/object_data.html#bpy-types-cyclesobjectsettings-is-caustics-receiver"),
@@ -203,12 +205,14 @@ url_manual_mapping = (
("bpy.types.materialgpencilstyle.use_fill_texture_mix*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-use-fill-texture-mix"),
("bpy.types.rendersettings_simplify_gpencil_shader_fx*", "render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-shader-fx"),
("bpy.types.rendersettings_simplify_gpencil_view_fill*", "render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-view-fill"),
+ ("bpy.types.sculpt.use_automasking_boundary_face_sets*", "sculpt_paint/sculpting/controls.html#bpy-types-sculpt-use-automasking-boundary-face-sets"),
("bpy.types.sequencertoolsettings.snap_to_hold_offset*", "video_editing/edit/montage/editing.html#bpy-types-sequencertoolsettings-snap-to-hold-offset"),
("bpy.types.toolsettings.use_mesh_automerge_and_split*", "modeling/meshes/tools/tool_settings.html#bpy-types-toolsettings-use-mesh-automerge-and-split"),
("bpy.ops.scene.view_layer_remove_unused_lightgroups*", "render/layers/passes.html#bpy-ops-scene-view-layer-remove-unused-lightgroups"),
("bpy.types.animvizmotionpaths.show_keyframe_numbers*", "animation/motion_paths.html#bpy-types-animvizmotionpaths-show-keyframe-numbers"),
("bpy.types.brush.cloth_constraint_softbody_strength*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-constraint-softbody-strength"),
("bpy.types.brush.elastic_deform_volume_preservation*", "sculpt_paint/sculpting/tools/elastic_deform.html#bpy-types-brush-elastic-deform-volume-preservation"),
+ ("bpy.types.brush.use_automasking_boundary_face_sets*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-automasking-boundary-face-sets"),
("bpy.types.brushcurvessculptsettings.minimum_length*", "sculpt_paint/curves_sculpting/tools/grow_shrink_curves.html#bpy-types-brushcurvessculptsettings-minimum-length"),
("bpy.types.brushgpencilsettings.fill_simplify_level*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-fill-simplify-level"),
("bpy.types.brushgpencilsettings.random_value_factor*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-random-value-factor"),
@@ -241,6 +245,7 @@ url_manual_mapping = (
("bpy.types.spacespreadsheet.geometry_component_type*", "editors/spreadsheet.html#bpy-types-spacespreadsheet-geometry-component-type"),
("bpy.types.toolsettings.use_gpencil_weight_data_add*", "grease_pencil/modes/draw/introduction.html#bpy-types-toolsettings-use-gpencil-weight-data-add"),
("bpy.types.view3doverlay.texture_paint_mode_opacity*", "editors/3dview/display/overlays.html#bpy-types-view3doverlay-texture-paint-mode-opacity"),
+ ("bpy.ops.mesh.customdata_bevel_weight_vertex_clear*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-bevel-weight-vertex-clear"),
("bpy.ops.mesh.customdata_custom_splitnormals_clear*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-custom-splitnormals-clear"),
("bpy.types.bakesettings.use_pass_ambient_occlusion*", "render/cycles/baking.html#bpy-types-bakesettings-use-pass-ambient-occlusion"),
("bpy.types.brush.surface_smooth_shape_preservation*", "sculpt_paint/sculpting/tools/smooth.html#bpy-types-brush-surface-smooth-shape-preservation"),
@@ -344,9 +349,12 @@ url_manual_mapping = (
("bpy.types.toolsettings.use_snap_uv_grid_absolute*", "editors/uv/controls/snapping.html#bpy-types-toolsettings-use-snap-uv-grid-absolute"),
("bpy.types.toolsettings.use_transform_data_origin*", "scene_layout/object/tools/tool_settings.html#bpy-types-toolsettings-use-transform-data-origin"),
("bpy.types.view3doverlay.sculpt_mode_mask_opacity*", "sculpt_paint/sculpting/editing/mask.html#bpy-types-view3doverlay-sculpt-mode-mask-opacity"),
+ ("bpy.ops.mesh.customdata_bevel_weight_edge_clear*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-bevel-weight-edge-clear"),
+ ("bpy.ops.mesh.customdata_bevel_weight_vertex_add*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-bevel-weight-vertex-add"),
("bpy.ops.mesh.customdata_custom_splitnormals_add*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-custom-splitnormals-add"),
("bpy.ops.outliner.collection_indirect_only_clear*", "render/layers/introduction.html#bpy-ops-outliner-collection-indirect-only-clear"),
("bpy.types.animvizmotionpaths.show_frame_numbers*", "animation/motion_paths.html#bpy-types-animvizmotionpaths-show-frame-numbers"),
+ ("bpy.types.brushgpencilsettings.fill_extend_mode*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-fill-extend-mode"),
("bpy.types.brushgpencilsettings.pen_smooth_steps*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-pen-smooth-steps"),
("bpy.types.brushgpencilsettings.show_fill_extend*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-show-fill-extend"),
("bpy.types.cycleslightsettings.is_caustics_light*", "render/cycles/light_settings.html#bpy-types-cycleslightsettings-is-caustics-light"),
@@ -384,6 +392,7 @@ url_manual_mapping = (
("bpy.types.movietrackingplanetrack.image_opacity*", "movie_clip/tracking/clip/sidebar/track/plane_track.html#bpy-types-movietrackingplanetrack-image-opacity"),
("bpy.types.particlesettings.use_parent_particles*", "physics/particles/emitter/render.html#bpy-types-particlesettings-use-parent-particles"),
("bpy.types.rigidbodyconstraint.solver_iterations*", "physics/rigid_body/constraints/introduction.html#bpy-types-rigidbodyconstraint-solver-iterations"),
+ ("bpy.types.sculpt.use_automasking_boundary_edges*", "sculpt_paint/sculpting/controls.html#bpy-types-sculpt-use-automasking-boundary-edges"),
("bpy.types.sequenceeditor.use_overlay_frame_lock*", "editors/video_sequencer/preview/sidebar.html#bpy-types-sequenceeditor-use-overlay-frame-lock"),
("bpy.types.sequencerpreviewoverlay.show_metadata*", "editors/video_sequencer/preview/display/overlays.html#bpy-types-sequencerpreviewoverlay-show-metadata"),
("bpy.types.sequencertimelineoverlay.show_fcurves*", "editors/video_sequencer/sequencer/display.html#bpy-types-sequencertimelineoverlay-show-fcurves"),
@@ -398,6 +407,7 @@ url_manual_mapping = (
("bpy.types.viewlayer.use_pass_cryptomatte_object*", "render/layers/passes.html#bpy-types-viewlayer-use-pass-cryptomatte-object"),
("bpy.ops.armature.rigify_apply_selection_colors*", "addons/rigging/rigify/metarigs.html#bpy-ops-armature-rigify-apply-selection-colors"),
("bpy.ops.ed.lib_id_generate_preview_from_object*", "editors/asset_browser.html#bpy-ops-ed-lib-id-generate-preview-from-object"),
+ ("bpy.types.brush.use_automasking_boundary_edges*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-automasking-boundary-edges"),
("bpy.types.brushcurvessculptsettings.add_amount*", "sculpt_paint/curves_sculpting/tools/add_curves.html#bpy-types-brushcurvessculptsettings-add-amount"),
("bpy.types.brushgpencilsettings.fill_layer_mode*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-fill-layer-mode"),
("bpy.types.brushgpencilsettings.random_strength*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-random-strength"),
@@ -444,6 +454,7 @@ url_manual_mapping = (
("bpy.types.toolsettings.use_snap_align_rotation*", "editors/3dview/controls/snapping.html#bpy-types-toolsettings-use-snap-align-rotation"),
("bpy.types.toolsettings.use_snap_to_same_target*", "editors/3dview/controls/snapping.html#bpy-types-toolsettings-use-snap-to-same-target"),
("bpy.types.viewlayer.use_pass_cryptomatte_asset*", "render/layers/passes.html#bpy-types-viewlayer-use-pass-cryptomatte-asset"),
+ ("bpy.ops.mesh.customdata_bevel_weight_edge_add*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-bevel-weight-edge-add"),
("bpy.ops.outliner.collection_indirect_only_set*", "render/layers/introduction.html#bpy-ops-outliner-collection-indirect-only-set"),
("bpy.ops.scene.freestyle_geometry_modifier_add*", "render/freestyle/view_layer/line_style/geometry.html#bpy-ops-scene-freestyle-geometry-modifier-add"),
("bpy.ops.scene.view_layer_add_used_lightgroups*", "render/layers/passes.html#bpy-ops-scene-view-layer-add-used-lightgroups"),
@@ -574,6 +585,8 @@ url_manual_mapping = (
("bpy.types.toolsettings.uv_sticky_select_mode*", "editors/uv/selecting.html#bpy-types-toolsettings-uv-sticky-select-mode"),
("bpy.types.volumedisplay.interpolation_method*", "modeling/volumes/properties.html#bpy-types-volumedisplay-interpolation-method"),
("bpy.ops.geometry.color_attribute_render_set*", "modeling/meshes/properties/object_data.html#bpy-ops-geometry-color-attribute-render-set"),
+ ("bpy.ops.mesh.customdata_crease_vertex_clear*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-crease-vertex-clear"),
+ ("bpy.types.brush.html#bpy.types.brush.jitter*", "sculpt_paint/brush/stroke.html#bpy-types-brush-html-bpy-types-brush-jitter"),
("bpy.types.brushgpencilsettings.angle_factor*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-angle-factor"),
("bpy.types.brushgpencilsettings.pen_strength*", "grease_pencil/modes/draw/tools/erase.html#bpy-types-brushgpencilsettings-pen-strength"),
("bpy.types.clothsettings.use_pressure_volume*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-use-pressure-volume"),
@@ -600,6 +613,7 @@ url_manual_mapping = (
("bpy.types.geometrynodeinputmeshedgevertices*", "modeling/geometry_nodes/mesh/edge_vertices.html#bpy-types-geometrynodeinputmeshedgevertices"),
("bpy.types.geometrynodeinputmeshfaceisplanar*", "modeling/geometry_nodes/mesh/face_is_planar.html#bpy-types-geometrynodeinputmeshfaceisplanar"),
("bpy.types.geometrynodeinputsplineresolution*", "modeling/geometry_nodes/curve/spline_resolution.html#bpy-types-geometrynodeinputsplineresolution"),
+ ("bpy.types.geometrynodemeshfacesetboundaries*", "modeling/geometry_nodes/mesh/face_set_boundaries.html#bpy-types-geometrynodemeshfacesetboundaries"),
("bpy.types.greasepencil.curve_edit_threshold*", "grease_pencil/modes/edit/curve_editing.html#bpy-types-greasepencil-curve-edit-threshold"),
("bpy.types.lineartgpencilmodifier.use_crease*", "grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-crease"),
("bpy.types.lineartgpencilmodifier.use_shadow*", "grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-shadow"),
@@ -678,13 +692,13 @@ url_manual_mapping = (
("bpy.types.lineartgpencilmodifier.use_cache*", "grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-cache"),
("bpy.types.lineartgpencilmodifier.use_loose*", "grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-loose"),
("bpy.types.materialgpencilstyle.show_stroke*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-show-stroke"),
- ("bpy.types.mesh.use_customdata_vertex_bevel*", "modeling/meshes/properties/custom_data.html#bpy-types-mesh-use-customdata-vertex-bevel"),
("bpy.types.movietrackingcamera.focal_length*", "movie_clip/tracking/clip/sidebar/track/camera.html#bpy-types-movietrackingcamera-focal-length"),
("bpy.types.movietrackingcamera.pixel_aspect*", "movie_clip/tracking/clip/sidebar/track/camera.html#bpy-types-movietrackingcamera-pixel-aspect"),
("bpy.types.movietrackingcamera.sensor_width*", "movie_clip/tracking/clip/sidebar/track/camera.html#bpy-types-movietrackingcamera-sensor-width"),
("bpy.types.posebone.use_ik_rotation_control*", "animation/armatures/posing/bone_constraints/inverse_kinematics/introduction.html#bpy-types-posebone-use-ik-rotation-control"),
("bpy.types.rendersettings.use_bake_multires*", "render/cycles/baking.html#bpy-types-rendersettings-use-bake-multires"),
("bpy.types.scenegpencil.antialias_threshold*", "render/cycles/render_settings/grease_pencil.html#bpy-types-scenegpencil-antialias-threshold"),
+ ("bpy.types.sculpt.use_automasking_face_sets*", "sculpt_paint/sculpting/controls.html#bpy-types-sculpt-use-automasking-face-sets"),
("bpy.types.spaceclipeditor.show_mask_spline*", "editors/clip/display/mask_display.html#bpy-types-spaceclipeditor-show-mask-spline"),
("bpy.types.spaceclipeditor.show_red_channel*", "editors/clip/display/clip_display.html#bpy-types-spaceclipeditor-show-red-channel"),
("bpy.types.spaceclipeditor.use_mute_footage*", "editors/clip/display/clip_display.html#bpy-types-spaceclipeditor-use-mute-footage"),
@@ -698,6 +712,8 @@ url_manual_mapping = (
("bpy.ops.constraint.disable_keep_transform*", "animation/constraints/interface/common.html#bpy-ops-constraint-disable-keep-transform"),
("bpy.ops.curves.convert_to_particle_system*", "sculpt_paint/curves_sculpting/introduction.html#bpy-ops-curves-convert-to-particle-system"),
("bpy.ops.gpencil.stroke_reset_vertex_color*", "grease_pencil/modes/vertex_paint/editing.html#bpy-ops-gpencil-stroke-reset-vertex-color"),
+ ("bpy.ops.mesh.customdata_crease_edge_clear*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-crease-edge-clear"),
+ ("bpy.ops.mesh.customdata_crease_vertex_add*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-crease-vertex-add"),
("bpy.ops.object.modifier_apply_as_shapekey*", "modeling/modifiers/introduction.html#bpy-ops-object-modifier-apply-as-shapekey"),
("bpy.ops.object.vertex_group_normalize_all*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-normalize-all"),
("bpy.ops.outliner.collection_color_tag_set*", "editors/outliner/editing.html#bpy-ops-outliner-collection-color-tag-set"),
@@ -709,6 +725,7 @@ url_manual_mapping = (
("bpy.types.animvizmotionpaths.frame_before*", "animation/motion_paths.html#bpy-types-animvizmotionpaths-frame-before"),
("bpy.types.brush.disconnected_distance_max*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-disconnected-distance-max"),
("bpy.types.brush.surface_smooth_iterations*", "sculpt_paint/sculpting/tools/smooth.html#bpy-types-brush-surface-smooth-iterations"),
+ ("bpy.types.brush.use_automasking_face_sets*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-automasking-face-sets"),
("bpy.types.brushgpencilsettings.pen_jitter*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-pen-jitter"),
("bpy.types.brushgpencilsettings.show_lasso*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-show-lasso"),
("bpy.types.compositornodeconvertcolorspace*", "compositing/types/converter/color_space.html#bpy-types-compositornodeconvertcolorspace"),
@@ -753,7 +770,6 @@ url_manual_mapping = (
("bpy.types.materialgpencilstyle.fill_style*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-fill-style"),
("bpy.types.materialgpencilstyle.mix_factor*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-mix-factor"),
("bpy.types.materialgpencilstyle.pass_index*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-pass-index"),
- ("bpy.types.mesh.use_customdata_edge_crease*", "modeling/meshes/properties/custom_data.html#bpy-types-mesh-use-customdata-edge-crease"),
("bpy.types.nodesocketinterface.description*", "interface/controls/nodes/groups.html#bpy-types-nodesocketinterface-description"),
("bpy.types.rendersettings.dither_intensity*", "render/output/properties/post_processing.html#bpy-types-rendersettings-dither-intensity"),
("bpy.types.rendersettings.film_transparent*", "render/cycles/render_settings/film.html#bpy-types-rendersettings-film-transparent"),
@@ -761,6 +777,7 @@ url_manual_mapping = (
("bpy.types.rendersettings.use_render_cache*", "render/output/properties/output.html#bpy-types-rendersettings-use-render-cache"),
("bpy.types.rendersettings.use_single_layer*", "render/layers/view_layer.html#bpy-types-rendersettings-use-single-layer"),
("bpy.types.sceneeevee.use_taa_reprojection*", "render/eevee/render_settings/sampling.html#bpy-types-sceneeevee-use-taa-reprojection"),
+ ("bpy.types.sculpt.use_automasking_topology*", "sculpt_paint/sculpting/controls.html#bpy-types-sculpt-use-automasking-topology"),
("bpy.types.spaceclipeditor.cursor_location*", "editors/clip/sidebar.html#bpy-types-spaceclipeditor-cursor-location"),
("bpy.types.spacefilebrowser.recent_folders*", "editors/file_browser.html#bpy-types-spacefilebrowser-recent-folders"),
("bpy.types.spacefilebrowser.system_folders*", "editors/file_browser.html#bpy-types-spacefilebrowser-system-folders"),
@@ -789,10 +806,11 @@ url_manual_mapping = (
("bpy.types.animvizmotionpaths.frame_start*", "animation/motion_paths.html#bpy-types-animvizmotionpaths-frame-start"),
("bpy.types.bakesettings.use_pass_indirect*", "render/cycles/baking.html#bpy-types-bakesettings-use-pass-indirect"),
("bpy.types.brush.cloth_force_falloff_type*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-force-falloff-type"),
+ ("bpy.types.brush.use_automasking_topology*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-automasking-topology"),
("bpy.types.brushgpencilsettings.caps_type*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-caps-type"),
- ("bpy.types.brushgpencilsettings.fill_leak*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-fill-leak"),
("bpy.types.brushgpencilsettings.show_fill*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-show-fill"),
("bpy.types.brushgpencilsettings.uv_random*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-uv-random"),
+ ("bpy.types.brushtextureslot.mask_map_mode*", "sculpt_paint/brush/texture_mask.html#bpy-types-brushtextureslot-mask-map-mode"),
("bpy.types.clothsettings.internal_tension*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-internal-tension"),
("bpy.types.colormanagedviewsettings.gamma*", "render/color_management.html#bpy-types-colormanagedviewsettings-gamma"),
("bpy.types.compositornodeplanetrackdeform*", "compositing/types/distort/plane_track_deform.html#bpy-types-compositornodeplanetrackdeform"),
@@ -801,7 +819,7 @@ url_manual_mapping = (
("bpy.types.editbone.bbone_handle_type_end*", "animation/armatures/bones/properties/bendy_bones.html#bpy-types-editbone-bbone-handle-type-end"),
("bpy.types.editbone.use_endroll_as_inroll*", "animation/armatures/bones/properties/bendy_bones.html#bpy-types-editbone-use-endroll-as-inroll"),
("bpy.types.fieldsettings.guide_kink_shape*", "physics/forces/force_fields/types/curve_guide.html#bpy-types-fieldsettings-guide-kink-shape"),
- ("bpy.types.fieldsettings.use_max_distance*", "physics/forces/force_fields/types/curve_guide.html#bpy-types-fieldsettings-use-max-distance"),
+ ("bpy.types.fieldsettings.use_max_distance*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-use-max-distance"),
("bpy.types.fieldsettings.use_min_distance*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-use-min-distance"),
("bpy.types.fileselectparams.filter_search*", "editors/file_browser.html#bpy-types-fileselectparams-filter-search"),
("bpy.types.fluiddomainsettings.cache_type*", "physics/fluid/type/domain/cache.html#bpy-types-fluiddomainsettings-cache-type"),
@@ -837,7 +855,6 @@ url_manual_mapping = (
("bpy.types.material.use_screen_refraction*", "render/eevee/materials/settings.html#bpy-types-material-use-screen-refraction"),
("bpy.types.materialgpencilstyle.mix_color*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-mix-color"),
("bpy.types.materialgpencilstyle.show_fill*", "grease_pencil/materials/properties.html#bpy-types-materialgpencilstyle-show-fill"),
- ("bpy.types.mesh.use_customdata_edge_bevel*", "modeling/meshes/properties/custom_data.html#bpy-types-mesh-use-customdata-edge-bevel"),
("bpy.types.mesh.use_mirror_vertex_group_x*", "sculpt_paint/weight_paint/tool_settings/symmetry.html#bpy-types-mesh-use-mirror-vertex-group-x"),
("bpy.types.movietrackingcamera.division_k*", "movie_clip/tracking/clip/sidebar/track/camera.html#bpy-types-movietrackingcamera-division-k"),
("bpy.types.movietrackingobject.keyframe_a*", "movie_clip/tracking/clip/toolbar/solve.html#bpy-types-movietrackingobject-keyframe-a"),
@@ -858,6 +875,7 @@ url_manual_mapping = (
("bpy.types.spaceoutliner.show_mode_column*", "editors/outliner/interface.html#bpy-types-spaceoutliner-show-mode-column"),
("bpy.types.spacesequenceeditor.show_gizmo*", "editors/video_sequencer/preview/display/gizmos.html#bpy-types-spacesequenceeditor-show-gizmo"),
("bpy.types.spacetexteditor.use_match_case*", "editors/text_editor.html#bpy-types-spacetexteditor-use-match-case"),
+ ("bpy.types.spaceuveditor.pixel_round_mode*", "modeling/meshes/uv/editing.html#bpy-types-spaceuveditor-pixel-round-mode"),
("bpy.types.spaceview3d.show_object_select*", "editors/3dview/display/visibility.html#bpy-types-spaceview3d-show-object-select"),
("bpy.types.toolsettings.use_lock_relative*", "sculpt_paint/weight_paint/tool_settings/options.html#bpy-types-toolsettings-use-lock-relative"),
("bpy.types.vertexpaint.use_group_restrict*", "sculpt_paint/weight_paint/tool_settings/options.html#bpy-types-vertexpaint-use-group-restrict"),
@@ -865,6 +883,7 @@ url_manual_mapping = (
("bpy.types.windowmanager.asset_path_dummy*", "editors/asset_browser.html#bpy-types-windowmanager-asset-path-dummy"),
("bpy.ops.armature.rigify_add_bone_groups*", "addons/rigging/rigify/metarigs.html#bpy-ops-armature-rigify-add-bone-groups"),
("bpy.ops.geometry.color_attribute_remove*", "modeling/meshes/properties/object_data.html#bpy-ops-geometry-color-attribute-remove"),
+ ("bpy.ops.mesh.customdata_crease_edge_add*", "modeling/meshes/properties/custom_data.html#bpy-ops-mesh-customdata-crease-edge-add"),
("bpy.ops.object.assign_property_defaults*", "animation/armatures/posing/editing/apply.html#bpy-ops-object-assign-property-defaults"),
("bpy.ops.object.vertex_group_limit_total*", "sculpt_paint/weight_paint/editing.html#bpy-ops-object-vertex-group-limit-total"),
("bpy.ops.object.vertex_group_remove_from*", "modeling/meshes/properties/vertex_groups/vertex_groups.html#bpy-ops-object-vertex-group-remove-from"),
@@ -872,6 +891,7 @@ url_manual_mapping = (
("bpy.ops.outliner.collection_hide_inside*", "editors/outliner/editing.html#bpy-ops-outliner-collection-hide-inside"),
("bpy.ops.outliner.collection_holdout_set*", "render/layers/introduction.html#bpy-ops-outliner-collection-holdout-set"),
("bpy.ops.outliner.collection_show_inside*", "editors/outliner/editing.html#bpy-ops-outliner-collection-show-inside"),
+ ("bpy.ops.poselib.pose_asset_select_bones*", "animation/armatures/posing/editing/pose_library.html#bpy-ops-poselib-pose-asset-select-bones"),
("bpy.ops.poselib.restore_previous_action*", "animation/armatures/posing/editing/pose_library.html#bpy-ops-poselib-restore-previous-action"),
("bpy.ops.preferences.reset_default_theme*", "editors/preferences/themes.html#bpy-ops-preferences-reset-default-theme"),
("bpy.ops.scene.view_layer_add_lightgroup*", "render/layers/passes.html#bpy-ops-scene-view-layer-add-lightgroup"),
@@ -885,6 +905,7 @@ url_manual_mapping = (
("bpy.types.brush.multiplane_scrape_angle*", "sculpt_paint/sculpting/tools/multiplane_scrape.html#bpy-types-brush-multiplane-scrape-angle"),
("bpy.types.brushgpencilsettings.hardness*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-hardness"),
("bpy.types.brushgpencilsettings.use_trim*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-use-trim"),
+ ("bpy.types.brushtextureslot.random_angle*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot-random-angle"),
("bpy.types.clothsettings.internal_spring*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-internal-spring"),
("bpy.types.clothsettings.pressure_factor*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-pressure-factor"),
("bpy.types.colormanagedviewsettings.look*", "render/color_management.html#bpy-types-colormanagedviewsettings-look"),
@@ -920,6 +941,7 @@ url_manual_mapping = (
("bpy.types.geometrynodeinputsplinecyclic*", "modeling/geometry_nodes/curve/is_spline_cyclic.html#bpy-types-geometrynodeinputsplinecyclic"),
("bpy.types.geometrynodeinstancestopoints*", "modeling/geometry_nodes/instances/instances_to_points.html#bpy-types-geometrynodeinstancestopoints"),
("bpy.types.gpencillayer.viewlayer_render*", "grease_pencil/properties/layers.html#bpy-types-gpencillayer-viewlayer-render"),
+ ("bpy.types.imagepaint.use_normal_falloff*", "sculpt_paint/brush/falloff.html#bpy-types-imagepaint-use-normal-falloff"),
("bpy.types.layercollection.hide_viewport*", "editors/outliner/interface.html#bpy-types-layercollection-hide-viewport"),
("bpy.types.layercollection.indirect_only*", "editors/outliner/interface.html#bpy-types-layercollection-indirect-only"),
("bpy.types.material.use_backface_culling*", "render/eevee/materials/settings.html#bpy-types-material-use-backface-culling"),
@@ -941,7 +963,6 @@ url_manual_mapping = (
("bpy.types.spacesequenceeditor.view_type*", "editors/video_sequencer/introduction.html#bpy-types-spacesequenceeditor-view-type"),
("bpy.types.spacetexteditor.margin_column*", "editors/text_editor.html#bpy-types-spacetexteditor-margin-column"),
("bpy.types.spacetexteditor.use_find_wrap*", "editors/text_editor.html#bpy-types-spacetexteditor-use-find-wrap"),
- ("bpy.types.spaceuveditor.pixel_snap_mode*", "modeling/meshes/uv/editing.html#bpy-types-spaceuveditor-pixel-snap-mode"),
("bpy.types.spaceuveditor.tile_grid_shape*", "editors/uv/overlays.html#bpy-types-spaceuveditor-tile-grid-shape"),
("bpy.types.spaceuveditor.use_custom_grid*", "editors/uv/overlays.html#bpy-types-spaceuveditor-use-custom-grid"),
("bpy.types.spaceuveditor.use_live_unwrap*", "modeling/meshes/uv/editing.html#bpy-types-spaceuveditor-use-live-unwrap"),
@@ -955,7 +976,9 @@ url_manual_mapping = (
("bpy.types.vertexweightproximitymodifier*", "modeling/modifiers/modify/weight_proximity.html#bpy-types-vertexweightproximitymodifier"),
("bpy.types.view3doverlay.show_wireframes*", "editors/3dview/display/overlays.html#bpy-types-view3doverlay-show-wireframes"),
("bpy.types.view3dshading.background_type*", "editors/3dview/display/shading.html#bpy-types-view3dshading-background-type"),
+ ("bpy.types.windowmanager.poselib_flipped*", "animation/armatures/posing/editing/pose_library.html#bpy-types-windowmanager-poselib-flipped"),
("bpy.types.workspace.use_filter_by_owner*", "interface/window_system/workspaces.html#bpy-types-workspace-use-filter-by-owner"),
+ ("bpy.ops.brush.stencil_fit_image_aspect*", "sculpt_paint/brush/texture.html#bpy-ops-brush-stencil-fit-image-aspect"),
("bpy.ops.gpencil.image_to_grease_pencil*", "editors/image/editing.html#bpy-ops-gpencil-image-to-grease-pencil"),
("bpy.ops.mesh.vertices_smooth_laplacian*", "modeling/meshes/editing/vertex/laplacian_smooth.html#bpy-ops-mesh-vertices-smooth-laplacian"),
("bpy.ops.object.multires_rebuild_subdiv*", "modeling/modifiers/generate/multiresolution.html#bpy-ops-object-multires-rebuild-subdiv"),
@@ -1033,6 +1056,7 @@ url_manual_mapping = (
("bpy.types.volumedisplay.wireframe_type*", "modeling/volumes/properties.html#bpy-types-volumedisplay-wireframe-type"),
("bpy.ops.anim.channels_editable_toggle*", "editors/graph_editor/channels.html#bpy-ops-anim-channels-editable-toggle"),
("bpy.ops.anim.channels_setting_disable*", "editors/graph_editor/channels.html#bpy-ops-anim-channels-setting-disable"),
+ ("bpy.ops.brush.stencil_reset_transform*", "sculpt_paint/brush/texture.html#bpy-ops-brush-stencil-reset-transform"),
("bpy.ops.curve.normals_make_consistent*", "modeling/curves/editing/control_points.html#bpy-ops-curve-normals-make-consistent"),
("bpy.ops.curves.snap_curves_to_surface*", "sculpt_paint/curves_sculpting/introduction.html#bpy-ops-curves-snap-curves-to-surface"),
("bpy.ops.ed.lib_id_load_custom_preview*", "editors/asset_browser.html#bpy-ops-ed-lib-id-load-custom-preview"),
@@ -1061,9 +1085,11 @@ url_manual_mapping = (
("bpy.types.brush.boundary_falloff_type*", "sculpt_paint/sculpting/tools/boundary.html#bpy-types-brush-boundary-falloff-type"),
("bpy.types.brush.cursor_color_subtract*", "sculpt_paint/brush/cursor.html#bpy-types-brush-cursor-color-subtract"),
("bpy.types.brush.texture_overlay_alpha*", "sculpt_paint/brush/cursor.html#bpy-types-brush-texture-overlay-alpha"),
+ ("bpy.types.brush.use_space_attenuation*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-space-attenuation"),
("bpy.types.brushgpencilsettings.aspect*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-aspect"),
("bpy.types.brushgpencilsettings.dilate*", "grease_pencil/modes/draw/tools/fill.html#bpy-types-brushgpencilsettings-dilate"),
("bpy.types.brushgpencilsettings.random*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-random"),
+ ("bpy.types.brushtextureslot.use_random*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot-use-random"),
("bpy.types.clothsettings.target_volume*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-target-volume"),
("bpy.types.colormanageddisplaysettings*", "render/color_management.html#bpy-types-colormanageddisplaysettings"),
("bpy.types.colorramp.hue_interpolation*", "interface/controls/templates/color_ramp.html#bpy-types-colorramp-hue-interpolation"),
@@ -1076,7 +1102,7 @@ url_manual_mapping = (
("bpy.types.editbone.use_local_location*", "animation/armatures/bones/properties/relations.html#bpy-types-editbone-use-local-location"),
("bpy.types.ffmpegsettings.audio_volume*", "render/output/properties/output.html#bpy-types-ffmpegsettings-audio-volume"),
("bpy.types.ffmpegsettings.max_b_frames*", "render/output/properties/output.html#bpy-types-ffmpegsettings-max-b-frames"),
- ("bpy.types.fieldsettings.falloff_power*", "physics/forces/force_fields/types/curve_guide.html#bpy-types-fieldsettings-falloff-power"),
+ ("bpy.types.fieldsettings.falloff_power*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-falloff-power"),
("bpy.types.fieldsettings.guide_minimum*", "physics/forces/force_fields/types/curve_guide.html#bpy-types-fieldsettings-guide-minimum"),
("bpy.types.fileselectparams.use_filter*", "editors/file_browser.html#bpy-types-fileselectparams-use-filter"),
("bpy.types.fluiddomainsettings.gravity*", "physics/fluid/type/domain/settings.html#bpy-types-fluiddomainsettings-gravity"),
@@ -1140,6 +1166,7 @@ url_manual_mapping = (
("bpy.ops.mesh.normals_make_consistent*", "modeling/meshes/editing/mesh/normals.html#bpy-ops-mesh-normals-make-consistent"),
("bpy.ops.mesh.offset_edge_loops_slide*", "modeling/meshes/editing/edge/offset_edge_slide.html#bpy-ops-mesh-offset-edge-loops-slide"),
("bpy.ops.mesh.primitive_uv_sphere_add*", "modeling/meshes/primitives.html#bpy-ops-mesh-primitive-uv-sphere-add"),
+ ("bpy.ops.object.curves_empty_hair_add*", "modeling/curves/primitives.html#bpy-ops-object-curves-empty-hair-add"),
("bpy.ops.object.duplicate_move_linked*", "scene_layout/object/editing/duplicate_linked.html#bpy-ops-object-duplicate-move-linked"),
("bpy.ops.object.make_override_library*", "files/linked_libraries/library_overrides.html#bpy-ops-object-make-override-library"),
("bpy.ops.object.parent_no_inverse_set*", "scene_layout/object/editing/parent.html#bpy-ops-object-parent-no-inverse-set"),
@@ -1157,10 +1184,12 @@ url_manual_mapping = (
("bpy.types.brush.boundary_deform_type*", "sculpt_paint/sculpting/tools/boundary.html#bpy-types-brush-boundary-deform-type"),
("bpy.types.brush.cursor_overlay_alpha*", "sculpt_paint/brush/cursor.html#bpy-types-brush-cursor-overlay-alpha"),
("bpy.types.brush.normal_radius_factor*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-normal-radius-factor"),
- ("bpy.types.brush.smooth_stroke_factor*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brush-smooth-stroke-factor"),
- ("bpy.types.brush.smooth_stroke_radius*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brush-smooth-stroke-radius"),
+ ("bpy.types.brush.smooth_stroke_factor*", "sculpt_paint/brush/stroke.html#bpy-types-brush-smooth-stroke-factor"),
+ ("bpy.types.brush.smooth_stroke_radius*", "sculpt_paint/brush/stroke.html#bpy-types-brush-smooth-stroke-radius"),
("bpy.types.brush.topology_rake_factor*", "sculpt_paint/sculpting/tool_settings/dyntopo.html#bpy-types-brush-topology-rake-factor"),
("bpy.types.brush.use_pose_ik_anchored*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-use-pose-ik-anchored"),
+ ("bpy.types.brush.use_pressure_masking*", "sculpt_paint/brush/texture_mask.html#bpy-types-brush-use-pressure-masking"),
+ ("bpy.types.brush.use_pressure_spacing*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-pressure-spacing"),
("bpy.types.brushgpencilsettings.angle*", "grease_pencil/modes/draw/tools/draw.html#bpy-types-brushgpencilsettings-angle"),
("bpy.types.clothsettings.use_pressure*", "physics/cloth/settings/physical_properties.html#bpy-types-clothsettings-use-pressure"),
("bpy.types.compositornodeantialiasing*", "compositing/types/filter/anti_aliasing.html#bpy-types-compositornodeantialiasing"),
@@ -1170,7 +1199,7 @@ url_manual_mapping = (
("bpy.types.compositornodekeyingscreen*", "compositing/types/matte/keying_screen.html#bpy-types-compositornodekeyingscreen"),
("bpy.types.dynamicpaintcanvassettings*", "physics/dynamic_paint/canvas.html#bpy-types-dynamicpaintcanvassettings"),
("bpy.types.ffmpegsettings.audio_codec*", "render/output/properties/output.html#bpy-types-ffmpegsettings-audio-codec"),
- ("bpy.types.fieldsettings.distance_max*", "physics/forces/force_fields/types/curve_guide.html#bpy-types-fieldsettings-distance-max"),
+ ("bpy.types.fieldsettings.distance_max*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-distance-max"),
("bpy.types.fieldsettings.distance_min*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-distance-min"),
("bpy.types.fieldsettings.falloff_type*", "physics/forces/force_fields/introduction.html#bpy-types-fieldsettings-falloff-type"),
("bpy.types.fileselectparams.directory*", "editors/file_browser.html#bpy-types-fileselectparams-directory"),
@@ -1198,7 +1227,7 @@ url_manual_mapping = (
("bpy.types.object.display_bounds_type*", "scene_layout/object/properties/display.html#bpy-types-object-display-bounds-type"),
("bpy.types.object.show_only_shape_key*", "animation/shape_keys/shape_keys_panel.html#bpy-types-object-show-only-shape-key"),
("bpy.types.regionview3d.lock_rotation*", "editors/3dview/navigate/views.html#bpy-types-regionview3d-lock-rotation"),
- ("bpy.types.rendersettings.hair_subdiv*", "render/cycles/render_settings/hair.html#bpy-types-rendersettings-hair-subdiv"),
+ ("bpy.types.rendersettings.hair_subdiv*", "render/eevee/render_settings/hair.html#bpy-types-rendersettings-hair-subdiv"),
("bpy.types.scene.audio_distance_model*", "scene_layout/scene/properties.html#bpy-types-scene-audio-distance-model"),
("bpy.types.scene.audio_doppler_factor*", "scene_layout/scene/properties.html#bpy-types-scene-audio-doppler-factor"),
("bpy.types.sequencetransform.rotation*", "editors/video_sequencer/sequencer/sidebar/strip.html#bpy-types-sequencetransform-rotation"),
@@ -1251,11 +1280,15 @@ url_manual_mapping = (
("bpy.types.bakesettings.normal_space*", "render/cycles/baking.html#bpy-types-bakesettings-normal-space"),
("bpy.types.brush.crease_pinch_factor*", "sculpt_paint/sculpting/tools/snake_hook.html#bpy-types-brush-crease-pinch-factor"),
("bpy.types.brush.elastic_deform_type*", "sculpt_paint/sculpting/tools/elastic_deform.html#bpy-types-brush-elastic-deform-type"),
+ ("bpy.types.brush.texture_sample_bias*", "sculpt_paint/brush/texture.html#bpy-types-brush-texture-sample-bias"),
("bpy.types.brush.use_cloth_collision*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-use-cloth-collision"),
("bpy.types.brush.use_grab_silhouette*", "sculpt_paint/sculpting/tools/grab.html#bpy-types-brush-use-grab-silhouette"),
+ ("bpy.types.brush.use_original_normal*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-original-normal"),
+ ("bpy.types.brush.use_pressure_jitter*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-pressure-jitter"),
("bpy.types.brush.use_primary_overlay*", "sculpt_paint/brush/cursor.html#bpy-types-brush-use-primary-overlay"),
("bpy.types.brushcurvessculptsettings*", "sculpt_paint/curves_sculpting/index.html#bpy-types-brushcurvessculptsettings"),
("bpy.types.brushtextureslot.map_mode*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot-map-mode"),
+ ("bpy.types.brushtextureslot.use_rake*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot-use-rake"),
("bpy.types.camera.passepartout_alpha*", "render/cameras.html#bpy-types-camera-passepartout-alpha"),
("bpy.types.colorrampelement.position*", "interface/controls/templates/color_ramp.html#bpy-types-colorrampelement-position"),
("bpy.types.compositornodechromamatte*", "compositing/types/matte/chroma_key.html#bpy-types-compositornodechromamatte"),
@@ -1370,6 +1403,7 @@ url_manual_mapping = (
("bpy.types.brush.smooth_deform_type*", "sculpt_paint/sculpting/tools/smooth.html#bpy-types-brush-smooth-deform-type"),
("bpy.types.brush.use_connected_only*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-use-connected-only"),
("bpy.types.brush.use_cursor_overlay*", "sculpt_paint/brush/cursor.html#bpy-types-brush-use-cursor-overlay"),
+ ("bpy.types.brush.use_original_plane*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-use-original-plane"),
("bpy.types.camera.show_passepartout*", "render/cameras.html#bpy-types-camera-show-passepartout"),
("bpy.types.collection.lineart_usage*", "scene_layout/collections/collections.html#bpy-types-collection-lineart-usage"),
("bpy.types.colormanagedviewsettings*", "render/color_management.html#bpy-types-colormanagedviewsettings"),
@@ -1440,6 +1474,7 @@ url_manual_mapping = (
("bpy.types.transformcacheconstraint*", "animation/constraints/transform/transform_cache.html#bpy-types-transformcacheconstraint"),
("bpy.types.unitsettings.length_unit*", "scene_layout/scene/properties.html#bpy-types-unitsettings-length-unit"),
("bpy.types.vertexweighteditmodifier*", "modeling/modifiers/modify/weight_edit.html#bpy-types-vertexweighteditmodifier"),
+ ("bpy.types.view3dshading.color_type*", "render/workbench/color.html#bpy-types-view3dshading-color-type"),
("bpy.types.volumedisplay.slice_axis*", "modeling/volumes/properties.html#bpy-types-volumedisplay-slice-axis"),
("bpy.ops.action.markers_make_local*", "animation/markers.html#bpy-ops-action-markers-make-local"),
("bpy.ops.anim.channels_clean_empty*", "editors/nla/editing.html#bpy-ops-anim-channels-clean-empty"),
@@ -1458,7 +1493,7 @@ url_manual_mapping = (
("bpy.ops.mask.feather_weight_clear*", "movie_clip/masking/editing.html#bpy-ops-mask-feather-weight-clear"),
("bpy.ops.mask.primitive_circle_add*", "movie_clip/masking/scurve.html#bpy-ops-mask-primitive-circle-add"),
("bpy.ops.mask.primitive_square_add*", "movie_clip/masking/scurve.html#bpy-ops-mask-primitive-square-add"),
- ("bpy.ops.mesh.dupli_extrude_cursor*", "modeling/meshes/tools/extrude_cursor.html#bpy-ops-mesh-dupli-extrude-cursor"),
+ ("bpy.ops.mesh.dupli_extrude_cursor*", "modeling/meshes/editing/vertex/extrude_cursor.html#bpy-ops-mesh-dupli-extrude-cursor"),
("bpy.ops.mesh.primitive_circle_add*", "modeling/meshes/primitives.html#bpy-ops-mesh-primitive-circle-add"),
("bpy.ops.mesh.primitive_monkey_add*", "modeling/meshes/primitives.html#bpy-ops-mesh-primitive-monkey-add"),
("bpy.ops.mesh.select_face_by_sides*", "modeling/meshes/selecting/all_by_trait.html#bpy-ops-mesh-select-face-by-sides"),
@@ -1486,6 +1521,8 @@ url_manual_mapping = (
("bpy.types.brush.cloth_deform_type*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-deform-type"),
("bpy.types.brush.cloth_sim_falloff*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-sim-falloff"),
("bpy.types.brush.slide_deform_type*", "sculpt_paint/sculpting/tools/slide_relax.html#bpy-types-brush-slide-deform-type"),
+ ("bpy.types.brush.use_scene_spacing*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-scene-spacing"),
+ ("bpy.types.brush.use_smooth_stroke*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-smooth-stroke"),
("bpy.types.camera.show_composition*", "render/cameras.html#bpy-types-camera-show-composition"),
("bpy.types.colorramp.interpolation*", "interface/controls/templates/color_ramp.html#bpy-types-colorramp-interpolation"),
("bpy.types.compositornodealphaover*", "compositing/types/color/alpha_over.html#bpy-types-compositornodealphaover"),
@@ -1539,6 +1576,7 @@ url_manual_mapping = (
("bpy.types.gpencilsculptguide.type*", "grease_pencil/modes/draw/guides.html#bpy-types-gpencilsculptguide-type"),
("bpy.types.greasepencil.onion_mode*", "grease_pencil/properties/onion_skinning.html#bpy-types-greasepencil-onion-mode"),
("bpy.types.greasepencilgrid.offset*", "grease_pencil/properties/display.html#bpy-types-greasepencilgrid-offset"),
+ ("bpy.types.imagepaint.normal_angle*", "sculpt_paint/brush/falloff.html#bpy-types-imagepaint-normal-angle"),
("bpy.types.laplaciandeformmodifier*", "modeling/modifiers/deform/laplacian_deform.html#bpy-types-laplaciandeformmodifier"),
("bpy.types.laplaciansmoothmodifier*", "modeling/modifiers/deform/laplacian_smooth.html#bpy-types-laplaciansmoothmodifier"),
("bpy.types.layercollection.exclude*", "editors/outliner/interface.html#bpy-types-layercollection-exclude"),
@@ -1577,6 +1615,7 @@ url_manual_mapping = (
("bpy.ops.constraint.move_to_index*", "animation/constraints/interface/header.html#bpy-ops-constraint-move-to-index"),
("bpy.ops.gpencil.frame_clean_fill*", "grease_pencil/modes/edit/grease_pencil_menu.html#bpy-ops-gpencil-frame-clean-fill"),
("bpy.ops.gpencil.select_alternate*", "grease_pencil/selecting.html#bpy-ops-gpencil-select-alternate"),
+ ("bpy.ops.gpencil.stroke_start_set*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-start-set"),
("bpy.ops.gpencil.stroke_subdivide*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-subdivide"),
("bpy.ops.gpencil.vertex_color_hsv*", "grease_pencil/modes/vertex_paint/editing.html#bpy-ops-gpencil-vertex-color-hsv"),
("bpy.ops.gpencil.vertex_color_set*", "grease_pencil/modes/vertex_paint/editing.html#bpy-ops-gpencil-vertex-color-set"),
@@ -1600,6 +1639,8 @@ url_manual_mapping = (
("bpy.ops.outliner.collection_hide*", "editors/outliner/editing.html#bpy-ops-outliner-collection-hide"),
("bpy.ops.outliner.collection_show*", "editors/outliner/editing.html#bpy-ops-outliner-collection-show"),
("bpy.ops.paint.mask_lasso_gesture*", "sculpt_paint/sculpting/editing/mask.html#bpy-ops-paint-mask-lasso-gesture"),
+ ("bpy.ops.poselib.apply_pose_asset*", "animation/armatures/posing/editing/pose_library.html#bpy-ops-poselib-apply-pose-asset"),
+ ("bpy.ops.poselib.blend_pose_asset*", "animation/armatures/posing/editing/pose_library.html#bpy-ops-poselib-blend-pose-asset"),
("bpy.ops.rigidbody.mass_calculate*", "scene_layout/object/editing/rigid_body.html#bpy-ops-rigidbody-mass-calculate"),
("bpy.ops.screen.spacedata_cleanup*", "advanced/operators.html#bpy-ops-screen-spacedata-cleanup"),
("bpy.ops.sculpt.detail_flood_fill*", "sculpt_paint/sculpting/tool_settings/dyntopo.html#bpy-ops-sculpt-detail-flood-fill"),
@@ -1620,6 +1661,8 @@ url_manual_mapping = (
("bpy.types.brush.pose_deform_type*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-pose-deform-type"),
("bpy.types.brush.pose_ik_segments*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-pose-ik-segments"),
("bpy.types.brush.pose_origin_type*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-pose-origin-type"),
+ ("bpy.types.brush.use_edge_to_edge*", "sculpt_paint/brush/stroke.html#bpy-types-brush-use-edge-to-edge"),
+ ("bpy.types.brushtextureslot.angle*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot-angle"),
("bpy.types.camerasolverconstraint*", "animation/constraints/motion_tracking/camera_solver.html#bpy-types-camerasolverconstraint"),
("bpy.types.clothcollisionsettings*", "physics/cloth/settings/collisions.html#bpy-types-clothcollisionsettings"),
("bpy.types.collection.hide_select*", "editors/outliner/interface.html#bpy-types-collection-hide-select"),
@@ -1681,6 +1724,7 @@ url_manual_mapping = (
("bpy.types.object.visible_diffuse*", "render/cycles/object_settings/object_data.html#bpy-types-object-visible-diffuse"),
("bpy.types.objectsolverconstraint*", "animation/constraints/motion_tracking/object_solver.html#bpy-types-objectsolverconstraint"),
("bpy.types.opacitygpencilmodifier*", "grease_pencil/modifiers/color/opacity.html#bpy-types-opacitygpencilmodifier"),
+ ("bpy.types.outlinegpencilmodifier*", "grease_pencil/modifiers/generate/outline.html#bpy-types-outlinegpencilmodifier"),
("bpy.types.particlesystemmodifier*", "physics/particles/index.html#bpy-types-particlesystemmodifier"),
("bpy.types.rendersettings.threads*", "render/cycles/render_settings/performance.html#bpy-types-rendersettings-threads"),
("bpy.types.scenedisplay.render_aa*", "render/workbench/sampling.html#bpy-types-scenedisplay-render-aa"),
@@ -1752,6 +1796,7 @@ url_manual_mapping = (
("bpy.ops.outliner.show_one_level*", "editors/outliner/editing.html#bpy-ops-outliner-show-one-level"),
("bpy.ops.paint.brush_colors_flip*", "sculpt_paint/texture_paint/tool_settings/brush_settings.html#bpy-ops-paint-brush-colors-flip"),
("bpy.ops.paint.weight_from_bones*", "sculpt_paint/weight_paint/editing.html#bpy-ops-paint-weight-from-bones"),
+ ("bpy.ops.paintcurve.delete_point*", "sculpt_paint/brush/stroke.html#bpy-ops-paintcurve-delete-point"),
("bpy.ops.pose.paths_range_update*", "animation/motion_paths.html#bpy-ops-pose-paths-range-update"),
("bpy.ops.poselib.action_sanitize*", "animation/armatures/properties/pose_library.html#bpy-ops-poselib-action-sanitize"),
("bpy.ops.preferences.studiolight*", "editors/preferences/lights.html#bpy-ops-preferences-studiolight"),
@@ -1791,7 +1836,7 @@ url_manual_mapping = (
("bpy.types.compositornodevecblur*", "compositing/types/filter/vector_blur.html#bpy-types-compositornodevecblur"),
("bpy.types.curve.use_fill_deform*", "modeling/curves/properties/shape.html#bpy-types-curve-use-fill-deform"),
("bpy.types.curve.use_path_follow*", "modeling/curves/properties/path_animation.html#bpy-types-curve-use-path-follow"),
- ("bpy.types.curves.surface_uv_map*", "sculpt_paint/curves_sculpting/introduction.html#bpy-types-curves-surface-uv-map"),
+ ("bpy.types.curves.surface_uv_map*", "modeling/curves/primitives.html#bpy-types-curves-surface-uv-map"),
("bpy.types.dampedtrackconstraint*", "animation/constraints/tracking/damped_track.html#bpy-types-dampedtrackconstraint"),
("bpy.types.distortednoisetexture*", "render/materials/legacy_textures/types/distorted_noise.html#bpy-types-distortednoisetexture"),
("bpy.types.dopesheet.filter_text*", "editors/graph_editor/channels.html#bpy-types-dopesheet-filter-text"),
@@ -1862,6 +1907,7 @@ url_manual_mapping = (
("bpy.ops.gpencil.duplicate_move*", "grease_pencil/modes/edit/grease_pencil_menu.html#bpy-ops-gpencil-duplicate-move"),
("bpy.ops.gpencil.select_grouped*", "grease_pencil/selecting.html#bpy-ops-gpencil-select-grouped"),
("bpy.ops.gpencil.stroke_arrange*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-arrange"),
+ ("bpy.ops.gpencil.stroke_outline*", "grease_pencil/modes/edit/stroke_menu.html#bpy-ops-gpencil-stroke-outline"),
("bpy.ops.graph.blend_to_default*", "editors/graph_editor/fcurves/editing.html#bpy-ops-graph-blend-to-default"),
("bpy.ops.graph.equalize_handles*", "editors/graph_editor/fcurves/editing.html#bpy-ops-graph-equalize-handles"),
("bpy.ops.mball.delete_metaelems*", "modeling/metas/editing.html#bpy-ops-mball-delete-metaelems"),
@@ -2041,7 +2087,9 @@ url_manual_mapping = (
("bpy.types.bakesettings.margin*", "render/cycles/baking.html#bpy-types-bakesettings-margin"),
("bpy.types.bakesettings.target*", "render/cycles/baking.html#bpy-types-bakesettings-target"),
("bpy.types.brush.cloth_damping*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-damping"),
+ ("bpy.types.brush.falloff_shape*", "sculpt_paint/brush/falloff.html#bpy-types-brush-falloff-shape"),
("bpy.types.brush.icon_filepath*", "sculpt_paint/brush/brush.html#bpy-types-brush-icon-filepath"),
+ ("bpy.types.brush.stroke_method*", "sculpt_paint/brush/stroke.html#bpy-types-brush-stroke-method"),
("bpy.types.brush.tip_roundness*", "sculpt_paint/sculpting/tools/clay_strips.html#bpy-types-brush-tip-roundness"),
("bpy.types.camera.display_size*", "render/cameras.html#bpy-types-camera-display-size"),
("bpy.types.camera.sensor_width*", "render/cameras.html#bpy-types-camera-sensor-width"),
@@ -2074,6 +2122,7 @@ url_manual_mapping = (
("bpy.types.mesh.use_paint_mask*", "sculpt_paint/brush/introduction.html#bpy-types-mesh-use-paint-mask"),
("bpy.types.object.display_type*", "scene_layout/object/properties/display.html#bpy-types-object-display-type"),
("bpy.types.objectlineart.usage*", "scene_layout/object/properties/line_art.html#bpy-types-objectlineart-usage"),
+ ("bpy.types.paint.input_samples*", "sculpt_paint/brush/stroke.html#bpy-types-paint-input-samples"),
("bpy.types.particledupliweight*", "physics/particles/emitter/vertex_groups.html#bpy-types-particledupliweight"),
("bpy.types.posebone.bone_group*", "animation/armatures/bones/properties/relations.html#bpy-types-posebone-bone-group"),
("bpy.types.poseboneconstraints*", "animation/armatures/posing/bone_constraints/index.html#bpy-types-poseboneconstraints"),
@@ -2109,6 +2158,7 @@ url_manual_mapping = (
("bpy.types.transformconstraint*", "animation/constraints/transform/transformation.html#bpy-types-transformconstraint"),
("bpy.types.triangulatemodifier*", "modeling/modifiers/generate/triangulate.html#bpy-types-triangulatemodifier"),
("bpy.types.unitsettings.system*", "scene_layout/scene/properties.html#bpy-types-unitsettings-system"),
+ ("bpy.types.view3dshading.light*", "render/workbench/lighting.html#bpy-types-view3dshading-light"),
("bpy.types.viewlayer.use_solid*", "render/layers/introduction.html#bpy-types-viewlayer-use-solid"),
("bpy.types.volume.frame_offset*", "modeling/volumes/properties.html#bpy-types-volume-frame-offset"),
("bpy.types.windowmanager.addon*", "editors/preferences/addons.html#bpy-types-windowmanager-addon"),
@@ -2184,6 +2234,8 @@ url_manual_mapping = (
("bpy.types.animvizmotionpaths*", "animation/motion_paths.html#bpy-types-animvizmotionpaths"),
("bpy.types.armature.show_axes*", "animation/armatures/properties/display.html#bpy-types-armature-show-axes"),
("bpy.types.armatureconstraint*", "animation/constraints/relationship/armature.html#bpy-types-armatureconstraint"),
+ ("bpy.types.brush.dash_samples*", "sculpt_paint/brush/stroke.html#bpy-types-brush-dash-samples"),
+ ("bpy.types.brush.sculpt_plane*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-sculpt-plane"),
("bpy.types.compositornodeblur*", "compositing/types/filter/blur_node.html#bpy-types-compositornodeblur"),
("bpy.types.compositornodecrop*", "compositing/types/distort/crop.html#bpy-types-compositornodecrop"),
("bpy.types.compositornodeflip*", "compositing/types/distort/flip.html#bpy-types-compositornodeflip"),
@@ -2242,6 +2294,7 @@ url_manual_mapping = (
("bpy.types.texturenodechecker*", "editors/texture_node/types/patterns/checker.html#bpy-types-texturenodechecker"),
("bpy.types.texturenodetexture*", "editors/texture_node/types/input/texture.html#bpy-types-texturenodetexture"),
("bpy.types.texturenodetexwood*", "editors/texture_node/types/textures/wood.html#bpy-types-texturenodetexwood"),
+ ("bpy.types.textureslot.offset*", "sculpt_paint/brush/texture.html#bpy-types-textureslot-offset"),
("bpy.types.view3dshading.type*", "editors/3dview/display/shading.html#bpy-types-view3dshading-type"),
("bpy.types.volume.frame_start*", "modeling/volumes/properties.html#bpy-types-volume-frame-start"),
("bpy.types.volume.is_sequence*", "modeling/volumes/properties.html#bpy-types-volume-is-sequence"),
@@ -2320,6 +2373,7 @@ url_manual_mapping = (
("bpy.types.action.use_cyclic*", "animation/actions.html#bpy-types-action-use-cyclic"),
("bpy.types.alphaoversequence*", "video_editing/edit/montage/strips/effects/alpha_over_under_overdrop.html#bpy-types-alphaoversequence"),
("bpy.types.armatureeditbones*", "animation/armatures/bones/editing/index.html#bpy-types-armatureeditbones"),
+ ("bpy.types.brush.jitter_unit*", "sculpt_paint/brush/stroke.html#bpy-types-brush-jitter-unit"),
("bpy.types.brush.pose_offset*", "sculpt_paint/sculpting/tools/pose.html#bpy-types-brush-pose-offset"),
("bpy.types.brush.rake_factor*", "sculpt_paint/sculpting/tools/snake_hook.html#bpy-types-brush-rake-factor"),
("bpy.types.camera.sensor_fit*", "render/cameras.html#bpy-types-camera-sensor-fit"),
@@ -2374,6 +2428,7 @@ url_manual_mapping = (
("bpy.types.texturenodeoutput*", "editors/texture_node/types/output/output.html#bpy-types-texturenodeoutput"),
("bpy.types.texturenoderotate*", "editors/texture_node/types/distort/rotate.html#bpy-types-texturenoderotate"),
("bpy.types.texturenodeviewer*", "editors/texture_node/types/output/viewer.html#bpy-types-texturenodeviewer"),
+ ("bpy.types.textureslot.scale*", "sculpt_paint/brush/texture.html#bpy-types-textureslot-scale"),
("bpy.types.tracktoconstraint*", "animation/constraints/tracking/track_to.html#bpy-types-tracktoconstraint"),
("bpy.types.transformsequence*", "video_editing/edit/montage/strips/effects/transform.html#bpy-types-transformsequence"),
("bpy.types.uvprojectmodifier*", "modeling/modifiers/modify/uv_project.html#bpy-types-uvprojectmodifier"),
@@ -2383,6 +2438,7 @@ url_manual_mapping = (
("bpy.types.worldmistsettings*", "render/cycles/world_settings.html#bpy-types-worldmistsettings"),
("bpy.ops.anim.channels_move*", "editors/graph_editor/channels.html#bpy-ops-anim-channels-move"),
("bpy.ops.armature.subdivide*", "animation/armatures/bones/editing/subdivide.html#bpy-ops-armature-subdivide"),
+ ("bpy.ops.brush.curve_preset*", "sculpt_paint/brush/falloff.html#bpy-ops-brush-curve-preset"),
("bpy.ops.buttons.toggle_pin*", "editors/properties_editor.html#bpy-ops-buttons-toggle-pin"),
("bpy.ops.clip.delete_marker*", "movie_clip/tracking/clip/editing/track.html#bpy-ops-clip-delete-marker"),
("bpy.ops.clip.filter_tracks*", "movie_clip/tracking/clip/editing/track.html#bpy-ops-clip-filter-tracks"),
@@ -2444,6 +2500,7 @@ url_manual_mapping = (
("bpy.types.bone.head_radius*", "animation/armatures/bones/properties/deform.html#bpy-types-bone-head-radius"),
("bpy.types.bone.tail_radius*", "animation/armatures/bones/properties/deform.html#bpy-types-bone-tail-radius"),
("bpy.types.brush.cloth_mass*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-mass"),
+ ("bpy.types.brush.dash_ratio*", "sculpt_paint/brush/stroke.html#bpy-types-brush-dash-ratio"),
("bpy.types.brushtextureslot*", "sculpt_paint/brush/texture.html#bpy-types-brushtextureslot"),
("bpy.types.colormixsequence*", "video_editing/edit/montage/strips/effects/color_mix.html#bpy-types-colormixsequence"),
("bpy.types.curve.dimensions*", "modeling/curves/properties/shape.html#bpy-types-curve-dimensions"),
@@ -2541,6 +2598,7 @@ url_manual_mapping = (
("bpy.ops.object.pointcloud*", "modeling/point_cloud.html#bpy-ops-object-pointcloud"),
("bpy.ops.object.select_all*", "scene_layout/object/selecting.html#bpy-ops-object-select-all"),
("bpy.ops.object.shade_flat*", "scene_layout/object/editing/shading.html#bpy-ops-object-shade-flat"),
+ ("bpy.ops.paintcurve.select*", "sculpt_paint/brush/stroke.html#bpy-ops-paintcurve-select"),
("bpy.ops.pose.group_assign*", "animation/armatures/properties/bone_groups.html#bpy-ops-pose-group-assign"),
("bpy.ops.pose.group_select*", "animation/armatures/properties/bone_groups.html#bpy-ops-pose-group-select"),
("bpy.ops.pose.paths_update*", "animation/motion_paths.html#bpy-ops-pose-paths-update"),
@@ -2552,6 +2610,7 @@ url_manual_mapping = (
("bpy.ops.screen.area_split*", "interface/window_system/areas.html#bpy-ops-screen-area-split"),
("bpy.ops.screen.screenshot*", "interface/window_system/topbar.html#bpy-ops-screen-screenshot"),
("bpy.ops.sculpt.dirty_mask*", "sculpt_paint/sculpting/editing/mask.html#bpy-ops-sculpt-dirty-mask"),
+ ("bpy.ops.sculpt.reveal_all*", "sculpt_paint/sculpting/editing/face_sets.html#bpy-ops-sculpt-reveal-all"),
("bpy.ops.sculpt.symmetrize*", "sculpt_paint/sculpting/tool_settings/symmetry.html#bpy-ops-sculpt-symmetrize"),
("bpy.ops.uv.remove_doubles*", "modeling/meshes/uv/editing.html#bpy-ops-uv-remove-doubles"),
("bpy.ops.uv.select_similar*", "editors/uv/selecting.html#bpy-ops-uv-select-similar"),
@@ -2655,7 +2714,7 @@ url_manual_mapping = (
("bpy.ops.wm.save_mainfile*", "files/blend/open_save.html#bpy-ops-wm-save-mainfile"),
("bpy.types.bone.show_wire*", "animation/armatures/bones/properties/display.html#bpy-types-bone-show-wire"),
("bpy.types.brush.hardness*", "sculpt_paint/sculpting/tool_settings/brush_settings.html#bpy-types-brush-hardness"),
- ("bpy.types.curves.surface*", "sculpt_paint/curves_sculpting/introduction.html#bpy-types-curves-surface"),
+ ("bpy.types.curves.surface*", "modeling/curves/primitives.html#bpy-types-curves-surface"),
("bpy.types.curvesmodifier*", "editors/video_sequencer/sequencer/sidebar/modifiers.html#bpy-types-curvesmodifier"),
("bpy.types.ffmpegsettings*", "render/output/properties/output.html#bpy-types-ffmpegsettings"),
("bpy.types.fmodifiernoise*", "editors/graph_editor/fcurves/modifiers.html#bpy-types-fmodifiernoise"),
@@ -2725,13 +2784,13 @@ url_manual_mapping = (
("bpy.ops.object.face_map*", "modeling/meshes/properties/object_data.html#bpy-ops-object-face-map"),
("bpy.ops.object.join_uvs*", "scene_layout/object/editing/link_transfer/copy_uvmaps.html#bpy-ops-object-join-uvs"),
("bpy.ops.outliner.delete*", "editors/outliner/editing.html#bpy-ops-outliner-delete"),
+ ("bpy.ops.paintcurve.draw*", "sculpt_paint/brush/stroke.html#bpy-ops-paintcurve-draw"),
("bpy.ops.pose.relax_rest*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-relax-rest"),
("bpy.ops.pose.select_all*", "animation/armatures/posing/selecting.html#bpy-ops-pose-select-all"),
("bpy.ops.rigidbody.world*", "physics/rigid_body/world.html#bpy-ops-rigidbody-world"),
("bpy.ops.sculpt.optimize*", "sculpt_paint/sculpting/editing/sculpt.html#bpy-ops-sculpt-optimize"),
("bpy.ops.sequencer.split*", "video_editing/edit/montage/editing.html#bpy-ops-sequencer-split"),
("bpy.ops.transform.shear*", "modeling/meshes/editing/mesh/transform/shear.html#bpy-ops-transform-shear"),
- ("bpy.ops.ui.eyedropper_**", "interface/controls/buttons/eyedropper.html#bpy-ops-ui-eyedropper"),
("bpy.ops.uv.cube_project*", "modeling/meshes/editing/uv.html#bpy-ops-uv-cube-project"),
("bpy.ops.uv.pack_islands*", "modeling/meshes/uv/editing.html#bpy-ops-uv-pack-islands"),
("bpy.ops.uv.select_split*", "modeling/meshes/uv/editing.html#bpy-ops-uv-select-split"),
@@ -2743,12 +2802,14 @@ url_manual_mapping = (
("bpy.ops.wm.batch_rename*", "files/blend/rename.html#bpy-ops-wm-batch-rename"),
("bpy.ops.wm.owner_enable*", "interface/window_system/workspaces.html#bpy-ops-wm-owner-enable"),
("bpy.ops.wm.redraw_timer*", "advanced/operators.html#bpy-ops-wm-redraw-timer"),
+ ("bpy.ops.wm.splash_about*", "interface/window_system/topbar.html#bpy-ops-wm-splash-about"),
("bpy.types.*light.shadow*", "render/eevee/lighting.html#bpy-types-light-shadow"),
("bpy.types.armature.show*", "animation/armatures/properties/display.html#bpy-types-armature-show"),
("bpy.types.armaturebones*", "animation/armatures/bones/index.html#bpy-types-armaturebones"),
("bpy.types.arraymodifier*", "modeling/modifiers/generate/array.html#bpy-types-arraymodifier"),
("bpy.types.assetmetadata*", "editors/asset_browser.html#bpy-types-assetmetadata"),
("bpy.types.bevelmodifier*", "modeling/modifiers/generate/bevel.html#bpy-types-bevelmodifier"),
+ ("bpy.types.brush.spacing*", "sculpt_paint/brush/stroke.html#bpy-types-brush-spacing"),
("bpy.types.buildmodifier*", "modeling/modifiers/generate/build.html#bpy-types-buildmodifier"),
("bpy.types.clothmodifier*", "physics/cloth/index.html#bpy-types-clothmodifier"),
("bpy.types.clothsettings*", "physics/cloth/settings/index.html#bpy-types-clothsettings"),
@@ -2783,6 +2844,7 @@ url_manual_mapping = (
("bpy.types.sequence.name*", "editors/video_sequencer/sequencer/sidebar/strip.html#bpy-types-sequence-name"),
("bpy.types.sequenceproxy*", "editors/video_sequencer/sequencer/sidebar/proxy.html#bpy-types-sequenceproxy"),
("bpy.types.shaderfxswirl*", "grease_pencil/visual_effects/swirl.html#bpy-types-shaderfxswirl"),
+ ("bpy.types.shadernodemix*", "render/shader_nodes/converter/mix.html#bpy-types-shadernodemix"),
("bpy.types.shadernodergb*", "render/shader_nodes/input/rgb.html#bpy-types-shadernodergb"),
("bpy.types.shapekey.mute*", "animation/shape_keys/shape_keys_panel.html#bpy-types-shapekey-mute"),
("bpy.types.soundsequence*", "video_editing/edit/montage/strips/sound.html#bpy-types-soundsequence"),
@@ -2821,6 +2883,7 @@ url_manual_mapping = (
("bpy.ops.object.convert*", "scene_layout/object/editing/convert.html#bpy-ops-object-convert"),
("bpy.ops.object.gpencil*", "grease_pencil/index.html#bpy-ops-object-gpencil"),
("bpy.ops.object.speaker*", "render/output/audio/speaker.html#bpy-ops-object-speaker"),
+ ("bpy.ops.paintcurve.new*", "sculpt_paint/brush/stroke.html#bpy-ops-paintcurve-new"),
("bpy.ops.pose.breakdown*", "animation/armatures/posing/editing/in_betweens.html#bpy-ops-pose-breakdown"),
("bpy.ops.pose.loc_clear*", "animation/armatures/posing/editing/clear.html#bpy-ops-pose-loc-clear"),
("bpy.ops.pose.propagate*", "animation/armatures/posing/editing/propagate.html#bpy-ops-pose-propagate"),
@@ -2902,6 +2965,7 @@ url_manual_mapping = (
("bpy.ops.script.reload*", "advanced/operators.html#bpy-ops-script-reload"),
("bpy.ops.sculpt.expand*", "sculpt_paint/sculpting/editing/mask.html#bpy-ops-sculpt-expand"),
("bpy.ops.sculpt_curves*", "sculpt_paint/curves_sculpting/index.html#bpy-ops-sculpt-curves"),
+ ("bpy.ops.ui.eyedropper*", "interface/controls/buttons/eyedropper.html#bpy-ops-ui-eyedropper"),
("bpy.ops.view3d.select*", "editors/3dview/selecting.html#bpy-ops-view3d-select"),
("bpy.ops.wm.debug_menu*", "advanced/operators.html#bpy-ops-wm-debug-menu"),
("bpy.ops.wm.obj_export*", "files/import_export/obj.html#bpy-ops-wm-obj-export"),
@@ -2911,6 +2975,7 @@ url_manual_mapping = (
("bpy.ops.wm.usd_export*", "files/import_export/usd.html#bpy-ops-wm-usd-export"),
("bpy.types.addsequence*", "video_editing/edit/montage/strips/effects/add.html#bpy-types-addsequence"),
("bpy.types.brush.cloth*", "sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth"),
+ ("bpy.types.brush.curve*", "sculpt_paint/brush/falloff.html#bpy-types-brush-curve"),
("bpy.types.camera.show*", "render/cameras.html#bpy-types-camera-show"),
("bpy.types.consoleline*", "editors/python_console.html#bpy-types-consoleline"),
("bpy.types.curve.bevel*", "modeling/curves/properties/geometry.html#bpy-types-curve-bevel"),
@@ -2960,6 +3025,7 @@ url_manual_mapping = (
("bpy.types.areaspaces*", "interface/window_system/areas.html#bpy-types-areaspaces"),
("bpy.types.bonegroups*", "animation/armatures/properties/bone_groups.html#bpy-types-bonegroups"),
("bpy.types.bpy_struct*", "files/data_blocks.html#bpy-types-bpy-struct"),
+ ("bpy.types.brush.rate*", "sculpt_paint/brush/stroke.html#bpy-types-brush-rate"),
("bpy.types.collection*", "scene_layout/collections/collections.html#bpy-types-collection"),
("bpy.types.compositor*", "compositing/index.html#bpy-types-compositor"),
("bpy.types.constraint*", "animation/constraints/index.html#bpy-types-constraint"),
diff --git a/release/scripts/startup/bl_ui/node_add_menu.py b/release/scripts/startup/bl_ui/node_add_menu.py
index 31b84b8f08a..873dbd533a5 100644
--- a/release/scripts/startup/bl_ui/node_add_menu.py
+++ b/release/scripts/startup/bl_ui/node_add_menu.py
@@ -59,6 +59,14 @@ def draw_node_group_add_menu(context, layout):
ops.value = "bpy.data.node_groups[%r]" % group.name
+def draw_assets_for_catalog(layout, catalog_path):
+ layout.template_node_asset_menu_items(catalog_path=catalog_path)
+
+
+def draw_root_assets(layout):
+ layout.menu_contents("NODE_MT_node_add_root_catalogs")
+
+
classes = (
)
diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
index e1b57ec4f43..c076cd7395a 100644
--- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py
+++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
@@ -16,6 +16,7 @@ class NODE_MT_geometry_node_GEO_ATTRIBUTE(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize")
node_add_menu.add_node_type(layout, "GeometryNodeRemoveAttribute")
node_add_menu.add_node_type(layout, "GeometryNodeStoreNamedAttribute")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_COLOR(Menu):
@@ -32,6 +33,7 @@ class NODE_MT_geometry_node_GEO_COLOR(Menu):
ops.value = "'RGBA'"
node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
node_add_menu.add_node_type(layout, "FunctionNodeSeparateColor")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_CURVE(Menu):
@@ -70,6 +72,7 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeSetSplineCyclic")
node_add_menu.add_node_type(layout, "GeometryNodeSetSplineResolution")
node_add_menu.add_node_type(layout, "GeometryNodeCurveSplineType")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu):
@@ -86,6 +89,7 @@ class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeCurveQuadraticBezier")
node_add_menu.add_node_type(layout, "GeometryNodeCurvePrimitiveQuadrilateral")
node_add_menu.add_node_type(layout, "GeometryNodeCurveStar")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_curve_topology(Menu):
@@ -97,6 +101,7 @@ class NODE_MT_geometry_node_curve_topology(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeOffsetPointInCurve")
node_add_menu.add_node_type(layout, "GeometryNodeCurveOfPoint")
node_add_menu.add_node_type(layout, "GeometryNodePointsOfCurve")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_GEOMETRY(Menu):
@@ -122,6 +127,7 @@ class NODE_MT_geometry_node_GEO_GEOMETRY(Menu):
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeSetID")
node_add_menu.add_node_type(layout, "GeometryNodeSetPosition")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_INPUT(Menu):
@@ -149,6 +155,7 @@ class NODE_MT_geometry_node_GEO_INPUT(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeInputPosition")
node_add_menu.add_node_type(layout, "GeometryNodeInputRadius")
node_add_menu.add_node_type(layout, "GeometryNodeInputSceneTime")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_INSTANCE(Menu):
@@ -166,6 +173,7 @@ class NODE_MT_geometry_node_GEO_INSTANCE(Menu):
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeInputInstanceRotation")
node_add_menu.add_node_type(layout, "GeometryNodeInputInstanceScale")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_MATERIAL(Menu):
@@ -181,6 +189,7 @@ class NODE_MT_geometry_node_GEO_MATERIAL(Menu):
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeSetMaterial")
node_add_menu.add_node_type(layout, "GeometryNodeSetMaterialIndex")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_GEO_MESH(Menu):
@@ -219,6 +228,7 @@ class NODE_MT_geometry_node_GEO_MESH(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeInputMeshVertexNeighbors")
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeSetShadeSmooth")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_PRIMITIVES_MESH(Menu):
@@ -235,6 +245,7 @@ class NODE_MT_category_PRIMITIVES_MESH(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeMeshCircle")
node_add_menu.add_node_type(layout, "GeometryNodeMeshLine")
node_add_menu.add_node_type(layout, "GeometryNodeMeshUVSphere")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_mesh_topology(Menu):
@@ -250,6 +261,7 @@ class NODE_MT_geometry_node_mesh_topology(Menu):
node_add_menu.add_node_type(layout, "GeometryNodeFaceOfCorner"),
node_add_menu.add_node_type(layout, "GeometryNodeOffsetCornerInFace"),
node_add_menu.add_node_type(layout, "GeometryNodeVertexOfCorner"),
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_OUTPUT(Menu):
@@ -259,6 +271,7 @@ class NODE_MT_category_GEO_OUTPUT(Menu):
def draw(self, _context):
layout = self.layout
node_add_menu.add_node_type(layout, "GeometryNodeViewer")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_POINT(Menu):
@@ -274,6 +287,7 @@ class NODE_MT_category_GEO_POINT(Menu):
node_add_menu.add_node_type(layout, "GeometryNodePointsToVolume")
layout.separator()
node_add_menu.add_node_type(layout, "GeometryNodeSetPointRadius")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_TEXT(Menu):
@@ -290,6 +304,7 @@ class NODE_MT_category_GEO_TEXT(Menu):
node_add_menu.add_node_type(layout, "FunctionNodeValueToString")
layout.separator()
node_add_menu.add_node_type(layout, "FunctionNodeInputSpecialCharacters")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_TEXTURE(Menu):
@@ -308,6 +323,7 @@ class NODE_MT_category_GEO_TEXTURE(Menu):
node_add_menu.add_node_type(layout, "ShaderNodeTexVoronoi")
node_add_menu.add_node_type(layout, "ShaderNodeTexWave")
node_add_menu.add_node_type(layout, "ShaderNodeTexWhiteNoise")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_UTILITIES(Menu):
@@ -331,6 +347,7 @@ class NODE_MT_category_GEO_UTILITIES(Menu):
node_add_menu.add_node_type(layout, "FunctionNodeRandomValue")
node_add_menu.add_node_type(layout, "FunctionNodeRotateEuler")
node_add_menu.add_node_type(layout, "GeometryNodeSwitch")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_UV(Menu):
@@ -341,6 +358,7 @@ class NODE_MT_category_GEO_UV(Menu):
layout = self.layout
node_add_menu.add_node_type(layout, "GeometryNodeUVPackIslands")
node_add_menu.add_node_type(layout, "GeometryNodeUVUnwrap")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_VECTOR(Menu):
@@ -354,6 +372,7 @@ class NODE_MT_category_GEO_VECTOR(Menu):
node_add_menu.add_node_type(layout, "ShaderNodeVectorCurve")
node_add_menu.add_node_type(layout, "ShaderNodeVectorMath")
node_add_menu.add_node_type(layout, "ShaderNodeVectorRotate")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_VOLUME(Menu):
@@ -364,6 +383,7 @@ class NODE_MT_category_GEO_VOLUME(Menu):
layout = self.layout
node_add_menu.add_node_type(layout, "GeometryNodeVolumeCube")
node_add_menu.add_node_type(layout, "GeometryNodeVolumeToMesh")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_GROUP(Menu):
@@ -373,6 +393,7 @@ class NODE_MT_category_GEO_GROUP(Menu):
def draw(self, context):
layout = self.layout
node_add_menu.draw_node_group_add_menu(context, layout)
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_category_GEO_LAYOUT(Menu):
@@ -383,6 +404,7 @@ class NODE_MT_category_GEO_LAYOUT(Menu):
layout = self.layout
node_add_menu.add_node_type(layout, "NodeFrame")
node_add_menu.add_node_type(layout, "NodeReroute")
+ node_add_menu.draw_assets_for_catalog(layout, self.bl_label)
class NODE_MT_geometry_node_add_all(Menu):
@@ -413,6 +435,7 @@ class NODE_MT_geometry_node_add_all(Menu):
layout.menu("NODE_MT_category_GEO_VOLUME")
layout.menu("NODE_MT_category_GEO_GROUP")
layout.menu("NODE_MT_category_GEO_LAYOUT")
+ node_add_menu.draw_root_assets(layout)
classes = (
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index a775a3cfa1b..a6b97fbdc85 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -586,7 +586,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
def draw_attribute_warnings(self, context, layout):
ob = context.object
- mesh = ob.data
+ mesh = context.mesh
unique_names = set()
colliding_names = []
@@ -595,8 +595,11 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
{"position": None, "shade_smooth": None, "normal": None, "crease": None},
mesh.attributes,
mesh.uv_layers,
- ob.vertex_groups,
+ None if ob is None else ob.vertex_groups,
):
+ if collection is None:
+ colliding_names.append("Cannot check for object vertex groups when pinning mesh")
+ continue
for name in collection.keys():
unique_names_len = len(unique_names)
unique_names.add(name)
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index ee0f41937e2..eff05e471aa 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -34,9 +34,9 @@ typedef struct EditBone {
/** User-Defined Properties on this Bone */
struct IDProperty *prop;
/**
- * Editbones have a one-way link (i.e. children refer
+ * Edit-bones have a one-way link (i.e. children refer
* to parents. This is converted to a two-way link for
- * normal bones when leaving editmode.
+ * normal bones when leaving edit-mode.
*/
struct EditBone *parent;
/** (64 == MAXBONENAME) */
diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh
index caed12d4fdf..73c2e00c4c4 100644
--- a/source/blender/blenkernel/BKE_asset_catalog.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog.hh
@@ -307,7 +307,7 @@ class AssetCatalogTreeItem {
/** Iterate over children calling \a callback for each of them, but do not recurse into their
* children. */
- void foreach_child(const ItemIterFn callback);
+ void foreach_child(ItemIterFn callback);
protected:
/** Child tree items, ordered by their names. */
@@ -345,10 +345,15 @@ class AssetCatalogTree {
/** Ensure an item representing \a path is in the tree, adding it if necessary. */
void insert_item(const AssetCatalog &catalog);
- void foreach_item(const AssetCatalogTreeItem::ItemIterFn callback);
+ void foreach_item(ItemIterFn callback);
/** Iterate over root items calling \a callback for each of them, but do not recurse into their
* children. */
- void foreach_root_item(const ItemIterFn callback);
+ void foreach_root_item(ItemIterFn callback);
+
+ bool is_empty() const;
+
+ AssetCatalogTreeItem *find_item(const AssetCatalogPath &path);
+ AssetCatalogTreeItem *find_root_item(const AssetCatalogPath &path);
protected:
/** Child tree items, ordered by their names. */
diff --git a/source/blender/blenkernel/BKE_asset_catalog_path.hh b/source/blender/blenkernel/BKE_asset_catalog_path.hh
index 135906dd064..93ab0389daf 100644
--- a/source/blender/blenkernel/BKE_asset_catalog_path.hh
+++ b/source/blender/blenkernel/BKE_asset_catalog_path.hh
@@ -49,7 +49,7 @@ class AssetCatalogPath {
AssetCatalogPath() = default;
AssetCatalogPath(StringRef path);
- AssetCatalogPath(const std::string &path);
+ AssetCatalogPath(std::string path);
AssetCatalogPath(const char *path);
AssetCatalogPath(const AssetCatalogPath &other_path) = default;
AssetCatalogPath(AssetCatalogPath &&other_path) noexcept;
diff --git a/source/blender/blenkernel/BKE_asset_library.hh b/source/blender/blenkernel/BKE_asset_library.hh
index e0a39e3aee8..2058df71f6a 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -10,6 +10,8 @@
# error This is a C++-only header file. Use BKE_asset_library.h instead.
#endif
+#include "DNA_asset_types.h"
+
#include "BKE_asset_library.h"
#include "BKE_asset_catalog.hh"
@@ -44,19 +46,24 @@ struct AssetLibrary {
* No-op if the catalog cannot be found. This could be the kind of "the
* catalog definition file is corrupt/lost" scenario that the simple name is
* meant to help recover from. */
- void refresh_catalog_simplename(struct AssetMetaData *asset_data);
+ void refresh_catalog_simplename(AssetMetaData *asset_data);
void on_blend_save_handler_register();
void on_blend_save_handler_unregister();
- void on_blend_save_post(struct Main *, struct PointerRNA **pointers, int num_pointers);
+ void on_blend_save_post(Main *bmain, PointerRNA **pointers, int num_pointers);
private:
bCallbackFuncStore on_save_callback_store_{};
};
+Vector<AssetLibraryReference> all_valid_asset_library_refs();
+
} // namespace blender::bke
+blender::bke::AssetLibrary *BKE_asset_library_load(const Main *bmain,
+ const AssetLibraryReference &library_reference);
+
blender::bke::AssetCatalogService *BKE_asset_library_get_catalog_service(
const ::AssetLibrary *library);
blender::bke::AssetCatalogTree *BKE_asset_library_get_catalog_tree(const ::AssetLibrary *library);
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 806fff2099e..4bffa5492b5 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -17,7 +17,7 @@ extern "C" {
*/
/* Blender major and minor version. */
-#define BLENDER_VERSION 304
+#define BLENDER_VERSION 305
/* Blender patch version for bugfix releases. */
#define BLENDER_VERSION_PATCH 0
/** Blender release cycle stage: alpha/beta/rc/release. */
@@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 5
+#define BLENDER_FILE_SUBVERSION 0
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h
index bc60b6f050e..5b1dea0833a 100644
--- a/source/blender/blenkernel/BKE_bpath.h
+++ b/source/blender/blenkernel/BKE_bpath.h
@@ -55,15 +55,18 @@ typedef enum eBPathForeachFlag {
* This is needed for directory manipulation callbacks which might otherwise modify the same
* directory multiple times. */
BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE = (1 << 8),
- /** Reload data (when the path is edited).
- * \note Only used by Image IDType currently. */
+ /**
+ * Reload data (when the path is edited).
+ * \note Only used by Image #IDType currently.
+ */
BKE_BPATH_FOREACH_PATH_RELOAD_EDITED = (1 << 9),
} eBPathForeachFlag;
ENUM_OPERATORS(eBPathForeachFlag, BKE_BPATH_FOREACH_PATH_RELOAD_EDITED)
struct BPathForeachPathData;
-/** Callback used to iterate over an ID's file paths.
+/**
+ * Callback used to iterate over an ID's file paths.
*
* \note `path`s parameters should be considered as having a maximal `FILE_MAX` string length.
*
@@ -145,8 +148,9 @@ bool BKE_bpath_foreach_path_allocated_process(struct BPathForeachPathData *bpath
/** Check for missing files. */
void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports);
-/** Recursively search into given search directory, for all file paths of all IDs in given \a
- * bmain, and replace existing paths as needed.
+/**
+ * Recursively search into given search directory, for all file paths of all IDs in given
+ * \a bmain, and replace existing paths as needed.
*
* \note The search will happen into the whole search directory tree recursively (with a limit of
* MAX_DIR_RECURSE), if several files are found matching a searched filename, the biggest one will
@@ -156,7 +160,7 @@ void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *report
* \param searchpath: The root directory in which the new filepaths should be searched for.
* \param find_all: If `true`, also search for files which current path is still valid, if `false`
* skip those still valid paths.
- * */
+ */
void BKE_bpath_missing_files_find(struct Main *bmain,
const char *searchpath,
struct ReportList *reports,
@@ -178,23 +182,28 @@ void BKE_bpath_absolute_convert(struct Main *bmain,
const char *basedir,
struct ReportList *reports);
-/** Temp backup of paths from all IDs in given \a bmain.
+/**
+ * Temp backup of paths from all IDs in given \a bmain.
*
- * \return An opaque handle to pass to #BKE_bpath_list_restore and #BKE_bpath_list_free.
+ * \return An opaque handle to pass to #BKE_bpath_list_restore and #BKE_bpath_list_free.
*/
void *BKE_bpath_list_backup(struct Main *bmain, eBPathForeachFlag flag);
-/** Restore the temp backup of paths from \a path_list_handle into all IDs in given \a bmain.
+/**
+ * Restore the temp backup of paths from \a path_list_handle into all IDs in given \a bmain.
*
* \note This function assumes that the data in given Main did not change (no
* addition/deletion/re-ordering of IDs, or their file paths) since the call to
- * #BKE_bpath_list_backup that generated the given \a path_list_handle. */
+ * #BKE_bpath_list_backup that generated the given \a path_list_handle.
+ */
void BKE_bpath_list_restore(struct Main *bmain, eBPathForeachFlag flag, void *path_list_handle);
-/** Free the temp backup of paths in \a path_list_handle.
+/**
+ * Free the temp backup of paths in \a path_list_handle.
*
* \note This function assumes that the path list has already been restored with a call to
- * #BKE_bpath_list_restore, and is therefore empty. */
+ * #BKE_bpath_list_restore, and is therefore empty.
+ */
void BKE_bpath_list_free(void *path_list_handle);
/** \} */
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index b7068720469..e1406e63ce1 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -285,7 +285,7 @@ bool CTX_data_dir(const char *member);
CTX_DATA_BEGIN (C, Type, instance, member) \
Type_id instance_id = (Type_id)ctx_link->ptr.owner_id;
-int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBase *));
+int ctx_data_list_count(const bContext *C, bool (*func)(const bContext *, ListBase *));
#define CTX_DATA_COUNT(C, member) ctx_data_list_count(C, CTX_data_##member)
@@ -316,22 +316,22 @@ void CTX_data_main_set(bContext *C, struct Main *bmain);
void CTX_data_scene_set(bContext *C, struct Scene *scene);
/* Only Outliner currently! */
-int CTX_data_selected_ids(const bContext *C, ListBase *list);
+bool CTX_data_selected_ids(const bContext *C, ListBase *list);
-int CTX_data_selected_editable_objects(const bContext *C, ListBase *list);
-int CTX_data_selected_editable_bases(const bContext *C, ListBase *list);
+bool CTX_data_selected_editable_objects(const bContext *C, ListBase *list);
+bool CTX_data_selected_editable_bases(const bContext *C, ListBase *list);
-int CTX_data_editable_objects(const bContext *C, ListBase *list);
-int CTX_data_editable_bases(const bContext *C, ListBase *list);
+bool CTX_data_editable_objects(const bContext *C, ListBase *list);
+bool CTX_data_editable_bases(const bContext *C, ListBase *list);
-int CTX_data_selected_objects(const bContext *C, ListBase *list);
-int CTX_data_selected_bases(const bContext *C, ListBase *list);
+bool CTX_data_selected_objects(const bContext *C, ListBase *list);
+bool CTX_data_selected_bases(const bContext *C, ListBase *list);
-int CTX_data_visible_objects(const bContext *C, ListBase *list);
-int CTX_data_visible_bases(const bContext *C, ListBase *list);
+bool CTX_data_visible_objects(const bContext *C, ListBase *list);
+bool CTX_data_visible_bases(const bContext *C, ListBase *list);
-int CTX_data_selectable_objects(const bContext *C, ListBase *list);
-int CTX_data_selectable_bases(const bContext *C, ListBase *list);
+bool CTX_data_selectable_objects(const bContext *C, ListBase *list);
+bool CTX_data_selectable_bases(const bContext *C, ListBase *list);
struct Object *CTX_data_active_object(const bContext *C);
struct Base *CTX_data_active_base(const bContext *C);
@@ -345,25 +345,25 @@ struct Mask *CTX_data_edit_mask(const bContext *C);
struct CacheFile *CTX_data_edit_cachefile(const bContext *C);
-int CTX_data_selected_nodes(const bContext *C, ListBase *list);
+bool CTX_data_selected_nodes(const bContext *C, ListBase *list);
struct EditBone *CTX_data_active_bone(const bContext *C);
-int CTX_data_selected_bones(const bContext *C, ListBase *list);
-int CTX_data_selected_editable_bones(const bContext *C, ListBase *list);
-int CTX_data_visible_bones(const bContext *C, ListBase *list);
-int CTX_data_editable_bones(const bContext *C, ListBase *list);
+bool CTX_data_selected_bones(const bContext *C, ListBase *list);
+bool CTX_data_selected_editable_bones(const bContext *C, ListBase *list);
+bool CTX_data_visible_bones(const bContext *C, ListBase *list);
+bool CTX_data_editable_bones(const bContext *C, ListBase *list);
struct bPoseChannel *CTX_data_active_pose_bone(const bContext *C);
-int CTX_data_selected_pose_bones(const bContext *C, ListBase *list);
-int CTX_data_selected_pose_bones_from_active_object(const bContext *C, ListBase *list);
-int CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
+bool CTX_data_selected_pose_bones(const bContext *C, ListBase *list);
+bool CTX_data_selected_pose_bones_from_active_object(const bContext *C, ListBase *list);
+bool CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
struct bGPdata *CTX_data_gpencil_data(const bContext *C);
struct bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C);
struct bGPDframe *CTX_data_active_gpencil_frame(const bContext *C);
-int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list);
-int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
-int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
+bool CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list);
+bool CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
+bool CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
const struct AssetLibraryReference *CTX_wm_asset_library_ref(const bContext *C);
struct AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid);
diff --git a/source/blender/blenkernel/BKE_duplilist.h b/source/blender/blenkernel/BKE_duplilist.h
index 44c4df1fc2e..a0732bf39cf 100644
--- a/source/blender/blenkernel/BKE_duplilist.h
+++ b/source/blender/blenkernel/BKE_duplilist.h
@@ -76,16 +76,20 @@ typedef struct DupliObject {
unsigned int random_id;
} DupliObject;
-/** Look up the RGBA value of a uniform shader attribute.
- * \return true if the attribute was found; if not, r_value is also set to zero. */
+/**
+ * Look up the RGBA value of a uniform shader attribute.
+ * \return true if the attribute was found; if not, r_value is also set to zero.
+ */
bool BKE_object_dupli_find_rgba_attribute(struct Object *ob,
struct DupliObject *dupli,
struct Object *dupli_parent,
const char *name,
float r_value[4]);
-/** Look up the RGBA value of a view layer/scene/world shader attribute.
- * \return true if the attribute was found; if not, r_value is also set to zero. */
+/**
+ * Look up the RGBA value of a view layer/scene/world shader attribute.
+ * \return true if the attribute was found; if not, r_value is also set to zero.
+ */
bool BKE_view_layer_find_rgba_attribute(struct Scene *scene,
struct ViewLayer *layer,
const char *name,
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index 109d3e6d977..431bc11b07f 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -119,7 +119,7 @@ struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings
int dynamicPaint_createUVSurface(struct Scene *scene,
struct DynamicPaintSurface *surface,
float *progress,
- short *do_update);
+ bool *do_update);
/**
* Calculate a single frame and included sub-frames for surface.
*/
diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h
index b9219814c08..976961f27ae 100644
--- a/source/blender/blenkernel/BKE_gpencil_geom.h
+++ b/source/blender/blenkernel/BKE_gpencil_geom.h
@@ -332,8 +332,12 @@ bool BKE_gpencil_stroke_stretch(struct bGPDstroke *gps,
* \param gps: Target stroke.
* \param index_from: the index of the first point to be used in the trimmed result.
* \param index_to: the index of the last point to be used in the trimmed result.
+ * \param keep_point: Keep strokes with one point. False remove the single points strokes
*/
-bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps, int index_from, int index_to);
+bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps,
+ int index_from,
+ int index_to,
+ const bool keep_point);
/**
* Split the given stroke into several new strokes, partitioning
* it based on whether the stroke points have a particular flag
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 0fe351c0aa4..6cae56b775f 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -167,9 +167,9 @@ void BKE_keyblock_update_from_offset(const struct Object *ob,
* Move shape key from org_index to new_index. Safe, clamps index to valid range,
* updates reference keys, the object's active shape index,
* the 'frame' value in case of absolute keys, etc.
- * Note indices are expected in real values (not 'fake' shapenr +1 ones).
+ * Note indices are expected in real values (not *fake* `shapenr +1` ones).
*
- * \param org_index: if < 0, current object's active shape will be used as skey to move.
+ * \param org_index: if < 0, current object's active shape will be used as shape-key to move.
* \return true if something was done, else false.
*/
bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 0ff7f50f71c..8f6786d4113 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -307,8 +307,6 @@ void BKE_mesh_translate(struct Mesh *me, const float offset[3], bool do_keys);
void BKE_mesh_tessface_clear(struct Mesh *mesh);
-void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh);
-
void BKE_mesh_mselect_clear(struct Mesh *me);
void BKE_mesh_mselect_validate(struct Mesh *me);
/**
@@ -974,11 +972,6 @@ void BKE_mesh_strip_loose_faces(struct Mesh *me);
void BKE_mesh_strip_loose_polysloops(struct Mesh *me);
void BKE_mesh_strip_loose_edges(struct Mesh *me);
-/**
- * If the mesh is from a very old blender version,
- * convert #MFace.edcode to edge #ME_EDGEDRAW.
- */
-void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old);
void BKE_mesh_calc_edges_loose(struct Mesh *mesh);
/**
* Calculate edges from polygons.
diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 92182f8045b..02c2bc9c330 100644
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@ -123,6 +123,13 @@ void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
*/
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh);
+/**
+ * Convert legacy #MFace.edcode to edge #ME_EDGEDRAW.
+ */
+void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old);
+
+void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh);
+
/* Inlines */
/* NOTE(@sybren): Instead of -1 that function uses ORIGINDEX_NONE as defined in BKE_customdata.h,
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index efadd5c11d6..2913beee759 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -249,8 +249,8 @@ float BKE_nlastrip_compute_frame_to_next_strip(struct NlaStrip *strip);
/**
* Returns the next strip in this strip's NLA track, or a null pointer.
*
- * \param strip The strip to find the next trip from.
- * \param check_transitions Whether or not to skip transitions.
+ * \param strip: The strip to find the next trip from.
+ * \param check_transitions: Whether or not to skip transitions.
* \return The next strip in the track, or NULL if none are present.
*/
struct NlaStrip *BKE_nlastrip_next_in_track(struct NlaStrip *strip, bool skip_transitions);
@@ -258,8 +258,8 @@ struct NlaStrip *BKE_nlastrip_next_in_track(struct NlaStrip *strip, bool skip_tr
/**
* Returns the previous strip in this strip's NLA track, or a null pointer.
*
- * \param strip The strip to find the previous trip from.
- * \param check_transitions Whether or not to skip transitions.
+ * \param strip: The strip to find the previous trip from.
+ * \param check_transitions: Whether or not to skip transitions.
* \return The previous strip in the track, or NULL if none are present.
*/
struct NlaStrip *BKE_nlastrip_prev_in_track(struct NlaStrip *strip, bool skip_transitions);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index ecf7a556459..ef46f4db998 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -572,6 +572,11 @@ struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree,
struct bNode *from_node,
struct bNodeSocket *from_sock);
+struct bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(struct bNodeTree *ntree,
+ struct bNode *from_node,
+ struct bNodeSocket *from_sock,
+ const char *idname,
+ const char *name);
struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree,
struct bNodeSocket *next_sock,
struct bNode *from_node,
@@ -983,8 +988,6 @@ void node_type_socket_templates(struct bNodeType *ntype,
struct bNodeSocketTemplate *outputs);
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
-void node_type_init(struct bNodeType *ntype,
- void (*initfunc)(struct bNodeTree *ntree, struct bNode *node));
/**
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
* Otherwise nodes will reload as undefined (T46619).
@@ -995,17 +998,6 @@ void node_type_storage(struct bNodeType *ntype,
void (*copyfunc)(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node));
-void node_type_update(struct bNodeType *ntype,
- void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node));
-void node_type_group_update(struct bNodeType *ntype,
- void (*group_update_func)(struct bNodeTree *ntree,
- struct bNode *node));
-
-void node_type_exec(struct bNodeType *ntype,
- NodeInitExecFunction init_exec_fn,
- NodeFreeExecFunction free_exec_fn,
- NodeExecFunction exec_fn);
-void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn);
/** \} */
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 60dfc0af25f..cfad8c5cfdb 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -283,7 +283,17 @@ void BKE_object_apply_parent_inverse(struct Object *ob);
void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]);
bool BKE_object_pose_context_check(const struct Object *ob);
+
struct Object *BKE_object_pose_armature_get(struct Object *ob);
+/**
+ * A version of #BKE_object_pose_armature_get with an additional check.
+ * When `ob` isn't an armature: only return the referenced pose object
+ * when the active object is in weight paint mode.
+ *
+ * \note Some callers need to check that pose bones are selectable
+ * which isn't the case when the object using the armature isn't in weight-paint mode.
+ */
+struct Object *BKE_object_pose_armature_get_with_wpaint_check(struct Object *ob);
struct Object *BKE_object_pose_armature_get_visible(struct Object *ob,
const struct Scene *scene,
struct ViewLayer *view_layer,
@@ -323,7 +333,7 @@ struct Base **BKE_object_pose_base_array_get(const struct Scene *scene,
void BKE_object_get_parent_matrix(struct Object *ob, struct Object *par, float r_parentmat[4][4]);
/**
- * Compute object world transform and store it in `ob->obmat`.
+ * Compute object world transform and store it in `ob->object_to_world`.
*/
void BKE_object_where_is_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(struct Depsgraph *depsgraph,
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 437a22e4782..9fc4aa5307d 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -886,7 +886,7 @@ void BKE_sculpt_sync_face_visibility_to_grids(struct Mesh *mesh, struct SubdivCC
* Test if PBVH can be used directly for drawing, which is faster than
* drawing the mesh and all updates that come with it.
*/
-bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct View3D *v3d);
+bool BKE_sculptsession_use_pbvh_draw(const struct Object *ob, const struct RegionView3D *rv3d);
enum {
SCULPT_MASK_LAYER_CALC_VERT = (1 << 0),
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index efb8c2a9bb1..4331a25c112 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -293,6 +293,7 @@ void BKE_ptcache_ids_from_object(struct ListBase *lb,
bool BKE_ptcache_object_has(struct Scene *scene, struct Object *ob, int duplis);
/************ ID specific functions ************************/
+
void BKE_ptcache_id_clear(PTCacheID *id, int mode, unsigned int cfra);
bool BKE_ptcache_id_exist(PTCacheID *id, int cfra);
int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *id, int mode);
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 9a7d2bde810..a86953f35cc 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -385,6 +385,7 @@ typedef struct MenuType {
bool (*poll)(const struct bContext *C, struct MenuType *mt);
/* draw entirely, view changes should be handled here */
void (*draw)(const struct bContext *C, struct Menu *menu);
+ void (*listener)(const wmRegionListenerParams *params);
/* RNA integration */
ExtensionRNA rna_ext;
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 11c37a74a54..f0bb530e32b 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -170,7 +170,7 @@ int BKE_sound_scene_playing(struct Scene *scene);
void BKE_sound_free_waveform(struct bSound *sound);
-void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, short *stop);
+void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, bool *stop);
void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene);
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 89f30ce8ef8..70c1049b5d7 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -657,8 +657,8 @@ void BKE_tracking_reconstruction_context_free(struct MovieReconstructContext *co
* callback in libmv side and passing to an interface.
*/
void BKE_tracking_reconstruction_solve(struct MovieReconstructContext *context,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress,
char *stats_message,
int message_size);
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index f3a929dc5b9..5d1a27f8ba0 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -75,7 +75,7 @@ typedef struct UndoStep {
/** Some situations require the global state to be stored, edge cases when exiting modes. */
bool use_memfile_step;
/** When this is true, undo/memfile read code is allowed to re-use old data-blocks for unchanged
- * IDs, and existing depsgraphes. This has to be forbidden in some cases (like renamed IDs). */
+ * IDs, and existing depsgraphs. This has to be forbidden in some cases (like renamed IDs). */
bool use_old_bmain_data;
/** For use by undo systems that accumulate changes (mesh-sculpt & image-painting). */
bool is_applied;
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 11ef2b08df4..bfdfc447baf 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -747,7 +747,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
MutableAttributeAccessor attributes = mesh_final->attributes_for_write();
SpanAttributeWriter<float3> rest_positions =
attributes.lookup_or_add_for_write_only_span<float3>("rest_position", ATTR_DOMAIN_POINT);
- if (rest_positions) {
+ if (rest_positions && attributes.domain_size(ATTR_DOMAIN_POINT) > 0) {
attributes.lookup<float3>("position").materialize(rest_positions.span);
rest_positions.finish();
}
@@ -1648,6 +1648,12 @@ static void editbmesh_build_data(struct Depsgraph *depsgraph,
const bool is_mesh_eval_owned = (me_final != mesh->runtime->mesh_eval);
BKE_object_eval_assign_data(obedit, &me_final->id, is_mesh_eval_owned);
+ /* Make sure that drivers can target shapekey properties.
+ * Note that this causes a potential inconsistency, as the shapekey may have a
+ * different topology than the evaluated mesh. */
+ BLI_assert(mesh->key == nullptr || DEG_is_evaluated_id(&mesh->key->id));
+ me_final->key = mesh->key;
+
obedit->runtime.editmesh_eval_cage = me_cage;
obedit->runtime.geometry_set_eval = non_mesh_components;
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 10aa4ec7906..8f6bd812d8e 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1738,7 +1738,7 @@ void what_does_obaction(Object *ob,
BKE_object_workob_clear(workob);
/* init workob */
- copy_m4_m4(workob->obmat, ob->obmat);
+ copy_m4_m4(workob->object_to_world, ob->object_to_world);
copy_m4_m4(workob->parentinv, ob->parentinv);
copy_m4_m4(workob->constinv, ob->constinv);
workob->parent = ob->parent;
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 965f48d1e51..b3990b2b7fc 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -237,7 +237,7 @@ bool BKE_appdir_font_folder_default(char *dir)
}
#elif defined(__APPLE__)
STRNCPY(test_dir, BLI_expand_tilde("~/Library/Fonts/"));
- BLI_path_slash_ensure(test_dir);
+ BLI_path_slash_ensure(test_dir, sizeof(test_dir));
#else
STRNCPY(test_dir, "/usr/share/fonts");
#endif
@@ -1093,13 +1093,13 @@ void BKE_appdir_app_templates(ListBase *templates)
* \param userdir: Directory specified in user preferences (may be NULL).
* note that by default this is an empty string, only use when non-empty.
*/
-static void where_is_temp(char *tempdir, const size_t tempdir_len, const char *userdir)
+static void where_is_temp(char *tempdir, const size_t tempdir_maxlen, const char *userdir)
{
tempdir[0] = '\0';
if (userdir && BLI_is_dir(userdir)) {
- BLI_strncpy(tempdir, userdir, tempdir_len);
+ BLI_strncpy(tempdir, userdir, tempdir_maxlen);
}
if (tempdir[0] == '\0') {
@@ -1116,23 +1116,23 @@ static void where_is_temp(char *tempdir, const size_t tempdir_len, const char *u
for (int i = 0; i < ARRAY_SIZE(env_vars); i++) {
const char *tmp = BLI_getenv(env_vars[i]);
if (tmp && (tmp[0] != '\0') && BLI_is_dir(tmp)) {
- BLI_strncpy(tempdir, tmp, tempdir_len);
+ BLI_strncpy(tempdir, tmp, tempdir_maxlen);
break;
}
}
}
if (tempdir[0] == '\0') {
- BLI_strncpy(tempdir, "/tmp/", tempdir_len);
+ BLI_strncpy(tempdir, "/tmp/", tempdir_maxlen);
}
else {
/* add a trailing slash if needed */
- BLI_path_slash_ensure(tempdir);
+ BLI_path_slash_ensure(tempdir, tempdir_maxlen);
}
}
static void tempdir_session_create(char *tempdir_session,
- const size_t tempdir_session_len,
+ const size_t tempdir_session_maxlen,
const char *tempdir)
{
tempdir_session[0] = '\0';
@@ -1146,9 +1146,9 @@ static void tempdir_session_create(char *tempdir_session,
* #_mktemp_s also requires the last null character is included. */
const int tempdir_session_len_required = tempdir_len + session_name_len + 1;
- if (tempdir_session_len_required <= tempdir_session_len) {
+ if (tempdir_session_len_required <= tempdir_session_maxlen) {
/* No need to use path joining utility as we know the last character of #tempdir is a slash. */
- BLI_string_join(tempdir_session, tempdir_session_len, tempdir, session_name);
+ BLI_string_join(tempdir_session, tempdir_session_maxlen, tempdir, session_name);
#ifdef WIN32
const bool needs_create = (_mktemp_s(tempdir_session, tempdir_session_len_required) == 0);
#else
@@ -1158,7 +1158,7 @@ static void tempdir_session_create(char *tempdir_session,
BLI_dir_create_recursive(tempdir_session);
}
if (BLI_is_dir(tempdir_session)) {
- BLI_path_slash_ensure(tempdir_session);
+ BLI_path_slash_ensure(tempdir_session, tempdir_session_maxlen);
/* Success. */
return;
}
@@ -1168,7 +1168,7 @@ static void tempdir_session_create(char *tempdir_session,
"Could not generate a temp file name for '%s', falling back to '%s'",
tempdir_session,
tempdir);
- BLI_strncpy(tempdir_session, tempdir, tempdir_session_len);
+ BLI_strncpy(tempdir_session, tempdir, tempdir_session_maxlen);
}
void BKE_tempdir_init(const char *userdir)
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 2e73cac99b5..e433c26cc54 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1596,7 +1596,7 @@ void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float o
}
/* Get inverse of (armature) object's matrix. */
- invert_m4_m4(obmat, ob->obmat);
+ invert_m4_m4(obmat, ob->object_to_world);
/* multiply given matrix by object's-inverse to find pose-space matrix */
mul_m4_m4m4(outmat, inmat, obmat);
@@ -2569,7 +2569,7 @@ void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob)
}
}
else {
- invert_m4_m4(ob->imat, ob->obmat); /* imat is needed */
+ invert_m4_m4(ob->world_to_object, ob->object_to_world); /* world_to_object is needed */
/* 1. clear flags */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -2696,14 +2696,14 @@ void BKE_pchan_minmax(const Object *ob,
pchan->custom_translation[0],
pchan->custom_translation[1],
pchan->custom_translation[2]);
- mul_m4_series(mat, ob->obmat, tmp, rmat, smat);
+ mul_m4_series(mat, ob->object_to_world, tmp, rmat, smat);
BKE_boundbox_minmax(bb_custom, mat, r_min, r_max);
}
else {
float vec[3];
- mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head);
+ mul_v3_m4v3(vec, ob->object_to_world, pchan_tx->pose_head);
minmax_v3v3_v3(r_min, r_max, vec);
- mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_tail);
+ mul_v3_m4v3(vec, ob->object_to_world, pchan_tx->pose_tail);
minmax_v3v3_v3(r_min, r_max, vec);
}
}
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index 89afb886fc2..64a3937c191 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -582,9 +582,9 @@ static void armature_deform_coords_impl(const Object *ob_arm,
};
float obinv[4][4];
- invert_m4_m4(obinv, ob_target->obmat);
+ invert_m4_m4(obinv, ob_target->object_to_world);
- mul_m4_m4m4(data.postmat, obinv, ob_arm->obmat);
+ mul_m4_m4m4(data.postmat, obinv, ob_arm->object_to_world);
invert_m4_m4(data.premat, data.postmat);
if (em_target != NULL) {
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 6d7aed239e7..5f749472b2d 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -249,11 +249,11 @@ static void apply_curve_transform(
* unless the option to allow curve to be positioned elsewhere is activated (i.e. no root).
*/
if ((ik_data->flag & CONSTRAINT_SPLINEIK_NO_ROOT) == 0) {
- mul_m4_v3(ik_data->tar->obmat, r_vec);
+ mul_m4_v3(ik_data->tar->object_to_world, r_vec);
}
/* Convert the position to pose-space. */
- mul_m4_v3(ob->imat, r_vec);
+ mul_m4_v3(ob->world_to_object, r_vec);
/* Set the new radius (it should be the average value). */
*r_radius = (radius + *r_radius) / 2;
@@ -818,8 +818,8 @@ void BKE_pose_eval_init(struct Depsgraph *depsgraph, Scene *UNUSED(scene), Objec
BLI_assert(object->pose != NULL);
BLI_assert((object->pose->flag & POSE_RECALC) == 0);
- /* imat is needed for solvers. */
- invert_m4_m4(object->imat, object->obmat);
+ /* world_to_object is needed for solvers. */
+ invert_m4_m4(object->world_to_object, object->object_to_world);
/* clear flags */
for (bPoseChannel *pchan = pose->chanbase.first; pchan != NULL; pchan = pchan->next) {
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index 38c712d7e75..62d03b2d79b 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -9,6 +9,7 @@
#include "BKE_asset_catalog.hh"
#include "BKE_asset_library.h"
+#include "BKE_asset_library.hh"
#include "BLI_fileops.hh"
#include "BLI_path_util.h"
@@ -787,6 +788,41 @@ void AssetCatalogTree::foreach_root_item(const ItemIterFn callback)
}
}
+bool AssetCatalogTree::is_empty() const
+{
+ return root_items_.empty();
+}
+
+AssetCatalogTreeItem *AssetCatalogTree::find_item(const AssetCatalogPath &path)
+{
+ AssetCatalogTreeItem *result = nullptr;
+ this->foreach_item([&](AssetCatalogTreeItem &item) {
+ if (result) {
+ /* There is no way to stop iteration. */
+ return;
+ }
+ if (item.catalog_path() == path) {
+ result = &item;
+ }
+ });
+ return result;
+}
+
+AssetCatalogTreeItem *AssetCatalogTree::find_root_item(const AssetCatalogPath &path)
+{
+ AssetCatalogTreeItem *result = nullptr;
+ this->foreach_root_item([&](AssetCatalogTreeItem &item) {
+ if (result) {
+ /* There is no way to stop iteration. */
+ return;
+ }
+ if (item.catalog_path() == path) {
+ result = &item;
+ }
+ });
+ return result;
+}
+
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
diff --git a/source/blender/blenkernel/intern/asset_catalog_path.cc b/source/blender/blenkernel/intern/asset_catalog_path.cc
index 669adb7adf4..9c653c1a137 100644
--- a/source/blender/blenkernel/intern/asset_catalog_path.cc
+++ b/source/blender/blenkernel/intern/asset_catalog_path.cc
@@ -12,7 +12,7 @@ namespace blender::bke {
const char AssetCatalogPath::SEPARATOR = '/';
-AssetCatalogPath::AssetCatalogPath(const std::string &path) : path_(path)
+AssetCatalogPath::AssetCatalogPath(std::string path) : path_(std::move(path))
{
}
diff --git a/source/blender/blenkernel/intern/asset_library.cc b/source/blender/blenkernel/intern/asset_library.cc
index 968873cbcbe..b8420af1168 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -10,6 +10,7 @@
#include "BKE_main.h"
#include "BKE_preferences.h"
+#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "DNA_asset_types.h"
@@ -19,6 +20,13 @@
bool blender::bke::AssetLibrary::save_catalogs_when_file_is_saved = true;
+blender::bke::AssetLibrary *BKE_asset_library_load(const Main *bmain,
+ const AssetLibraryReference &library_reference)
+{
+ blender::bke::AssetLibraryService *service = blender::bke::AssetLibraryService::get();
+ return service->get_asset_library(bmain, library_reference);
+}
+
/**
* Loading an asset library at this point only means loading the catalogs. Later on this should
* invoke reading of asset representations too.
@@ -172,4 +180,26 @@ void AssetLibrary::refresh_catalog_simplename(struct AssetMetaData *asset_data)
}
STRNCPY(asset_data->catalog_simple_name, catalog->simple_name.c_str());
}
+
+Vector<AssetLibraryReference> all_valid_asset_library_refs()
+{
+ Vector<AssetLibraryReference> result;
+ int i;
+ LISTBASE_FOREACH_INDEX (const bUserAssetLibrary *, asset_library, &U.asset_libraries, i) {
+ if (!BLI_is_dir(asset_library->path)) {
+ continue;
+ }
+ AssetLibraryReference library_ref{};
+ library_ref.custom_library_index = i;
+ library_ref.type = ASSET_LIBRARY_CUSTOM;
+ result.append(library_ref);
+ }
+
+ AssetLibraryReference library_ref{};
+ library_ref.custom_library_index = -1;
+ library_ref.type = ASSET_LIBRARY_LOCAL;
+ result.append(library_ref);
+ return result;
+}
+
} // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/asset_library_service.cc b/source/blender/blenkernel/intern/asset_library_service.cc
index a6b2b7548a2..cd8de7908bf 100644
--- a/source/blender/blenkernel/intern/asset_library_service.cc
+++ b/source/blender/blenkernel/intern/asset_library_service.cc
@@ -7,11 +7,15 @@
#include "asset_library_service.hh"
#include "BKE_blender.h"
+#include "BKE_preferences.h"
#include "BLI_fileops.h" /* For PATH_MAX (at least on Windows). */
#include "BLI_path_util.h"
#include "BLI_string_ref.hh"
+#include "DNA_asset_types.h"
+#include "DNA_userdef_types.h"
+
#include "CLG_log.h"
static CLG_LogRef LOG = {"bke.asset_service"};
@@ -38,13 +42,45 @@ void AssetLibraryService::destroy()
instance_.reset();
}
+AssetLibrary *AssetLibraryService::get_asset_library(
+ const Main *bmain, const AssetLibraryReference &library_reference)
+{
+ if (library_reference.type == ASSET_LIBRARY_LOCAL) {
+ /* For the "Current File" library we get the asset library root path based on main. */
+ char root_path[FILE_MAX];
+ if (bmain) {
+ BKE_asset_library_find_suitable_root_path_from_main(bmain, root_path);
+ }
+ else {
+ root_path[0] = '\0';
+ }
+
+ if (root_path[0] == '\0') {
+ /* File wasn't saved yet. */
+ return get_asset_library_current_file();
+ }
+
+ return get_asset_library_on_disk(root_path);
+ }
+ if (library_reference.type == ASSET_LIBRARY_CUSTOM) {
+ bUserAssetLibrary *user_library = BKE_preferences_asset_library_find_from_index(
+ &U, library_reference.custom_library_index);
+
+ if (user_library) {
+ return get_asset_library_on_disk(user_library->path);
+ }
+ }
+
+ return nullptr;
+}
+
namespace {
std::string normalize_directory_path(StringRefNull directory)
{
char dir_normalized[PATH_MAX];
STRNCPY(dir_normalized, directory.c_str());
- BLI_path_normalize_dir(nullptr, dir_normalized);
+ BLI_path_normalize_dir(nullptr, dir_normalized, sizeof(dir_normalized));
return std::string(dir_normalized);
}
} // namespace
diff --git a/source/blender/blenkernel/intern/asset_library_service.hh b/source/blender/blenkernel/intern/asset_library_service.hh
index 277fb9db6cc..c22c6b182ce 100644
--- a/source/blender/blenkernel/intern/asset_library_service.hh
+++ b/source/blender/blenkernel/intern/asset_library_service.hh
@@ -44,6 +44,9 @@ class AssetLibraryService {
/** Destroy the AssetLibraryService singleton. It will be reallocated by #get() if necessary. */
static void destroy();
+ AssetLibrary *get_asset_library(const Main *bmain,
+ const AssetLibraryReference &library_reference);
+
/**
* Get the given asset library. Opens it (i.e. creates a new AssetLibrary instance) if necessary.
*/
diff --git a/source/blender/blenkernel/intern/asset_library_service_test.cc b/source/blender/blenkernel/intern/asset_library_service_test.cc
index d105c5644de..7952e7ea3b0 100644
--- a/source/blender/blenkernel/intern/asset_library_service_test.cc
+++ b/source/blender/blenkernel/intern/asset_library_service_test.cc
@@ -118,7 +118,7 @@ TEST_F(AssetLibraryServiceTest, library_path_trailing_slashes)
asset_lib_no_slash[strlen(asset_lib_no_slash) - 1] = '\0';
}
- BLI_path_slash_ensure(asset_lib_with_slash);
+ BLI_path_slash_ensure(asset_lib_with_slash, PATH_MAX);
AssetLibrary *const lib_no_slash = service->get_asset_library_on_disk(asset_lib_no_slash);
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 23cf368af01..3598201d906 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -59,7 +59,7 @@ void BKE_blender_free(void)
{
/* samples are in a global list..., also sets G_MAIN->sound->sample NULL */
- /* Needs to run before main free as wm is still referenced for icons preview jobs. */
+ /* Needs to run before main free as window-manager is still referenced for icons preview jobs. */
BKE_studiolight_free();
BKE_blender_globals_clear();
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 85a43b7c479..8b0d3f2e92e 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -186,7 +186,7 @@ static void setup_app_data(bContext *C,
clean_paths(bfd->main);
}
- /* XXX here the complex windowmanager matching */
+ /* The following code blocks performs complex window-manager matching. */
/* no load screens? */
if (mode != LOAD_UI) {
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 2e07b52c7bf..a0458f0f8d8 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -959,7 +959,7 @@ void boids_precalc_rules(ParticleSettings *part, float cfra)
if (flbr->ob && flbr->cfra != cfra) {
/* save object locations for velocity calculations */
copy_v3_v3(flbr->oloc, flbr->loc);
- copy_v3_v3(flbr->loc, flbr->ob->obmat[3]);
+ copy_v3_v3(flbr->loc, flbr->ob->object_to_world[3]);
flbr->cfra = cfra;
}
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 8608ce97397..7c1193d80ab 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -221,16 +221,16 @@ float BKE_camera_object_dof_distance(const Object *ob)
}
if (cam->dof.focus_object) {
float view_dir[3], dof_dir[3];
- normalize_v3_v3(view_dir, ob->obmat[2]);
+ normalize_v3_v3(view_dir, ob->object_to_world[2]);
bPoseChannel *pchan = BKE_pose_channel_find_name(cam->dof.focus_object->pose,
cam->dof.focus_subtarget);
if (pchan) {
float posemat[4][4];
- mul_m4_m4m4(posemat, cam->dof.focus_object->obmat, pchan->pose_mat);
- sub_v3_v3v3(dof_dir, ob->obmat[3], posemat[3]);
+ mul_m4_m4m4(posemat, cam->dof.focus_object->object_to_world, pchan->pose_mat);
+ sub_v3_v3v3(dof_dir, ob->object_to_world[3], posemat[3]);
}
else {
- sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof.focus_object->obmat[3]);
+ sub_v3_v3v3(dof_dir, ob->object_to_world[3], cam->dof.focus_object->object_to_world[3]);
}
return fabsf(dot_v3v3(view_dir, dof_dir));
}
@@ -628,7 +628,7 @@ static void camera_frame_fit_data_init(const Scene *scene,
BKE_camera_params_compute_matrix(params);
/* initialize callback data */
- copy_m3_m4(data->camera_rotmat, (float(*)[4])ob->obmat);
+ copy_m3_m4(data->camera_rotmat, (float(*)[4])ob->object_to_world);
normalize_m3(data->camera_rotmat);
/* To transform a plane which is in its homogeneous representation (4d vector),
* we need the inverse of the transpose of the transform matrix... */
@@ -828,7 +828,7 @@ bool BKE_camera_view_frame_fit_to_coords(const Depsgraph *depsgraph,
static void camera_model_matrix(const Object *camera, float r_modelmat[4][4])
{
- copy_m4_m4(r_modelmat, camera->obmat);
+ copy_m4_m4(r_modelmat, camera->object_to_world);
}
static void camera_stereo3d_model_matrix(const Object *camera,
@@ -854,7 +854,7 @@ static void camera_stereo3d_model_matrix(const Object *camera,
}
float size[3];
- mat4_to_size(size, camera->obmat);
+ mat4_to_size(size, camera->object_to_world);
size_to_mat4(sizemat, size);
if (pivot == CAM_S3D_PIVOT_CENTER) {
@@ -894,7 +894,7 @@ static void camera_stereo3d_model_matrix(const Object *camera,
toeinmat[3][0] = interocular_distance * fac_signed;
/* transform */
- normalize_m4_m4(r_modelmat, camera->obmat);
+ normalize_m4_m4(r_modelmat, camera->object_to_world);
mul_m4_m4m4(r_modelmat, r_modelmat, toeinmat);
/* scale back to the original size */
@@ -902,7 +902,7 @@ static void camera_stereo3d_model_matrix(const Object *camera,
}
else { /* CAM_S3D_PIVOT_LEFT, CAM_S3D_PIVOT_RIGHT */
/* rotate perpendicular to the interocular line */
- normalize_m4_m4(r_modelmat, camera->obmat);
+ normalize_m4_m4(r_modelmat, camera->object_to_world);
mul_m4_m4m4(r_modelmat, r_modelmat, rotmat);
/* translate along the interocular line */
@@ -918,7 +918,7 @@ static void camera_stereo3d_model_matrix(const Object *camera,
}
}
else {
- normalize_m4_m4(r_modelmat, camera->obmat);
+ normalize_m4_m4(r_modelmat, camera->object_to_world);
/* translate - no rotation in CAM_S3D_OFFAXIS, CAM_S3D_PARALLEL */
translate_m4(r_modelmat, -interocular_distance * fac_signed, 0.0f, 0.0f);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 89983eb8f62..88ba50fe901 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -269,7 +269,7 @@ static int do_step_cloth(
/* Get the current position. */
copy_v3_v3(verts->xconst, mvert[i].co);
- mul_m4_v3(ob->obmat, verts->xconst);
+ mul_m4_v3(ob->object_to_world, verts->xconst);
if (vert_mass_changed) {
verts->mass = clmd->sim_parms->mass;
@@ -581,11 +581,11 @@ static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexC
if (clmd->clothObject) {
/* Inverse matrix is not up to date. */
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
for (i = 0; i < cloth->mvert_num; i++) {
copy_v3_v3(vertexCos[i], cloth->verts[i].x);
- mul_m4_v3(ob->imat, vertexCos[i]); /* cloth is in global coords */
+ mul_m4_v3(ob->world_to_object, vertexCos[i]); /* cloth is in global coords */
}
}
}
@@ -763,11 +763,11 @@ static bool cloth_from_object(
if (first) {
copy_v3_v3(verts->x, mvert[i].co);
- mul_m4_v3(ob->obmat, verts->x);
+ mul_m4_v3(ob->object_to_world, verts->x);
if (shapekey_rest) {
copy_v3_v3(verts->xrest, shapekey_rest[i]);
- mul_m4_v3(ob->obmat, verts->xrest);
+ mul_m4_v3(ob->object_to_world, verts->xrest);
}
else {
copy_v3_v3(verts->xrest, verts->x);
@@ -1155,7 +1155,7 @@ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh)
/* vertex count is already ensured to match */
for (i = 0; i < mesh->totvert; i++, verts++) {
copy_v3_v3(verts->xrest, mvert[i].co);
- mul_m4_v3(ob->obmat, verts->xrest);
+ mul_m4_v3(ob->object_to_world, verts->xrest);
}
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a6a6a1ca28f..bcc4ad0cb55 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -149,7 +149,7 @@ bConstraintOb *BKE_constraints_make_evalob(
/* Quats/Axis-Angle, so Eulers should just use default order */
cob->rotOrder = EULER_ORDER_DEFAULT;
}
- copy_m4_m4(cob->matrix, ob->obmat);
+ copy_m4_m4(cob->matrix, ob->object_to_world);
}
else {
unit_m4(cob->matrix);
@@ -175,7 +175,7 @@ bConstraintOb *BKE_constraints_make_evalob(
}
/* matrix in world-space */
- mul_m4_m4m4(cob->matrix, ob->obmat, cob->pchan->pose_mat);
+ mul_m4_m4m4(cob->matrix, ob->object_to_world, cob->pchan->pose_mat);
}
else {
unit_m4(cob->matrix);
@@ -216,7 +216,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
/* cob->ob might not exist! */
if (cob->ob) {
/* copy new ob-matrix back to owner */
- copy_m4_m4(cob->ob->obmat, cob->matrix);
+ copy_m4_m4(cob->ob->object_to_world, cob->matrix);
/* copy inverse of delta back to owner */
invert_m4_m4(cob->ob->constinv, delta);
@@ -227,7 +227,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
/* cob->ob or cob->pchan might not exist */
if (cob->ob && cob->pchan) {
/* copy new pose-matrix back to owner */
- mul_m4_m4m4(cob->pchan->pose_mat, cob->ob->imat, cob->matrix);
+ mul_m4_m4m4(cob->pchan->pose_mat, cob->ob->world_to_object, cob->matrix);
/* copy inverse of delta back to owner */
invert_m4_m4(cob->pchan->constinv, delta);
@@ -276,7 +276,7 @@ void BKE_constraint_mat_convertspace(Object *ob,
}
else {
/* World to pose. */
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
mul_m4_m4m4(mat, imat, mat);
/* Use pose-space as stepping stone for other spaces. */
@@ -319,7 +319,7 @@ void BKE_constraint_mat_convertspace(Object *ob,
}
else {
/* Pose to world. */
- mul_m4_m4m4(mat, ob->obmat, mat);
+ mul_m4_m4m4(mat, ob->object_to_world, mat);
/* Use world-space as stepping stone for other spaces. */
if (to != CONSTRAINT_SPACE_WORLD) {
/* Call self with slightly different values. */
@@ -429,7 +429,7 @@ void BKE_constraint_mat_convertspace(Object *ob,
/* Check if object has a parent. */
if (ob->parent) {
/* 'subtract' parent's effects from owner. */
- mul_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv);
+ mul_m4_m4m4(diff_mat, ob->parent->object_to_world, ob->parentinv);
invert_m4_m4_safe(imat, diff_mat);
mul_m4_m4m4(mat, imat, mat);
}
@@ -465,7 +465,7 @@ void BKE_constraint_mat_convertspace(Object *ob,
/* check that object has a parent - otherwise this won't work */
if (ob->parent) {
/* 'add' parent's effect back to owner */
- mul_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv);
+ mul_m4_m4m4(diff_mat, ob->parent->object_to_world, ob->parentinv);
mul_m4_m4m4(mat, diff_mat, mat);
}
else {
@@ -518,7 +518,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
const int defgroup = BKE_object_defgroup_name_index(ob, substring);
/* initialize target matrix using target matrix */
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
/* get index of vertex group */
if (defgroup == -1) {
@@ -584,7 +584,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
* calc_gizmo_stats, V3D_ORIENT_NORMAL case */
/* We need the transpose of the inverse for a normal. */
- copy_m3_m4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->object_to_world);
invert_m3_m3(tmat, imat);
transpose_m3(tmat);
@@ -605,7 +605,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
normalize_m4(mat);
/* apply the average coordinate as the new location */
- mul_v3_m4v3(mat[3], ob->obmat, vec);
+ mul_v3_m4v3(mat[3], ob->object_to_world, vec);
}
/* function that sets the given matrix based on given vertex group in lattice */
@@ -627,7 +627,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
const int defgroup = BKE_object_defgroup_name_index(ob, substring);
/* initialize target matrix using target matrix */
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
/* get index of vertex group */
if (defgroup == -1) {
@@ -661,11 +661,11 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
}
}
- /* find average location, then multiply by ob->obmat to find world-space location */
+ /* find average location, then multiply by ob->object_to_world to find world-space location */
if (grouped) {
mul_v3_fl(vec, 1.0f / grouped);
}
- mul_v3_m4v3(tvec, ob->obmat, vec);
+ mul_v3_m4v3(tvec, ob->object_to_world, vec);
/* copy new location to matrix */
copy_v3_v3(mat[3], tvec);
@@ -684,7 +684,7 @@ static void constraint_target_to_mat4(Object *ob,
{
/* Case OBJECT */
if (substring[0] == '\0') {
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
BKE_constraint_mat_convertspace(ob, NULL, cob, mat, from, to, false);
}
/* Case VERTEXGROUP */
@@ -719,7 +719,7 @@ static void constraint_target_to_mat4(Object *ob,
if (headtail < 0.000001f && !(is_bbone && full_bbone)) {
/* skip length interpolation if set to head */
- mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat, ob->object_to_world, pchan->pose_mat);
}
else if (is_bbone && pchan->bone->segments == pchan->runtime.bbone_segments) {
/* use point along bbone */
@@ -745,7 +745,7 @@ static void constraint_target_to_mat4(Object *ob,
mul_v3_m4v3(tempmat[3], pchan->pose_mat, loc);
}
- mul_m4_m4m4(mat, ob->obmat, tempmat);
+ mul_m4_m4m4(mat, ob->object_to_world, tempmat);
}
else {
float tempmat[4][4], loc[3];
@@ -757,11 +757,11 @@ static void constraint_target_to_mat4(Object *ob,
copy_m4_m4(tempmat, pchan->pose_mat);
copy_v3_v3(tempmat[3], loc);
- mul_m4_m4m4(mat, ob->obmat, tempmat);
+ mul_m4_m4m4(mat, ob->object_to_world, tempmat);
}
}
else {
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
}
/* convert matrix space as required */
@@ -1069,7 +1069,7 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
if (data->flag & CHILDOF_SET_INVERSE) {
invert_m4_m4(data->invmat, parmat);
if (cob->pchan != NULL) {
- mul_m4_series(data->invmat, data->invmat, cob->ob->obmat);
+ mul_m4_series(data->invmat, data->invmat, cob->ob->object_to_world);
}
copy_m4_m4(inverse_matrix, data->invmat);
@@ -1388,8 +1388,8 @@ static void kinematic_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
else {
float vec[3];
/* move grabtarget into world space */
- mul_v3_m4v3(vec, ob->obmat, data->grabtarget);
- copy_m4_m4(ct->matrix, ob->obmat);
+ mul_v3_m4v3(vec, ob->object_to_world, data->grabtarget);
+ copy_m4_m4(ct->matrix, ob->object_to_world);
copy_v3_v3(ct->matrix[3], vec);
}
}
@@ -1528,7 +1528,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
copy_v3_v3(totmat[3], vec);
- mul_m4_m4m4(ct->matrix, ct->tar->obmat, totmat);
+ mul_m4_m4m4(ct->matrix, ct->tar->object_to_world, totmat);
}
}
}
@@ -2557,7 +2557,7 @@ static void armdef_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
bPoseChannel *pchan = BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget);
if (pchan != NULL) {
- mul_m4_m4m4(ct->matrix, ct->tar->obmat, pchan->pose_mat);
+ mul_m4_m4m4(ct->matrix, ct->tar->object_to_world, pchan->pose_mat);
return;
}
}
@@ -2613,7 +2613,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct,
float weight = ct->weight;
/* Our object's location in target pose space. */
- invert_m4_m4(iobmat, ct->tar->obmat);
+ invert_m4_m4(iobmat, ct->tar->object_to_world);
mul_v3_m4v3(co, iobmat, wco);
/* Multiply by the envelope weight when appropriate. */
@@ -2644,7 +2644,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct,
mul_m4_m4m4(basemat, bone->arm_mat, b_bone_rest_mats[index].mat);
}
- armdef_accumulate_matrix(ct->tar->obmat,
+ armdef_accumulate_matrix(ct->tar->object_to_world,
iobmat,
basemat,
b_bone_mats[index + 1].mat,
@@ -2657,7 +2657,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct,
mul_m4_m4m4(basemat, bone->arm_mat, b_bone_rest_mats[index + 1].mat);
}
- armdef_accumulate_matrix(ct->tar->obmat,
+ armdef_accumulate_matrix(ct->tar->object_to_world,
iobmat,
basemat,
b_bone_mats[index + 2].mat,
@@ -2667,8 +2667,13 @@ static void armdef_accumulate_bone(bConstraintTarget *ct,
}
else {
/* Simple bone. This requires DEG_OPCODE_BONE_DONE dependency due to chan_mat. */
- armdef_accumulate_matrix(
- ct->tar->obmat, iobmat, bone->arm_mat, pchan->chan_mat, weight, r_sum_mat, r_sum_dq);
+ armdef_accumulate_matrix(ct->tar->object_to_world,
+ iobmat,
+ bone->arm_mat,
+ pchan->chan_mat,
+ weight,
+ r_sum_mat,
+ r_sum_dq);
}
/* Accumulate the weight. */
@@ -2694,7 +2699,7 @@ static void armdef_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
/* For constraints on bones, use the rest position to bind b-bone segments
* and envelopes, to allow safely changing the bone location as if parented. */
copy_v3_v3(input_co, cob->pchan->bone->arm_head);
- mul_m4_v3(cob->ob->obmat, input_co);
+ mul_m4_v3(cob->ob->object_to_world, input_co);
}
else {
copy_v3_v3(input_co, cob->matrix[3]);
@@ -3927,7 +3932,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
unit_m4(totmat);
copy_v3_v3(totmat[3], vec);
- mul_m4_m4m4(targetMatrix, ct->tar->obmat, totmat);
+ mul_m4_m4m4(targetMatrix, ct->tar->object_to_world, totmat);
}
}
@@ -4227,7 +4232,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
if (BKE_shrinkwrap_init_tree(
&tree, target_eval, scon->shrinkType, scon->shrinkMode, do_track_normal)) {
- BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat);
+ BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->object_to_world);
switch (scon->shrinkType) {
case MOD_SHRINKWRAP_NEAREST_SURFACE:
@@ -4902,7 +4907,7 @@ static void followtrack_evaluate_using_3d_position_object(FollowTrackContext *co
/* Object matrix of the camera. */
float camera_obmat[4][4];
- copy_m4_m4(camera_obmat, camera_object->obmat);
+ copy_m4_m4(camera_obmat, camera_object->object_to_world);
/* Calculate inverted matrix of the solved camera at the current time. */
float reconstructed_camera_mat[4][4];
@@ -5054,10 +5059,10 @@ static void followtrack_project_to_depth_object_if_needed(FollowTrackContext *co
}
float depth_object_mat_inv[4][4];
- invert_m4_m4(depth_object_mat_inv, depth_object->obmat);
+ invert_m4_m4(depth_object_mat_inv, depth_object->object_to_world);
float ray_start[3], ray_end[3];
- mul_v3_m4v3(ray_start, depth_object_mat_inv, context->camera_object->obmat[3]);
+ mul_v3_m4v3(ray_start, depth_object_mat_inv, context->camera_object->object_to_world[3]);
mul_v3_m4v3(ray_end, depth_object_mat_inv, cob->matrix[3]);
float ray_direction[3];
@@ -5080,7 +5085,7 @@ static void followtrack_project_to_depth_object_if_needed(FollowTrackContext *co
&tree_data);
if (result != -1) {
- mul_v3_m4v3(cob->matrix[3], depth_object->obmat, hit.co);
+ mul_v3_m4v3(cob->matrix[3], depth_object->object_to_world, hit.co);
}
free_bvhtree_from_mesh(&tree_data);
@@ -5128,9 +5133,9 @@ static void followtrack_evaluate_using_2d_position(FollowTrackContext *context,
}
float disp[3];
- mul_v3_m4v3(disp, camera_object->obmat, vec);
+ mul_v3_m4v3(disp, camera_object->object_to_world, vec);
- copy_m4_m4(rmat, camera_object->obmat);
+ copy_m4_m4(rmat, camera_object->object_to_world);
zero_v3(rmat[3]);
mul_m4_m4m4(cob->matrix, cob->matrix, rmat);
@@ -5152,10 +5157,10 @@ static void followtrack_evaluate_using_2d_position(FollowTrackContext *context,
}
float disp[3];
- mul_v3_m4v3(disp, camera_object->obmat, vec);
+ mul_v3_m4v3(disp, camera_object->object_to_world, vec);
/* apply camera rotation so Z-axis would be co-linear */
- copy_m4_m4(rmat, camera_object->obmat);
+ copy_m4_m4(rmat, camera_object->object_to_world);
zero_v3(rmat[3]);
mul_m4_m4m4(cob->matrix, cob->matrix, rmat);
@@ -5303,7 +5308,7 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat);
invert_m4_m4(imat, mat);
- mul_m4_m4m4(parmat, camob->obmat, imat);
+ mul_m4_m4m4(parmat, camob->object_to_world, imat);
copy_m4_m4(obmat, cob->matrix);
@@ -5650,7 +5655,7 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph,
BLI_freelinkN(&single_con, new_con);
/* Apply transform from matrix. */
- BKE_object_apply_mat4(ob, ob_eval->obmat, true, true);
+ BKE_object_apply_mat4(ob, ob_eval->object_to_world, true, true);
return true;
}
@@ -6237,7 +6242,7 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph,
cob->ob = (Object *)ownerdata;
cob->pchan = NULL;
if (cob->ob) {
- copy_m4_m4(cob->matrix, cob->ob->obmat);
+ copy_m4_m4(cob->matrix, cob->ob->object_to_world);
copy_m4_m4(cob->startmat, cob->matrix);
}
else {
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index d7bd0038d3c..1d6092849cc 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -393,37 +393,37 @@ static void *ctx_data_pointer_get(const bContext *C, const char *member)
return NULL;
}
-static int ctx_data_pointer_verify(const bContext *C, const char *member, void **pointer)
+static bool ctx_data_pointer_verify(const bContext *C, const char *member, void **pointer)
{
/* if context is NULL, pointer must be NULL too and that is a valid return */
if (C == NULL) {
*pointer = NULL;
- return 1;
+ return true;
}
bContextDataResult result;
if (ctx_data_get((bContext *)C, member, &result) == CTX_RESULT_OK) {
BLI_assert(result.type == CTX_DATA_TYPE_POINTER);
*pointer = result.ptr.data;
- return 1;
+ return true;
}
*pointer = NULL;
- return 0;
+ return false;
}
-static int ctx_data_collection_get(const bContext *C, const char *member, ListBase *list)
+static bool ctx_data_collection_get(const bContext *C, const char *member, ListBase *list)
{
bContextDataResult result;
if (ctx_data_get((bContext *)C, member, &result) == CTX_RESULT_OK) {
BLI_assert(result.type == CTX_DATA_TYPE_COLLECTION);
*list = result.list;
- return 1;
+ return true;
}
BLI_listbase_clear(list);
- return 0;
+ return false;
}
static int ctx_data_base_collection_get(const bContext *C, const char *member, ListBase *list)
@@ -681,7 +681,7 @@ void CTX_data_list_add_ptr(bContextDataResult *result, const PointerRNA *ptr)
BLI_addtail(&result->list, link);
}
-int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBase *))
+int ctx_data_list_count(const bContext *C, bool (*func)(const bContext *, ListBase *))
{
ListBase list;
@@ -1291,62 +1291,62 @@ ToolSettings *CTX_data_tool_settings(const bContext *C)
return NULL;
}
-int CTX_data_selected_ids(const bContext *C, ListBase *list)
+bool CTX_data_selected_ids(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_ids", list);
}
-int CTX_data_selected_nodes(const bContext *C, ListBase *list)
+bool CTX_data_selected_nodes(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_nodes", list);
}
-int CTX_data_selected_editable_objects(const bContext *C, ListBase *list)
+bool CTX_data_selected_editable_objects(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_editable_objects", list);
}
-int CTX_data_selected_editable_bases(const bContext *C, ListBase *list)
+bool CTX_data_selected_editable_bases(const bContext *C, ListBase *list)
{
return ctx_data_base_collection_get(C, "selected_editable_objects", list);
}
-int CTX_data_editable_objects(const bContext *C, ListBase *list)
+bool CTX_data_editable_objects(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "editable_objects", list);
}
-int CTX_data_editable_bases(const bContext *C, ListBase *list)
+bool CTX_data_editable_bases(const bContext *C, ListBase *list)
{
return ctx_data_base_collection_get(C, "editable_objects", list);
}
-int CTX_data_selected_objects(const bContext *C, ListBase *list)
+bool CTX_data_selected_objects(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_objects", list);
}
-int CTX_data_selected_bases(const bContext *C, ListBase *list)
+bool CTX_data_selected_bases(const bContext *C, ListBase *list)
{
return ctx_data_base_collection_get(C, "selected_objects", list);
}
-int CTX_data_visible_objects(const bContext *C, ListBase *list)
+bool CTX_data_visible_objects(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "visible_objects", list);
}
-int CTX_data_visible_bases(const bContext *C, ListBase *list)
+bool CTX_data_visible_bases(const bContext *C, ListBase *list)
{
return ctx_data_base_collection_get(C, "visible_objects", list);
}
-int CTX_data_selectable_objects(const bContext *C, ListBase *list)
+bool CTX_data_selectable_objects(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selectable_objects", list);
}
-int CTX_data_selectable_bases(const bContext *C, ListBase *list)
+bool CTX_data_selectable_bases(const bContext *C, ListBase *list)
{
return ctx_data_base_collection_get(C, "selectable_objects", list);
}
@@ -1404,22 +1404,22 @@ struct CacheFile *CTX_data_edit_cachefile(const bContext *C)
return ctx_data_pointer_get(C, "edit_cachefile");
}
-int CTX_data_selected_bones(const bContext *C, ListBase *list)
+bool CTX_data_selected_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_bones", list);
}
-int CTX_data_selected_editable_bones(const bContext *C, ListBase *list)
+bool CTX_data_selected_editable_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_editable_bones", list);
}
-int CTX_data_visible_bones(const bContext *C, ListBase *list)
+bool CTX_data_visible_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "visible_bones", list);
}
-int CTX_data_editable_bones(const bContext *C, ListBase *list)
+bool CTX_data_editable_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "editable_bones", list);
}
@@ -1429,17 +1429,17 @@ struct bPoseChannel *CTX_data_active_pose_bone(const bContext *C)
return ctx_data_pointer_get(C, "active_pose_bone");
}
-int CTX_data_selected_pose_bones(const bContext *C, ListBase *list)
+bool CTX_data_selected_pose_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_pose_bones", list);
}
-int CTX_data_selected_pose_bones_from_active_object(const bContext *C, ListBase *list)
+bool CTX_data_selected_pose_bones_from_active_object(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "selected_pose_bones_from_active_object", list);
}
-int CTX_data_visible_pose_bones(const bContext *C, ListBase *list)
+bool CTX_data_visible_pose_bones(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "visible_pose_bones", list);
}
@@ -1459,17 +1459,17 @@ bGPDframe *CTX_data_active_gpencil_frame(const bContext *C)
return ctx_data_pointer_get(C, "active_gpencil_frame");
}
-int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list)
+bool CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "visible_gpencil_layers", list);
}
-int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list)
+bool CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "editable_gpencil_layers", list);
}
-int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list)
+bool CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list)
{
return ctx_data_collection_get(C, "editable_gpencil_strokes", list);
}
diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c
index 9a27ba91c2f..066d8494451 100644
--- a/source/blender/blenkernel/intern/curve_deform.c
+++ b/source/blender/blenkernel/intern/curve_deform.c
@@ -44,8 +44,8 @@ typedef struct {
static void init_curve_deform(const Object *ob_curve, const Object *ob_target, CurveDeform *cd)
{
float imat[4][4];
- invert_m4_m4(imat, ob_target->obmat);
- mul_m4_m4m4(cd->objectspace, imat, ob_curve->obmat);
+ invert_m4_m4(imat, ob_target->object_to_world);
+ mul_m4_m4m4(cd->objectspace, imat, ob_curve->object_to_world);
invert_m4_m4(cd->curvespace, cd->objectspace);
copy_m3_m4(cd->objectspace3, cd->objectspace);
cd->no_rot_axis = 0;
diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
index ecf3be9bd81..3a86068d8e8 100644
--- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
+++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
@@ -71,7 +71,7 @@ static void fill_mesh_topology(const int vert_offset,
MEdge &edge = edges[profile_edge_offset + i_ring];
edge.v1 = ring_vert_offset + i_profile;
edge.v2 = next_ring_vert_offset + i_profile;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
@@ -87,7 +87,7 @@ static void fill_mesh_topology(const int vert_offset,
MEdge &edge = edges[ring_edge_offset + i_profile];
edge.v1 = ring_vert_offset + i_profile;
edge.v2 = ring_vert_offset + i_next_profile;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc
index 72e53023d6d..61755a5be9b 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -412,11 +412,11 @@ void curves_copy_parameters(const Curves &src, Curves &dst)
CurvesSurfaceTransforms::CurvesSurfaceTransforms(const Object &curves_ob, const Object *surface_ob)
{
- this->curves_to_world = curves_ob.obmat;
+ this->curves_to_world = curves_ob.object_to_world;
this->world_to_curves = this->curves_to_world.inverted();
if (surface_ob != nullptr) {
- this->surface_to_world = surface_ob->obmat;
+ this->surface_to_world = surface_ob->object_to_world;
this->world_to_surface = this->surface_to_world.inverted();
this->surface_to_curves = this->world_to_curves * this->surface_to_world;
this->curves_to_surface = this->world_to_surface * this->curves_to_world;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index e177250ae5a..e0ae3f42be6 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2790,7 +2790,7 @@ static bool dynamicPaint_symmetrizeAdjData(PaintAdjData *ed, int active_points)
int dynamicPaint_createUVSurface(Scene *scene,
DynamicPaintSurface *surface,
float *progress,
- short *do_update)
+ bool *do_update)
{
/* Antialias jitter point relative coords */
const int aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1;
@@ -3783,7 +3783,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
numOfVerts_p = mesh_p->totvert;
mvert_p = BKE_mesh_verts_for_write(mesh_p);
- copy_m4_m4(prev_obmat, ob->obmat);
+ copy_m4_m4(prev_obmat, ob->object_to_world);
/* current frame mesh */
scene->r.cfra = cur_fra;
@@ -3816,7 +3816,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
.brush_vel = *brushVel,
.mvert_p = mvert_p,
.mvert_c = mvert_c,
- .obmat = ob->obmat,
+ .obmat = ob->object_to_world,
.prev_obmat = prev_obmat,
.timescale = timescale,
};
@@ -3856,7 +3856,7 @@ static void dynamicPaint_brushObjectCalculateVelocity(
SUBFRAME_RECURSION,
BKE_scene_ctime_get(scene),
eModifierType_DynamicPaint);
- copy_m4_m4(prev_obmat, ob->obmat);
+ copy_m4_m4(prev_obmat, ob->object_to_world);
/* current frame mesh */
scene->r.cfra = cur_fra;
@@ -3871,7 +3871,7 @@ static void dynamicPaint_brushObjectCalculateVelocity(
/* calculate speed */
mul_m4_v3(prev_obmat, prev_loc);
- mul_m4_v3(ob->obmat, cur_loc);
+ mul_m4_v3(ob->object_to_world, cur_loc);
sub_v3_v3v3(brushVel->v, cur_loc, prev_loc);
mul_v3_fl(brushVel->v, 1.0f / timescale);
@@ -4279,14 +4279,14 @@ static bool dynamicPaint_paintMesh(Depsgraph *depsgraph,
* (Faster than transforming per surface point
* coordinates and normals to object space) */
for (ii = 0; ii < numOfVerts; ii++) {
- mul_m4_v3(brushOb->obmat, mvert[ii].co);
+ mul_m4_v3(brushOb->object_to_world, mvert[ii].co);
boundInsert(&mesh_bb, mvert[ii].co);
/* for proximity project calculate average normal */
if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) {
float nor[3];
copy_v3_v3(nor, vert_normals[ii]);
- mul_mat3_m4_v3(brushOb->obmat, nor);
+ mul_mat3_m4_v3(brushOb->object_to_world, nor);
normalize_v3(nor);
add_v3_v3(avg_brushNor, nor);
@@ -5870,7 +5870,7 @@ static bool dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *o
}
/* matrix comparison */
- if (!equals_m4m4(bData->prev_obmat, ob->obmat)) {
+ if (!equals_m4m4(bData->prev_obmat, ob->object_to_world)) {
return true;
}
@@ -5957,7 +5957,7 @@ static void dynamic_paint_generate_bake_data_cb(void *__restrict userdata,
mul_v3_v3v3(scaled_nor, temp_nor, ob->scale);
bData->bNormal[index].normal_scale = len_v3(scaled_nor);
}
- mul_mat3_m4_v3(ob->obmat, temp_nor);
+ mul_mat3_m4_v3(ob->object_to_world, temp_nor);
normalize_v3(temp_nor);
negate_v3_v3(bData->bNormal[index].invNorm, temp_nor);
}
@@ -5995,7 +5995,7 @@ static void dynamic_paint_generate_bake_data_cb(void *__restrict userdata,
mul_v3_v3v3(scaled_nor, temp_nor, ob->scale);
bData->bNormal[index].normal_scale = len_v3(scaled_nor);
}
- mul_mat3_m4_v3(ob->obmat, temp_nor);
+ mul_mat3_m4_v3(ob->object_to_world, temp_nor);
normalize_v3(temp_nor);
negate_v3_v3(bData->bNormal[index].invNorm, temp_nor);
}
@@ -6113,7 +6113,7 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface,
bData->mesh_bounds.valid = false;
for (index = 0; index < canvasNumOfVerts; index++) {
copy_v3_v3(canvas_verts[index].v, mvert[index].co);
- mul_m4_v3(ob->obmat, canvas_verts[index].v);
+ mul_m4_v3(ob->object_to_world, canvas_verts[index].v);
boundInsert(&bData->mesh_bounds, canvas_verts[index].v);
}
@@ -6143,7 +6143,7 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface,
dynamicPaint_prepareAdjacencyData(surface, false);
/* Copy current frame vertices to check against in next frame */
- copy_m4_m4(bData->prev_obmat, ob->obmat);
+ copy_m4_m4(bData->prev_obmat, ob->object_to_world);
memcpy(bData->prev_verts, mvert, canvasNumOfVerts * sizeof(MVert));
bData->clear = 0;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 42b38854248..c2ae4efbde8 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -154,8 +154,8 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
if (eff->ob->runtime.curve_cache->anim_path_accum_length) {
BKE_where_on_path(
eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
- mul_m4_v3(eff->ob->obmat, eff->guide_loc);
- mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir);
+ mul_m4_v3(eff->ob->object_to_world, eff->guide_loc);
+ mul_mat3_m4_v3(eff->ob->object_to_world, eff->guide_dir);
}
}
}
@@ -707,8 +707,8 @@ bool get_effector_data(EffectorCache *eff,
copy_v3_v3(efd->loc, verts[*efd->index].co);
copy_v3_v3(efd->nor, vert_normals[*efd->index]);
- mul_m4_v3(eff->ob->obmat, efd->loc);
- mul_mat3_m4_v3(eff->ob->obmat, efd->nor);
+ mul_m4_v3(eff->ob->object_to_world, efd->loc);
+ mul_mat3_m4_v3(eff->ob->object_to_world, efd->nor);
normalize_v3(efd->nor);
@@ -760,23 +760,23 @@ bool get_effector_data(EffectorCache *eff,
const Object *ob = eff->ob;
/* Use z-axis as normal. */
- normalize_v3_v3(efd->nor, ob->obmat[2]);
+ normalize_v3_v3(efd->nor, ob->object_to_world[2]);
if (eff->pd && ELEM(eff->pd->shape, PFIELD_SHAPE_PLANE, PFIELD_SHAPE_LINE)) {
float temp[3], translate[3];
- sub_v3_v3v3(temp, point->loc, ob->obmat[3]);
+ sub_v3_v3v3(temp, point->loc, ob->object_to_world[3]);
project_v3_v3v3(translate, temp, efd->nor);
/* for vortex the shape chooses between old / new force */
if (eff->pd->forcefield == PFIELD_VORTEX || eff->pd->shape == PFIELD_SHAPE_LINE) {
- add_v3_v3v3(efd->loc, ob->obmat[3], translate);
+ add_v3_v3v3(efd->loc, ob->object_to_world[3], translate);
}
else { /* normally efd->loc is closest point on effector xy-plane */
sub_v3_v3v3(efd->loc, point->loc, translate);
}
}
else {
- copy_v3_v3(efd->loc, ob->obmat[3]);
+ copy_v3_v3(efd->loc, ob->object_to_world[3]);
}
zero_v3(efd->vel);
@@ -801,8 +801,8 @@ bool get_effector_data(EffectorCache *eff,
}
else {
/* for some effectors we need the object center every time */
- sub_v3_v3v3(efd->vec_to_point2, point->loc, eff->ob->obmat[3]);
- normalize_v3_v3(efd->nor2, eff->ob->obmat[2]);
+ sub_v3_v3v3(efd->vec_to_point2, point->loc, eff->ob->object_to_world[3]);
+ normalize_v3_v3(efd->nor2, eff->ob->object_to_world[2]);
}
}
@@ -875,7 +875,7 @@ static void do_texture_effector(EffectorCache *eff,
copy_v3_v3(tex_co, point->loc);
if (eff->pd->flag & PFIELD_TEX_OBJECT) {
- mul_m4_v3(eff->ob->imat, tex_co);
+ mul_m4_v3(eff->ob->world_to_object, tex_co);
if (eff->pd->flag & PFIELD_TEX_2D) {
tex_co[2] = 0.0f;
diff --git a/source/blender/blenkernel/intern/fcurve_driver.c b/source/blender/blenkernel/intern/fcurve_driver.c
index 9f63e2d3743..3d1439b5530 100644
--- a/source/blender/blenkernel/intern/fcurve_driver.c
+++ b/source/blender/blenkernel/intern/fcurve_driver.c
@@ -321,7 +321,7 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
}
else {
/* Object. */
- mat[i] = ob->obmat;
+ mat[i] = ob->object_to_world;
}
}
@@ -399,7 +399,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
else {
/* Convert to world-space. */
copy_v3_v3(tmp_loc, pchan->pose_head);
- mul_m4_v3(ob->obmat, tmp_loc);
+ mul_m4_v3(ob->object_to_world, tmp_loc);
}
}
else {
@@ -410,7 +410,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
float mat[4][4];
/* Extract transform just like how the constraints do it! */
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
BKE_constraint_mat_convertspace(
ob, NULL, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false);
@@ -424,7 +424,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
}
else {
/* World-space. */
- copy_v3_v3(tmp_loc, ob->obmat[3]);
+ copy_v3_v3(tmp_loc, ob->object_to_world[3]);
}
}
@@ -500,7 +500,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
}
else {
/* World-space matrix. */
- mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat, ob->object_to_world, pchan->pose_mat);
}
}
else {
@@ -514,7 +514,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
/* Just like how the constraints do it! */
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
BKE_constraint_mat_convertspace(
ob, NULL, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false);
}
@@ -525,7 +525,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
}
else {
/* World-space matrix - just the good-old one. */
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
}
}
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 5470231cd07..a3d2d73678c 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -433,7 +433,7 @@ static void manta_set_domain_from_mesh(FluidDomainSettings *fds,
copy_v3_v3(fds->global_size, size);
copy_v3_v3(fds->dp0, min);
- invert_m4_m4(fds->imat, ob->obmat);
+ invert_m4_m4(fds->imat, ob->object_to_world);
/* Prevent crash when initializing a plane as domain. */
if (!init_resolution || (size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) ||
@@ -498,8 +498,8 @@ static bool fluid_modifier_init(
zero_v3(fds->shift_f);
add_v3_fl(fds->shift_f, 0.5f);
zero_v3(fds->prev_loc);
- mul_m4_v3(ob->obmat, fds->prev_loc);
- copy_m4_m4(fds->obmat, ob->obmat);
+ mul_m4_v3(ob->object_to_world, fds->prev_loc);
+ copy_m4_m4(fds->obmat, ob->object_to_world);
/* Set resolutions. */
if (fmd->domain->type == FLUID_DOMAIN_TYPE_GAS &&
@@ -566,11 +566,11 @@ static int get_light(Scene *scene, ViewLayer *view_layer, float *light)
Light *la = base_tmp->object->data;
if (la->type == LA_LOCAL) {
- copy_v3_v3(light, base_tmp->object->obmat[3]);
+ copy_v3_v3(light, base_tmp->object->object_to_world[3]);
return 1;
}
if (!found_light) {
- copy_v3_v3(light, base_tmp->object->obmat[3]);
+ copy_v3_v3(light, base_tmp->object->object_to_world[3]);
found_light = 1;
}
}
@@ -1036,7 +1036,7 @@ static void obstacles_from_mesh(Object *coll_ob,
float co[3];
/* Vertex position. */
- mul_m4_v3(coll_ob->obmat, verts[i].co);
+ mul_m4_v3(coll_ob->object_to_world, verts[i].co);
manta_pos_to_cell(fds, verts[i].co);
/* Vertex velocity. */
@@ -2099,11 +2099,11 @@ static void emit_from_mesh(
float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(me);
for (i = 0; i < numverts; i++) {
/* Vertex position. */
- mul_m4_v3(flow_ob->obmat, verts[i].co);
+ mul_m4_v3(flow_ob->object_to_world, verts[i].co);
manta_pos_to_cell(fds, verts[i].co);
/* Vertex normal. */
- mul_mat3_m4_v3(flow_ob->obmat, vert_normals[i]);
+ mul_mat3_m4_v3(flow_ob->object_to_world, vert_normals[i]);
mul_mat3_m4_v3(fds->imat, vert_normals[i]);
normalize_v3(vert_normals[i]);
@@ -2121,7 +2121,7 @@ static void emit_from_mesh(
/* Calculate emission map bounds. */
bb_boundInsert(bb, verts[i].co);
}
- mul_m4_v3(flow_ob->obmat, flow_center);
+ mul_m4_v3(flow_ob->object_to_world, flow_center);
manta_pos_to_cell(fds, flow_center);
/* Set emission map.
@@ -2191,7 +2191,7 @@ static void adaptive_domain_adjust(
float frame_shift_f[3];
float ob_loc[3] = {0};
- mul_m4_v3(ob->obmat, ob_loc);
+ mul_m4_v3(ob->object_to_world, ob_loc);
sub_v3_v3v3(frame_shift_f, ob_loc, fds->prev_loc);
copy_v3_v3(fds->prev_loc, ob_loc);
@@ -3495,12 +3495,12 @@ static Mesh *create_smoke_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obje
/* Calculate required shift to match domain's global position
* it was originally simulated at (if object moves without manta step). */
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->obmat, ob_loc);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->object_to_world, ob_loc);
mul_m4_v3(fds->obmat, ob_cache_loc);
sub_v3_v3v3(fds->obj_shift_f, ob_cache_loc, ob_loc);
/* Convert shift to local space and apply to vertices. */
- mul_mat3_m4_v3(ob->imat, fds->obj_shift_f);
+ mul_mat3_m4_v3(ob->world_to_object, fds->obj_shift_f);
/* Apply shift to vertices. */
for (int i = 0; i < num_verts; i++) {
add_v3_v3(mverts[i].co, fds->obj_shift_f);
@@ -3525,8 +3525,8 @@ static int manta_step(
bool mode_replay = (mode == FLUID_DOMAIN_CACHE_REPLAY);
/* Update object state. */
- invert_m4_m4(fds->imat, ob->obmat);
- copy_m4_m4(fds->obmat, ob->obmat);
+ invert_m4_m4(fds->imat, ob->object_to_world);
+ copy_m4_m4(fds->obmat, ob->object_to_world);
/* Gas domain might use adaptive domain. */
if (fds->type == FLUID_DOMAIN_TYPE_GAS) {
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc
index e078991187d..2b36020b4e7 100644
--- a/source/blender/blenkernel/intern/geometry_set_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_set_instances.cc
@@ -98,7 +98,7 @@ static void geometry_set_collect_recursive_collection(const Collection &collecti
LISTBASE_FOREACH (const CollectionObject *, collection_object, &collection.gobject) {
BLI_assert(collection_object->ob != nullptr);
const Object &object = *collection_object->ob;
- const float4x4 object_transform = transform * object.obmat;
+ const float4x4 object_transform = transform * object.object_to_world;
geometry_set_collect_recursive_object(object, object_transform, r_sets);
}
LISTBASE_FOREACH (const CollectionChild *, collection_child, &collection.children) {
@@ -220,7 +220,7 @@ void Instances::ensure_geometry_instances()
Collection &collection = reference.collection();
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (&collection, object) {
const int handle = instances->add_reference(*object);
- instances->add_instance(handle, object->obmat);
+ instances->add_instance(handle, object->object_to_world);
float4x4 &transform = instances->transforms().last();
sub_v3_v3(transform.values[3], collection.instance_offset);
}
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 45e56717d6a..5409bf61274 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2691,7 +2691,7 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph,
/* if not layer parented, try with object parented */
if (obparent_eval == NULL) {
if ((ob_eval != NULL) && (ob_eval->type == OB_GPENCIL)) {
- copy_m4_m4(diff_mat, ob_eval->obmat);
+ copy_m4_m4(diff_mat, ob_eval->object_to_world);
mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat);
return;
}
@@ -2701,8 +2701,8 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph,
}
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
- add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
+ mul_m4_m4m4(diff_mat, obparent_eval->object_to_world, gpl->inverse);
+ add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]);
mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat);
return;
}
@@ -2710,14 +2710,14 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph,
bPoseChannel *pchan = BKE_pose_channel_find_name(obparent_eval->pose, gpl->parsubstr);
if (pchan) {
float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, obparent_eval->obmat, pchan->pose_mat);
+ mul_m4_m4m4(tmp_mat, obparent_eval->object_to_world, pchan->pose_mat);
mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);
- add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
+ add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]);
}
else {
/* if bone not found use object (armature) */
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
- add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
+ mul_m4_m4m4(diff_mat, obparent_eval->object_to_world, gpl->inverse);
+ add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]);
}
mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat);
return;
@@ -2771,12 +2771,12 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob)
Object *ob_parent = DEG_get_evaluated_object(depsgraph, gpl->parent);
/* calculate new matrix */
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
- mul_m4_m4m4(cur_mat, ob->imat, ob_parent->obmat);
+ mul_m4_m4m4(cur_mat, ob->world_to_object, ob_parent->object_to_world);
}
else if (gpl->partype == PARBONE) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_parent->pose, gpl->parsubstr);
if (pchan != NULL) {
- mul_m4_series(cur_mat, ob->imat, ob_parent->obmat, pchan->pose_mat);
+ mul_m4_series(cur_mat, ob->world_to_object, ob_parent->object_to_world, pchan->pose_mat);
}
else {
unit_m4(cur_mat);
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 52fcdef8a43..9297663b157 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -789,7 +789,10 @@ bool BKE_gpencil_stroke_stretch(bGPDstroke *gps,
/** \name Stroke Trim
* \{ */
-bool BKE_gpencil_stroke_trim_points(bGPDstroke *gps, const int index_from, const int index_to)
+bool BKE_gpencil_stroke_trim_points(bGPDstroke *gps,
+ const int index_from,
+ const int index_to,
+ const bool keep_point)
{
bGPDspoint *pt = gps->points, *new_pt;
MDeformVert *dv, *new_dv;
@@ -800,7 +803,7 @@ bool BKE_gpencil_stroke_trim_points(bGPDstroke *gps, const int index_from, const
return false;
}
- if (new_count == 1) {
+ if ((!keep_point) && (new_count == 1)) {
if (gps->dvert) {
BKE_gpencil_free_stroke_weights(gps);
MEM_freeN(gps->dvert);
@@ -894,7 +897,7 @@ bool BKE_gpencil_stroke_split(bGPdata *gpd,
/* Trim the original stroke into a shorter one.
* Keep the end point. */
- BKE_gpencil_stroke_trim_points(gps, 0, old_count);
+ BKE_gpencil_stroke_trim_points(gps, 0, old_count, false);
BKE_gpencil_stroke_geometry_update(gpd, gps);
return true;
}
@@ -917,7 +920,7 @@ bool BKE_gpencil_stroke_shrink(bGPDstroke *gps, const float dist, const short mo
if (gps->totpoints == 1) {
second_last = &pt[1];
if (len_v3v3(&second_last->x, &pt->x) < dist) {
- BKE_gpencil_stroke_trim_points(gps, 0, 0);
+ BKE_gpencil_stroke_trim_points(gps, 0, 0, false);
return true;
}
}
@@ -969,7 +972,7 @@ bool BKE_gpencil_stroke_shrink(bGPDstroke *gps, const float dist, const short mo
index_start = index_end = 0; /* no length left to cut */
}
- BKE_gpencil_stroke_trim_points(gps, index_start, index_end);
+ BKE_gpencil_stroke_trim_points(gps, index_start, index_end, false);
if (gps->totpoints == 0) {
return false;
@@ -3562,8 +3565,8 @@ void BKE_gpencil_stroke_start_set(bGPDstroke *gps, int start_idx)
}
bGPDstroke *gps_b = BKE_gpencil_stroke_duplicate(gps, true, false);
- BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx - 1);
- BKE_gpencil_stroke_trim_points(gps, start_idx, gps->totpoints - 1);
+ BKE_gpencil_stroke_trim_points(gps_b, 0, start_idx - 1, true);
+ BKE_gpencil_stroke_trim_points(gps, start_idx, gps->totpoints - 1, true);
/* Join both strokes. */
BKE_gpencil_stroke_join(gps, gps_b, false, false, false, false);
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index c84ee2e4a56..1ad7aeed41c 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -942,7 +942,7 @@ void BKE_gpencil_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb)
BLO_read_data_address(reader, &gpmd->curve_intensity);
if (gpmd->curve_intensity) {
BKE_curvemapping_blend_read(reader, gpmd->curve_intensity);
- /* initialize the curve. Maybe this could be moved to modififer logic */
+ /* Initialize the curve. Maybe this could be moved to modifier logic. */
BKE_curvemapping_init(gpmd->curve_intensity);
}
}
diff --git a/source/blender/blenkernel/intern/icons.cc b/source/blender/blenkernel/intern/icons.cc
index dc1d23de7e0..7fd0515b52c 100644
--- a/source/blender/blenkernel/intern/icons.cc
+++ b/source/blender/blenkernel/intern/icons.cc
@@ -530,7 +530,7 @@ void BKE_previewimg_ensure(PreviewImage *prv, const int size)
thumb = IMB_thumb_manage(filepath, THB_LARGE, (ThumbSource)source);
if (thumb) {
- /* PreviewImage assumes premultiplied alhpa... */
+ /* #PreviewImage assumes pre-multiplied alpha. */
IMB_premultiply_alpha(thumb);
if (do_preview) {
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index bd655caae2b..a21033a8b91 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1147,7 +1147,7 @@ static char *get_rna_access(ID *id,
/* 'buf' _must_ be initialized in this block */
/* append preceding bits to path */
- /* NOTE: strings are not escapted and they should be! */
+ /* NOTE: strings are not escaped and they should be! */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
char actname_esc[sizeof(((bActionChannel *)NULL)->name) * 2];
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index f6a409ee3f0..0adf162b4eb 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -355,10 +355,10 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
BKE_displist_free(&ltOb->runtime.curve_cache->disp);
}
- copy_m4_m4(mat, ltOb->obmat);
- unit_m4(ltOb->obmat);
+ copy_m4_m4(mat, ltOb->object_to_world);
+ unit_m4(ltOb->object_to_world);
BKE_lattice_deform_coords(ltOb, NULL, vert_coords, uNew * vNew * wNew, 0, NULL, 1.0f);
- copy_m4_m4(ltOb->obmat, mat);
+ copy_m4_m4(ltOb->object_to_world, mat);
lt->typeu = typeu;
lt->typev = typev;
diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c
index 3a1c42b9178..892889aa426 100644
--- a/source/blender/blenkernel/intern/lattice_deform.c
+++ b/source/blender/blenkernel/intern/lattice_deform.c
@@ -79,15 +79,15 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
/* for example with a particle system: (ob == NULL) */
if (ob == NULL) {
/* In deform-space, calc matrix. */
- invert_m4_m4(latmat, oblatt->obmat);
+ invert_m4_m4(latmat, oblatt->object_to_world);
/* back: put in deform array */
invert_m4_m4(imat, latmat);
}
else {
/* In deform-space, calc matrix. */
- invert_m4_m4(imat, oblatt->obmat);
- mul_m4_m4m4(latmat, imat, ob->obmat);
+ invert_m4_m4(imat, oblatt->object_to_world);
+ mul_m4_m4m4(latmat, imat, ob->object_to_world);
/* back: put in deform array. */
invert_m4_m4(imat, latmat);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 06d69b6ff61..5b54f16661c 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -614,7 +614,7 @@ static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc)
return true;
}
- /* Check visiblilty restriction flags */
+ /* Check visibility restriction flags */
if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_HIDE_VIEWPORT) {
return true;
}
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index 158aaa961ce..f60234a684d 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -1612,7 +1612,7 @@ static void library_make_local_copying_check(ID *id,
if (!BLI_gset_haskey(done_ids, from_id)) {
if (BLI_gset_haskey(loop_tags, from_id)) {
/* We are in a 'dependency loop' of IDs, this does not say us anything, skip it.
- * Note that this is the situation that can lead to archipelagoes of linked data-blocks
+ * Note that this is the situation that can lead to archipelagos of linked data-blocks
* (since all of them have non-local users, they would all be duplicated,
* leading to a loop of unused linked data-blocks that cannot be freed since they all use
* each other...). */
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index 1a80376f482..c7643c56212 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -293,14 +293,14 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
* is never affected). */
for (ID *id = tagged_deleted_ids.first; id; id = id->next) {
id->tag |= LIB_TAG_NO_MAIN;
- /* Usercount needs to be reset artificially, since some usages may not be cleared in batch
+ /* User-count needs to be reset artificially, since some usages may not be cleared in batch
* deletion (typically, if one deleted ID uses another deleted ID, this may not be cleared by
* remapping code, depending on order in which these are handled). */
id->us = ID_FAKE_USERS(id);
}
}
else {
- /* First tag all datablocks directly from target lib.
+ /* First tag all data-blocks directly from target lib.
* Note that we go forward here, since we want to check dependencies before users
* (e.g. meshes before objects).
* Avoids to have to loop twice. */
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 55834d5cf4e..adc0eb5f78c 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -521,7 +521,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
}
if (1) {
- /* now convert linknodes into arrays for faster per pixel access */
+ /* Now convert link-nodes into arrays for faster per pixel access. */
uint **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__);
uint bucket_index;
@@ -1186,7 +1186,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
// printf("tris %d, feather tris %d\n", sf_tri_tot, tot_feather_quads);
}
- /* add trianges */
+ /* Add triangles. */
BLI_scanfill_end_arena(&sf_ctx, sf_arena);
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 6c6d2298dbd..59530a6d6a6 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1450,7 +1450,7 @@ static bool fill_texpaint_slots_cb(bNode *node, void *userdata)
NodeTexImage *storage = (NodeTexImage *)node->storage;
slot->interp = storage->interpolation;
slot->image_user = &storage->iuser;
- /* for new renderer, we need to traverse the treeback in search of a UV node */
+ /* For new renderer, we need to traverse the tree back in search of a UV node. */
bNode *uvnode = nodetree_uv_node_recursive(node);
if (uvnode) {
@@ -1512,58 +1512,65 @@ static ePaintSlotFilter material_paint_slot_filter(const struct Object *ob)
void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const struct Object *ob)
{
- int count = 0;
-
if (!ma) {
return;
}
const ePaintSlotFilter slot_filter = material_paint_slot_filter(ob);
- /* COW needed when adding texture slot on an object with no materials. */
- DEG_id_tag_update(&ma->id, ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE);
+ const TexPaintSlot *prev_texpaintslot = ma->texpaintslot;
+ const int prev_paint_active_slot = ma->paint_active_slot;
+ const int prev_paint_clone_slot = ma->paint_clone_slot;
+ const int prev_tot_slots = ma->tot_slots;
- if (ma->texpaintslot) {
- MEM_freeN(ma->texpaintslot);
- ma->tot_slots = 0;
- ma->texpaintslot = NULL;
- }
+ ma->texpaintslot = NULL;
+ ma->tot_slots = 0;
if (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_IMAGE) {
ma->paint_active_slot = 0;
ma->paint_clone_slot = 0;
- return;
}
-
- if (!(ma->nodetree)) {
+ else if (!(ma->nodetree)) {
ma->paint_active_slot = 0;
ma->paint_clone_slot = 0;
- return;
}
+ else {
+ int count = count_texture_nodes_recursive(ma->nodetree, slot_filter);
- count = count_texture_nodes_recursive(ma->nodetree, slot_filter);
-
- if (count == 0) {
- ma->paint_active_slot = 0;
- ma->paint_clone_slot = 0;
- return;
- }
+ if (count == 0) {
+ ma->paint_active_slot = 0;
+ ma->paint_clone_slot = 0;
+ }
+ else {
+ ma->texpaintslot = MEM_callocN(sizeof(*ma->texpaintslot) * count, "texpaint_slots");
- ma->texpaintslot = MEM_callocN(sizeof(*ma->texpaintslot) * count, "texpaint_slots");
+ bNode *active_node = nodeGetActivePaintCanvas(ma->nodetree);
- bNode *active_node = nodeGetActivePaintCanvas(ma->nodetree);
+ fill_texpaint_slots_recursive(ma->nodetree, active_node, ob, ma, count, slot_filter);
- fill_texpaint_slots_recursive(ma->nodetree, active_node, ob, ma, count, slot_filter);
+ ma->tot_slots = count;
- ma->tot_slots = count;
+ if (ma->paint_active_slot >= count) {
+ ma->paint_active_slot = count - 1;
+ }
- if (ma->paint_active_slot >= count) {
- ma->paint_active_slot = count - 1;
+ if (ma->paint_clone_slot >= count) {
+ ma->paint_clone_slot = count - 1;
+ }
+ }
}
- if (ma->paint_clone_slot >= count) {
- ma->paint_clone_slot = count - 1;
+ /* COW needed when adding texture slot on an object with no materials.
+ * But do it only when slots actually change to avoid continuous depsgraph updates. */
+ if (ma->tot_slots != prev_tot_slots || ma->paint_active_slot != prev_paint_active_slot ||
+ ma->paint_clone_slot != prev_paint_clone_slot ||
+ (ma->texpaintslot && prev_texpaintslot &&
+ memcmp(ma->texpaintslot, prev_texpaintslot, sizeof(*ma->texpaintslot) * ma->tot_slots) !=
+ 0)) {
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE);
}
+
+ MEM_SAFE_FREE(prev_texpaintslot);
}
void BKE_texpaint_slots_refresh_object(Scene *scene, struct Object *ob)
diff --git a/source/blender/blenkernel/intern/mball_tessellate.cc b/source/blender/blenkernel/intern/mball_tessellate.cc
index bb3713e770a..f8a64a7cd8b 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.cc
+++ b/source/blender/blenkernel/intern/mball_tessellate.cc
@@ -1188,8 +1188,9 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
const eEvaluationMode deg_eval_mode = DEG_get_mode(depsgraph);
const short parenting_dupli_transflag = (OB_DUPLIFACES | OB_DUPLIVERTS);
- copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */
- invert_m4_m4(obinv, ob->obmat);
+ copy_m4_m4(obmat,
+ ob->object_to_world); /* to cope with duplicators from BKE_scene_base_iter_next */
+ invert_m4_m4(obinv, ob->object_to_world);
BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.');
@@ -1237,13 +1238,13 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
/* when metaball object has zero scale, then MetaElem to this MetaBall
* will not be put to mainb array */
- if (has_zero_axis_m4(bob->obmat)) {
+ if (has_zero_axis_m4(bob->object_to_world)) {
zero_size = 1;
}
else if (bob->parent) {
struct Object *pob = bob->parent;
while (pob) {
- if (has_zero_axis_m4(pob->obmat)) {
+ if (has_zero_axis_m4(pob->object_to_world)) {
zero_size = 1;
break;
}
@@ -1307,7 +1308,7 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
* rotation ->
* ml local space
*/
- mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->obmat, pos, rot);
+ mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->object_to_world, pos, rot);
/* ml local space -> basis object space */
invert_m4_m4((float(*)[4])new_ml->imat, (float(*)[4])new_ml->mat);
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 0018c217964..2d613f24a0a 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1608,38 +1608,6 @@ void BKE_mesh_tessface_clear(Mesh *mesh)
mesh_tessface_clear_intern(mesh, true);
}
-void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
-{
- if (UNLIKELY(mesh->cd_flag)) {
- return;
- }
-
- const Span<MVert> verts = mesh->verts();
- const Span<MEdge> edges = mesh->edges();
-
- for (const MVert &vert : verts) {
- if (vert.bweight_legacy != 0) {
- mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
- break;
- }
- }
-
- for (const MEdge &edge : edges) {
- if (edge.bweight_legacy != 0) {
- mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
- if (mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
- break;
- }
- }
- if (edge.crease_legacy != 0) {
- mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
- if (mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
- break;
- }
- }
- }
-}
-
/* -------------------------------------------------------------------- */
/* MSelect functions (currently used in weight paint mode) */
diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc b/source/blender/blenkernel/intern/mesh_calc_edges.cc
index 5e6babdf7b4..4a4c2ebcbb0 100644
--- a/source/blender/blenkernel/intern/mesh_calc_edges.cc
+++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc
@@ -146,7 +146,7 @@ static void serialize_and_initialize_deduplicated_edges(MutableSpan<EdgeMap> edg
/* Initialize new edge. */
new_edge.v1 = item.key.v_low;
new_edge.v2 = item.key.v_high;
- new_edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ new_edge.flag = ME_EDGEDRAW;
}
item.value.index = new_edge_index;
new_edge_index++;
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index 784d35a8d65..2255038a991 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -119,7 +119,7 @@ static void make_edges_mdata_extend(Mesh &mesh)
BLI_edgehashIterator_getKey(ehi, &medge->v1, &medge->v2);
BLI_edgehashIterator_setValue(ehi, POINTER_FROM_UINT(e_index));
- medge->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ medge->flag = ME_EDGEDRAW;
}
BLI_edgehashIterator_free(ehi);
@@ -223,7 +223,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
for (b = 1; b < dl->nr; b++) {
medge->v1 = startvert + ofs + b - 1;
medge->v2 = startvert + ofs + b;
- medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
+ medge->flag = ME_LOOSEEDGE | ME_EDGEDRAW;
medge++;
}
@@ -251,7 +251,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
else {
medge->v2 = startvert + ofs + b + 1;
}
- medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
+ medge->flag = ME_LOOSEEDGE | ME_EDGEDRAW;
medge++;
}
}
@@ -706,7 +706,7 @@ void BKE_mesh_edges_set_draw_render(Mesh *mesh)
{
MutableSpan<MEdge> edges = mesh->edges_for_write();
for (int i = 0; i < mesh->totedge; i++) {
- edges[i].flag |= ME_EDGEDRAW | ME_EDGERENDER;
+ edges[i].flag |= ME_EDGEDRAW;
}
}
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index df3057d9592..feb40808704 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -30,6 +30,258 @@
#include "BKE_multires.h"
/* -------------------------------------------------------------------- */
+/** \name Legacy Edge Calculation
+ * \{ */
+
+struct EdgeSort {
+ uint v1, v2;
+ char is_loose, is_draw;
+};
+
+/* edges have to be added with lowest index first for sorting */
+static void to_edgesort(struct EdgeSort *ed, uint v1, uint v2, char is_loose, short is_draw)
+{
+ if (v1 < v2) {
+ ed->v1 = v1;
+ ed->v2 = v2;
+ }
+ else {
+ ed->v1 = v2;
+ ed->v2 = v1;
+ }
+ ed->is_loose = is_loose;
+ ed->is_draw = is_draw;
+}
+
+static int vergedgesort(const void *v1, const void *v2)
+{
+ const struct EdgeSort *x1 = static_cast<const struct EdgeSort *>(v1);
+ const struct EdgeSort *x2 = static_cast<const struct EdgeSort *>(v2);
+
+ if (x1->v1 > x2->v1) {
+ return 1;
+ }
+ if (x1->v1 < x2->v1) {
+ return -1;
+ }
+ if (x1->v2 > x2->v2) {
+ return 1;
+ }
+ if (x1->v2 < x2->v2) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Create edges based on known verts and faces,
+ * this function is only used when loading very old blend files */
+static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
+ const MFace *allface,
+ MLoop *allloop,
+ const MPoly *allpoly,
+ int /*totvert*/,
+ int totface,
+ int /*totloop*/,
+ int totpoly,
+ const bool use_old,
+ MEdge **r_medge,
+ int *r_totedge)
+{
+ const MPoly *mpoly;
+ const MFace *mface;
+ MEdge *medge, *med;
+ EdgeHash *hash;
+ struct EdgeSort *edsort, *ed;
+ int a, totedge = 0;
+ uint totedge_final = 0;
+ uint edge_index;
+
+ /* we put all edges in array, sort them, and detect doubles that way */
+
+ for (a = totface, mface = allface; a > 0; a--, mface++) {
+ if (mface->v4) {
+ totedge += 4;
+ }
+ else if (mface->v3) {
+ totedge += 3;
+ }
+ else {
+ totedge += 1;
+ }
+ }
+
+ if (totedge == 0) {
+ /* flag that mesh has edges */
+ (*r_medge) = (MEdge *)MEM_callocN(0, __func__);
+ (*r_totedge) = 0;
+ return;
+ }
+
+ ed = edsort = (EdgeSort *)MEM_mallocN(totedge * sizeof(struct EdgeSort), "EdgeSort");
+
+ for (a = totface, mface = allface; a > 0; a--, mface++) {
+ to_edgesort(ed++, mface->v1, mface->v2, !mface->v3, mface->edcode & ME_V1V2);
+ if (mface->v4) {
+ to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
+ to_edgesort(ed++, mface->v3, mface->v4, 0, mface->edcode & ME_V3V4);
+ to_edgesort(ed++, mface->v4, mface->v1, 0, mface->edcode & ME_V4V1);
+ }
+ else if (mface->v3) {
+ to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
+ to_edgesort(ed++, mface->v3, mface->v1, 0, mface->edcode & ME_V3V1);
+ }
+ }
+
+ qsort(edsort, totedge, sizeof(struct EdgeSort), vergedgesort);
+
+ /* count final amount */
+ for (a = totedge, ed = edsort; a > 1; a--, ed++) {
+ /* edge is unique when it differs from next edge, or is last */
+ if (ed->v1 != (ed + 1)->v1 || ed->v2 != (ed + 1)->v2) {
+ totedge_final++;
+ }
+ }
+ totedge_final++;
+
+ medge = (MEdge *)MEM_callocN(sizeof(MEdge) * totedge_final, __func__);
+
+ for (a = totedge, med = medge, ed = edsort; a > 1; a--, ed++) {
+ /* edge is unique when it differs from next edge, or is last */
+ if (ed->v1 != (ed + 1)->v1 || ed->v2 != (ed + 1)->v2) {
+ med->v1 = ed->v1;
+ med->v2 = ed->v2;
+ if (use_old == false || ed->is_draw) {
+ med->flag = ME_EDGEDRAW;
+ }
+ if (ed->is_loose) {
+ med->flag |= ME_LOOSEEDGE;
+ }
+
+ /* order is swapped so extruding this edge as a surface won't flip face normals
+ * with cyclic curves */
+ if (ed->v1 + 1 != ed->v2) {
+ SWAP(uint, med->v1, med->v2);
+ }
+ med++;
+ }
+ else {
+ /* Equal edge, merge the draw-flag. */
+ (ed + 1)->is_draw |= ed->is_draw;
+ }
+ }
+ /* last edge */
+ med->v1 = ed->v1;
+ med->v2 = ed->v2;
+ med->flag = ME_EDGEDRAW;
+ if (ed->is_loose) {
+ med->flag |= ME_LOOSEEDGE;
+ }
+
+ MEM_freeN(edsort);
+
+ /* set edge members of mloops */
+ hash = BLI_edgehash_new_ex(__func__, totedge_final);
+ for (edge_index = 0, med = medge; edge_index < totedge_final; edge_index++, med++) {
+ BLI_edgehash_insert(hash, med->v1, med->v2, POINTER_FROM_UINT(edge_index));
+ }
+
+ mpoly = allpoly;
+ for (a = 0; a < totpoly; a++, mpoly++) {
+ MLoop *ml, *ml_next;
+ int i = mpoly->totloop;
+
+ ml_next = allloop + mpoly->loopstart; /* first loop */
+ ml = &ml_next[i - 1]; /* last loop */
+
+ while (i-- != 0) {
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(hash, ml->v, ml_next->v));
+ ml = ml_next;
+ ml_next++;
+ }
+ }
+
+ BLI_edgehash_free(hash, nullptr);
+
+ *r_medge = medge;
+ *r_totedge = totedge_final;
+}
+
+void BKE_mesh_calc_edges_legacy(Mesh *me, const bool use_old)
+{
+ using namespace blender;
+ MEdge *medge;
+ int totedge = 0;
+ const Span<MVert> verts = me->verts();
+ const Span<MPoly> polys = me->polys();
+ MutableSpan<MLoop> loops = me->loops_for_write();
+
+ mesh_calc_edges_mdata(verts.data(),
+ (MFace *)CustomData_get_layer(&me->fdata, CD_MFACE),
+ loops.data(),
+ polys.data(),
+ verts.size(),
+ me->totface,
+ loops.size(),
+ polys.size(),
+ use_old,
+ &medge,
+ &totedge);
+
+ if (totedge == 0) {
+ /* flag that mesh has edges */
+ me->totedge = 0;
+ return;
+ }
+
+ medge = (MEdge *)CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, totedge);
+ me->totedge = totedge;
+
+ BKE_mesh_strip_loose_faces(me);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name CD Flag Initialization
+ * \{ */
+
+void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
+{
+ using namespace blender;
+ if (UNLIKELY(mesh->cd_flag)) {
+ return;
+ }
+
+ const Span<MVert> verts = mesh->verts();
+ const Span<MEdge> edges = mesh->edges();
+
+ for (const MVert &vert : verts) {
+ if (vert.bweight_legacy != 0) {
+ mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
+ break;
+ }
+ }
+
+ for (const MEdge &edge : edges) {
+ if (edge.bweight_legacy != 0) {
+ mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
+ if (mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
+ break;
+ }
+ }
+ if (edge.crease_legacy != 0) {
+ mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
+ if (mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
+ break;
+ }
+ }
+ }
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name NGon Tessellation (NGon to MFace Conversion)
* \{ */
diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index 261bc3d150b..ce3fc5d99c8 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -152,8 +152,8 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
/* tmp is a transform from coords relative to the object's own origin,
* to coords relative to the mirror object origin */
- invert_m4_m4(tmp, mirror_ob->obmat);
- mul_m4_m4m4(tmp, tmp, ob->obmat);
+ invert_m4_m4(tmp, mirror_ob->object_to_world);
+ mul_m4_m4m4(tmp, tmp, ob->object_to_world);
/* itmp is the reverse transform back to origin-relative coordinates */
invert_m4_m4(itmp, tmp);
@@ -169,9 +169,9 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
/* Account for non-uniform scale in `ob`, see: T87592. */
float ob_scale[3] = {
- len_squared_v3(ob->obmat[0]),
- len_squared_v3(ob->obmat[1]),
- len_squared_v3(ob->obmat[2]),
+ len_squared_v3(ob->object_to_world[0]),
+ len_squared_v3(ob->object_to_world[1]),
+ len_squared_v3(ob->object_to_world[2]),
};
/* Scale to avoid precision loss with extreme values. */
const float ob_scale_max = max_fff(UNPACK3(ob_scale));
diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 62354c83df1..0887e26148a 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -19,6 +19,7 @@
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.h"
#include "BLI_span.hh"
+#include "BLI_task.hh"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -302,17 +303,20 @@ void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, const Mesh *source)
&target->vdata, CD_PAINT_MASK, CD_CONSTRUCT, nullptr, target->totvert);
}
- for (int i = 0; i < target->totvert; i++) {
- float from_co[3];
- BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist_sq = FLT_MAX;
- copy_v3_v3(from_co, target_verts[i].co);
- BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
- if (nearest.index != -1) {
- target_mask[i] = source_mask[nearest.index];
+ blender::threading::parallel_for(IndexRange(target->totvert), 4096, [&](const IndexRange range) {
+ for (const int i : range) {
+ float from_co[3];
+ BVHTreeNearest nearest;
+ nearest.index = -1;
+ nearest.dist_sq = FLT_MAX;
+ copy_v3_v3(from_co, target_verts[i].co);
+ BLI_bvhtree_find_nearest(
+ bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
+ if (nearest.index != -1) {
+ target_mask[i] = source_mask[nearest.index];
+ }
}
- }
+ });
free_bvhtree_from_mesh(&bvhtree);
}
@@ -344,21 +348,24 @@ void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, const Mesh *source)
BVHTreeFromMesh bvhtree = {nullptr};
BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_LOOPTRI, 2);
- for (int i = 0; i < target->totpoly; i++) {
- float from_co[3];
- BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist_sq = FLT_MAX;
- const MPoly *mpoly = &target_polys[i];
- BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], target_verts, from_co);
- BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
- if (nearest.index != -1) {
- dst[i] = src[looptri[nearest.index].poly];
- }
- else {
- dst[i] = 1;
+ blender::threading::parallel_for(IndexRange(target->totpoly), 2048, [&](const IndexRange range) {
+ for (const int i : range) {
+ float from_co[3];
+ BVHTreeNearest nearest;
+ nearest.index = -1;
+ nearest.dist_sq = FLT_MAX;
+ const MPoly *mpoly = &target_polys[i];
+ BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], target_verts, from_co);
+ BLI_bvhtree_find_nearest(
+ bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
+ if (nearest.index != -1) {
+ dst[i] = src[looptri[nearest.index].poly];
+ }
+ else {
+ dst[i] = 1;
+ }
}
- }
+ });
free_bvhtree_from_mesh(&bvhtree);
dst_face_sets.finish();
}
@@ -399,85 +406,87 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
MVert *target_verts = (MVert *)CustomData_get_layer(&target->vdata, CD_MVERT);
if (domain == ATTR_DOMAIN_POINT) {
- for (int i = 0; i < target->totvert; i++) {
- BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist_sq = FLT_MAX;
- BLI_bvhtree_find_nearest(
- bvhtree.tree, target_verts[i].co, &nearest, bvhtree.nearest_callback, &bvhtree);
-
- if (nearest.index != -1) {
- memcpy(POINTER_OFFSET(target_data, size_t(i) * data_size),
- POINTER_OFFSET(source_data, size_t(nearest.index) * data_size),
- data_size);
- }
- }
+ blender::threading::parallel_for(
+ IndexRange(target->totvert), 4096, [&](const IndexRange range) {
+ for (const int i : range) {
+ BVHTreeNearest nearest;
+ nearest.index = -1;
+ nearest.dist_sq = FLT_MAX;
+ BLI_bvhtree_find_nearest(
+ bvhtree.tree, target_verts[i].co, &nearest, bvhtree.nearest_callback, &bvhtree);
+
+ if (nearest.index != -1) {
+ memcpy(POINTER_OFFSET(target_data, size_t(i) * data_size),
+ POINTER_OFFSET(source_data, size_t(nearest.index) * data_size),
+ data_size);
+ }
+ }
+ });
}
else {
/* Lazily init vertex -> loop maps. */
if (!source_lmap) {
- const MPoly *source_polys = (MPoly *)CustomData_get_layer(&source->pdata, CD_MPOLY);
- const MLoop *source_loops = (MLoop *)CustomData_get_layer(&source->ldata, CD_MLOOP);
- const MPoly *target_polys = (MPoly *)CustomData_get_layer(&target->pdata, CD_MPOLY);
- const MLoop *target_loops = (MLoop *)CustomData_get_layer(&target->ldata, CD_MLOOP);
-
BKE_mesh_vert_loop_map_create(&source_lmap,
&source_lmap_mem,
- source_polys,
- source_loops,
+ source->polys().data(),
+ source->loops().data(),
source->totvert,
source->totpoly,
source->totloop);
BKE_mesh_vert_loop_map_create(&target_lmap,
&target_lmap_mem,
- target_polys,
- target_loops,
+ target->polys().data(),
+ target->loops().data(),
target->totvert,
target->totpoly,
target->totloop);
}
- for (int i = 0; i < target->totvert; i++) {
- BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist_sq = FLT_MAX;
- BLI_bvhtree_find_nearest(
- bvhtree.tree, target_verts[i].co, &nearest, bvhtree.nearest_callback, &bvhtree);
-
- if (nearest.index == -1) {
- continue;
- }
-
- MeshElemMap *source_loops = source_lmap + nearest.index;
- MeshElemMap *target_loops = target_lmap + i;
-
- if (target_loops->count == 0 || source_loops->count == 0) {
- continue;
- }
-
- /*
- * Average color data for loops around the source vertex into
- * the first target loop around the target vertex
- */
-
- CustomData_interp(source_cdata,
- target_cdata,
- source_loops->indices,
- nullptr,
- nullptr,
- source_loops->count,
- target_loops->indices[0]);
-
- void *elem = POINTER_OFFSET(target_data, size_t(target_loops->indices[0]) * data_size);
-
- /* Copy to rest of target loops. */
- for (int j = 1; j < target_loops->count; j++) {
- memcpy(POINTER_OFFSET(target_data, size_t(target_loops->indices[j]) * data_size),
- elem,
- data_size);
- }
- }
+ blender::threading::parallel_for(
+ IndexRange(target->totvert), 2048, [&](const IndexRange range) {
+ for (const int i : range) {
+ BVHTreeNearest nearest;
+ nearest.index = -1;
+ nearest.dist_sq = FLT_MAX;
+ BLI_bvhtree_find_nearest(
+ bvhtree.tree, target_verts[i].co, &nearest, bvhtree.nearest_callback, &bvhtree);
+
+ if (nearest.index == -1) {
+ continue;
+ }
+
+ MeshElemMap *source_loops = source_lmap + nearest.index;
+ MeshElemMap *target_loops = target_lmap + i;
+
+ if (target_loops->count == 0 || source_loops->count == 0) {
+ continue;
+ }
+
+ /*
+ * Average color data for loops around the source vertex into
+ * the first target loop around the target vertex
+ */
+
+ CustomData_interp(source_cdata,
+ target_cdata,
+ source_loops->indices,
+ nullptr,
+ nullptr,
+ source_loops->count,
+ target_loops->indices[0]);
+
+ void *elem = POINTER_OFFSET(target_data,
+ size_t(target_loops->indices[0]) * data_size);
+
+ /* Copy to rest of target loops. */
+ for (int j = 1; j < target_loops->count; j++) {
+ memcpy(POINTER_OFFSET(target_data, size_t(target_loops->indices[j]) * data_size),
+ elem,
+ data_size);
+ }
+ }
+ });
}
}
diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc
index 9b140171912..9cd3b6e9e9e 100644
--- a/source/blender/blenkernel/intern/mesh_validate.cc
+++ b/source/blender/blenkernel/intern/mesh_validate.cc
@@ -1315,216 +1315,6 @@ void BKE_mesh_strip_loose_edges(Mesh *me)
/** \name Mesh Edge Calculation
* \{ */
-/* make edges in a Mesh, for outside of editmode */
-
-struct EdgeSort {
- uint v1, v2;
- char is_loose, is_draw;
-};
-
-/* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct EdgeSort *ed, uint v1, uint v2, char is_loose, short is_draw)
-{
- if (v1 < v2) {
- ed->v1 = v1;
- ed->v2 = v2;
- }
- else {
- ed->v1 = v2;
- ed->v2 = v1;
- }
- ed->is_loose = is_loose;
- ed->is_draw = is_draw;
-}
-
-static int vergedgesort(const void *v1, const void *v2)
-{
- const struct EdgeSort *x1 = static_cast<const struct EdgeSort *>(v1);
- const struct EdgeSort *x2 = static_cast<const struct EdgeSort *>(v2);
-
- if (x1->v1 > x2->v1) {
- return 1;
- }
- if (x1->v1 < x2->v1) {
- return -1;
- }
- if (x1->v2 > x2->v2) {
- return 1;
- }
- if (x1->v2 < x2->v2) {
- return -1;
- }
-
- return 0;
-}
-
-/* Create edges based on known verts and faces,
- * this function is only used when loading very old blend files */
-
-static void mesh_calc_edges_mdata(const MVert * /*allvert*/,
- const MFace *allface,
- MLoop *allloop,
- const MPoly *allpoly,
- int /*totvert*/,
- int totface,
- int /*totloop*/,
- int totpoly,
- const bool use_old,
- MEdge **r_medge,
- int *r_totedge)
-{
- const MPoly *mpoly;
- const MFace *mface;
- MEdge *medge, *med;
- EdgeHash *hash;
- struct EdgeSort *edsort, *ed;
- int a, totedge = 0;
- uint totedge_final = 0;
- uint edge_index;
-
- /* we put all edges in array, sort them, and detect doubles that way */
-
- for (a = totface, mface = allface; a > 0; a--, mface++) {
- if (mface->v4) {
- totedge += 4;
- }
- else if (mface->v3) {
- totedge += 3;
- }
- else {
- totedge += 1;
- }
- }
-
- if (totedge == 0) {
- /* flag that mesh has edges */
- (*r_medge) = (MEdge *)MEM_callocN(0, __func__);
- (*r_totedge) = 0;
- return;
- }
-
- ed = edsort = (EdgeSort *)MEM_mallocN(totedge * sizeof(struct EdgeSort), "EdgeSort");
-
- for (a = totface, mface = allface; a > 0; a--, mface++) {
- to_edgesort(ed++, mface->v1, mface->v2, !mface->v3, mface->edcode & ME_V1V2);
- if (mface->v4) {
- to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
- to_edgesort(ed++, mface->v3, mface->v4, 0, mface->edcode & ME_V3V4);
- to_edgesort(ed++, mface->v4, mface->v1, 0, mface->edcode & ME_V4V1);
- }
- else if (mface->v3) {
- to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
- to_edgesort(ed++, mface->v3, mface->v1, 0, mface->edcode & ME_V3V1);
- }
- }
-
- qsort(edsort, totedge, sizeof(struct EdgeSort), vergedgesort);
-
- /* count final amount */
- for (a = totedge, ed = edsort; a > 1; a--, ed++) {
- /* edge is unique when it differs from next edge, or is last */
- if (ed->v1 != (ed + 1)->v1 || ed->v2 != (ed + 1)->v2) {
- totedge_final++;
- }
- }
- totedge_final++;
-
- medge = (MEdge *)MEM_callocN(sizeof(MEdge) * totedge_final, __func__);
-
- for (a = totedge, med = medge, ed = edsort; a > 1; a--, ed++) {
- /* edge is unique when it differs from next edge, or is last */
- if (ed->v1 != (ed + 1)->v1 || ed->v2 != (ed + 1)->v2) {
- med->v1 = ed->v1;
- med->v2 = ed->v2;
- if (use_old == false || ed->is_draw) {
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
- }
- if (ed->is_loose) {
- med->flag |= ME_LOOSEEDGE;
- }
-
- /* order is swapped so extruding this edge as a surface won't flip face normals
- * with cyclic curves */
- if (ed->v1 + 1 != ed->v2) {
- SWAP(uint, med->v1, med->v2);
- }
- med++;
- }
- else {
- /* Equal edge, merge the draw-flag. */
- (ed + 1)->is_draw |= ed->is_draw;
- }
- }
- /* last edge */
- med->v1 = ed->v1;
- med->v2 = ed->v2;
- med->flag = ME_EDGEDRAW;
- if (ed->is_loose) {
- med->flag |= ME_LOOSEEDGE;
- }
- med->flag |= ME_EDGERENDER;
-
- MEM_freeN(edsort);
-
- /* set edge members of mloops */
- hash = BLI_edgehash_new_ex(__func__, totedge_final);
- for (edge_index = 0, med = medge; edge_index < totedge_final; edge_index++, med++) {
- BLI_edgehash_insert(hash, med->v1, med->v2, POINTER_FROM_UINT(edge_index));
- }
-
- mpoly = allpoly;
- for (a = 0; a < totpoly; a++, mpoly++) {
- MLoop *ml, *ml_next;
- int i = mpoly->totloop;
-
- ml_next = allloop + mpoly->loopstart; /* first loop */
- ml = &ml_next[i - 1]; /* last loop */
-
- while (i-- != 0) {
- ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(hash, ml->v, ml_next->v));
- ml = ml_next;
- ml_next++;
- }
- }
-
- BLI_edgehash_free(hash, nullptr);
-
- *r_medge = medge;
- *r_totedge = totedge_final;
-}
-
-void BKE_mesh_calc_edges_legacy(Mesh *me, const bool use_old)
-{
- MEdge *medge;
- int totedge = 0;
- const Span<MVert> verts = me->verts();
- const Span<MPoly> polys = me->polys();
- MutableSpan<MLoop> loops = me->loops_for_write();
-
- mesh_calc_edges_mdata(verts.data(),
- (MFace *)CustomData_get_layer(&me->fdata, CD_MFACE),
- loops.data(),
- polys.data(),
- verts.size(),
- me->totface,
- loops.size(),
- polys.size(),
- use_old,
- &medge,
- &totedge);
-
- if (totedge == 0) {
- /* flag that mesh has edges */
- me->totedge = 0;
- return;
- }
-
- medge = (MEdge *)CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, totedge);
- me->totedge = totedge;
-
- BKE_mesh_strip_loose_faces(me);
-}
-
void BKE_mesh_calc_edges_loose(Mesh *mesh)
{
const Span<MLoop> loops = mesh->loops();
@@ -1579,7 +1369,7 @@ void BKE_mesh_calc_edges_tessface(Mesh *mesh)
BLI_edgesetIterator_step(ehi), i++, med++, index++) {
BLI_edgesetIterator_getKey(ehi, &med->v1, &med->v2);
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med->flag = ME_EDGEDRAW;
*index = ORIGINDEX_NONE;
}
BLI_edgesetIterator_free(ehi);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 24663d6db05..c0aff204069 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -464,6 +464,7 @@ NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act, const bool is_libo
*/
nlt = BKE_nlatrack_add(adt, NULL, is_liboverride);
BKE_nlatrack_add_strip(nlt, strip, is_liboverride);
+ BLI_strncpy(nlt->name, act->id.name + 2, sizeof(nlt->name));
}
/* automatically name it too */
@@ -2054,7 +2055,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
/* If block is already in tweak-mode, just leave, but we should report
- * that this block is in tweak-mode (as our returncode). */
+ * that this block is in tweak-mode (as our return-code). */
if (adt->flag & ADT_NLA_EDIT_ON) {
return true;
}
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 3e3a8355f98..aa6ca37f48c 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2022,21 +2022,29 @@ bNode *nodeFindNodebyName(bNodeTree *ntree, const char *name)
bool nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **r_node, int *r_sockindex)
{
*r_node = nullptr;
+ if (!ntree->runtime->topology_cache_is_dirty) {
+ bNode *node = &sock->owner_node();
+ *r_node = node;
+ if (r_sockindex) {
+ ListBase *sockets = (sock->in_out == SOCK_IN) ? &node->inputs : &node->outputs;
+ *r_sockindex = BLI_findindex(sockets, sock);
+ }
+ return true;
+ }
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
ListBase *sockets = (sock->in_out == SOCK_IN) ? &node->inputs : &node->outputs;
- int index = 0;
- LISTBASE_FOREACH (bNodeSocket *, tsock, sockets) {
+ int i;
+ LISTBASE_FOREACH_INDEX (bNodeSocket *, tsock, sockets, i) {
if (sock == tsock) {
if (r_node != nullptr) {
*r_node = node;
}
if (r_sockindex != nullptr) {
- *r_sockindex = index;
+ *r_sockindex = i;
}
return true;
}
- index++;
}
}
return false;
@@ -3373,10 +3381,18 @@ struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(bNodeTree *ntree,
bNode *from_node,
bNodeSocket *from_sock)
{
- bNodeSocket *iosock = ntreeAddSocketInterface(ntree,
- static_cast<eNodeSocketInOut>(from_sock->in_out),
- from_sock->idname,
- DATA_(from_sock->name));
+ return ntreeAddSocketInterfaceFromSocketWithName(
+ ntree, from_node, from_sock, from_sock->idname, from_sock->name);
+}
+
+struct bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(bNodeTree *ntree,
+ bNode *from_node,
+ bNodeSocket *from_sock,
+ const char *idname,
+ const char *name)
+{
+ bNodeSocket *iosock = ntreeAddSocketInterface(
+ ntree, static_cast<eNodeSocketInOut>(from_sock->in_out), idname, DATA_(name));
if (iosock) {
if (iosock->typeinfo->interface_from_socket) {
iosock->typeinfo->interface_from_socket(ntree, iosock, from_node, from_sock);
@@ -4330,12 +4346,6 @@ void node_type_socket_templates(struct bNodeType *ntype,
}
}
-void node_type_init(struct bNodeType *ntype,
- void (*initfunc)(struct bNodeTree *ntree, struct bNode *node))
-{
- ntype->initfunc = initfunc;
-}
-
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth)
{
ntype->width = width;
@@ -4383,33 +4393,6 @@ void node_type_storage(bNodeType *ntype,
ntype->freefunc = freefunc;
}
-void node_type_update(struct bNodeType *ntype,
- void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
-{
- ntype->updatefunc = updatefunc;
-}
-
-void node_type_group_update(struct bNodeType *ntype,
- void (*group_update_func)(struct bNodeTree *ntree, struct bNode *node))
-{
- ntype->group_update_func = group_update_func;
-}
-
-void node_type_exec(struct bNodeType *ntype,
- NodeInitExecFunction init_exec_fn,
- NodeFreeExecFunction free_exec_fn,
- NodeExecFunction exec_fn)
-{
- ntype->init_exec_fn = init_exec_fn;
- ntype->free_exec_fn = free_exec_fn;
- ntype->exec_fn = exec_fn;
-}
-
-void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
-{
- ntype->gpu_fn = gpu_fn;
-}
-
/* callbacks for undefined types */
static bool node_undefined_poll(bNodeType * /*ntype*/,
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index d98f5e85028..9085a54d86f 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -1330,14 +1330,14 @@ void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd)
/* Calculate the world-space matrix for the pose-channel target first,
* then carry on as usual. */
- mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat, hmd->object->object_to_world, pchan->pose_mat);
invert_m4_m4(imat, mat);
- mul_m4_m4m4(hmd->parentinv, imat, ob->obmat);
+ mul_m4_m4m4(hmd->parentinv, imat, ob->object_to_world);
}
else {
- invert_m4_m4(hmd->object->imat, hmd->object->obmat);
- mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat);
+ invert_m4_m4(hmd->object->world_to_object, hmd->object->object_to_world);
+ mul_m4_m4m4(hmd->parentinv, hmd->object->world_to_object, ob->object_to_world);
}
}
}
@@ -1355,14 +1355,14 @@ void BKE_object_modifier_gpencil_hook_reset(Object *ob, HookGpencilModifierData
/* Calculate the world-space matrix for the pose-channel target first,
* then carry on as usual. */
- mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat, hmd->object->object_to_world, pchan->pose_mat);
invert_m4_m4(imat, mat);
- mul_m4_m4m4(hmd->parentinv, imat, ob->obmat);
+ mul_m4_m4m4(hmd->parentinv, imat, ob->object_to_world);
}
else {
- invert_m4_m4(hmd->object->imat, hmd->object->obmat);
- mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat);
+ invert_m4_m4(hmd->object->world_to_object, hmd->object->object_to_world);
+ mul_m4_m4m4(hmd->parentinv, hmd->object->world_to_object, ob->object_to_world);
}
}
@@ -2541,6 +2541,28 @@ Object *BKE_object_pose_armature_get(Object *ob)
return nullptr;
}
+Object *BKE_object_pose_armature_get_with_wpaint_check(Object *ob)
+{
+ /* When not in weight paint mode. */
+ if (ob) {
+ switch (ob->type) {
+ case OB_MESH: {
+ if ((ob->mode & OB_MODE_WEIGHT_PAINT) == 0) {
+ return nullptr;
+ }
+ break;
+ }
+ case OB_GPENCIL: {
+ if ((ob->mode & OB_MODE_WEIGHT_GPENCIL) == 0) {
+ return nullptr;
+ }
+ break;
+ }
+ }
+ }
+ return BKE_object_pose_armature_get(ob);
+}
+
Object *BKE_object_pose_armature_get_visible(Object *ob,
const Scene *scene,
ViewLayer *view_layer,
@@ -3102,10 +3124,10 @@ void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4])
BKE_object_get_parent_matrix(ob, ob->parent, par_imat);
invert_m4(par_imat);
- mul_m4_m4m4(r_mat, par_imat, ob->obmat);
+ mul_m4_m4m4(r_mat, par_imat, ob->object_to_world);
}
else {
- copy_m4_m4(r_mat, ob->obmat);
+ copy_m4_m4(r_mat, ob->object_to_world);
}
}
@@ -3359,32 +3381,32 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float r_parentmat[4][
}
if (ok) {
- mul_m4_m4m4(r_parentmat, par->obmat, tmat);
+ mul_m4_m4m4(r_parentmat, par->object_to_world, tmat);
}
else {
- copy_m4_m4(r_parentmat, par->obmat);
+ copy_m4_m4(r_parentmat, par->object_to_world);
}
break;
}
case PARBONE:
ob_parbone(ob, par, tmat);
- mul_m4_m4m4(r_parentmat, par->obmat, tmat);
+ mul_m4_m4m4(r_parentmat, par->object_to_world, tmat);
break;
case PARVERT1:
unit_m4(r_parentmat);
give_parvert(par, ob->par1, vec);
- mul_v3_m4v3(r_parentmat[3], par->obmat, vec);
+ mul_v3_m4v3(r_parentmat[3], par->object_to_world, vec);
break;
case PARVERT3:
ob_parvert3(ob, par, tmat);
- mul_m4_m4m4(r_parentmat, par->obmat, tmat);
+ mul_m4_m4m4(r_parentmat, par->object_to_world, tmat);
break;
case PARSKEL:
- copy_m4_m4(r_parentmat, par->obmat);
+ copy_m4_m4(r_parentmat, par->object_to_world);
break;
}
}
@@ -3422,7 +3444,7 @@ static void solve_parenting(
/* origin, for help line */
if (set_origin) {
if ((ob->partype & PARTYPE) == PARSKEL) {
- copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, par->object_to_world[3]);
}
else {
copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]);
@@ -3441,10 +3463,10 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph,
Object *par = ob->parent;
/* calculate parent matrix */
- solve_parenting(ob, par, true, ob->obmat, r_originmat);
+ solve_parenting(ob, par, true, ob->object_to_world, r_originmat);
}
else {
- BKE_object_to_mat4(ob, ob->obmat);
+ BKE_object_to_mat4(ob, ob->object_to_world);
}
/* try to fall back to the scene rigid body world if none given */
@@ -3461,7 +3483,7 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph,
}
/* set negative scale flag in object */
- if (is_negative_m4(ob->obmat)) {
+ if (is_negative_m4(ob->object_to_world)) {
ob->transflag |= OB_NEG_SCALE;
}
else {
@@ -3507,7 +3529,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
{
BKE_object_workob_clear(workob);
- unit_m4(workob->obmat);
+ unit_m4(workob->object_to_world);
unit_m4(workob->parentinv);
unit_m4(workob->constinv);
@@ -3599,7 +3621,7 @@ void BKE_object_apply_parent_inverse(struct Object *ob)
* `inv(parent) @ world = parentinv`
* `parentinv = inv(parent) @ world`
*
- * NOTE: If `ob->obmat` has shear, then this `parentinv` is insufficient because
+ * NOTE: If `ob->object_to_world` has shear, then this `parentinv` is insufficient because
* `parent @ parentinv => shearless result`
*
* Thus, local will have shear which cannot be decomposed into TRS:
@@ -3628,7 +3650,7 @@ void BKE_object_apply_parent_inverse(struct Object *ob)
copy_m4_m4(ob_local, ob->parentinv);
invert_m4(ob_local);
mul_m4_m4_post(ob_local, par_imat);
- mul_m4_m4_post(ob_local, ob->obmat);
+ mul_m4_m4_post(ob_local, ob->object_to_world);
/* Send use_compat=False so the rotation is predictable. */
BKE_object_apply_mat4(ob, ob_local, false, false);
@@ -3793,7 +3815,7 @@ void BKE_object_dimensions_get(Object *ob, float r_vec[3])
const BoundBox *bb = BKE_object_boundbox_get(ob);
if (bb) {
float3 scale;
- mat4_to_size(scale, ob->obmat);
+ mat4_to_size(scale, ob->object_to_world);
r_vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
r_vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
@@ -3850,19 +3872,19 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us
case OB_FONT:
case OB_SURF: {
const BoundBox bb = *BKE_curve_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
case OB_MESH: {
const BoundBox bb = *BKE_mesh_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
case OB_GPENCIL: {
const BoundBox bb = *BKE_gpencil_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
@@ -3875,7 +3897,7 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us
for (v = 0; v < lt->pntsv; v++) {
for (u = 0; u < lt->pntsu; u++, bp++) {
float3 vec;
- mul_v3_m4v3(vec, ob->obmat, bp->vec);
+ mul_v3_m4v3(vec, ob->object_to_world, bp->vec);
minmax_v3v3_v3(r_min, r_max, vec);
}
}
@@ -3890,7 +3912,8 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us
case OB_MBALL: {
float ob_min[3], ob_max[3];
- changed = BKE_mball_minmax_ex((const MetaBall *)ob->data, ob_min, ob_max, ob->obmat, 0);
+ changed = BKE_mball_minmax_ex(
+ (const MetaBall *)ob->data, ob_min, ob_max, ob->object_to_world, 0);
if (changed) {
minmax_v3v3_v3(r_min, r_max, ob_min);
minmax_v3v3_v3(r_min, r_max, ob_max);
@@ -3899,20 +3922,20 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us
}
case OB_CURVES: {
const BoundBox bb = *BKE_curves_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
case OB_POINTCLOUD: {
const BoundBox bb = *BKE_pointcloud_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
case OB_VOLUME: {
const BoundBox bb = *BKE_volume_boundbox_get(ob);
- BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max);
+ BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
changed = true;
break;
}
@@ -3926,14 +3949,14 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us
size *= ob->empty_drawsize;
}
- minmax_v3v3_v3(r_min, r_max, ob->obmat[3]);
+ minmax_v3v3_v3(r_min, r_max, ob->object_to_world[3]);
float3 vec;
- copy_v3_v3(vec, ob->obmat[3]);
+ copy_v3_v3(vec, ob->object_to_world[3]);
add_v3_v3(vec, size);
minmax_v3v3_v3(r_min, r_max, vec);
- copy_v3_v3(vec, ob->obmat[3]);
+ copy_v3_v3(vec, ob->object_to_world[3]);
sub_v3_v3(vec, size);
minmax_v3v3_v3(r_min, r_max, vec);
}
@@ -3980,12 +4003,12 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re
* however the issue with empty objects being visible when viewed from the side
* is only noticeable in orthographic views. */
float3 view_dir;
- sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->obmat[3]);
- dot = dot_v3v3(ob->obmat[2], view_dir);
+ sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->object_to_world[3]);
+ dot = dot_v3v3(ob->object_to_world[2], view_dir);
eps = 0.0f;
}
else {
- dot = dot_v3v3(ob->obmat[2], rv3d->viewinv[2]);
+ dot = dot_v3v3(ob->object_to_world[2], rv3d->viewinv[2]);
eps = 1e-5f;
}
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) {
@@ -4002,7 +4025,7 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED) {
float3 proj, ob_z_axis;
- normalize_v3_v3(ob_z_axis, ob->obmat[2]);
+ normalize_v3_v3(ob_z_axis, ob->object_to_world[2]);
project_plane_v3_v3v3(proj, ob_z_axis, rv3d->viewinv[2]);
const float proj_length_sq = len_squared_v3(proj);
if (proj_length_sq > 1e-5f) {
@@ -4194,7 +4217,7 @@ void BKE_scene_foreach_display_point(Depsgraph *depsgraph,
DEG_ITER_OBJECT_FLAG_DUPLI;
DEG_OBJECT_ITER_BEGIN (&deg_iter_settings, ob) {
if ((ob->base_flag & BASE_SELECTED) != 0) {
- BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data);
+ BKE_object_foreach_display_point(ob, ob->object_to_world, func_cb, user_data);
}
}
DEG_OBJECT_ITER_END;
@@ -4237,10 +4260,10 @@ void *BKE_object_tfm_backup(Object *ob)
copy_v3_v3(obtfm->drotAxis, ob->drotAxis);
obtfm->rotAngle = ob->rotAngle;
obtfm->drotAngle = ob->drotAngle;
- copy_m4_m4(obtfm->obmat, ob->obmat);
+ copy_m4_m4(obtfm->obmat, ob->object_to_world);
copy_m4_m4(obtfm->parentinv, ob->parentinv);
copy_m4_m4(obtfm->constinv, ob->constinv);
- copy_m4_m4(obtfm->imat, ob->imat);
+ copy_m4_m4(obtfm->imat, ob->world_to_object);
return (void *)obtfm;
}
@@ -4260,10 +4283,10 @@ void BKE_object_tfm_restore(Object *ob, void *obtfm_pt)
copy_v3_v3(ob->drotAxis, obtfm->drotAxis);
ob->rotAngle = obtfm->rotAngle;
ob->drotAngle = obtfm->drotAngle;
- copy_m4_m4(ob->obmat, obtfm->obmat);
+ copy_m4_m4(ob->object_to_world, obtfm->obmat);
copy_m4_m4(ob->parentinv, obtfm->parentinv);
copy_m4_m4(ob->constinv, obtfm->constinv);
- copy_m4_m4(ob->imat, obtfm->imat);
+ copy_m4_m4(ob->world_to_object, obtfm->imat);
}
/** \} */
@@ -5291,7 +5314,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
for (i = 0; i < verts.size(); i++) {
if (index[i] != ORIGINDEX_NONE) {
float co[3];
- mul_v3_m4v3(co, ob->obmat, verts[i].co);
+ mul_v3_m4v3(co, ob->object_to_world, verts[i].co);
BLI_kdtree_3d_insert(tree, index[i], co);
tot++;
}
@@ -5305,7 +5328,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
for (i = 0; i < tot; i++) {
float co[3];
- mul_v3_m4v3(co, ob->obmat, verts[i].co);
+ mul_v3_m4v3(co, ob->object_to_world, verts[i].co);
BLI_kdtree_3d_insert(tree, i, co);
}
}
@@ -5334,7 +5357,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
a = nu->pntsu;
while (a--) {
float co[3];
- mul_v3_m4v3(co, ob->obmat, bezt->vec[1]);
+ mul_v3_m4v3(co, ob->object_to_world, bezt->vec[1]);
BLI_kdtree_3d_insert(tree, i++, co);
bezt++;
}
@@ -5346,7 +5369,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
a = nu->pntsu * nu->pntsv;
while (a--) {
float co[3];
- mul_v3_m4v3(co, ob->obmat, bp->vec);
+ mul_v3_m4v3(co, ob->object_to_world, bp->vec);
BLI_kdtree_3d_insert(tree, i++, co);
bp++;
}
@@ -5369,7 +5392,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
for (bp = lt->def; i < tot; bp++) {
float co[3];
- mul_v3_m4v3(co, ob->obmat, bp->vec);
+ mul_v3_m4v3(co, ob->object_to_world, bp->vec);
BLI_kdtree_3d_insert(tree, i++, co);
}
diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc
index d43eff6f9b4..a41f7c8bce4 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -197,7 +197,8 @@ static bool copy_dupli_context(DupliContext *r_ctx,
/**
* Generate a dupli instance.
*
- * \param mat: is transform of the object relative to current context (including #Object.obmat).
+ * \param mat: is transform of the object relative to current context (including
+ * #Object.object_to_world).
*/
static DupliObject *make_dupli(const DupliContext *ctx,
Object *ob,
@@ -296,7 +297,7 @@ static DupliObject *make_dupli(const DupliContext *ctx,
/**
* Recursive dupli-objects.
*
- * \param space_mat: is the local dupli-space (excluding dupli #Object.obmat).
+ * \param space_mat: is the local dupli-space (excluding dupli #Object.object_to_world).
*/
static void make_recursive_duplis(const DupliContext *ctx,
Object *ob,
@@ -468,8 +469,8 @@ static void make_duplis_collection(const DupliContext *ctx)
/* Combine collection offset and `obmat`. */
unit_m4(collection_mat);
sub_v3_v3(collection_mat[3], collection->instance_offset);
- mul_m4_m4m4(collection_mat, ob->obmat, collection_mat);
- /* Don't access 'ob->obmat' from now on. */
+ mul_m4_m4m4(collection_mat, ob->object_to_world, collection_mat);
+ /* Don't access 'ob->object_to_world' from now on. */
eEvaluationMode mode = DEG_get_mode(ctx->depsgraph);
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (collection, cob, mode) {
@@ -477,7 +478,7 @@ static void make_duplis_collection(const DupliContext *ctx)
float mat[4][4];
/* Collection dupli-offset, should apply after everything else. */
- mul_m4_m4m4(mat, collection_mat, cob->obmat);
+ mul_m4_m4m4(mat, collection_mat, cob->object_to_world);
make_dupli(ctx, cob, mat, _base_id);
@@ -584,11 +585,11 @@ static DupliObject *vertex_dupli(const DupliContext *ctx,
/* Make offset relative to inst_ob using relative child transform. */
mul_mat3_m4_v3(child_imat, obmat[3]);
/* Apply `obmat` _after_ the local vertex transform. */
- mul_m4_m4m4(obmat, inst_ob->obmat, obmat);
+ mul_m4_m4m4(obmat, inst_ob->object_to_world, obmat);
/* Space matrix is constructed by removing `obmat` transform,
* this yields the world-space transform for recursive duplis. */
- mul_m4_m4m4(space_mat, obmat, inst_ob->imat);
+ mul_m4_m4m4(space_mat, obmat, inst_ob->world_to_object);
DupliObject *dob = make_dupli(ctx, inst_ob, obmat, index);
@@ -608,10 +609,10 @@ static void make_child_duplis_verts_from_mesh(const DupliContext *ctx,
const MVert *mvert = vdd->mvert;
const int totvert = vdd->totvert;
- invert_m4_m4(inst_ob->imat, inst_ob->obmat);
+ invert_m4_m4(inst_ob->world_to_object, inst_ob->object_to_world);
/* Relative transform from parent to child space. */
float child_imat[4][4];
- mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat);
+ mul_m4_m4m4(child_imat, inst_ob->world_to_object, ctx->object->object_to_world);
for (int i = 0; i < totvert; i++) {
DupliObject *dob = vertex_dupli(
@@ -630,10 +631,10 @@ static void make_child_duplis_verts_from_editmesh(const DupliContext *ctx,
BMEditMesh *em = vdd->em;
const bool use_rotation = vdd->params.use_rotation;
- invert_m4_m4(inst_ob->imat, inst_ob->obmat);
+ invert_m4_m4(inst_ob->world_to_object, inst_ob->object_to_world);
/* Relative transform from parent to child space. */
float child_imat[4][4];
- mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat);
+ mul_m4_m4m4(child_imat, inst_ob->world_to_object, ctx->object->object_to_world);
BMVert *v;
BMIter iter;
@@ -758,7 +759,7 @@ static void make_duplis_font(const DupliContext *ctx)
return;
}
- copy_m4_m4(pmat, par->obmat);
+ copy_m4_m4(pmat, par->object_to_world);
/* In `par` the family name is stored, use this to find the other objects. */
@@ -803,7 +804,7 @@ static void make_duplis_font(const DupliContext *ctx)
mul_m4_v3(pmat, vec);
- copy_m4_m4(obmat, par->obmat);
+ copy_m4_m4(obmat, par->object_to_world);
if (UNLIKELY(ct->rot != 0.0f)) {
float rmat[4][4];
@@ -919,7 +920,7 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
make_dupli(ctx_for_instance, &object, matrix, id, &geometry_set, i);
float space_matrix[4][4];
- mul_m4_m4m4(space_matrix, instance_offset_matrices[i].values, object.imat);
+ mul_m4_m4m4(space_matrix, instance_offset_matrices[i].values, object.world_to_object);
mul_m4_m4_pre(space_matrix, parent_transform);
make_recursive_duplis(ctx_for_instance, &object, space_matrix, id, &geometry_set, i);
break;
@@ -951,7 +952,7 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
}
float instance_matrix[4][4];
- mul_m4_m4m4(instance_matrix, collection_matrix, object->obmat);
+ mul_m4_m4m4(instance_matrix, collection_matrix, object->object_to_world);
make_dupli(&sub_ctx, object, instance_matrix, object_id++);
make_recursive_duplis(&sub_ctx, object, collection_matrix, object_id++);
@@ -986,7 +987,7 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx,
static void make_duplis_geometry_set(const DupliContext *ctx)
{
const GeometrySet *geometry_set = ctx->object->runtime.geometry_set_eval;
- make_duplis_geometry_set_impl(ctx, *geometry_set, ctx->object->obmat, false, false);
+ make_duplis_geometry_set_impl(ctx, *geometry_set, ctx->object->object_to_world, false, false);
}
static const DupliGenerator gen_dupli_geometry_set = {
@@ -1092,11 +1093,11 @@ static DupliObject *face_dupli(const DupliContext *ctx,
}
/* Apply `obmat` _after_ the local face transform. */
- mul_m4_m4m4(obmat, inst_ob->obmat, obmat);
+ mul_m4_m4m4(obmat, inst_ob->object_to_world, obmat);
/* Space matrix is constructed by removing `obmat` transform,
* this yields the world-space transform for recursive duplis. */
- mul_m4_m4m4(space_mat, obmat, inst_ob->imat);
+ mul_m4_m4m4(space_mat, obmat, inst_ob->world_to_object);
DupliObject *dob = make_dupli(ctx, inst_ob, obmat, index);
@@ -1176,9 +1177,9 @@ static void make_child_duplis_faces_from_mesh(const DupliContext *ctx,
float child_imat[4][4];
- invert_m4_m4(inst_ob->imat, inst_ob->obmat);
+ invert_m4_m4(inst_ob->world_to_object, inst_ob->object_to_world);
/* Relative transform from parent to child space. */
- mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat);
+ mul_m4_m4m4(child_imat, inst_ob->world_to_object, ctx->object->object_to_world);
const float scale_fac = ctx->object->instance_faces_scale;
for (a = 0, mp = mpoly; a < totface; a++, mp++) {
@@ -1216,9 +1217,9 @@ static void make_child_duplis_faces_from_editmesh(const DupliContext *ctx,
BLI_assert((vert_coords == nullptr) || (em->bm->elem_index_dirty & BM_VERT) == 0);
- invert_m4_m4(inst_ob->imat, inst_ob->obmat);
+ invert_m4_m4(inst_ob->world_to_object, inst_ob->object_to_world);
/* Relative transform from parent to child space. */
- mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat);
+ mul_m4_m4m4(child_imat, inst_ob->world_to_object, ctx->object->object_to_world);
const float scale_fac = ctx->object->instance_faces_scale;
BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, a) {
@@ -1347,8 +1348,9 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
sim.ob = par;
sim.psys = psys;
sim.psmd = psys_get_modifier(par, psys);
- /* Make sure emitter `imat` is in global coordinates instead of render view coordinates. */
- invert_m4_m4(par->imat, par->obmat);
+ /* Make sure emitter `world_to_object` is in global coordinates instead of render view
+ * coordinates. */
+ invert_m4_m4(par->world_to_object, par->object_to_world);
/* First check for loops (particle system object used as dupli-object). */
if (part->ren_as == PART_DRAW_OB) {
@@ -1535,7 +1537,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
b = 0;
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (
part->instance_collection, object, mode) {
- copy_m4_m4(tmat, oblist[b]->obmat);
+ copy_m4_m4(tmat, oblist[b]->object_to_world);
/* Apply collection instance offset. */
sub_v3_v3(tmat[3], part->instance_collection->instance_offset);
@@ -1558,7 +1560,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
}
else {
float obmat[4][4];
- copy_m4_m4(obmat, ob->obmat);
+ copy_m4_m4(obmat, ob->object_to_world);
float vec[3];
copy_v3_v3(vec, obmat[3]);
@@ -1752,7 +1754,7 @@ ListBase *object_duplilist_preview(Depsgraph *depsgraph,
*viewer_path)) {
ctx.preview_base_geometry = &viewer_log->geometry;
make_duplis_geometry_set_impl(
- &ctx, viewer_log->geometry, ob_eval->obmat, true, ob_eval->type == OB_CURVES);
+ &ctx, viewer_log->geometry, ob_eval->object_to_world, true, ob_eval->type == OB_CURVES);
}
}
return duplilist;
diff --git a/source/blender/blenkernel/intern/object_update.cc b/source/blender/blenkernel/intern/object_update.cc
index e53090bcffe..106c9594718 100644
--- a/source/blender/blenkernel/intern/object_update.cc
+++ b/source/blender/blenkernel/intern/object_update.cc
@@ -61,7 +61,7 @@ void BKE_object_eval_local_transform(Depsgraph *depsgraph, Object *ob)
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* calculate local matrix */
- BKE_object_to_mat4(ob, ob->obmat);
+ BKE_object_to_mat4(ob, ob->object_to_world);
}
void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob)
@@ -78,18 +78,18 @@ void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob)
/* get local matrix (but don't calculate it, as that was done already!) */
/* XXX: redundant? */
- copy_m4_m4(locmat, ob->obmat);
+ copy_m4_m4(locmat, ob->object_to_world);
/* get parent effect matrix */
BKE_object_get_parent_matrix(ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
- mul_m4_m4m4(ob->obmat, tmat, locmat);
+ mul_m4_m4m4(ob->object_to_world, tmat, locmat);
/* origin, for help line */
if ((ob->partype & PARTYPE) == PARSKEL) {
- copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]);
+ copy_v3_v3(ob->runtime.parent_display_origin, par->object_to_world[3]);
}
else {
copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]);
@@ -121,9 +121,9 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* Make sure inverse matrix is always up to date. This way users of it
* do not need to worry about recalculating it. */
- invert_m4_m4_safe(ob->imat, ob->obmat);
+ invert_m4_m4_safe(ob->world_to_object, ob->object_to_world);
/* Set negative scale flag in object. */
- if (is_negative_m4(ob->obmat)) {
+ if (is_negative_m4(ob->object_to_world)) {
ob->transflag |= OB_NEG_SCALE;
}
else {
@@ -257,8 +257,8 @@ void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object)
/* Base flags. */
object_orig->base_flag = object->base_flag;
/* Transformation flags. */
- copy_m4_m4(object_orig->obmat, object->obmat);
- copy_m4_m4(object_orig->imat, object->imat);
+ copy_m4_m4(object_orig->object_to_world, object->object_to_world);
+ copy_m4_m4(object_orig->world_to_object, object->world_to_object);
copy_m4_m4(object_orig->constinv, object->constinv);
object_orig->transflag = object->transflag;
object_orig->flag = object->flag;
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index 408cd117e32..a39e53662aa 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -1201,7 +1201,7 @@ void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3])
mul_v3_v3fl(stroke, ups->average_stroke_accum, fac);
}
else {
- copy_v3_v3(stroke, ob->obmat[3]);
+ copy_v3_v3(stroke, ob->object_to_world[3]);
}
}
@@ -2316,7 +2316,7 @@ void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
&key);
}
-bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D * /*v3d*/)
+bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
{
SculptSession *ss = ob->sculpt;
if (ss == nullptr || ss->pbvh == nullptr || ss->mode_type != OB_MODE_SCULPT) {
@@ -2324,9 +2324,10 @@ bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D * /*v3d*/)
}
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
- /* Regular mesh only draws from PBVH without modifiers and shape keys. */
-
- return !(ss->shapekey_active || ss->deform_modifiers_active);
+ /* Regular mesh only draws from PBVH without modifiers and shape keys, or for
+ * external engines that do not have access to the PBVH like Eevee does. */
+ const bool external_engine = rv3d && rv3d->render_engine != nullptr;
+ return !(ss->shapekey_active || ss->deform_modifiers_active || external_engine);
}
/* Multires and dyntopo always draw directly from the PBVH. */
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index d6dd3cf0dbb..4a0a09bcf56 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2370,8 +2370,8 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
0,
0);
- mul_m4_v3(sim->ob->obmat, state.co);
- mul_mat3_m4_v3(sim->ob->obmat, state.vel);
+ mul_m4_v3(sim->ob->object_to_world, state.co);
+ mul_mat3_m4_v3(sim->ob->object_to_world, state.vel);
pd_point_from_particle(sim, pa, &state, &point);
@@ -2454,8 +2454,8 @@ bool do_guides(Depsgraph *depsgraph,
}
}
- mul_m4_v3(eff->ob->obmat, guidevec);
- mul_mat3_m4_v3(eff->ob->obmat, guidedir);
+ mul_m4_v3(eff->ob->object_to_world, guidevec);
+ mul_mat3_m4_v3(eff->ob->object_to_world, guidedir);
normalize_v3(guidedir);
@@ -2956,7 +2956,7 @@ static void psys_thread_create_path(ParticleTask *task,
psys_particle_on_emitter(
ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa->fuv, foffset, co, 0, 0, 0, orco);
- mul_m4_v3(ob->obmat, co);
+ mul_m4_v3(ob->object_to_world, co);
for (w = 0; w < 4; w++) {
sub_v3_v3v3(off1[w], co, key[w]->co);
@@ -3419,7 +3419,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
/* dynamic hair is in object space */
/* keyed and baked are already in global space */
if (hair_mesh) {
- mul_m4_v3(sim->ob->obmat, ca->co);
+ mul_m4_v3(sim->ob->object_to_world, ca->co);
}
else if (!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR)) {
mul_m4_v3(hairmat, ca->co);
@@ -3929,7 +3929,7 @@ void psys_mat_hair_to_global(
psys_mat_hair_to_object(ob, mesh, from, pa, facemat);
- mul_m4_m4m4(hairmat, ob->obmat, facemat);
+ mul_m4_m4m4(hairmat, ob->object_to_world, facemat);
}
/************************************************/
@@ -4290,7 +4290,7 @@ static void get_cpa_texture(Mesh *mesh,
case TEXCO_OBJECT:
copy_v3_v3(texvec, par->state.co);
if (mtex->object) {
- mul_m4_v3(mtex->object->imat, texvec);
+ mul_m4_v3(mtex->object->world_to_object, texvec);
}
break;
case TEXCO_UV:
@@ -4378,7 +4378,7 @@ void psys_get_texture(
case TEXCO_OBJECT:
copy_v3_v3(texvec, pa->state.co);
if (mtex->object) {
- mul_m4_v3(mtex->object->imat, texvec);
+ mul_m4_v3(mtex->object->world_to_object, texvec);
}
break;
case TEXCO_UV:
@@ -4661,8 +4661,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
do_particle_interpolation(psys, p, pa, t, &pind, state);
if (pind.mesh) {
- mul_m4_v3(sim->ob->obmat, state->co);
- mul_mat3_m4_v3(sim->ob->obmat, state->vel);
+ mul_m4_v3(sim->ob->object_to_world, state->co);
+ mul_mat3_m4_v3(sim->ob->object_to_world, state->vel);
}
else if (!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) {
if ((pa->flag & PARS_REKEY) == 0) {
@@ -4685,7 +4685,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
}
}
else if (totchild) {
- // invert_m4_m4(imat, ob->obmat);
+ // invert_m4_m4(imat, ob->object_to_world);
/* interpolate childcache directly if it exists */
if (psys->childcache) {
@@ -4733,7 +4733,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
* positioning it accurately to the surface of the emitter. */
// copy_v3_v3(cpa_1st, co);
- // mul_m4_v3(ob->obmat, cpa_1st);
+ // mul_m4_v3(ob->object_to_world, cpa_1st);
pa = psys->particles + cpa->parent;
@@ -5170,7 +5170,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim,
}
if (psys->part->rotmode == PART_ROT_VEL) {
- transpose_m3_m4(nmat, ob->imat);
+ transpose_m3_m4(nmat, ob->world_to_object);
mul_m3_v3(nmat, nor);
normalize_v3(nor);
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index a890812cfc4..6cc7dbc70d0 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -187,7 +187,7 @@ static void do_kink_spiral(ParticleThreadContext *ctx,
zero_v3(kink_base);
kink_base[part->kink_axis] = 1.0f;
- mul_mat3_m4_v3(ctx->sim.ob->obmat, kink_base);
+ mul_mat3_m4_v3(ctx->sim.ob->object_to_world, kink_base);
/* Fill in invariant part of modifier context. */
ParticleChildModifierContext modifier_ctx = {NULL};
@@ -873,7 +873,7 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx,
part->kink_flat,
part->kink,
part->kink_axis,
- sim->ob->obmat,
+ sim->ob->object_to_world,
smooth_start);
}
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c72bbe2fd08..72094f8cf04 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -750,10 +750,10 @@ void psys_get_birth_coords(
/* particles live in global space so */
/* let's convert: */
/* -location */
- mul_m4_v3(ob->obmat, loc);
+ mul_m4_v3(ob->object_to_world, loc);
/* -normal */
- mul_mat3_m4_v3(ob->obmat, nor);
+ mul_mat3_m4_v3(ob->object_to_world, nor);
normalize_v3(nor);
/* -tangent */
@@ -771,7 +771,7 @@ void psys_get_birth_coords(
fac = -sinf((float)M_PI * (part->tanphase + phase));
madd_v3_v3fl(vtan, utan, fac);
- mul_mat3_m4_v3(ob->obmat, vtan);
+ mul_mat3_m4_v3(ob->object_to_world, vtan);
copy_v3_v3(utan, nor);
mul_v3_fl(utan, dot_v3v3(vtan, nor));
@@ -786,7 +786,7 @@ void psys_get_birth_coords(
r_vel[1] = 2.0f * (psys_frand(psys, p + 11) - 0.5f);
r_vel[2] = 2.0f * (psys_frand(psys, p + 12) - 0.5f);
- mul_mat3_m4_v3(ob->obmat, r_vel);
+ mul_mat3_m4_v3(ob->object_to_world, r_vel);
normalize_v3(r_vel);
}
@@ -796,7 +796,7 @@ void psys_get_birth_coords(
r_ave[1] = 2.0f * (psys_frand(psys, p + 14) - 0.5f);
r_ave[2] = 2.0f * (psys_frand(psys, p + 15) - 0.5f);
- mul_mat3_m4_v3(ob->obmat, r_ave);
+ mul_mat3_m4_v3(ob->object_to_world, r_ave);
normalize_v3(r_ave);
}
@@ -808,7 +808,7 @@ void psys_get_birth_coords(
r_rot[3] = 2.0f * (psys_frand(psys, p + 19) - 0.5f);
normalize_qt(r_rot);
- mat4_to_quat(rot, ob->obmat);
+ mat4_to_quat(rot, ob->object_to_world);
mul_qt_qtqt(r_rot, r_rot, rot);
}
@@ -822,7 +822,7 @@ void psys_get_birth_coords(
/* boids store direction in ave */
if (fabsf(nor[2]) == 1.0f) {
- sub_v3_v3v3(state->ave, loc, ob->obmat[3]);
+ sub_v3_v3v3(state->ave, loc, ob->object_to_world[3]);
normalize_v3(state->ave);
}
else {
@@ -868,15 +868,15 @@ void psys_get_birth_coords(
/* *emitter object orientation */
if (part->ob_vel[0] != 0.0f) {
- normalize_v3_v3(vec, ob->obmat[0]);
+ normalize_v3_v3(vec, ob->object_to_world[0]);
madd_v3_v3fl(vel, vec, part->ob_vel[0]);
}
if (part->ob_vel[1] != 0.0f) {
- normalize_v3_v3(vec, ob->obmat[1]);
+ normalize_v3_v3(vec, ob->object_to_world[1]);
madd_v3_v3fl(vel, vec, part->ob_vel[1]);
}
if (part->ob_vel[2] != 0.0f) {
- normalize_v3_v3(vec, ob->obmat[2]);
+ normalize_v3_v3(vec, ob->object_to_world[2]);
madd_v3_v3fl(vel, vec, part->ob_vel[2]);
}
@@ -924,7 +924,7 @@ void psys_get_birth_coords(
case PART_ROT_OB_X:
case PART_ROT_OB_Y:
case PART_ROT_OB_Z:
- copy_v3_v3(rot_vec, ob->obmat[part->rotmode - PART_ROT_OB_X]);
+ copy_v3_v3(rot_vec, ob->object_to_world[part->rotmode - PART_ROT_OB_X]);
use_global_space = false;
break;
default:
@@ -951,7 +951,7 @@ void psys_get_birth_coords(
float q_obmat[4];
float q_imat[4];
- mat4_to_quat(q_obmat, ob->obmat);
+ mat4_to_quat(q_obmat, ob->object_to_world);
invert_qt_qt_normalized(q_imat, q_obmat);
if (part->rotmode != PART_ROT_NOR_TAN) {
@@ -1639,7 +1639,7 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
}
}
- /* Loop through springs backwaqrds - for efficient delete function */
+ /* Loop through springs backwards - for efficient delete function. */
for (i = psys->tot_fluidsprings - 1; i >= 0; i--) {
if (psys->fluid_springs[i].delete_flag) {
sph_spring_delete(psys, i);
@@ -3364,7 +3364,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim,
use_hair = psys_hair_use_simulation(pa, max_length);
psys_mat_hair_to_object(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat);
- mul_m4_m4m4(root_mat, sim->ob->obmat, hairmat);
+ mul_m4_m4m4(root_mat, sim->ob->object_to_world, hairmat);
normalize_m4(root_mat);
bending_stiffness = CLAMPIS(
@@ -3555,7 +3555,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
HairKey *key, *root;
PARTICLE_P;
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
psys->lattice_deform_data = psys_create_lattice_deform_data(sim);
@@ -3577,7 +3577,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
/* convert from global to geometry space */
copy_v3_v3(key->co, pa->state.co);
- mul_m4_v3(ob->imat, key->co);
+ mul_m4_v3(ob->world_to_object, key->co);
if (pa->totkey) {
sub_v3_v3(key->co, root->co);
@@ -4380,7 +4380,7 @@ static void particles_fluid_step(ParticleSimulationData *sim,
mul_v3_v3(pa->state.co, scaleAbs);
/* Match domain scale. */
- mul_m4_v3(ob->obmat, pa->state.co);
+ mul_m4_v3(ob->object_to_world, pa->state.co);
/* Add origin offset to particle position. */
zero_v3(tmp);
@@ -4764,7 +4764,7 @@ void particle_system_update(struct Depsgraph *depsgraph,
float cfra;
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
- /* drawdata is outdated after ANY change */
+ /* Draw data is outdated after ANY change. */
if (psys->pdd) {
psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
}
@@ -4963,7 +4963,7 @@ void particle_system_update(struct Depsgraph *depsgraph,
/* Save matrix for duplicators,
* at render-time the actual dupli-object's matrix is used so don't update! */
- invert_m4_m4(psys->imat, ob->obmat);
+ invert_m4_m4(psys->imat, ob->object_to_world);
BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index ac98bed2cf0..868cdde6d01 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1317,7 +1317,7 @@ static int ptcache_path(PTCacheID *pid, char *dirname)
BLI_path_abs(dirname, blendfilename);
}
- return BLI_path_slash_ensure(dirname); /* new strlen() */
+ return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */
}
if ((blendfile_path[0] != '\0') || lib) {
char file[MAX_PTCACHE_PATH]; /* we don't want the dir, only the file */
@@ -1334,14 +1334,14 @@ static int ptcache_path(PTCacheID *pid, char *dirname)
BLI_snprintf(dirname, MAX_PTCACHE_PATH, "//" PTCACHE_PATH "%s", file);
BLI_path_abs(dirname, blendfilename);
- return BLI_path_slash_ensure(dirname); /* new strlen() */
+ return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */
}
/* use the temp path. this is weak but better than not using point cache at all */
/* temporary directory is assumed to exist and ALWAYS has a trailing slash */
BLI_snprintf(dirname, MAX_PTCACHE_PATH, "%s" PTCACHE_PATH, BKE_tempdir_session());
- return BLI_path_slash_ensure(dirname); /* new strlen() */
+ return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */
}
static size_t ptcache_filepath_ext_append(PTCacheID *pid,
@@ -2611,7 +2611,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra)
}
#endif
- /* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */
+ /* Clear all files in the temp dir with the prefix of the ID and the `.bphys` suffix. */
switch (mode) {
case PTCACHE_CLEAR_ALL:
case PTCACHE_CLEAR_BEFORE:
@@ -2775,7 +2775,7 @@ void BKE_ptcache_id_time(
/* time handling for point cache:
* - simulation time is scaled by result of bsystem_time
* - for offsetting time only time offset is taken into account, since
- * that's always the same and can't be animated. a timeoffset which
+ * that's always the same and can't be animated. a time-offset which
* varies over time is not simple to support.
* - field and motion blur offsets are currently ignored, proper solution
* is probably to interpolate results from two frames for that ..
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index ffc6bc8d7a3..5e91b23bce3 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -264,13 +264,13 @@ static RigidBodyCon *rigidbody_copy_constraint(const Object *ob, const int UNUSE
RigidBodyCon *rbcN = NULL;
if (ob->rigidbody_constraint) {
- /* just duplicate the whole struct first (to catch all the settings) */
+ /* Just duplicate the whole struct first (to catch all the settings). */
rbcN = MEM_dupallocN(ob->rigidbody_constraint);
- /* tag object as needing to be verified */
+ /* Tag object as needing to be verified. */
rbcN->flag |= RBC_FLAG_NEEDS_VALIDATE;
- /* clear out all the fields which need to be revalidated later */
+ /* Clear out all the fields which need to be re-validated later. */
rbcN->physics_constraint = NULL;
}
@@ -684,7 +684,7 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
if (totvert > 0 && tottri > 0) {
BKE_mesh_calc_volume(mvert, totvert, lt, tottri, mloop, &volume, NULL);
- const float volume_scale = mat4_to_volume_scale(ob->obmat);
+ const float volume_scale = mat4_to_volume_scale(ob->object_to_world);
volume *= fabsf(volume_scale);
}
}
@@ -809,7 +809,7 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool
return;
}
- mat4_to_loc_quat(loc, rot, ob->obmat);
+ mat4_to_loc_quat(loc, rot, ob->object_to_world);
rbo->shared->physics_object = RB_body_new(rbo->shared->physics_shape, loc, rot);
@@ -974,7 +974,7 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
rbc->physics_constraint = NULL;
}
- mat4_to_loc_quat(loc, rot, ob->obmat);
+ mat4_to_loc_quat(loc, rot, ob->object_to_world);
if (rb1 && rb2) {
switch (rbc->type) {
@@ -1266,7 +1266,7 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type)
rbo->mesh_source = RBO_MESH_DEFORM;
/* set initial transform */
- mat4_to_loc_quat(rbo->pos, rbo->orn, ob->obmat);
+ mat4_to_loc_quat(rbo->pos, rbo->orn, ob->object_to_world);
/* flag cache as outdated */
BKE_rigidbody_cache_reset(rbw);
@@ -1689,7 +1689,7 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Object *ob, RigidBodyO
if (!(rbo->flag & RBO_FLAG_KINEMATIC)) {
/* update scale for all non kinematic objects */
float new_scale[3], old_scale[3];
- mat4_to_size(new_scale, ob->obmat);
+ mat4_to_size(new_scale, ob->object_to_world);
RB_body_get_scale(rbo->shared->physics_object, old_scale);
/* Avoid updating collision shape AABBs if scale didn't change. */
@@ -1886,7 +1886,7 @@ static ListBase rigidbody_create_substep_data(RigidBodyWorld *rbw)
copy_v4_v4(data->old_rot, rot);
copy_v3_v3(data->old_scale, scale);
- mat4_decompose(loc, rot, scale, ob->obmat);
+ mat4_decompose(loc, rot, scale, ob->object_to_world);
copy_v3_v3(data->new_pos, loc);
copy_v4_v4(data->new_rot, rot);
@@ -2055,15 +2055,15 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime)
quat_to_mat4(mat, rbo->orn);
copy_v3_v3(mat[3], rbo->pos);
- mat4_to_size(size, ob->obmat);
+ mat4_to_size(size, ob->object_to_world);
size_to_mat4(size_mat, size);
mul_m4_m4m4(mat, mat, size_mat);
- copy_m4_m4(ob->obmat, mat);
+ copy_m4_m4(ob->object_to_world, mat);
}
/* otherwise set rigid body transform to current obmat */
else {
- mat4_to_loc_quat(rbo->pos, rbo->orn, ob->obmat);
+ mat4_to_loc_quat(rbo->pos, rbo->orn, ob->object_to_world);
}
}
diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc
index bd26075f81f..c921cf603de 100644
--- a/source/blender/blenkernel/intern/scene.cc
+++ b/source/blender/blenkernel/intern/scene.cc
@@ -2278,13 +2278,13 @@ int BKE_scene_base_iter_next(
if (iter->dupli_refob != *ob) {
if (iter->dupli_refob) {
/* Restore previous object's real matrix. */
- copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
+ copy_m4_m4(iter->dupli_refob->object_to_world, iter->omat);
}
/* Backup new object's real matrix. */
iter->dupli_refob = *ob;
- copy_m4_m4(iter->omat, iter->dupli_refob->obmat);
+ copy_m4_m4(iter->omat, iter->dupli_refob->object_to_world);
}
- copy_m4_m4((*ob)->obmat, iter->dupob->mat);
+ copy_m4_m4((*ob)->object_to_world, iter->dupob->mat);
iter->dupob = iter->dupob->next;
}
@@ -2294,7 +2294,7 @@ int BKE_scene_base_iter_next(
if (iter->dupli_refob) {
/* Restore last object's real matrix. */
- copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
+ copy_m4_m4(iter->dupli_refob->object_to_world, iter->omat);
iter->dupli_refob = nullptr;
}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 3e5dbc47c40..2c896788b20 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -304,7 +304,7 @@ IDTypeInfo IDType_ID_SCR = {
/* ************ Space-type/region-type handling ************** */
-/* keep global; this has to be accessible outside of windowmanager */
+/** Keep global; this has to be accessible outside of window-manager. */
static ListBase spacetypes = {NULL, NULL};
/* not SpaceType itself */
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 14a7d26a354..efe423ccfc5 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -133,9 +133,9 @@ typedef struct SB_thread_context {
#define BSF_INTERSECT 1 /* edge intersects collider face */
-/* private definitions for bodypoint states */
-#define SBF_DOFUZZY 1 /* Bodypoint do fuzzy. */
-#define SBF_OUTOFCOLLISION 2 /* Bodypoint does not collide. */
+/* private definitions for body-point states */
+#define SBF_DOFUZZY 1 /* Body-point do fuzzy. */
+#define SBF_OUTOFCOLLISION 2 /* Body-point does not collide. */
#define BFF_INTERSECT 1 /* collider edge intrudes face. */
#define BFF_CLOSEVERT 2 /* collider vertex repulses face. */
@@ -318,7 +318,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
/* OBBs for idea1 */
pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax) * pccd_M->tri_num, "ccd_Mesh_Faces_mima");
- /* anyhoo we need to walk the list of faces and find OBB they live in */
+ /* Anyhow we need to walk the list of faces and find OBB they live in. */
for (i = 0, mima = pccd_M->mima, vt = pccd_M->tri; i < pccd_M->tri_num; i++, mima++, vt++) {
const float *v;
@@ -413,7 +413,7 @@ static void ccd_mesh_update(Object *ob, ccd_Mesh *pccd_M)
pccd_M->bbmax[2] = max_ff(pccd_M->bbmax[2], v[2] + hull);
}
- /* anyhoo we need to walk the list of faces and find OBB they live in */
+ /* Anyhow we need to walk the list of faces and find OBB they live in. */
for (i = 0, mima = pccd_M->mima, vt = pccd_M->tri; i < pccd_M->tri_num; i++, mima++, vt++) {
const float *v;
@@ -2644,7 +2644,7 @@ static void springs_from_mesh(Object *ob)
bp = ob->soft->bpoint;
for (a = 0; a < me->totvert; a++, bp++) {
copy_v3_v3(bp->origS, verts[a].co);
- mul_m4_v3(ob->obmat, bp->origS);
+ mul_m4_v3(ob->object_to_world, bp->origS);
}
}
/* recalculate spring length for meshes here */
@@ -2809,9 +2809,9 @@ static float globallen(float *v1, float *v2, Object *ob)
{
float p1[3], p2[3];
copy_v3_v3(p1, v1);
- mul_m4_v3(ob->obmat, p1);
+ mul_m4_v3(ob->object_to_world, p1);
copy_v3_v3(p2, v2);
- mul_m4_v3(ob->obmat, p2);
+ mul_m4_v3(ob->object_to_world, p2);
return len_v3v3(p1, p2);
}
@@ -3073,12 +3073,13 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts,
SB_estimate_transform(ob, sb->lcom, sb->lrot, sb->lscale);
}
/* Inverse matrix is not up to date. */
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
for (a = 0; a < numVerts; a++, bp++) {
copy_v3_v3(vertexCos[a], bp->pos);
if (local == 0) {
- mul_m4_v3(ob->imat, vertexCos[a]); /* softbody is in global coords, baked optionally not */
+ mul_m4_v3(ob->world_to_object,
+ vertexCos[a]); /* softbody is in global coords, baked optionally not */
}
}
}
@@ -3223,7 +3224,7 @@ static void softbody_update_positions(Object *ob,
/* copy the position of the goals at desired end time */
copy_v3_v3(bp->origE, vertexCos[a]);
/* vertexCos came from local world, go global */
- mul_m4_v3(ob->obmat, bp->origE);
+ mul_m4_v3(ob->object_to_world, bp->origE);
/* just to be save give bp->origT a defined value
* will be calculated in interpolate_exciter() */
copy_v3_v3(bp->origT, bp->origE);
@@ -3279,7 +3280,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
for (a = 0, bp = sb->bpoint; a < numVerts; a++, bp++) {
copy_v3_v3(bp->pos, vertexCos[a]);
- mul_m4_v3(ob->obmat, bp->pos); /* Yep, soft-body is global coords. */
+ mul_m4_v3(ob->object_to_world, bp->pos); /* Yep, soft-body is global coords. */
copy_v3_v3(bp->origS, bp->pos);
copy_v3_v3(bp->origE, bp->pos);
copy_v3_v3(bp->origT, bp->pos);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index d08fba0e657..51a20cf1e35 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -1025,7 +1025,7 @@ void BKE_sound_free_waveform(bSound *sound)
sound->tags &= ~SOUND_TAGS_WAVEFORM_NO_RELOAD;
}
-void BKE_sound_read_waveform(Main *bmain, bSound *sound, short *stop)
+void BKE_sound_read_waveform(Main *bmain, bSound *sound, bool *stop)
{
bool need_close_audio_handles = false;
if (sound->playback_handle == NULL) {
@@ -1041,8 +1041,11 @@ void BKE_sound_read_waveform(Main *bmain, bSound *sound, short *stop)
int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND;
waveform->data = MEM_mallocN(sizeof(float[3]) * length, "SoundWaveform.samples");
+ /* Ideally this would take a boolean argument. */
+ short stop_i16 = *stop;
waveform->length = AUD_readSound(
- sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, stop);
+ sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, &stop_i16);
+ *stop = stop_i16 != 0;
}
else {
/* Create an empty waveform here if the sound couldn't be
@@ -1129,9 +1132,9 @@ static void sound_update_base(Scene *scene, Object *object, void *new_set)
AUD_SequenceEntry_setConeAngleInner(strip->speaker_handle, speaker->cone_angle_inner);
AUD_SequenceEntry_setConeVolumeOuter(strip->speaker_handle, speaker->cone_volume_outer);
- mat4_to_quat(quat, object->obmat);
+ mat4_to_quat(quat, object->object_to_world);
AUD_SequenceEntry_setAnimationData(
- strip->speaker_handle, AUD_AP_LOCATION, scene->r.cfra, object->obmat[3], 1);
+ strip->speaker_handle, AUD_AP_LOCATION, scene->r.cfra, object->object_to_world[3], 1);
AUD_SequenceEntry_setAnimationData(
strip->speaker_handle, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1);
AUD_SequenceEntry_setAnimationData(
@@ -1171,9 +1174,9 @@ void BKE_sound_update_scene(Depsgraph *depsgraph, Scene *scene)
}
if (scene->camera) {
- mat4_to_quat(quat, scene->camera->obmat);
+ mat4_to_quat(quat, scene->camera->object_to_world);
AUD_Sequence_setAnimationData(
- scene->sound_scene, AUD_AP_LOCATION, scene->r.cfra, scene->camera->obmat[3], 1);
+ scene->sound_scene, AUD_AP_LOCATION, scene->r.cfra, scene->camera->object_to_world[3], 1);
AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1);
}
@@ -1381,7 +1384,7 @@ int BKE_sound_scene_playing(Scene *UNUSED(scene))
void BKE_sound_read_waveform(Main *bmain,
bSound *sound,
/* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop)
+ bool *stop)
{
UNUSED_VARS(sound, stop, bmain);
}
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc b/source/blender/blenkernel/intern/subdiv_mesh.cc
index 3b97c1f5e68..e1c434f2b2e 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.cc
+++ b/source/blender/blenkernel/intern/subdiv_mesh.cc
@@ -794,7 +794,7 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
/* TODO: Ensure crease layer isn't copied to result. */
subdiv_edge->flag = 0;
if (!ctx->settings->use_optimal_display) {
- subdiv_edge->flag |= ME_EDGERENDER;
+ subdiv_edge->flag |= ME_EDGEDRAW;
}
if (ctx->edge_origindex != nullptr) {
ctx->edge_origindex[subdiv_edge_index] = ORIGINDEX_NONE;
@@ -804,7 +804,7 @@ static void subdiv_copy_edge_data(SubdivMeshContext *ctx,
const int coarse_edge_index = coarse_edge - ctx->coarse_edges;
CustomData_copy_data(
&ctx->coarse_mesh->edata, &ctx->subdiv_mesh->edata, coarse_edge_index, subdiv_edge_index, 1);
- subdiv_edge->flag |= ME_EDGERENDER;
+ subdiv_edge->flag |= ME_EDGEDRAW;
}
static void subdiv_mesh_edge(const SubdivForeachContext *foreach_context,
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index c37f4b1ea2f..80fb637b76e 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -962,7 +962,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
int edgeSize = ccgSubSurf_getEdgeSize(ss);
uint i = 0;
short *edgeFlags = ccgdm->edgeFlags;
- const short ed_interior_flag = ccgdm->drawInteriorEdges ? (ME_EDGEDRAW | ME_EDGERENDER) : 0;
+ const short ed_interior_flag = ccgdm->drawInteriorEdges ? ME_EDGEDRAW : 0;
totface = ccgSubSurf_getNumFaces(ss);
for (index = 0; index < totface; index++) {
@@ -1005,11 +1005,11 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
if (edgeFlags) {
if (edgeIdx != -1) {
- ed_flag |= ((edgeFlags[index] & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW | ME_EDGERENDER);
+ ed_flag |= ((edgeFlags[index] & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW);
}
}
else {
- ed_flag |= ME_EDGEDRAW | ME_EDGERENDER;
+ ed_flag |= ME_EDGEDRAW;
}
for (x = 0; x < edgeSize - 1; x++) {
diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c
index 11041b4c0fd..e784c39ba08 100644
--- a/source/blender/blenkernel/intern/tracking_solver.c
+++ b/source/blender/blenkernel/intern/tracking_solver.c
@@ -56,8 +56,8 @@ typedef struct MovieReconstructContext {
} MovieReconstructContext;
typedef struct ReconstructProgressData {
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
char *stats_message;
int message_size;
@@ -465,8 +465,8 @@ static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *recons
}
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress,
char *stats_message,
int message_size)
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index f7ea4c81fbf..f5badfc9e94 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -715,7 +715,7 @@ static const char *unit_find_str(const char *str, const char *substr, bool case_
/* Weak unicode support!, so "µm" won't match up be replaced by "m"
* since non ascii utf8 values will NEVER return true */
isalpha_or_utf8(*BLI_str_find_prev_char_utf8(str_found, str)) == 0) {
- /* Next char cannot be alphanum. */
+ /* Next char cannot be alpha-numeric. */
int len_name = strlen(substr);
if (!isalpha_or_utf8(*(str_found + len_name))) {
diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c
index 7ace1a3aa3b..9f48b9b9c4a 100644
--- a/source/blender/blenkernel/intern/vfont.c
+++ b/source/blender/blenkernel/intern/vfont.c
@@ -1310,14 +1310,14 @@ static bool vfont_to_curve(Object *ob,
float timeofs, sizefac;
if (ob != NULL) {
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
}
else {
unit_m4(imat);
}
copy_m3_m4(imat3, imat);
- copy_m3_m4(cmat, cu->textoncurve->obmat);
+ copy_m3_m4(cmat, cu->textoncurve->object_to_world);
mul_m3_m3m3(cmat, cmat, imat3);
sizefac = normalize_v3(cmat[0]) / font_size;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 0d3a790ba00..d71db8f71a5 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -141,19 +141,18 @@ static int write_audio_frame(FFMpegContext *context)
frame->pts = context->audio_time / av_q2d(c->time_base);
frame->nb_samples = context->audio_input_samples;
frame->format = c->sample_fmt;
- frame->channels = c->channels;
- frame->channel_layout = c->channel_layout;
+ av_channel_layout_copy(&frame->ch_layout, &c->ch_layout);
if (context->audio_deinterleave) {
int channel, i;
uint8_t *temp;
- for (channel = 0; channel < c->channels; channel++) {
+ for (channel = 0; channel < c->ch_layout.nb_channels; channel++) {
for (i = 0; i < frame->nb_samples; i++) {
memcpy(context->audio_deinterleave_buffer +
(i + channel * frame->nb_samples) * context->audio_sample_size,
context->audio_input_buffer +
- (c->channels * i + channel) * context->audio_sample_size,
+ (c->ch_layout.nb_channels * i + channel) * context->audio_sample_size,
context->audio_sample_size);
}
}
@@ -164,10 +163,11 @@ static int write_audio_frame(FFMpegContext *context)
}
avcodec_fill_audio_frame(frame,
- c->channels,
+ c->ch_layout.nb_channels,
c->sample_fmt,
context->audio_input_buffer,
- context->audio_input_samples * c->channels * context->audio_sample_size,
+ context->audio_input_samples * c->ch_layout.nb_channels *
+ context->audio_sample_size,
1);
int success = 1;
@@ -492,7 +492,7 @@ static const AVCodec *get_av1_encoder(
/* Apply AV1 encoder specific settings. */
if (codec) {
- if (strcmp(codec->name, "librav1e") == 0) {
+ if (STREQ(codec->name, "librav1e")) {
/* Set "tiles" to 8 to enable multi-threaded encoding. */
if (rd->threads > 8) {
ffmpeg_dict_set_int(opts, "tiles", rd->threads);
@@ -530,7 +530,7 @@ static const AVCodec *get_av1_encoder(
BLI_snprintf(buffer, sizeof(buffer), "keyint=%d", context->ffmpeg_gop_size);
av_dict_set(opts, "rav1e-params", buffer, 0);
}
- else if (strcmp(codec->name, "libsvtav1") == 0) {
+ else if (STREQ(codec->name, "libsvtav1")) {
/* Set preset value based on ffmpeg_preset.
* Must check context->ffmpeg_preset again in case this encoder was selected due to the
* absence of another. */
@@ -552,7 +552,7 @@ static const AVCodec *get_av1_encoder(
ffmpeg_dict_set_int(opts, "qp", context->ffmpeg_crf);
}
}
- else if (strcmp(codec->name, "libaom-av1") == 0) {
+ else if (STREQ(codec->name, "libaom-av1")) {
/* Speed up libaom-av1 encoding by enabling multithreading and setting tiles. */
ffmpeg_dict_set_int(opts, "row-mt", 1);
const char *tiles_string = NULL;
@@ -944,23 +944,23 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
c->sample_rate = rd->ffcodecdata.audio_mixrate;
c->bit_rate = context->ffmpeg_audio_bitrate * 1000;
c->sample_fmt = AV_SAMPLE_FMT_S16;
- c->channels = rd->ffcodecdata.audio_channels;
+ c->ch_layout.nb_channels = rd->ffcodecdata.audio_channels;
switch (rd->ffcodecdata.audio_channels) {
case FFM_CHANNELS_MONO:
- c->channel_layout = AV_CH_LAYOUT_MONO;
+ av_channel_layout_from_mask(&c->ch_layout, AV_CH_LAYOUT_MONO);
break;
case FFM_CHANNELS_STEREO:
- c->channel_layout = AV_CH_LAYOUT_STEREO;
+ av_channel_layout_from_mask(&c->ch_layout, AV_CH_LAYOUT_STEREO);
break;
case FFM_CHANNELS_SURROUND4:
- c->channel_layout = AV_CH_LAYOUT_QUAD;
+ av_channel_layout_from_mask(&c->ch_layout, AV_CH_LAYOUT_QUAD);
break;
case FFM_CHANNELS_SURROUND51:
- c->channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
+ av_channel_layout_from_mask(&c->ch_layout, AV_CH_LAYOUT_5POINT1_BACK);
break;
case FFM_CHANNELS_SURROUND71:
- c->channel_layout = AV_CH_LAYOUT_7POINT1;
+ av_channel_layout_from_mask(&c->ch_layout, AV_CH_LAYOUT_7POINT1);
break;
}
@@ -1017,7 +1017,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
return NULL;
}
- /* need to prevent floating point exception when using vorbis audio codec,
+ /* Need to prevent floating point exception when using VORBIS audio codec,
* initialize this value in the same way as it's done in FFmpeg itself (sergey) */
c->time_base.num = 1;
c->time_base.den = c->sample_rate;
@@ -1027,7 +1027,7 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
* not sure if that is needed anymore, so let's try out if there are any
* complaints regarding some FFmpeg versions users might have. */
context->audio_input_samples = AV_INPUT_BUFFER_MIN_SIZE * 8 / c->bits_per_coded_sample /
- c->channels;
+ c->ch_layout.nb_channels;
}
else {
context->audio_input_samples = c->frame_size;
@@ -1037,11 +1037,11 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
context->audio_sample_size = av_get_bytes_per_sample(c->sample_fmt);
- context->audio_input_buffer = (uint8_t *)av_malloc(context->audio_input_samples * c->channels *
- context->audio_sample_size);
+ context->audio_input_buffer = (uint8_t *)av_malloc(
+ context->audio_input_samples * c->ch_layout.nb_channels * context->audio_sample_size);
if (context->audio_deinterleave) {
context->audio_deinterleave_buffer = (uint8_t *)av_malloc(
- context->audio_input_samples * c->channels * context->audio_sample_size);
+ context->audio_input_samples * c->ch_layout.nb_channels * context->audio_sample_size);
}
context->audio_time = 0.0f;
@@ -1432,7 +1432,7 @@ int BKE_ffmpeg_start(void *context_v,
AVCodecContext *c = context->audio_codec;
AUD_DeviceSpecs specs;
- specs.channels = c->channels;
+ specs.channels = c->ch_layout.nb_channels;
switch (av_get_packed_sample_fmt(c->sample_fmt)) {
case AV_SAMPLE_FMT_U8:
diff --git a/source/blender/blenlib/BLI_color_mix.hh b/source/blender/blenlib/BLI_color_mix.hh
index 322da2bf112..55989669f70 100644
--- a/source/blender/blenlib/BLI_color_mix.hh
+++ b/source/blender/blenlib/BLI_color_mix.hh
@@ -76,7 +76,7 @@ struct FloatTraits {
static inline BlendType max(BlendType a, BlendType b)
{
- return min_ff(a, b);
+ return max_ff(a, b);
}
/* Discretizes in steps of 1.0 / range */
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 7e1b7c2ba56..538474f58b6 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -624,7 +624,7 @@ void BLI_space_transform_apply_normal(const struct SpaceTransform *data, float n
void BLI_space_transform_invert_normal(const struct SpaceTransform *data, float no[3]);
#define BLI_SPACE_TRANSFORM_SETUP(data, local, target) \
- BLI_space_transform_from_matrices((data), (local)->obmat, (target)->obmat)
+ BLI_space_transform_from_matrices((data), (local)->object_to_world, (target)->object_to_world)
/** \} */
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index d4d2ddead71..4ea059391b6 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -68,8 +68,15 @@ const char *BLI_path_extension(const char *filepath) ATTR_NONNULL();
/**
* Append a filename to a dir, ensuring slash separates.
+ * \return The new length of `dst`.
*/
-void BLI_path_append(char *__restrict dst, size_t maxlen, const char *__restrict file)
+size_t BLI_path_append(char *__restrict dst, size_t maxlen, const char *__restrict file)
+ ATTR_NONNULL();
+/**
+ * A version of #BLI_path_append that ensures a trailing slash if there is space in `dst`.
+ * \return The new length of `dst`.
+ */
+size_t BLI_path_append_dir(char *__restrict dst, size_t maxlen, const char *__restrict dir)
ATTR_NONNULL();
/**
@@ -195,7 +202,10 @@ const char *BLI_path_basename(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_
* - 1 or -2: `path`
* - 2 or -1: `file.txt`
*
- * Ignores multiple slashes at any point in the path (including start/end).
+ * Ignored elements in the path:
+ * - Multiple slashes at any point in the path (including start/end).
+ * - Single '.' in the path: `/./` except for the beginning of the path
+ * where it's used to signify a $PWD relative path.
*/
bool BLI_path_name_at_index(const char *__restrict path,
int index,
@@ -218,7 +228,7 @@ const char *BLI_path_slash_rfind(const char *string) ATTR_NONNULL() ATTR_WARN_UN
* Appends a slash to string if there isn't one there already.
* Returns the new length of the string.
*/
-int BLI_path_slash_ensure(char *string) ATTR_NONNULL();
+int BLI_path_slash_ensure(char *string, size_t string_maxlen) ATTR_NONNULL(1);
/**
* Removes the last slash and everything after it to the end of string, if there is one.
*/
@@ -314,7 +324,7 @@ void BLI_path_normalize(const char *relabase, char *path) ATTR_NONNULL(2);
*
* \note Same as #BLI_path_normalize but adds a trailing slash.
*/
-void BLI_path_normalize_dir(const char *relabase, char *dir) ATTR_NONNULL(2);
+void BLI_path_normalize_dir(const char *relabase, char *dir, size_t dir_maxlen) ATTR_NONNULL(2);
/**
* Make given name safe to be used in paths.
@@ -357,6 +367,8 @@ bool BLI_path_make_safe(char *path) ATTR_NONNULL(1);
*
* Replaces path with the path of its parent directory, returning true if
* it was able to find a parent directory within the path.
+ *
+ * On success, the resulting path will always have a trailing slash.
*/
bool BLI_path_parent_dir(char *path) ATTR_NONNULL();
/**
diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h
index df82e94ae2e..936e892a9e2 100644
--- a/source/blender/blenlib/BLI_string_utils.h
+++ b/source/blender/blenlib/BLI_string_utils.h
@@ -48,33 +48,6 @@ void BLI_string_split_suffix(const char *string, char *r_body, char *r_suf, size
void BLI_string_split_prefix(const char *string, char *r_pre, char *r_body, size_t str_len);
/**
- * Join strings, return newly allocated string.
- */
-char *BLI_string_join_array(char *result,
- size_t result_len,
- const char *strings[],
- uint strings_len) ATTR_NONNULL();
-/**
- * A version of #BLI_string_join that takes a separator which can be any character including '\0'.
- */
-char *BLI_string_join_array_by_sep_char(char *result,
- size_t result_len,
- char sep,
- const char *strings[],
- uint strings_len) ATTR_NONNULL();
-
-/**
- * Join an array of strings into a newly allocated, null terminated string.
- */
-char *BLI_string_join_arrayN(const char *strings[], uint strings_len) ATTR_WARN_UNUSED_RESULT
- ATTR_NONNULL();
-/**
- * A version of #BLI_string_joinN that takes a separator which can be any character including '\0'.
- */
-char *BLI_string_join_array_by_sep_charN(char sep,
- const char *strings[],
- uint strings_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-/**
* A version of #BLI_string_join_array_by_sep_charN that takes a table array.
* The new location of each string is written into this array.
*/
@@ -82,17 +55,7 @@ char *BLI_string_join_array_by_sep_char_with_tableN(char sep,
char *table[],
const char *strings[],
uint strings_len) ATTR_NONNULL();
-/**
- * Take multiple arguments, pass as (array, length).
- */
-#define BLI_string_join(result, result_len, ...) \
- BLI_string_join_array( \
- result, result_len, ((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
-#define BLI_string_joinN(...) \
- BLI_string_join_arrayN(((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
-#define BLI_string_join_by_sep_charN(sep, ...) \
- BLI_string_join_array_by_sep_charN( \
- sep, ((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
+
#define BLI_string_join_by_sep_char_with_tableN(sep, table, ...) \
BLI_string_join_array_by_sep_char_with_tableN( \
sep, table, ((const char *[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__))
@@ -149,6 +112,360 @@ bool BLI_uniquename(struct ListBase *list,
int name_offset,
size_t name_len);
+/* Expand array functions. */
+
+/* Intentionally no comma after `_BLI_STRING_ARGS_0` to allow it to be empty. */
+#define _BLI_STRING_ARGS_1 _BLI_STRING_ARGS_0 const char *a
+#define _BLI_STRING_ARGS_2 _BLI_STRING_ARGS_1, const char *b
+#define _BLI_STRING_ARGS_3 _BLI_STRING_ARGS_2, const char *c
+#define _BLI_STRING_ARGS_4 _BLI_STRING_ARGS_3, const char *d
+#define _BLI_STRING_ARGS_5 _BLI_STRING_ARGS_4, const char *e
+#define _BLI_STRING_ARGS_6 _BLI_STRING_ARGS_5, const char *f
+#define _BLI_STRING_ARGS_7 _BLI_STRING_ARGS_6, const char *g
+#define _BLI_STRING_ARGS_8 _BLI_STRING_ARGS_7, const char *h
+#define _BLI_STRING_ARGS_9 _BLI_STRING_ARGS_8, const char *i
+#define _BLI_STRING_ARGS_10 _BLI_STRING_ARGS_9, const char *j
+
+/* ------------------------------------------------------------------------- */
+/** \name Implement: `BLI_string_join(..)`
+ * \{ */
+
+#define _BLI_STRING_ARGS_0 char *__restrict dst, const size_t dst_len,
+
+/**
+ * Join strings, return the length of the resulting string.
+ */
+size_t BLI_string_join_array(char *result,
+ size_t result_len,
+ const char *strings[],
+ uint strings_len) ATTR_NONNULL();
+
+#define BLI_string_join(...) VA_NARGS_CALL_OVERLOAD(_BLI_string_join_, __VA_ARGS__)
+
+BLI_INLINE size_t _BLI_string_join_3(_BLI_STRING_ARGS_1) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_4(_BLI_STRING_ARGS_2) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_5(_BLI_STRING_ARGS_3) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_6(_BLI_STRING_ARGS_4) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_7(_BLI_STRING_ARGS_5) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_8(_BLI_STRING_ARGS_6) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_9(_BLI_STRING_ARGS_7) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_10(_BLI_STRING_ARGS_8) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_11(_BLI_STRING_ARGS_9) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_12(_BLI_STRING_ARGS_10) ATTR_NONNULL();
+
+BLI_INLINE size_t _BLI_string_join_3(_BLI_STRING_ARGS_1)
+{
+ const char *string_array[] = {a};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_4(_BLI_STRING_ARGS_2)
+{
+ const char *string_array[] = {a, b};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_5(_BLI_STRING_ARGS_3)
+{
+ const char *string_array[] = {a, b, c};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_6(_BLI_STRING_ARGS_4)
+{
+ const char *string_array[] = {a, b, c, d};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_7(_BLI_STRING_ARGS_5)
+{
+ const char *string_array[] = {a, b, c, d, e};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_8(_BLI_STRING_ARGS_6)
+{
+ const char *string_array[] = {a, b, c, d, e, f};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_9(_BLI_STRING_ARGS_7)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_10(_BLI_STRING_ARGS_8)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_11(_BLI_STRING_ARGS_9)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_12(_BLI_STRING_ARGS_10)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i, j};
+ return BLI_string_join_array(dst, dst_len, string_array, ARRAY_SIZE(string_array));
+}
+
+#undef _BLI_STRING_ARGS_0
+
+/** \} */
+
+/* ------------------------------------------------------------------------- */
+/** \name Implement: `BLI_string_joinN(..)`
+ * \{ */
+
+/**
+ * Join an array of strings into a newly allocated, null terminated string.
+ */
+char *BLI_string_join_arrayN(const char *strings[], uint strings_len) ATTR_WARN_UNUSED_RESULT
+ ATTR_NONNULL();
+
+#define BLI_string_joinN(...) VA_NARGS_CALL_OVERLOAD(_BLI_string_joinN_, __VA_ARGS__)
+
+#define _BLI_STRING_ARGS_0
+
+BLI_INLINE char *_BLI_string_joinN_1(_BLI_STRING_ARGS_1) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_2(_BLI_STRING_ARGS_2) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_3(_BLI_STRING_ARGS_3) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_4(_BLI_STRING_ARGS_4) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_5(_BLI_STRING_ARGS_5) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_6(_BLI_STRING_ARGS_6) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_7(_BLI_STRING_ARGS_7) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_8(_BLI_STRING_ARGS_8) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_9(_BLI_STRING_ARGS_9) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_joinN_10(_BLI_STRING_ARGS_10) ATTR_NONNULL();
+
+BLI_INLINE char *_BLI_string_joinN_1(_BLI_STRING_ARGS_1)
+{
+ const char *string_array[] = {a};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_2(_BLI_STRING_ARGS_2)
+{
+ const char *string_array[] = {a, b};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_3(_BLI_STRING_ARGS_3)
+{
+ const char *string_array[] = {a, b, c};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_4(_BLI_STRING_ARGS_4)
+{
+ const char *string_array[] = {a, b, c, d};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_5(_BLI_STRING_ARGS_5)
+{
+ const char *string_array[] = {a, b, c, d, e};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_6(_BLI_STRING_ARGS_6)
+{
+ const char *string_array[] = {a, b, c, d, e, f};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_7(_BLI_STRING_ARGS_7)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_8(_BLI_STRING_ARGS_8)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_9(_BLI_STRING_ARGS_9)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_joinN_10(_BLI_STRING_ARGS_10)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i, j};
+ return BLI_string_join_arrayN(string_array, ARRAY_SIZE(string_array));
+}
+
+#undef _BLI_STRING_ARGS_0
+
+/** \} */
+
+/* ------------------------------------------------------------------------- */
+/** \name Implement: `BLI_string_join_by_sep_char(..)`
+ * \{ */
+
+/**
+ * A version of #BLI_string_join_array that takes a separator which can be any character
+ * including '\0'.
+ */
+size_t BLI_string_join_array_by_sep_char(char *result,
+ size_t result_len,
+ char sep,
+ const char *strings[],
+ uint strings_len) ATTR_NONNULL();
+
+#define BLI_string_join_by_sep_char(...) \
+ VA_NARGS_CALL_OVERLOAD(_BLI_string_join_by_sep_char_, __VA_ARGS__)
+
+#define _BLI_STRING_ARGS_0 char *__restrict dst, const size_t dst_len, const char sep,
+
+BLI_INLINE size_t _BLI_string_join_by_sep_char_4(_BLI_STRING_ARGS_1) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_5(_BLI_STRING_ARGS_2) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_6(_BLI_STRING_ARGS_3) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_7(_BLI_STRING_ARGS_4) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_8(_BLI_STRING_ARGS_5) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_9(_BLI_STRING_ARGS_6) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_10(_BLI_STRING_ARGS_7) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_11(_BLI_STRING_ARGS_8) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_12(_BLI_STRING_ARGS_9) ATTR_NONNULL();
+BLI_INLINE size_t _BLI_string_join_by_sep_char_13(_BLI_STRING_ARGS_10) ATTR_NONNULL();
+
+BLI_INLINE size_t _BLI_string_join_by_sep_char_4(_BLI_STRING_ARGS_1)
+{
+ const char *string_array[] = {a};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_5(_BLI_STRING_ARGS_2)
+{
+ const char *string_array[] = {a, b};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_6(_BLI_STRING_ARGS_3)
+{
+ const char *string_array[] = {a, b, c};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_7(_BLI_STRING_ARGS_4)
+{
+ const char *string_array[] = {a, b, c, d};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_8(_BLI_STRING_ARGS_5)
+{
+ const char *string_array[] = {a, b, c, d, e};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_9(_BLI_STRING_ARGS_6)
+{
+ const char *string_array[] = {a, b, c, d, e, f};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_10(_BLI_STRING_ARGS_7)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_11(_BLI_STRING_ARGS_8)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_12(_BLI_STRING_ARGS_9)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE size_t _BLI_string_join_by_sep_char_13(_BLI_STRING_ARGS_10)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i, j};
+ return BLI_string_join_array_by_sep_char(
+ dst, dst_len, sep, string_array, ARRAY_SIZE(string_array));
+}
+
+#undef _BLI_STRING_ARGS_0
+
+/** \} */
+
+/* ------------------------------------------------------------------------- */
+/** \name Implement: `BLI_string_join_by_sep_charN(..)`
+ * \{ */
+
+/**
+ * A version of #BLI_string_join_by_sep_char that takes a separator which can be any character
+ * including '\0'.
+ */
+char *BLI_string_join_array_by_sep_charN(char sep,
+ const char *strings[],
+ uint strings_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+
+#define BLI_string_join_by_sep_charN(...) \
+ VA_NARGS_CALL_OVERLOAD(_BLI_string_join_by_sep_charN_, __VA_ARGS__)
+
+#define _BLI_STRING_ARGS_0 const char sep,
+
+BLI_INLINE char *_BLI_string_join_by_sep_charN_2(_BLI_STRING_ARGS_1) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_3(_BLI_STRING_ARGS_2) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_4(_BLI_STRING_ARGS_3) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_5(_BLI_STRING_ARGS_4) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_6(_BLI_STRING_ARGS_5) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_7(_BLI_STRING_ARGS_6) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_8(_BLI_STRING_ARGS_7) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_9(_BLI_STRING_ARGS_8) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_10(_BLI_STRING_ARGS_9) ATTR_NONNULL();
+BLI_INLINE char *_BLI_string_join_by_sep_charN_11(_BLI_STRING_ARGS_10) ATTR_NONNULL();
+
+BLI_INLINE char *_BLI_string_join_by_sep_charN_2(_BLI_STRING_ARGS_1)
+{
+ const char *string_array[] = {a};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_3(_BLI_STRING_ARGS_2)
+{
+ const char *string_array[] = {a, b};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_4(_BLI_STRING_ARGS_3)
+{
+ const char *string_array[] = {a, b, c};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_5(_BLI_STRING_ARGS_4)
+{
+ const char *string_array[] = {a, b, c, d};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_6(_BLI_STRING_ARGS_5)
+{
+ const char *string_array[] = {a, b, c, d, e};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_7(_BLI_STRING_ARGS_6)
+{
+ const char *string_array[] = {a, b, c, d, e, f};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_8(_BLI_STRING_ARGS_7)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_9(_BLI_STRING_ARGS_8)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_10(_BLI_STRING_ARGS_9)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+BLI_INLINE char *_BLI_string_join_by_sep_charN_11(_BLI_STRING_ARGS_10)
+{
+ const char *string_array[] = {a, b, c, d, e, f, g, h, i, j};
+ return BLI_string_join_array_by_sep_charN(sep, string_array, ARRAY_SIZE(string_array));
+}
+
+/** \} */
+
+#undef _BLI_STRING_ARGS_0
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h
index 75f39de6b7f..a94fd796121 100644
--- a/source/blender/blenlib/BLI_uvproject.h
+++ b/source/blender/blenlib/BLI_uvproject.h
@@ -15,7 +15,7 @@ struct ProjCameraInfo;
/**
* Create UV info from the camera, needs to be freed.
*
- * \param rotmat: can be `obedit->obmat` when uv project is used.
+ * \param rotmat: can be `obedit->object_to_world` when uv project is used.
* \param winx, winy: can be from `scene->r.xsch / ysch`.
*/
struct ProjCameraInfo *BLI_uvproject_camera_info(struct Object *ob,
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index c8acae533bd..f5516bf344a 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -401,7 +401,7 @@ static bool delete_recursive(const char *dir)
/* dir listing produces dir path without trailing slash... */
BLI_strncpy(path, fl->path, sizeof(path));
- BLI_path_slash_ensure(path);
+ BLI_path_slash_ensure(path, sizeof(path));
if (delete_recursive(path)) {
err = true;
diff --git a/source/blender/blenlib/intern/kdtree_impl.h b/source/blender/blenlib/intern/kdtree_impl.h
index 6614f1bf964..f7993eb5adc 100644
--- a/source/blender/blenlib/intern/kdtree_impl.h
+++ b/source/blender/blenlib/intern/kdtree_impl.h
@@ -11,9 +11,9 @@
#include "BLI_strict_flags.h"
#include "BLI_utildefines.h"
-#define _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
-#define _CONCAT(MACRO_ARG1, MACRO_ARG2) _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
-#define BLI_kdtree_nd_(id) _CONCAT(KDTREE_PREFIX_ID, _##id)
+#define _BLI_KDTREE_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
+#define _BLI_KDTREE_CONCAT(MACRO_ARG1, MACRO_ARG2) _BLI_KDTREE_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
+#define BLI_kdtree_nd_(id) _BLI_KDTREE_CONCAT(KDTREE_PREFIX_ID, _##id)
typedef struct KDTreeNode_head {
uint left, right;
diff --git a/source/blender/blenlib/intern/list_sort_impl.h b/source/blender/blenlib/intern/list_sort_impl.h
index e1b93986f4a..7c38fc60b29 100644
--- a/source/blender/blenlib/intern/list_sort_impl.h
+++ b/source/blender/blenlib/intern/list_sort_impl.h
@@ -47,24 +47,25 @@
#endif
#ifdef SORT_IMPL_USE_THUNK
-# define THUNK_APPEND1(a, thunk) a, thunk
-# define THUNK_PREPEND2(thunk, a, b) thunk, a, b
+# define BLI_LIST_THUNK_APPEND1(a, thunk) a, thunk
+# define BLI_LIST_THUNK_PREPEND2(thunk, a, b) thunk, a, b
#else
-# define THUNK_APPEND1(a, thunk) a
-# define THUNK_PREPEND2(thunk, a, b) a, b
+# define BLI_LIST_THUNK_APPEND1(a, thunk) a
+# define BLI_LIST_THUNK_PREPEND2(thunk, a, b) a, b
#endif
-#define _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
-#define _CONCAT(MACRO_ARG1, MACRO_ARG2) _CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
-#define _SORT_PREFIX(id) _CONCAT(SORT_IMPL_FUNC, _##id)
+#define _BLI_LIST_SORT_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) MACRO_ARG1##MACRO_ARG2
+#define _BLI_LIST_SORT_CONCAT(MACRO_ARG1, MACRO_ARG2) \
+ _BLI_LIST_SORT_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2)
+#define _BLI_LIST_SORT_PREFIX(id) _BLI_LIST_SORT_CONCAT(SORT_IMPL_FUNC, _##id)
/* local identifiers */
-#define SortInfo _SORT_PREFIX(SortInfo)
-#define CompareFn _SORT_PREFIX(CompareFn)
-#define init_sort_info _SORT_PREFIX(init_sort_info)
-#define merge_lists _SORT_PREFIX(merge_lists)
-#define sweep_up _SORT_PREFIX(sweep_up)
-#define insert_list _SORT_PREFIX(insert_list)
+#define SortInfo _BLI_LIST_SORT_PREFIX(SortInfo)
+#define CompareFn _BLI_LIST_SORT_PREFIX(CompareFn)
+#define init_sort_info _BLI_LIST_SORT_PREFIX(init_sort_info)
+#define merge_lists _BLI_LIST_SORT_PREFIX(merge_lists)
+#define sweep_up _BLI_LIST_SORT_PREFIX(sweep_up)
+#define insert_list _BLI_LIST_SORT_PREFIX(insert_list)
typedef int (*CompareFn)(
#ifdef SORT_IMPL_USE_THUNK
@@ -159,7 +160,7 @@ BLI_INLINE list_node *merge_lists(list_node *first,
list_node *list = NULL;
list_node **pos = &list;
while (first && second) {
- if (func(THUNK_PREPEND2(thunk, SORT_ARG(first), SORT_ARG(second))) > 0) {
+ if (func(BLI_LIST_THUNK_PREPEND2(thunk, SORT_ARG(first), SORT_ARG(second))) > 0) {
*pos = second;
second = second->next;
}
@@ -181,7 +182,7 @@ BLI_INLINE list_node *sweep_up(struct SortInfo *si, list_node *list, unsigned in
{
unsigned int i;
for (i = si->min_rank; i < upto; i++) {
- list = merge_lists(si->ranks[i], list, THUNK_APPEND1(si->func, si->thunk));
+ list = merge_lists(si->ranks[i], list, BLI_LIST_THUNK_APPEND1(si->func, si->thunk));
si->ranks[i] = NULL;
}
return list;
@@ -225,17 +226,19 @@ BLI_INLINE void insert_list(struct SortInfo *si, list_node *list, unsigned int r
// printf("Rank '%d' should not exceed " STRINGIFY(MAX_RANKS), rank);
rank = MAX_RANKS;
}
- list = merge_lists(sweep_up(si, NULL, si->n_ranks), list, THUNK_APPEND1(si->func, si->thunk));
+ list = merge_lists(
+ sweep_up(si, NULL, si->n_ranks), list, BLI_LIST_THUNK_APPEND1(si->func, si->thunk));
for (i = si->n_ranks; i < rank; i++) {
si->ranks[i] = NULL;
}
}
else {
if (rank) {
- list = merge_lists(sweep_up(si, NULL, rank), list, THUNK_APPEND1(si->func, si->thunk));
+ list = merge_lists(
+ sweep_up(si, NULL, rank), list, BLI_LIST_THUNK_APPEND1(si->func, si->thunk));
}
for (i = rank; i < si->n_ranks && si->ranks[i]; i++) {
- list = merge_lists(si->ranks[i], list, THUNK_APPEND1(si->func, si->thunk));
+ list = merge_lists(si->ranks[i], list, BLI_LIST_THUNK_APPEND1(si->func, si->thunk));
si->ranks[i] = NULL;
}
}
@@ -281,7 +284,7 @@ BLI_INLINE list_node *list_sort_do(list_node *list,
list_node *next = list->next;
list_node *tail = next->next;
- if (func(THUNK_PREPEND2(thunk, SORT_ARG(list), SORT_ARG(next))) > 0) {
+ if (func(BLI_LIST_THUNK_PREPEND2(thunk, SORT_ARG(list), SORT_ARG(next))) > 0) {
next->next = list;
next = list;
list = list->next;
@@ -296,8 +299,8 @@ BLI_INLINE list_node *list_sort_do(list_node *list,
return sweep_up(&si, list, si.n_ranks);
}
-#undef _CONCAT_AUX
-#undef _CONCAT
+#undef _BLI_LIST_SORT_CONCAT_AUX
+#undef _BLI_LIST_SORT_CONCAT
#undef _SORT_PREFIX
#undef SortInfo
@@ -310,6 +313,6 @@ BLI_INLINE list_node *list_sort_do(list_node *list,
#undef list_node
#undef list_sort_do
-#undef THUNK_APPEND1
-#undef THUNK_PREPEND2
+#undef BLI_LIST_THUNK_APPEND1
+#undef BLI_LIST_THUNK_PREPEND2
#undef SORT_ARG
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index afe8c3cc033..d13f3fe5ced 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -153,6 +153,19 @@ void BLI_path_normalize(const char *relabase, char *path)
*/
#ifdef WIN32
+
+ while ((start = strstr(path, "\\.\\"))) {
+ eind = start + strlen("\\.\\") - 1;
+ memmove(start, eind, strlen(eind) + 1);
+ }
+
+ /* remove two consecutive backslashes, but skip the UNC prefix,
+ * which needs to be preserved */
+ while ((start = strstr(path + BLI_path_unc_prefix_len(path), "\\\\"))) {
+ eind = start + strlen("\\\\") - 1;
+ memmove(start, eind, strlen(eind) + 1);
+ }
+
while ((start = strstr(path, "\\..\\"))) {
eind = start + strlen("\\..\\") - 1;
a = start - path - 1;
@@ -170,18 +183,18 @@ void BLI_path_normalize(const char *relabase, char *path)
}
}
- while ((start = strstr(path, "\\.\\"))) {
- eind = start + strlen("\\.\\") - 1;
+#else
+
+ while ((start = strstr(path, "/./"))) {
+ eind = start + (3 - 1) /* strlen("/./") - 1 */;
memmove(start, eind, strlen(eind) + 1);
}
- /* remove two consecutive backslashes, but skip the UNC prefix,
- * which needs to be preserved */
- while ((start = strstr(path + BLI_path_unc_prefix_len(path), "\\\\"))) {
- eind = start + strlen("\\\\") - 1;
+ while ((start = strstr(path, "//"))) {
+ eind = start + (2 - 1) /* strlen("//") - 1 */;
memmove(start, eind, strlen(eind) + 1);
}
-#else
+
while ((start = strstr(path, "/../"))) {
a = start - path - 1;
if (a > 0) {
@@ -206,19 +219,10 @@ void BLI_path_normalize(const char *relabase, char *path)
}
}
- while ((start = strstr(path, "/./"))) {
- eind = start + (3 - 1) /* strlen("/./") - 1 */;
- memmove(start, eind, strlen(eind) + 1);
- }
-
- while ((start = strstr(path, "//"))) {
- eind = start + (2 - 1) /* strlen("//") - 1 */;
- memmove(start, eind, strlen(eind) + 1);
- }
#endif
}
-void BLI_path_normalize_dir(const char *relabase, char *dir)
+void BLI_path_normalize_dir(const char *relabase, char *dir, size_t dir_maxlen)
{
/* Would just create an unexpected "/" path, just early exit entirely. */
if (dir[0] == '\0') {
@@ -226,7 +230,7 @@ void BLI_path_normalize_dir(const char *relabase, char *dir)
}
BLI_path_normalize(relabase, dir);
- BLI_path_slash_ensure(dir);
+ BLI_path_slash_ensure(dir, dir_maxlen);
}
bool BLI_filename_make_safe_ex(char *fname, bool allow_tokens)
@@ -622,18 +626,28 @@ bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char
bool BLI_path_parent_dir(char *path)
{
- const char parent_dir[] = {'.', '.', SEP, '\0'}; /* "../" or "..\\" */
- char tmp[FILE_MAX + 4];
-
- BLI_path_join(tmp, sizeof(tmp), path, parent_dir);
- BLI_path_normalize(NULL, tmp); /* does all the work of normalizing the path for us */
-
- if (!BLI_path_extension_check(tmp, parent_dir)) {
- strcpy(path, tmp); /* We assume the parent directory is always shorter. */
- return true;
+ /* Use #BLI_path_name_at_index instead of checking if the strings ends with `parent_dir`
+ * to ensure the logic isn't confused by:
+ * - Directory names that happen to end with `..`.
+ * - When `path` is empty, the contents will be `../`
+ * which would cause checking for a tailing `/../` fail.
+ * Extracting the span of the final directory avoids both these issues. */
+ int tail_ofs = 0, tail_len = 0;
+ if (!BLI_path_name_at_index(path, -1, &tail_ofs, &tail_len)) {
+ return false;
+ }
+ if (tail_len == 1) {
+ /* Last path is ".", as normalize should remove this, it's safe to assume failure.
+ * This happens when the input a single period (possibly with slashes before or after). */
+ if (path[tail_ofs] == '.') {
+ return false;
+ }
}
- return false;
+ /* Input paths should already be normalized if `..` is part of the path. */
+ BLI_assert(!((tail_len == 2) && (path[tail_ofs] == '.') && (path[tail_ofs + 1] == '.')));
+ path[tail_ofs] = '\0';
+ return true;
}
bool BLI_path_parent_dir_until_exists(char *dir)
@@ -1431,21 +1445,34 @@ const char *BLI_path_extension(const char *filepath)
return extension;
}
-void BLI_path_append(char *__restrict dst, const size_t maxlen, const char *__restrict file)
+size_t BLI_path_append(char *__restrict dst, const size_t maxlen, const char *__restrict file)
{
size_t dirlen = BLI_strnlen(dst, maxlen);
- /* inline BLI_path_slash_ensure */
+ /* Inline #BLI_path_slash_ensure. */
if ((dirlen > 0) && (dst[dirlen - 1] != SEP)) {
dst[dirlen++] = SEP;
dst[dirlen] = '\0';
}
if (dirlen >= maxlen) {
- return; /* fills the path */
+ return dirlen; /* fills the path */
}
- BLI_strncpy(dst + dirlen, file, maxlen - dirlen);
+ return dirlen + BLI_strncpy_rlen(dst + dirlen, file, maxlen - dirlen);
+}
+
+size_t BLI_path_append_dir(char *__restrict dst, const size_t maxlen, const char *__restrict dir)
+{
+ size_t dirlen = BLI_path_append(dst, maxlen, dir);
+ if (dirlen + 1 < maxlen) {
+ /* Inline #BLI_path_slash_ensure. */
+ if ((dirlen > 0) && (dst[dirlen - 1] != SEP)) {
+ dst[dirlen++] = SEP;
+ dst[dirlen] = '\0';
+ }
+ }
+ return dirlen;
}
size_t BLI_path_join_array(char *__restrict dst,
@@ -1469,14 +1496,36 @@ size_t BLI_path_join_array(char *__restrict dst,
return ofs;
}
+#ifdef WIN32
+ /* Special case "//" for relative paths, don't use separator #SEP
+ * as this has a special meaning on both WIN32 & UNIX.
+ * Without this check joining `"//", "path"`. results in `"//\path"`. */
+ if (ofs != 0) {
+ size_t i;
+ for (i = 0; i < ofs; i++) {
+ if (dst[i] != '/') {
+ break;
+ }
+ }
+ if (i == ofs) {
+ /* All slashes, keep them as-is, and join the remaining path array. */
+ return path_array_num > 1 ?
+ BLI_path_join_array(
+ dst + ofs, dst_len - ofs, &path_array[1], path_array_num - 1) :
+ ofs;
+ }
+ }
+#endif
+
/* Remove trailing slashes, unless there are *only* trailing slashes
* (allow `//` or `//some_path` as the first argument). */
bool has_trailing_slash = false;
if (ofs != 0) {
size_t len = ofs;
- while ((len != 0) && ELEM(path[len - 1], SEP, ALTSEP)) {
+ while ((len != 0) && (path[len - 1] == SEP)) {
len -= 1;
}
+
if (len != 0) {
ofs = len;
}
@@ -1487,18 +1536,18 @@ size_t BLI_path_join_array(char *__restrict dst,
path = path_array[path_index];
has_trailing_slash = false;
const char *path_init = path;
- while (ELEM(path[0], SEP, ALTSEP)) {
+ while (path[0] == SEP) {
path++;
}
size_t len = strlen(path);
if (len != 0) {
- while ((len != 0) && ELEM(path[len - 1], SEP, ALTSEP)) {
+ while ((len != 0) && (path[len - 1] == SEP)) {
len -= 1;
}
if (len != 0) {
/* the very first path may have a slash at the end */
- if (ofs && !ELEM(dst[ofs - 1], SEP, ALTSEP)) {
+ if (ofs && (dst[ofs - 1] != SEP)) {
dst[ofs++] = SEP;
if (ofs == dst_last) {
break;
@@ -1521,7 +1570,7 @@ size_t BLI_path_join_array(char *__restrict dst,
}
if (has_trailing_slash) {
- if ((ofs != dst_last) && (ofs != 0) && (ELEM(dst[ofs - 1], SEP, ALTSEP) == 0)) {
+ if ((ofs != dst_last) && (ofs != 0) && (dst[ofs - 1] != SEP)) {
dst[ofs++] = SEP;
}
}
@@ -1538,53 +1587,64 @@ const char *BLI_path_basename(const char *path)
return filename ? filename + 1 : path;
}
-bool BLI_path_name_at_index(const char *__restrict path,
- const int index,
- int *__restrict r_offset,
- int *__restrict r_len)
+static bool path_name_at_index_forward(const char *__restrict path,
+ const int index,
+ int *__restrict r_offset,
+ int *__restrict r_len)
{
- if (index >= 0) {
- int index_step = 0;
- int prev = -1;
- int i = 0;
- while (true) {
- const char c = path[i];
- if (ELEM(c, SEP, ALTSEP, '\0')) {
- if (prev + 1 != i) {
- prev += 1;
+ BLI_assert(index >= 0);
+ int index_step = 0;
+ int prev = -1;
+ int i = 0;
+ while (true) {
+ const char c = path[i];
+ if (ELEM(c, SEP, '\0')) {
+ if (prev + 1 != i) {
+ prev += 1;
+ /* Skip '/./' (behave as if they don't exist). */
+ if (!((i - prev == 1) && (prev != 0) && (path[prev] == '.'))) {
if (index_step == index) {
*r_offset = prev;
*r_len = i - prev;
- // printf("!!! %d %d\n", start, end);
return true;
}
index_step += 1;
}
- if (c == '\0') {
- break;
- }
- prev = i;
}
- i += 1;
+ if (c == '\0') {
+ break;
+ }
+ prev = i;
}
- return false;
+ i += 1;
}
+ return false;
+}
- /* negative number, reverse where -1 is the last element */
+static bool path_name_at_index_backward(const char *__restrict path,
+ const int index,
+ int *__restrict r_offset,
+ int *__restrict r_len)
+{
+ /* Negative number, reverse where -1 is the last element. */
+ BLI_assert(index < 0);
int index_step = -1;
int prev = strlen(path);
int i = prev - 1;
while (true) {
const char c = i >= 0 ? path[i] : '\0';
- if (ELEM(c, SEP, ALTSEP, '\0')) {
+ if (ELEM(c, SEP, '\0')) {
if (prev - 1 != i) {
i += 1;
- if (index_step == index) {
- *r_offset = i;
- *r_len = prev - i;
- return true;
+ /* Skip '/./' (behave as if they don't exist). */
+ if (!((prev - i == 1) && (i != 0) && (path[i] == '.'))) {
+ if (index_step == index) {
+ *r_offset = i;
+ *r_len = prev - i;
+ return true;
+ }
+ index_step -= 1;
}
- index_step -= 1;
}
if (c == '\0') {
break;
@@ -1596,6 +1656,15 @@ bool BLI_path_name_at_index(const char *__restrict path,
return false;
}
+bool BLI_path_name_at_index(const char *__restrict path,
+ const int index,
+ int *__restrict r_offset,
+ int *__restrict r_len)
+{
+ return (index >= 0) ? path_name_at_index_forward(path, index, r_offset, r_len) :
+ path_name_at_index_backward(path, index, r_offset, r_len);
+}
+
bool BLI_path_contains(const char *container_path, const char *containee_path)
{
char container_native[PATH_MAX];
@@ -1624,7 +1693,7 @@ bool BLI_path_contains(const char *container_path, const char *containee_path)
/* Add a trailing slash to prevent same-prefix directories from matching.
* e.g. "/some/path" doesn't contain "/some/path_lib". */
- BLI_path_slash_ensure(container_native);
+ BLI_path_slash_ensure(container_native, sizeof(container_native));
return BLI_str_startswith(containee_native, container_native);
}
@@ -1659,13 +1728,17 @@ const char *BLI_path_slash_rfind(const char *string)
return (lfslash > lbslash) ? lfslash : lbslash;
}
-int BLI_path_slash_ensure(char *string)
+int BLI_path_slash_ensure(char *string, size_t string_maxlen)
{
int len = strlen(string);
+ BLI_assert(len < string_maxlen);
if (len == 0 || string[len - 1] != SEP) {
- string[len] = SEP;
- string[len + 1] = '\0';
- return len + 1;
+ /* Avoid unlikely buffer overflow. */
+ if (len + 1 < string_maxlen) {
+ string[len] = SEP;
+ string[len + 1] = '\0';
+ return len + 1;
+ }
}
return len;
}
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c
index 0b9baaff3e9..27734d2f429 100644
--- a/source/blender/blenlib/intern/string_utils.c
+++ b/source/blender/blenlib/intern/string_utils.c
@@ -344,10 +344,10 @@ bool BLI_uniquename(
*
* \{ */
-char *BLI_string_join_array(char *result,
- size_t result_len,
- const char *strings[],
- uint strings_len)
+size_t BLI_string_join_array(char *result,
+ size_t result_len,
+ const char *strings[],
+ uint strings_len)
{
char *c = result;
char *c_end = &result[result_len - 1];
@@ -358,10 +358,10 @@ char *BLI_string_join_array(char *result,
}
}
*c = '\0';
- return c;
+ return (size_t)(c - result);
}
-char *BLI_string_join_array_by_sep_char(
+size_t BLI_string_join_array_by_sep_char(
char *result, size_t result_len, char sep, const char *strings[], uint strings_len)
{
char *c = result;
@@ -378,7 +378,7 @@ char *BLI_string_join_array_by_sep_char(
}
}
*c = '\0';
- return c;
+ return (size_t)(c - result);
}
char *BLI_string_join_arrayN(const char *strings[], uint strings_len)
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index 347166bd57d..0398bf0b3fe 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -129,7 +129,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float rotmat[4][4], float
uci.camsize = uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
/* account for scaled cameras */
- copy_m4_m4(uci.caminv, ob->obmat);
+ copy_m4_m4(uci.caminv, ob->object_to_world);
normalize_m4(uci.caminv);
if (invert_m4(uci.caminv)) {
diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc
index 89e537235db..9d5422d62ff 100644
--- a/source/blender/blenlib/tests/BLI_path_util_test.cc
+++ b/source/blender/blenlib/tests/BLI_path_util_test.cc
@@ -9,69 +9,166 @@
#include "BLI_string.h"
/* -------------------------------------------------------------------- */
-/* tests */
+/** \name Local Utilities
+ * \{ */
-/* BLI_path_normalize */
-#ifndef _WIN32
-TEST(path_util, Clean)
+static void str_replace_char_with_relative_exception(char *str, char src, char dst)
{
- /* "/./" -> "/" */
- {
- char path[FILE_MAX] = "/a/./b/./c/./";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("/a/b/c/", path);
+ /* Always keep "//" or more leading slashes (special meaning). */
+ if (src == '/') {
+ if (str[0] == '/' && str[1] == '/') {
+ str += 2;
+ while (*str == '/') {
+ str++;
+ }
+ }
}
+ BLI_str_replace_char(str, src, dst);
+}
- {
- char path[FILE_MAX] = "/./././";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("/", path);
+static char *str_replace_char_strdup(const char *str, char src, char dst)
+{
+ if (str == nullptr) {
+ return nullptr;
}
+ char *str_dupe = strdup(str);
+ BLI_str_replace_char(str_dupe, src, dst);
+ return str_dupe;
+}
- {
- char path[FILE_MAX] = "/a/./././b/";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("/a/b/", path);
- }
+/** \} */
- /* "//" -> "/" */
- {
- char path[FILE_MAX] = "a////";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("a/", path);
- }
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_normalize
+ * \{ */
- if (false) /* FIXME */
- {
- char path[FILE_MAX] = "./a////";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("./a/", path);
- }
+#define NORMALIZE_WITH_BASEDIR(input, input_base, output) \
+ { \
+ char path[FILE_MAX] = input; \
+ const char *input_base_test = input_base; \
+ if (SEP == '\\') { \
+ str_replace_char_with_relative_exception(path, '/', '\\'); \
+ input_base_test = str_replace_char_strdup(input_base_test, '/', '\\'); \
+ } \
+ BLI_path_normalize(input_base_test, path); \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '\\', '/'); \
+ if (input_base_test) { \
+ free((void *)input_base_test); \
+ } \
+ } \
+ EXPECT_STREQ(output, path); \
+ } \
+ ((void)0)
- /* "foo/bar/../" -> "foo/" */
- {
- char path[FILE_MAX] = "/a/b/c/../../../";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("/", path);
- }
+#define NORMALIZE(input, output) NORMALIZE_WITH_BASEDIR(input, nullptr, output)
- {
- char path[FILE_MAX] = "/a/../a/b/../b/c/../c/";
- BLI_path_normalize(nullptr, path);
- EXPECT_STREQ("/a/b/c/", path);
- }
+/* #BLI_path_normalize: "/./" -> "/" */
+TEST(path_util, Clean_Dot)
+{
+ NORMALIZE("/./", "/");
+ NORMALIZE("/a/./b/./c/./", "/a/b/c/");
+ NORMALIZE("/./././", "/");
+ NORMALIZE("/a/./././b/", "/a/b/");
+}
+/* #BLI_path_normalize: complex "/./" -> "/", "//" -> "/", "./path/../" -> "./". */
+TEST(path_util, Clean_Complex)
+{
+ NORMALIZE("/a/./b/./c/./.././.././", "/a/");
+ NORMALIZE("/a//.//b//.//c//.//..//.//..//.//", "/a/");
+}
+/* #BLI_path_normalize: "//" -> "/" */
+TEST(path_util, Clean_DoubleSlash)
+{
+ NORMALIZE("//", "//"); /* Exception, double forward slash. */
+ NORMALIZE(".//", "./");
+ NORMALIZE("a////", "a/");
+ NORMALIZE("./a////", "./a/");
+}
+/* #BLI_path_normalize: "foo/bar/../" -> "foo/" */
+TEST(path_util, Clean_Parent)
+{
+ NORMALIZE("/a/b/c/../../../", "/");
+ NORMALIZE("/a/../a/b/../b/c/../c/", "/a/b/c/");
+ NORMALIZE_WITH_BASEDIR("//../", "/a/b/c/", "/a/b/");
+}
- {
- char path[FILE_MAX] = "//../";
- BLI_path_normalize("/a/b/c/", path);
- EXPECT_STREQ("/a/b/", path);
- }
+#undef NORMALIZE_WITH_BASEDIR
+#undef NORMALIZE
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_parent_dir
+ * \{ */
+
+#define PARENT_DIR(input, output) \
+ { \
+ char path[FILE_MAX] = input; \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '/', '\\'); \
+ } \
+ BLI_path_parent_dir(path); \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '\\', '/'); \
+ } \
+ EXPECT_STREQ(output, path); \
+ } \
+ ((void)0)
+
+TEST(path_util, ParentDir_Simple)
+{
+ PARENT_DIR("/a/b/", "/a/");
+ PARENT_DIR("/a/b", "/a/");
+ PARENT_DIR("/a", "/");
}
-#endif
+
+TEST(path_util, ParentDir_NOP)
+{
+ PARENT_DIR("/", "/");
+ PARENT_DIR("", "");
+ PARENT_DIR(".", ".");
+ PARENT_DIR("./", "./");
+ PARENT_DIR(".//", ".//");
+ PARENT_DIR("./.", "./.");
+}
+
+TEST(path_util, ParentDir_TrailingPeriod)
+{
+ /* Ensure trailing dots aren't confused with parent path. */
+ PARENT_DIR("/.../.../.../", "/.../.../");
+ PARENT_DIR("/.../.../...", "/.../.../");
+
+ PARENT_DIR("/a../b../c../", "/a../b../");
+ PARENT_DIR("/a../b../c..", "/a../b../");
+
+ PARENT_DIR("/a./b./c./", "/a./b./");
+ PARENT_DIR("/a./b./c.", "/a./b./");
+}
+
+TEST(path_util, ParentDir_Complex)
+{
+ PARENT_DIR("./a/", "./");
+ PARENT_DIR("./a", "./");
+ PARENT_DIR("../a/", "../");
+ PARENT_DIR("../a", "../");
+}
+
+#undef PARENT_DIR
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_name_at_index
+ * \{ */
#define AT_INDEX(str_input, index_input, str_expect) \
{ \
char path[] = str_input; \
+ /* Test input assumes forward slash, support back-slash on WIN32. */ \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '/', '\\'); \
+ } \
const char *expect = str_expect; \
int index_output, len_output; \
const bool ret = BLI_path_name_at_index(path, index_input, &index_output, &len_output); \
@@ -87,7 +184,6 @@ TEST(path_util, Clean)
} \
((void)0)
-/* BLI_path_name_at_index */
TEST(path_util, NameAtIndex_Single)
{
AT_INDEX("/a", 0, "a");
@@ -163,24 +259,82 @@ TEST(path_util, NameAtIndex_MiscNeg)
AT_INDEX("/how/now/brown/cow/", 4, nullptr);
}
+#define TEST_STR "./a/./b/./c/."
+
+TEST(path_util, NameAtIndex_SingleDot)
+{
+ AT_INDEX(TEST_STR, 0, ".");
+ AT_INDEX(TEST_STR, 1, "a");
+ AT_INDEX(TEST_STR, 2, "b");
+ AT_INDEX(TEST_STR, 3, "c");
+ AT_INDEX(TEST_STR, 4, nullptr);
+}
+
+TEST(path_util, NameAtIndex_SingleDotNeg)
+{
+ AT_INDEX(TEST_STR, -5, nullptr);
+ AT_INDEX(TEST_STR, -4, ".");
+ AT_INDEX(TEST_STR, -3, "a");
+ AT_INDEX(TEST_STR, -2, "b");
+ AT_INDEX(TEST_STR, -1, "c");
+}
+
+#undef TEST_STR
+
+#define TEST_STR ".//a//.//b//.//c//.//"
+
+TEST(path_util, NameAtIndex_SingleDotDoubleSlash)
+{
+ AT_INDEX(TEST_STR, 0, ".");
+ AT_INDEX(TEST_STR, 1, "a");
+ AT_INDEX(TEST_STR, 2, "b");
+ AT_INDEX(TEST_STR, 3, "c");
+ AT_INDEX(TEST_STR, 4, nullptr);
+}
+
+TEST(path_util, NameAtIndex_SingleDotDoubleSlashNeg)
+{
+ AT_INDEX(TEST_STR, -5, nullptr);
+ AT_INDEX(TEST_STR, -4, ".");
+ AT_INDEX(TEST_STR, -3, "a");
+ AT_INDEX(TEST_STR, -2, "b");
+ AT_INDEX(TEST_STR, -1, "c");
+}
+
+#undef TEST_STR
+
+TEST(path_util, NameAtIndex_SingleDotSeries)
+{
+ AT_INDEX("abc/././/././xyz", 0, "abc");
+ AT_INDEX("abc/././/././xyz", 1, "xyz");
+ AT_INDEX("abc/././/././xyz", 2, nullptr);
+}
+
+TEST(path_util, NameAtIndex_SingleDotSeriesNeg)
+{
+ AT_INDEX("abc/././/././xyz", -3, nullptr);
+ AT_INDEX("abc/././/././xyz", -2, "abc");
+ AT_INDEX("abc/././/././xyz", -1, "xyz");
+}
+
TEST(path_util, NameAtIndex_MiscComplex)
{
AT_INDEX("how//now/brown/cow", 0, "how");
- AT_INDEX("//how///now\\/brown/cow", 1, "now");
- AT_INDEX("/how/now\\//brown\\/cow", 2, "brown");
- AT_INDEX("/how/now/brown/cow//\\", 3, "cow");
- AT_INDEX("/how/now/brown/\\cow", 4, nullptr);
- AT_INDEX("how/now/brown/\\cow\\", 4, nullptr);
+ AT_INDEX("//how///now//brown/cow", 1, "now");
+ AT_INDEX("/how/now///brown//cow", 2, "brown");
+ AT_INDEX("/how/now/brown/cow///", 3, "cow");
+ AT_INDEX("/how/now/brown//cow", 4, nullptr);
+ AT_INDEX("how/now/brown//cow/", 4, nullptr);
}
TEST(path_util, NameAtIndex_MiscComplexNeg)
{
AT_INDEX("how//now/brown/cow", -4, "how");
- AT_INDEX("//how///now\\/brown/cow", -3, "now");
- AT_INDEX("/how/now\\//brown\\/cow", -2, "brown");
- AT_INDEX("/how/now/brown/cow//\\", -1, "cow");
- AT_INDEX("/how/now/brown/\\cow", -5, nullptr);
- AT_INDEX("how/now/brown/\\cow\\", -5, nullptr);
+ AT_INDEX("//how///now//brown/cow", -3, "now");
+ AT_INDEX("/how/now///brown//cow", -2, "brown");
+ AT_INDEX("/how/now/brown/cow///", -1, "cow");
+ AT_INDEX("/how/now/brown//cow", -5, nullptr);
+ AT_INDEX("how/now/brown//cow/", -5, nullptr);
}
TEST(path_util, NameAtIndex_NoneComplex)
@@ -201,21 +355,59 @@ TEST(path_util, NameAtIndex_NoneComplexNeg)
#undef AT_INDEX
-#define JOIN(str_expect, out_size, ...) \
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_join
+ * \{ */
+
+/* For systems with `/` path separator (non WIN32). */
+#define JOIN_FORWARD_SLASH(str_expect, out_size, ...) \
{ \
const char *expect = str_expect; \
char result[(out_size) + 1024]; \
- /* check we don't write past the last byte */ \
+ /* Check we don't write past the last byte. */ \
result[out_size] = '\0'; \
BLI_path_join(result, out_size, __VA_ARGS__); \
- /* simplify expected string */ \
+ EXPECT_STREQ(result, expect); \
+ EXPECT_EQ(result[out_size], '\0'); \
+ } \
+ ((void)0)
+
+/* For systems with `\` path separator (WIN32).
+ * Perform additional manipulation to behave as if input arguments used `\` separators.
+ * Needed since #BLI_path_join uses native slashes. */
+#define JOIN_BACK_SLASH(str_expect, out_size, ...) \
+ { \
+ const char *expect = str_expect; \
+ char result[(out_size) + 1024]; \
+ const char *input_forward_slash[] = {__VA_ARGS__}; \
+ char *input_back_slash[ARRAY_SIZE(input_forward_slash)] = {nullptr}; \
+ for (int i = 0; i < ARRAY_SIZE(input_forward_slash); i++) { \
+ input_back_slash[i] = strdup(input_forward_slash[i]); \
+ BLI_str_replace_char(input_back_slash[i], '/', '\\'); \
+ } \
+ /* Check we don't write past the last byte. */ \
+ result[out_size] = '\0'; \
+ BLI_path_join_array(result, \
+ out_size, \
+ const_cast<const char **>(input_back_slash), \
+ ARRAY_SIZE(input_back_slash)); \
BLI_str_replace_char(result, '\\', '/'); \
EXPECT_STREQ(result, expect); \
EXPECT_EQ(result[out_size], '\0'); \
+ for (int i = 0; i < ARRAY_SIZE(input_forward_slash); i++) { \
+ free(input_back_slash[i]); \
+ } \
} \
((void)0)
-/* BLI_path_join */
+#ifdef WIN32
+# define JOIN JOIN_BACK_SLASH
+#else
+# define JOIN JOIN_FORWARD_SLASH
+#endif
+
TEST(path_util, JoinNop)
{
JOIN("", 100, "");
@@ -293,9 +485,9 @@ TEST(path_util, JoinTruncateLong)
TEST(path_util, JoinComplex)
{
- JOIN("/a/b/c/d/e/f/g/", 100, "/", "\\a/b", "//////c/d", "", "e\\\\", "f", "g//");
- JOIN("/aa/bb/cc/dd/ee/ff/gg/", 100, "/", "\\aa/bb", "//////cc/dd", "", "ee\\\\", "ff", "gg//");
- JOIN("1/2/3/", 100, "1", "////////", "", "2", "3\\");
+ JOIN("/a/b/c/d/e/f/g/", 100, "/", "a/b", "//////c/d", "", "e", "f", "g//");
+ JOIN("/aa/bb/cc/dd/ee/ff/gg/", 100, "/", "aa/bb", "//////cc/dd", "", "ee", "ff", "gg//");
+ JOIN("1/2/3/", 100, "1", "////////", "", "2", "3///");
}
TEST(path_util, JoinRelativePrefix)
@@ -306,8 +498,15 @@ TEST(path_util, JoinRelativePrefix)
}
#undef JOIN
+#undef JOIN_BACK_SLASH
+#undef JOIN_FORWARD_SLASH
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_frame
+ * \{ */
-/* BLI_path_frame */
TEST(path_util, Frame)
{
bool ret;
@@ -384,7 +583,12 @@ TEST(path_util, Frame)
}
}
-/* BLI_split_dirfile */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_split_dirfile
+ * \{ */
+
TEST(path_util, SplitDirfile)
{
{
@@ -440,6 +644,12 @@ TEST(path_util, SplitDirfile)
}
}
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_frame_strip
+ * \{ */
+
#define PATH_FRAME_STRIP(input_path, expect_path, expect_ext) \
{ \
char path[FILE_MAX]; \
@@ -451,7 +661,6 @@ TEST(path_util, SplitDirfile)
} \
((void)0)
-/* BLI_path_frame_strip */
TEST(path_util, PathFrameStrip)
{
PATH_FRAME_STRIP("", "", "");
@@ -463,6 +672,12 @@ TEST(path_util, PathFrameStrip)
}
#undef PATH_FRAME_STRIP
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_extension_check
+ * \{ */
+
#define PATH_EXTENSION_CHECK(input_path, input_ext, expect_ext) \
{ \
const bool ret = BLI_path_extension_check(input_path, input_ext); \
@@ -475,7 +690,6 @@ TEST(path_util, PathFrameStrip)
} \
((void)0)
-/* BLI_path_extension_check */
TEST(path_util, PathExtensionCheck)
{
PATH_EXTENSION_CHECK("a/b/c.exe", ".exe", ".exe");
@@ -501,6 +715,12 @@ TEST(path_util, PathExtensionCheck)
}
#undef PATH_EXTENSION_CHECK
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_frame_check_chars
+ * \{ */
+
#define PATH_FRAME_CHECK_CHARS(input_path, expect_hasChars) \
{ \
const bool ret = BLI_path_frame_check_chars(input_path); \
@@ -513,7 +733,6 @@ TEST(path_util, PathExtensionCheck)
} \
((void)0)
-/* BLI_path_frame_check_chars */
TEST(path_util, PathFrameCheckChars)
{
PATH_FRAME_CHECK_CHARS("a#", true);
@@ -533,6 +752,12 @@ TEST(path_util, PathFrameCheckChars)
}
#undef PATH_FRAME_CHECK_CHARS
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_frame_range
+ * \{ */
+
#define PATH_FRAME_RANGE(input_path, sta, end, digits, expect_outpath) \
{ \
char path[FILE_MAX]; \
@@ -549,7 +774,6 @@ TEST(path_util, PathFrameCheckChars)
} \
((void)0)
-/* BLI_path_frame_range */
TEST(path_util, PathFrameRange)
{
int dummy = -1;
@@ -565,6 +789,12 @@ TEST(path_util, PathFrameRange)
}
#undef PATH_FRAME_RANGE
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_frame_get
+ * \{ */
+
#define PATH_FRAME_GET(input_path, expect_frame, expect_numdigits, expect_pathisvalid) \
{ \
char path[FILE_MAX]; \
@@ -582,7 +812,6 @@ TEST(path_util, PathFrameRange)
} \
((void)0)
-/* BLI_path_frame_get */
TEST(path_util, PathFrameGet)
{
PATH_FRAME_GET("001.avi", 1, 3, true);
@@ -594,7 +823,12 @@ TEST(path_util, PathFrameGet)
}
#undef PATH_FRAME_GET
-/* BLI_path_extension */
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_extension
+ * \{ */
+
TEST(path_util, PathExtension)
{
EXPECT_EQ(nullptr, BLI_path_extension("some.def/file"));
@@ -608,62 +842,88 @@ TEST(path_util, PathExtension)
EXPECT_STREQ(".001", BLI_path_extension("Text.001"));
}
-/* BLI_path_rel. */
-#ifndef _WIN32
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_rel
+ * \{ */
-# define PATH_REL(abs_path, ref_path, rel_path) \
- { \
- char path[FILE_MAX]; \
- BLI_strncpy(path, abs_path, sizeof(path)); \
- BLI_path_rel(path, ref_path); \
- EXPECT_STREQ(rel_path, path); \
+#define PATH_REL(abs_path, ref_path, rel_path) \
+ { \
+ char path[FILE_MAX]; \
+ const char *ref_path_test = ref_path; \
+ BLI_strncpy(path, abs_path, sizeof(path)); \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '/', '\\'); \
+ ref_path_test = str_replace_char_strdup(ref_path_test, '/', '\\'); \
+ } \
+ BLI_path_rel(path, ref_path_test); \
+ if (SEP == '\\') { \
+ BLI_str_replace_char(path, '\\', '/'); \
+ free((void *)ref_path_test); \
} \
- void(0)
+ EXPECT_STREQ(rel_path, path); \
+ } \
+ void(0)
-TEST(path_util, PathRelPath)
+#ifdef WIN32
+# define ABS_PREFIX "C:"
+#else
+# define ABS_PREFIX ""
+#endif
+
+TEST(path_util, PathRelPath_Simple)
{
- PATH_REL("/foo/bar/blender.blend", "/foo/bar/", "//blender.blend");
- PATH_REL("/foo/bar/blender.blend", "/foo/bar", "//bar/blender.blend");
+ PATH_REL(ABS_PREFIX "/foo/bar/blender.blend", ABS_PREFIX "/foo/bar/", "//blender.blend");
+}
- /* Check for potential buffer overflows. */
- {
- char abs_path_in[FILE_MAX];
- abs_path_in[0] = '/';
- for (int i = 1; i < FILE_MAX - 1; i++) {
- abs_path_in[i] = 'A';
- }
- abs_path_in[FILE_MAX - 1] = '\0';
- char abs_path_out[FILE_MAX];
- abs_path_out[0] = '/';
- abs_path_out[1] = '/';
- for (int i = 2; i < FILE_MAX - 1; i++) {
- abs_path_out[i] = 'A';
- }
- abs_path_out[FILE_MAX - 1] = '\0';
- PATH_REL(abs_path_in, "/", abs_path_out);
-
- const char *ref_path_in = "/foo/bar/";
- const size_t ref_path_in_len = strlen(ref_path_in);
- strcpy(abs_path_in, ref_path_in);
- for (int i = ref_path_in_len; i < FILE_MAX - 1; i++) {
- abs_path_in[i] = 'A';
- }
- abs_path_in[FILE_MAX - 1] = '\0';
- abs_path_out[0] = '/';
- abs_path_out[1] = '/';
- for (int i = 2; i < FILE_MAX - (int(ref_path_in_len) - 1); i++) {
- abs_path_out[i] = 'A';
- }
- abs_path_out[FILE_MAX - (ref_path_in_len - 1)] = '\0';
- PATH_REL(abs_path_in, ref_path_in, abs_path_out);
+TEST(path_util, PathRelPath_SimpleSubdir)
+{
+ PATH_REL(ABS_PREFIX "/foo/bar/blender.blend", ABS_PREFIX "/foo/bar", "//bar/blender.blend");
+}
+
+TEST(path_util, PathRelPath_BufferOverflowRoot)
+{
+ char abs_path_in[FILE_MAX];
+ const char *abs_prefix = ABS_PREFIX "/";
+ for (int i = STRNCPY_RLEN(abs_path_in, abs_prefix); i < FILE_MAX - 1; i++) {
+ abs_path_in[i] = 'A';
}
+ abs_path_in[FILE_MAX - 1] = '\0';
+ char abs_path_out[FILE_MAX];
+ for (int i = STRNCPY_RLEN(abs_path_out, "//"); i < FILE_MAX - 1; i++) {
+ abs_path_out[i] = 'A';
+ }
+ abs_path_out[FILE_MAX - std::max((strlen(abs_prefix) - 1), size_t(1))] = '\0';
+ PATH_REL(abs_path_in, abs_prefix, abs_path_out);
}
-# undef PATH_REL
+TEST(path_util, PathRelPath_BufferOverflowSubdir)
+{
+ char abs_path_in[FILE_MAX];
+ const char *ref_path_in = ABS_PREFIX "/foo/bar/";
+ const size_t ref_path_in_len = strlen(ref_path_in);
+ for (int i = STRNCPY_RLEN(abs_path_in, ref_path_in); i < FILE_MAX - 1; i++) {
+ abs_path_in[i] = 'A';
+ }
+ abs_path_in[FILE_MAX - 1] = '\0';
+ char abs_path_out[FILE_MAX];
+ for (int i = STRNCPY_RLEN(abs_path_out, "//"); i < FILE_MAX - (int(ref_path_in_len) - 1); i++) {
+ abs_path_out[i] = 'A';
+ }
+ abs_path_out[FILE_MAX - std::max((ref_path_in_len - 1), size_t(1))] = '\0';
+ PATH_REL(abs_path_in, ref_path_in, abs_path_out);
+}
-#endif
+#undef PATH_REL
+#undef ABS_PREFIX
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Tests for: #BLI_path_contains
+ * \{ */
-/* BLI_path_contains */
TEST(path_util, PathContains)
{
EXPECT_TRUE(BLI_path_contains("/some/path", "/some/path")) << "A path contains itself";
@@ -692,4 +952,6 @@ TEST(path_util, PathContains_Windows_case_insensitive)
EXPECT_TRUE(BLI_path_contains("C:\\some\\path", "c:\\SOME\\path\\inside"))
<< "On Windows path comparison should ignore case";
}
-#endif
+#endif /* WIN32 */
+
+/** \} */
diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc
index ec1768232c8..569798048f6 100644
--- a/source/blender/blenloader/intern/readfile.cc
+++ b/source/blender/blenloader/intern/readfile.cc
@@ -2143,7 +2143,7 @@ static void direct_link_id_common(
BlendDataReader *reader, Library *current_library, ID *id, ID *id_old, const int tag)
{
if (!BLO_read_data_is_undo(reader)) {
- /* When actually reading a file, we do want to reset/re-generate session uuids.
+ /* When actually reading a file, we do want to reset/re-generate session UUIDS.
* In undo case, we want to re-use existing ones. */
id->session_uuid = MAIN_ID_SESSION_UUID_UNSET;
}
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index e4a93762da4..cdb63bd8075 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -44,6 +44,7 @@
#include "BKE_image.h"
#include "BKE_main.h" /* for Main */
#include "BKE_mesh.h" /* for ME_ defines (patching) */
+#include "BKE_mesh_legacy_convert.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
diff --git a/source/blender/blenloader/intern/versioning_300.cc b/source/blender/blenloader/intern/versioning_300.cc
index a2bd7fd2fd1..65094655cfe 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3653,6 +3653,25 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 304, 6)) {
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type != NTREE_GEOMETRY) {
+ continue;
+ }
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type != GEO_NODE_SAMPLE_CURVE) {
+ continue;
+ }
+ static_cast<NodeGeometryCurveSample *>(node->storage)->use_all_curves = true;
+ static_cast<NodeGeometryCurveSample *>(node->storage)->data_type = CD_PROP_FLOAT;
+ bNodeSocket *curve_socket = nodeFindSocket(node, SOCK_IN, "Curve");
+ BLI_assert(curve_socket != nullptr);
+ STRNCPY(curve_socket->name, "Curves");
+ STRNCPY(curve_socket->identifier, "Curves");
+ }
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 9a0568a3589..23d514a7b12 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -62,6 +62,7 @@
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
+#include "BKE_mesh_legacy_convert.h"
#include "SEQ_iterator.h"
#include "SEQ_sequencer.h"
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 8125130490a..cff8eb5a2f7 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -732,8 +732,7 @@ short BM_edge_flag_to_mflag(BMEdge *e)
return (((hflag & BM_ELEM_SEAM) ? ME_SEAM : 0) | ((hflag & BM_ELEM_DRAW) ? ME_EDGEDRAW : 0) |
((hflag & BM_ELEM_SMOOTH) == 0 ? ME_SHARP : 0) |
- (BM_edge_is_wire(e) ? ME_LOOSEEDGE : 0) | /* not typical */
- ME_EDGERENDER);
+ (BM_edge_is_wire(e) ? ME_LOOSEEDGE : 0));
}
char BM_face_flag_to_mflag(BMFace *f)
{
diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c
index 8240fbc53c1..b6520fb48b3 100644
--- a/source/blender/bmesh/operators/bmo_bridge.c
+++ b/source/blender/bmesh/operators/bmo_bridge.c
@@ -14,6 +14,13 @@
#include "intern/bmesh_operators_private.h" /* own include */
+/**
+ * TODO(@campbellbarton): Many connected edge loops can cause an error attempting
+ * to create faces with duplicate vertices. While this needs to be investigated,
+ * it's simple enough to check for this case, see: T102232.
+ */
+#define USE_DUPLICATE_FACE_VERT_CHECK
+
#define EDGE_MARK 4
#define EDGE_OUT 8
#define FACE_OUT 16
@@ -386,61 +393,84 @@ static void bridge_loop_pair(BMesh *bm,
f_example = l_a ? l_a->f : (l_b ? l_b->f : NULL);
if (v_b != v_b_next) {
- BMVert *v_arr[4] = {v_b, v_b_next, v_a_next, v_a};
- f = BM_face_exists(v_arr, 4);
- if (f == NULL) {
- /* copy if loop data if its is missing on one ring */
- f = BM_face_create_verts(bm, v_arr, 4, NULL, BM_CREATE_NOP, true);
-
- l_iter = BM_FACE_FIRST_LOOP(f);
- if (l_b) {
- BM_elem_attrs_copy(bm, bm, l_b, l_iter);
- }
- l_iter = l_iter->next;
- if (l_b_next) {
- BM_elem_attrs_copy(bm, bm, l_b_next, l_iter);
- }
- l_iter = l_iter->next;
- if (l_a_next) {
- BM_elem_attrs_copy(bm, bm, l_a_next, l_iter);
- }
- l_iter = l_iter->next;
- if (l_a) {
- BM_elem_attrs_copy(bm, bm, l_a, l_iter);
+#ifdef USE_DUPLICATE_FACE_VERT_CHECK /* Only check for duplicates between loops. */
+ BLI_assert((v_b != v_b_next) && (v_a_next != v_a));
+ if (UNLIKELY(ELEM(v_b, v_a_next, v_a) || ELEM(v_b_next, v_a_next, v_a))) {
+ f = NULL;
+ }
+ else
+#endif
+ {
+ BMVert *v_arr[4] = {v_b, v_b_next, v_a_next, v_a};
+ f = BM_face_exists(v_arr, 4);
+ if (f == NULL) {
+ /* copy if loop data if its is missing on one ring */
+ f = BM_face_create_verts(bm, v_arr, 4, NULL, BM_CREATE_NOP, true);
+
+ l_iter = BM_FACE_FIRST_LOOP(f);
+ if (l_b) {
+ BM_elem_attrs_copy(bm, bm, l_b, l_iter);
+ }
+ l_iter = l_iter->next;
+ if (l_b_next) {
+ BM_elem_attrs_copy(bm, bm, l_b_next, l_iter);
+ }
+ l_iter = l_iter->next;
+ if (l_a_next) {
+ BM_elem_attrs_copy(bm, bm, l_a_next, l_iter);
+ }
+ l_iter = l_iter->next;
+ if (l_a) {
+ BM_elem_attrs_copy(bm, bm, l_a, l_iter);
+ }
}
}
}
else {
- BMVert *v_arr[3] = {v_b, v_a_next, v_a};
- f = BM_face_exists(v_arr, 3);
- if (f == NULL) {
- /* fan-fill a triangle */
- f = BM_face_create_verts(bm, v_arr, 3, NULL, BM_CREATE_NOP, true);
-
- l_iter = BM_FACE_FIRST_LOOP(f);
- if (l_b) {
- BM_elem_attrs_copy(bm, bm, l_b, l_iter);
- }
- l_iter = l_iter->next;
- if (l_a_next) {
- BM_elem_attrs_copy(bm, bm, l_a_next, l_iter);
- }
- l_iter = l_iter->next;
- if (l_a) {
- BM_elem_attrs_copy(bm, bm, l_a, l_iter);
+#ifdef USE_DUPLICATE_FACE_VERT_CHECK /* Only check for duplicates between loops. */
+ BLI_assert(v_a_next != v_a);
+ if (UNLIKELY(ELEM(v_b, v_a_next, v_a))) {
+ f = NULL;
+ }
+ else
+#endif
+ {
+ BMVert *v_arr[3] = {v_b, v_a_next, v_a};
+ f = BM_face_exists(v_arr, 3);
+ if (f == NULL) {
+ /* fan-fill a triangle */
+ f = BM_face_create_verts(bm, v_arr, 3, NULL, BM_CREATE_NOP, true);
+
+ l_iter = BM_FACE_FIRST_LOOP(f);
+ if (l_b) {
+ BM_elem_attrs_copy(bm, bm, l_b, l_iter);
+ }
+ l_iter = l_iter->next;
+ if (l_a_next) {
+ BM_elem_attrs_copy(bm, bm, l_a_next, l_iter);
+ }
+ l_iter = l_iter->next;
+ if (l_a) {
+ BM_elem_attrs_copy(bm, bm, l_a, l_iter);
+ }
}
}
}
- if (f_example && (f_example != f)) {
- BM_elem_attrs_copy(bm, bm, f_example, f);
- }
- BMO_face_flag_enable(bm, f, FACE_OUT);
- BM_elem_flag_enable(f, BM_ELEM_TAG);
+#ifdef USE_DUPLICATE_FACE_VERT_CHECK
+ if (f != NULL)
+#endif
+ {
+ if (f_example && (f_example != f)) {
+ BM_elem_attrs_copy(bm, bm, f_example, f);
+ }
+ BMO_face_flag_enable(bm, f, FACE_OUT);
+ BM_elem_flag_enable(f, BM_ELEM_TAG);
- /* tag all edges of the face, untag the loop edges after */
- if (use_edgeout) {
- bm_face_edges_tag_out(bm, f);
+ /* tag all edges of the face, untag the loop edges after */
+ if (use_edgeout) {
+ bm_face_edges_tag_out(bm, f);
+ }
}
if (el_a_next == el_a_first) {
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 8da28af3ca7..c45f9dbe49c 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -2058,7 +2058,7 @@ static void get_profile_point(BevelParams *bp, const Profile *pro, int i, int ns
}
else {
BLI_assert(is_power_of_2_i(nseg) && nseg <= bp->pro_spacing.seg_2);
- /* Find spacing between subsamples in prof_co_2. */
+ /* Find spacing between sub-samples in `prof_co_2`. */
int subsample_spacing = bp->pro_spacing.seg_2 / nseg;
copy_v3_v3(r_co, pro->prof_co_2 + 3 * i * subsample_spacing);
}
diff --git a/source/blender/bmesh/tools/bmesh_wireframe.c b/source/blender/bmesh/tools/bmesh_wireframe.c
index 14ec45f14b0..bdc36559e05 100644
--- a/source/blender/bmesh/tools/bmesh_wireframe.c
+++ b/source/blender/bmesh/tools/bmesh_wireframe.c
@@ -175,7 +175,7 @@ void BM_mesh_wireframe(BMesh *bm,
BMVert **verts_neg = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__);
BMVert **verts_pos = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__);
- /* Will over-alloc, but makes for easy lookups by index to keep aligned. */
+ /* Will over-allocate, but makes for easy lookups by index to keep aligned. */
BMVert **verts_boundary = use_boundary ? MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__) :
NULL;
diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h
index 16d1e2e6bb5..ffd02ed5a2f 100644
--- a/source/blender/compositor/operations/COM_ConvertOperation.h
+++ b/source/blender/compositor/operations/COM_ConvertOperation.h
@@ -98,7 +98,7 @@ class ConvertVectorToValueOperation : public ConvertBaseOperation {
class ConvertRGBToYCCOperation : public ConvertBaseOperation {
private:
- /** YCbCr mode (Jpeg, ITU601, ITU709) */
+ /** YCbCr mode (JPEG, ITU601, ITU709) */
int mode_;
public:
@@ -116,7 +116,7 @@ class ConvertRGBToYCCOperation : public ConvertBaseOperation {
class ConvertYCCToRGBOperation : public ConvertBaseOperation {
private:
- /** YCbCr mode (Jpeg, ITU601, ITU709) */
+ /** YCbCr mode (JPEG, ITU601, ITU709) */
int mode_;
public:
diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt
index bab0b5385ec..b4352248b5b 100644
--- a/source/blender/compositor/realtime_compositor/CMakeLists.txt
+++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt
@@ -3,6 +3,7 @@
set(INC
.
algorithms
+ cached_resources
../../blenkernel
../../blenlib
../../gpu
@@ -10,6 +11,7 @@ set(INC
../../makesdna
../../makesrna
../../nodes
+ ../../render
../../gpu/intern
../../../../intern/guardedalloc
)
@@ -31,6 +33,7 @@ set(SRC
intern/shader_node.cc
intern/shader_operation.cc
intern/simple_operation.cc
+ intern/static_cache_manager.cc
intern/static_shader_manager.cc
intern/texture_pool.cc
intern/utilities.cc
@@ -51,6 +54,7 @@ set(SRC
COM_shader_node.hh
COM_shader_operation.hh
COM_simple_operation.hh
+ COM_static_cache_manager.hh
COM_static_shader_manager.hh
COM_texture_pool.hh
COM_utilities.hh
@@ -58,14 +62,149 @@ set(SRC
algorithms/intern/algorithm_parallel_reduction.cc
algorithms/COM_algorithm_parallel_reduction.hh
+
+ cached_resources/intern/morphological_distance_feather_weights.cc
+ cached_resources/intern/symmetric_blur_weights.cc
+ cached_resources/intern/symmetric_separable_blur_weights.cc
+
+ cached_resources/COM_cached_resource.hh
+ cached_resources/COM_morphological_distance_feather_weights.hh
+ cached_resources/COM_symmetric_blur_weights.hh
+ cached_resources/COM_symmetric_separable_blur_weights.hh
)
set(LIB
bf_gpu
bf_nodes
bf_imbuf
+ bf_render
bf_blenlib
bf_blenkernel
)
+set(GLSL_SRC
+ shaders/compositor_alpha_crop.glsl
+ shaders/compositor_bilateral_blur.glsl
+ shaders/compositor_blur.glsl
+ shaders/compositor_blur_variable_size.glsl
+ shaders/compositor_bokeh_image.glsl
+ shaders/compositor_box_mask.glsl
+ shaders/compositor_convert.glsl
+ shaders/compositor_despeckle.glsl
+ shaders/compositor_directional_blur.glsl
+ shaders/compositor_edge_filter.glsl
+ shaders/compositor_ellipse_mask.glsl
+ shaders/compositor_filter.glsl
+ shaders/compositor_flip.glsl
+ shaders/compositor_image_crop.glsl
+ shaders/compositor_morphological_distance.glsl
+ shaders/compositor_morphological_distance_feather.glsl
+ shaders/compositor_morphological_distance_threshold.glsl
+ shaders/compositor_morphological_step.glsl
+ shaders/compositor_normalize.glsl
+ shaders/compositor_parallel_reduction.glsl
+ shaders/compositor_projector_lens_distortion.glsl
+ shaders/compositor_realize_on_domain.glsl
+ shaders/compositor_screen_lens_distortion.glsl
+ shaders/compositor_set_alpha.glsl
+ shaders/compositor_split_viewer.glsl
+ shaders/compositor_symmetric_blur.glsl
+ shaders/compositor_symmetric_separable_blur.glsl
+ shaders/compositor_tone_map_photoreceptor.glsl
+ shaders/compositor_tone_map_simple.glsl
+
+ shaders/library/gpu_shader_compositor_alpha_over.glsl
+ shaders/library/gpu_shader_compositor_blur_common.glsl
+ shaders/library/gpu_shader_compositor_bright_contrast.glsl
+ shaders/library/gpu_shader_compositor_channel_matte.glsl
+ shaders/library/gpu_shader_compositor_chroma_matte.glsl
+ shaders/library/gpu_shader_compositor_color_balance.glsl
+ shaders/library/gpu_shader_compositor_color_correction.glsl
+ shaders/library/gpu_shader_compositor_color_matte.glsl
+ shaders/library/gpu_shader_compositor_color_spill.glsl
+ shaders/library/gpu_shader_compositor_color_to_luminance.glsl
+ shaders/library/gpu_shader_compositor_difference_matte.glsl
+ shaders/library/gpu_shader_compositor_distance_matte.glsl
+ shaders/library/gpu_shader_compositor_exposure.glsl
+ shaders/library/gpu_shader_compositor_gamma.glsl
+ shaders/library/gpu_shader_compositor_hue_correct.glsl
+ shaders/library/gpu_shader_compositor_hue_saturation_value.glsl
+ shaders/library/gpu_shader_compositor_invert.glsl
+ shaders/library/gpu_shader_compositor_luminance_matte.glsl
+ shaders/library/gpu_shader_compositor_main.glsl
+ shaders/library/gpu_shader_compositor_map_value.glsl
+ shaders/library/gpu_shader_compositor_normal.glsl
+ shaders/library/gpu_shader_compositor_posterize.glsl
+ shaders/library/gpu_shader_compositor_separate_combine.glsl
+ shaders/library/gpu_shader_compositor_set_alpha.glsl
+ shaders/library/gpu_shader_compositor_store_output.glsl
+ shaders/library/gpu_shader_compositor_texture_utilities.glsl
+ shaders/library/gpu_shader_compositor_type_conversion.glsl
+)
+
+set(GLSL_C)
+foreach(GLSL_FILE ${GLSL_SRC})
+ data_to_c_simple(${GLSL_FILE} GLSL_C)
+endforeach()
+
+blender_add_lib(bf_compositor_shaders "${GLSL_C}" "" "" "")
+
+list(APPEND LIB
+ bf_compositor_shaders
+)
+
+set(GLSL_SOURCE_CONTENT "")
+foreach(GLSL_FILE ${GLSL_SRC})
+ get_filename_component(GLSL_FILE_NAME ${GLSL_FILE} NAME)
+ string(REPLACE "." "_" GLSL_FILE_NAME_UNDERSCORES ${GLSL_FILE_NAME})
+ string(APPEND GLSL_SOURCE_CONTENT "SHADER_SOURCE\(datatoc_${GLSL_FILE_NAME_UNDERSCORES}, \"${GLSL_FILE_NAME}\", \"${GLSL_FILE}\"\)\n")
+endforeach()
+
+set(glsl_source_list_file "${CMAKE_CURRENT_BINARY_DIR}/glsl_compositor_source_list.h")
+file(GENERATE OUTPUT ${glsl_source_list_file} CONTENT "${GLSL_SOURCE_CONTENT}")
+list(APPEND SRC ${glsl_source_list_file})
+list(APPEND INC ${CMAKE_CURRENT_BINARY_DIR})
+
+target_include_directories(bf_compositor_shaders PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+
+set(SRC_SHADER_CREATE_INFOS
+ shaders/infos/compositor_alpha_crop_info.hh
+ shaders/infos/compositor_bilateral_blur_info.hh
+ shaders/infos/compositor_blur_info.hh
+ shaders/infos/compositor_blur_variable_size_info.hh
+ shaders/infos/compositor_bokeh_image_info.hh
+ shaders/infos/compositor_box_mask_info.hh
+ shaders/infos/compositor_convert_info.hh
+ shaders/infos/compositor_despeckle_info.hh
+ shaders/infos/compositor_directional_blur_info.hh
+ shaders/infos/compositor_edge_filter_info.hh
+ shaders/infos/compositor_ellipse_mask_info.hh
+ shaders/infos/compositor_filter_info.hh
+ shaders/infos/compositor_flip_info.hh
+ shaders/infos/compositor_image_crop_info.hh
+ shaders/infos/compositor_morphological_distance_feather_info.hh
+ shaders/infos/compositor_morphological_distance_info.hh
+ shaders/infos/compositor_morphological_distance_threshold_info.hh
+ shaders/infos/compositor_morphological_step_info.hh
+ shaders/infos/compositor_normalize_info.hh
+ shaders/infos/compositor_parallel_reduction_info.hh
+ shaders/infos/compositor_projector_lens_distortion_info.hh
+ shaders/infos/compositor_realize_on_domain_info.hh
+ shaders/infos/compositor_screen_lens_distortion_info.hh
+ shaders/infos/compositor_set_alpha_info.hh
+ shaders/infos/compositor_split_viewer_info.hh
+ shaders/infos/compositor_symmetric_blur_info.hh
+ shaders/infos/compositor_symmetric_separable_blur_info.hh
+ shaders/infos/compositor_tone_map_photoreceptor_info.hh
+ shaders/infos/compositor_tone_map_simple_info.hh
+)
+
+set(SHADER_CREATE_INFOS_CONTENT "")
+foreach(DESCRIPTOR_FILE ${SRC_SHADER_CREATE_INFOS})
+ string(APPEND SHADER_CREATE_INFOS_CONTENT "#include \"${DESCRIPTOR_FILE}\"\n")
+endforeach()
+
+set(shader_create_info_list_file "${CMAKE_CURRENT_BINARY_DIR}/compositor_shader_create_info_list.hh")
+file(GENERATE OUTPUT ${shader_create_info_list_file} CONTENT "${SHADER_CREATE_INFOS_CONTENT}")
+
blender_add_lib(bf_realtime_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/compositor/realtime_compositor/COM_context.hh b/source/blender/compositor/realtime_compositor/COM_context.hh
index b5c8cea641f..80fb4f70ca4 100644
--- a/source/blender/compositor/realtime_compositor/COM_context.hh
+++ b/source/blender/compositor/realtime_compositor/COM_context.hh
@@ -9,6 +9,7 @@
#include "GPU_texture.h"
+#include "COM_static_cache_manager.hh"
#include "COM_static_shader_manager.hh"
#include "COM_texture_pool.hh"
@@ -22,14 +23,17 @@ namespace blender::realtime_compositor {
* providing input data like render passes and the active scene, as well as references to the data
* where the output of the evaluator will be written. The class also provides a reference to the
* texture pool which should be implemented by the caller and provided during construction.
- * Finally, the class have an instance of a static shader manager for convenient shader
- * acquisition. */
+ * Finally, the class have an instance of a static shader manager and a static resource manager
+ * for acquiring cached shaders and resources efficiently. */
class Context {
private:
/* A texture pool that can be used to allocate textures for the compositor efficiently. */
TexturePool &texture_pool_;
/* A static shader manager that can be used to acquire shaders for the compositor efficiently. */
StaticShaderManager shader_manager_;
+ /* A static cache manager that can be used to acquire cached resources for the compositor
+ * efficiently. */
+ StaticCacheManager cache_manager_;
public:
Context(TexturePool &texture_pool);
@@ -67,6 +71,9 @@ class Context {
/* Get a reference to the static shader manager of this context. */
StaticShaderManager &shader_manager();
+
+ /* Get a reference to the static cache manager of this context. */
+ StaticCacheManager &cache_manager();
};
} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/COM_result.hh b/source/blender/compositor/realtime_compositor/COM_result.hh
index a16d68bb92d..f5ecc4c2112 100644
--- a/source/blender/compositor/realtime_compositor/COM_result.hh
+++ b/source/blender/compositor/realtime_compositor/COM_result.hh
@@ -14,7 +14,9 @@
namespace blender::realtime_compositor {
/* Possible data types that operations can operate on. They either represent the base type of the
- * result texture or a single value result. */
+ * result texture or a single value result. The color type represents an RGBA color. And the vector
+ * type represents a generic 4-component vector, which can encode two 2D vectors, one 3D vector
+ * with the last component ignored, or other dimensional data. */
enum class ResultType : uint8_t {
Float,
Vector,
@@ -85,7 +87,7 @@ class Result {
* is a texture. */
union {
float float_value_;
- float3 vector_value_;
+ float4 vector_value_;
float4 color_value_;
};
/* The domain of the result. This only matters if the result was a texture. See the discussion in
@@ -157,7 +159,7 @@ class Result {
/* If the result is a single value result of type vector, return its vector value. Otherwise, an
* uninitialized value is returned. */
- float3 get_vector_value() const;
+ float4 get_vector_value() const;
/* If the result is a single value result of type color, return its color value. Otherwise, an
* uninitialized value is returned. */
@@ -167,7 +169,7 @@ class Result {
float get_float_value_default(float default_value) const;
/* Same as get_vector_value but returns a default value if the result is not a single value. */
- float3 get_vector_value_default(const float3 &default_value) const;
+ float4 get_vector_value_default(const float4 &default_value) const;
/* Same as get_color_value but returns a default value if the result is not a single value. */
float4 get_color_value_default(const float4 &default_value) const;
@@ -178,7 +180,7 @@ class Result {
/* If the result is a single value result of type vector, set its vector value and upload it to
* the texture. Otherwise, an undefined behavior is invoked. */
- void set_vector_value(const float3 &value);
+ void set_vector_value(const float4 &value);
/* If the result is a single value result of type color, set its color value and upload it to the
* texture. Otherwise, an undefined behavior is invoked. */
diff --git a/source/blender/compositor/realtime_compositor/COM_static_cache_manager.hh b/source/blender/compositor/realtime_compositor/COM_static_cache_manager.hh
new file mode 100644
index 00000000000..20fbb156879
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/COM_static_cache_manager.hh
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include <memory>
+
+#include "BLI_map.hh"
+#include "BLI_math_vec_types.hh"
+
+#include "COM_morphological_distance_feather_weights.hh"
+#include "COM_symmetric_blur_weights.hh"
+#include "COM_symmetric_separable_blur_weights.hh"
+
+namespace blender::realtime_compositor {
+
+/* -------------------------------------------------------------------------------------------------
+ * Static Cache Manager
+ *
+ * A static cache manager is a collection of cached resources that can be retrieved when needed and
+ * created if not already available. In particular, each cached resource type has its own Map in
+ * the class, where all instances of that cached resource type are stored and tracked. See the
+ * CachedResource class for more information.
+ *
+ * The manager deletes the cached resources that are no longer needed. A cached resource is said to
+ * be not needed when it was not used in the previous evaluation. This is done through the
+ * following mechanism:
+ *
+ * - Before every evaluation, do the following:
+ * 1. All resources whose CachedResource::needed flag is false are deleted.
+ * 2. The CachedResource::needed flag of all remaining resources is set to false.
+ * - During evaluation, when retrieving any cached resource, set its CachedResource::needed flag to
+ * true.
+ *
+ * In effect, any resource that was used in the previous evaluation but was not used in the current
+ * evaluation will be deleted before the next evaluation. This mechanism is implemented in the
+ * reset() method of the class, which should be called before every evaluation. */
+class StaticCacheManager {
+ private:
+ /* A map that stores all SymmetricBlurWeights cached resources. */
+ Map<SymmetricBlurWeightsKey, std::unique_ptr<SymmetricBlurWeights>> symmetric_blur_weights_;
+
+ /* A map that stores all SymmetricSeparableBlurWeights cached resources. */
+ Map<SymmetricSeparableBlurWeightsKey, std::unique_ptr<SymmetricSeparableBlurWeights>>
+ symmetric_separable_blur_weights_;
+
+ /* A map that stores all MorphologicalDistanceFeatherWeights cached resources. */
+ Map<MorphologicalDistanceFeatherWeightsKey, std::unique_ptr<MorphologicalDistanceFeatherWeights>>
+ morphological_distance_feather_weights_;
+
+ public:
+ /* Reset the cache manager by deleting the cached resources that are no longer needed because
+ * they weren't used in the last evaluation and prepare the remaining cached resources to track
+ * their needed status in the next evaluation. See the class description for more information.
+ * This should be called before every evaluation. */
+ void reset();
+
+ /* Check if there is an available SymmetricBlurWeights cached resource with the given parameters
+ * in the manager, if one exists, return it, otherwise, return a newly created one and add it to
+ * the manager. In both cases, tag the cached resource as needed to keep it cached for the next
+ * evaluation. */
+ SymmetricBlurWeights &get_symmetric_blur_weights(int type, float2 radius);
+
+ /* Check if there is an available SymmetricSeparableBlurWeights cached resource with the given
+ * parameters in the manager, if one exists, return it, otherwise, return a newly created one and
+ * add it to the manager. In both cases, tag the cached resource as needed to keep it cached for
+ * the next evaluation. */
+ SymmetricSeparableBlurWeights &get_symmetric_separable_blur_weights(int type, float radius);
+
+ /* Check if there is an available MorphologicalDistanceFeatherWeights cached resource with the
+ * given parameters in the manager, if one exists, return it, otherwise, return a newly created
+ * one and add it to the manager. In both cases, tag the cached resource as needed to keep it
+ * cached for the next evaluation. */
+ MorphologicalDistanceFeatherWeights &get_morphological_distance_feather_weights(int type,
+ int radius);
+};
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/COM_texture_pool.hh b/source/blender/compositor/realtime_compositor/COM_texture_pool.hh
index cc6641d288f..c68219b0279 100644
--- a/source/blender/compositor/realtime_compositor/COM_texture_pool.hh
+++ b/source/blender/compositor/realtime_compositor/COM_texture_pool.hh
@@ -60,8 +60,8 @@ class TexturePool {
/* Shorthand for acquire with GPU_RGBA16F format. */
GPUTexture *acquire_color(int2 size);
- /* Shorthand for acquire with GPU_RGBA16F format. Identical to acquire_color because vectors
- * are stored in RGBA textures, due to the limited support for RGB textures. */
+ /* Shorthand for acquire with GPU_RGBA16F format. Identical to acquire_color because vectors are
+ * 4D, and are thus stored in RGBA textures. */
GPUTexture *acquire_vector(int2 size);
/* Shorthand for acquire with GPU_R16F format. */
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/COM_cached_resource.hh b/source/blender/compositor/realtime_compositor/cached_resources/COM_cached_resource.hh
new file mode 100644
index 00000000000..fe3158ef52d
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/COM_cached_resource.hh
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+namespace blender::realtime_compositor {
+
+/* -------------------------------------------------------------------------------------------------
+ * Cached Resource.
+ *
+ * A cached resource is any resource that can be cached across compositor evaluations and across
+ * multiple operations. Cached resources are managed by an instance of a StaticCacheManager and are
+ * freed when they are no longer needed, a state which is represented by the `needed` member in the
+ * class. For more information on the caching mechanism, see the StaticCacheManager class.
+ *
+ * To add a new cached resource:
+ *
+ * - Create a derived class from CachedResource to represent the resource.
+ * - Create a key class that can be used in a Map to identify the resource.
+ * - Add a new Map to StaticCacheManager mapping the key to the resource.
+ * - Reset the contents of the added map in StaticCacheManager::reset.
+ * - Add an appropriate getter method in StaticCacheManager.
+ *
+ * See the existing cached resources for reference. */
+class CachedResource {
+ public:
+ /* A flag that represents the needed status of the cached resource. See the StaticCacheManager
+ * class for more information on how this member is utilized in the caching mechanism. */
+ bool needed = true;
+};
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/COM_morphological_distance_feather_weights.hh b/source/blender/compositor/realtime_compositor/cached_resources/COM_morphological_distance_feather_weights.hh
new file mode 100644
index 00000000000..cd6827bdd6b
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/COM_morphological_distance_feather_weights.hh
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include <cstdint>
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_cached_resource.hh"
+
+namespace blender::realtime_compositor {
+
+/* ------------------------------------------------------------------------------------------------
+ * Morphological Distance Feather Key.
+ */
+class MorphologicalDistanceFeatherWeightsKey {
+ public:
+ int type;
+ float radius;
+
+ MorphologicalDistanceFeatherWeightsKey(int type, float radius);
+
+ uint64_t hash() const;
+};
+
+bool operator==(const MorphologicalDistanceFeatherWeightsKey &a,
+ const MorphologicalDistanceFeatherWeightsKey &b);
+
+/* -------------------------------------------------------------------------------------------------
+ * Morphological Distance Feather Weights.
+ *
+ * A cached resource that computes and caches 1D GPU textures containing the weights of the
+ * separable Gaussian filter of the given radius as well as an inverse distance falloff of the
+ * given type and radius. The weights and falloffs are symmetric, because the Gaussian and falloff
+ * functions are all even functions. Consequently, only the positive half of the filter is computed
+ * and the shader takes that into consideration. */
+class MorphologicalDistanceFeatherWeights : public CachedResource {
+ private:
+ GPUTexture *weights_texture_ = nullptr;
+ GPUTexture *distance_falloffs_texture_ = nullptr;
+
+ public:
+ MorphologicalDistanceFeatherWeights(int type, int radius);
+
+ ~MorphologicalDistanceFeatherWeights();
+
+ void compute_weights(int radius);
+
+ void compute_distance_falloffs(int type, int radius);
+
+ void bind_weights_as_texture(GPUShader *shader, const char *texture_name) const;
+
+ void unbind_weights_as_texture() const;
+
+ void bind_distance_falloffs_as_texture(GPUShader *shader, const char *texture_name) const;
+
+ void unbind_distance_falloffs_as_texture() const;
+};
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_blur_weights.hh b/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_blur_weights.hh
new file mode 100644
index 00000000000..05d3c7c6f3e
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_blur_weights.hh
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include <cstdint>
+
+#include "BLI_math_vec_types.hh"
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_cached_resource.hh"
+
+namespace blender::realtime_compositor {
+
+/* ------------------------------------------------------------------------------------------------
+ * Symmetric Blur Weights Key.
+ */
+class SymmetricBlurWeightsKey {
+ public:
+ int type;
+ float2 radius;
+
+ SymmetricBlurWeightsKey(int type, float2 radius);
+
+ uint64_t hash() const;
+};
+
+bool operator==(const SymmetricBlurWeightsKey &a, const SymmetricBlurWeightsKey &b);
+
+/* -------------------------------------------------------------------------------------------------
+ * Symmetric Blur Weights.
+ *
+ * A cached resource that computes and caches a 2D GPU texture containing the weights of the filter
+ * of the given type and radius. The filter is assumed to be symmetric, because the filter
+ * functions are evaluated on the normalized distance to the center. Consequently, only the upper
+ * right quadrant are computed and the shader takes that into consideration. */
+class SymmetricBlurWeights : public CachedResource {
+ private:
+ GPUTexture *texture_ = nullptr;
+
+ public:
+ SymmetricBlurWeights(int type, float2 radius);
+
+ ~SymmetricBlurWeights();
+
+ void bind_as_texture(GPUShader *shader, const char *texture_name) const;
+
+ void unbind_as_texture() const;
+};
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_separable_blur_weights.hh b/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_separable_blur_weights.hh
new file mode 100644
index 00000000000..85e75e4535d
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/COM_symmetric_separable_blur_weights.hh
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include <cstdint>
+
+#include "BLI_math_vec_types.hh"
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_cached_resource.hh"
+
+namespace blender::realtime_compositor {
+
+/* ------------------------------------------------------------------------------------------------
+ * Symmetric Separable Blur Weights Key.
+ */
+class SymmetricSeparableBlurWeightsKey {
+ public:
+ int type;
+ float radius;
+
+ SymmetricSeparableBlurWeightsKey(int type, float radius);
+
+ uint64_t hash() const;
+};
+
+bool operator==(const SymmetricSeparableBlurWeightsKey &a,
+ const SymmetricSeparableBlurWeightsKey &b);
+
+/* -------------------------------------------------------------------------------------------------
+ * Symmetric Separable Blur Weights.
+ *
+ * A cached resource that computes and caches a 1D GPU texture containing the weights of the
+ * separable filter of the given type and radius. The filter is assumed to be symmetric, because
+ * the filter functions are all even functions. Consequently, only the positive half of the filter
+ * is computed and the shader takes that into consideration. */
+class SymmetricSeparableBlurWeights : public CachedResource {
+ private:
+ GPUTexture *texture_ = nullptr;
+
+ public:
+ SymmetricSeparableBlurWeights(int type, float radius);
+
+ ~SymmetricSeparableBlurWeights();
+
+ void bind_as_texture(GPUShader *shader, const char *texture_name) const;
+
+ void unbind_as_texture() const;
+};
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/intern/morphological_distance_feather_weights.cc b/source/blender/compositor/realtime_compositor/cached_resources/intern/morphological_distance_feather_weights.cc
new file mode 100644
index 00000000000..eac88b907b8
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/intern/morphological_distance_feather_weights.cc
@@ -0,0 +1,159 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <cmath>
+#include <cstdint>
+
+#include "BLI_array.hh"
+#include "BLI_hash.hh"
+#include "BLI_index_range.hh"
+
+#include "RE_pipeline.h"
+
+#include "DNA_scene_types.h"
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_morphological_distance_feather_weights.hh"
+
+namespace blender::realtime_compositor {
+
+/* --------------------------------------------------------------------
+ * Morphological Distance Feather Weights Key.
+ */
+
+MorphologicalDistanceFeatherWeightsKey::MorphologicalDistanceFeatherWeightsKey(int type,
+ float radius)
+ : type(type), radius(radius)
+{
+}
+
+uint64_t MorphologicalDistanceFeatherWeightsKey::hash() const
+{
+ return get_default_hash_2(type, radius);
+}
+
+bool operator==(const MorphologicalDistanceFeatherWeightsKey &a,
+ const MorphologicalDistanceFeatherWeightsKey &b)
+{
+ return a.type == b.type && a.radius == b.radius;
+}
+
+/* --------------------------------------------------------------------
+ * Morphological Distance Feather Weights.
+ */
+
+MorphologicalDistanceFeatherWeights::MorphologicalDistanceFeatherWeights(int type, int radius)
+{
+ compute_weights(radius);
+ compute_distance_falloffs(type, radius);
+}
+
+MorphologicalDistanceFeatherWeights::~MorphologicalDistanceFeatherWeights()
+{
+ GPU_texture_free(weights_texture_);
+ GPU_texture_free(distance_falloffs_texture_);
+}
+
+void MorphologicalDistanceFeatherWeights::compute_weights(int radius)
+{
+ /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only
+ * compute half of it and no doubling happens. We add 1 to make sure the filter size is always
+ * odd and there is a center weight. */
+ const int size = radius + 1;
+ Array<float> weights(size);
+
+ float sum = 0.0f;
+
+ /* First, compute the center weight. */
+ const float center_weight = RE_filter_value(R_FILTER_GAUSS, 0.0f);
+ weights[0] = center_weight;
+ sum += center_weight;
+
+ /* Second, compute the other weights in the positive direction, making sure to add double the
+ * weight to the sum of weights because the filter is symmetric and we only loop over half of
+ * it. Skip the center weight already computed by dropping the front index. */
+ const float scale = radius > 0.0f ? 1.0f / radius : 0.0f;
+ for (const int i : weights.index_range().drop_front(1)) {
+ const float weight = RE_filter_value(R_FILTER_GAUSS, i * scale);
+ weights[i] = weight;
+ sum += weight * 2.0f;
+ }
+
+ /* Finally, normalize the weights. */
+ for (const int i : weights.index_range()) {
+ weights[i] /= sum;
+ }
+
+ weights_texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data());
+}
+
+/* Computes a falloff that is equal to 1 at an input of zero and decrease to zero at an input of 1,
+ * with the rate of decrease depending on the falloff type. */
+static float compute_distance_falloff(int type, float x)
+{
+ x = 1.0f - x;
+
+ switch (type) {
+ case PROP_SMOOTH:
+ return 3.0f * x * x - 2.0f * x * x * x;
+ case PROP_SPHERE:
+ return std::sqrt(2.0f * x - x * x);
+ case PROP_ROOT:
+ return std::sqrt(x);
+ case PROP_SHARP:
+ return x * x;
+ case PROP_INVSQUARE:
+ return x * (2.0f - x);
+ case PROP_LIN:
+ return x;
+ default:
+ BLI_assert_unreachable();
+ return x;
+ }
+}
+
+void MorphologicalDistanceFeatherWeights::compute_distance_falloffs(int type, int radius)
+{
+ /* The size of the distance falloffs is double the radius plus 1, but since the falloffs are
+ * symmetric, we only compute half of them and no doubling happens. We add 1 to make sure the
+ * falloffs size is always odd and there is a center falloff. */
+ const int size = radius + 1;
+ Array<float> falloffs(size);
+
+ /* Compute the distance falloffs in the positive direction only, because the falloffs are
+ * symmetric. */
+ const float scale = radius > 0.0f ? 1.0f / radius : 0.0f;
+ for (const int i : falloffs.index_range()) {
+ falloffs[i] = compute_distance_falloff(type, i * scale);
+ }
+
+ distance_falloffs_texture_ = GPU_texture_create_1d(
+ "Distance Factors", size, 1, GPU_R16F, falloffs.data());
+}
+
+void MorphologicalDistanceFeatherWeights::bind_weights_as_texture(GPUShader *shader,
+ const char *texture_name) const
+{
+ const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
+ GPU_texture_bind(weights_texture_, texture_image_unit);
+}
+
+void MorphologicalDistanceFeatherWeights::unbind_weights_as_texture() const
+{
+ GPU_texture_unbind(weights_texture_);
+}
+
+void MorphologicalDistanceFeatherWeights::bind_distance_falloffs_as_texture(
+ GPUShader *shader, const char *texture_name) const
+{
+ const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
+ GPU_texture_bind(distance_falloffs_texture_, texture_image_unit);
+}
+
+void MorphologicalDistanceFeatherWeights::unbind_distance_falloffs_as_texture() const
+{
+ GPU_texture_unbind(distance_falloffs_texture_);
+}
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_blur_weights.cc b/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_blur_weights.cc
new file mode 100644
index 00000000000..a22d32a8e18
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_blur_weights.cc
@@ -0,0 +1,115 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <cstdint>
+
+#include "BLI_array.hh"
+#include "BLI_hash.hh"
+#include "BLI_index_range.hh"
+#include "BLI_math_vec_types.hh"
+#include "BLI_math_vector.hh"
+
+#include "RE_pipeline.h"
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_symmetric_blur_weights.hh"
+
+namespace blender::realtime_compositor {
+
+/* --------------------------------------------------------------------
+ * Symmetric Blur Weights Key.
+ */
+
+SymmetricBlurWeightsKey::SymmetricBlurWeightsKey(int type, float2 radius)
+ : type(type), radius(radius)
+{
+}
+
+uint64_t SymmetricBlurWeightsKey::hash() const
+{
+ return get_default_hash_3(type, radius.x, radius.y);
+}
+
+bool operator==(const SymmetricBlurWeightsKey &a, const SymmetricBlurWeightsKey &b)
+{
+ return a.type == b.type && a.radius == b.radius;
+}
+
+/* --------------------------------------------------------------------
+ * Symmetric Blur Weights.
+ */
+
+SymmetricBlurWeights::SymmetricBlurWeights(int type, float2 radius)
+{
+ /* The full size of filter is double the radius plus 1, but since the filter is symmetric, we
+ * only compute a single quadrant of it and so no doubling happens. We add 1 to make sure the
+ * filter size is always odd and there is a center weight. */
+ const float2 scale = math::safe_divide(float2(1.0f), radius);
+ const int2 size = int2(math::ceil(radius)) + int2(1);
+ Array<float> weights(size.x * size.y);
+
+ float sum = 0.0f;
+
+ /* First, compute the center weight. */
+ const float center_weight = RE_filter_value(type, 0.0f);
+ weights[0] = center_weight;
+ sum += center_weight;
+
+ /* Then, compute the weights along the positive x axis, making sure to add double the weight to
+ * the sum of weights because the filter is symmetric and we only loop over the positive half
+ * of the x axis. Skip the center weight already computed by dropping the front index. */
+ for (const int x : IndexRange(size.x).drop_front(1)) {
+ const float weight = RE_filter_value(type, x * scale.x);
+ weights[x] = weight;
+ sum += weight * 2.0f;
+ }
+
+ /* Then, compute the weights along the positive y axis, making sure to add double the weight to
+ * the sum of weights because the filter is symmetric and we only loop over the positive half
+ * of the y axis. Skip the center weight already computed by dropping the front index. */
+ for (const int y : IndexRange(size.y).drop_front(1)) {
+ const float weight = RE_filter_value(type, y * scale.y);
+ weights[size.x * y] = weight;
+ sum += weight * 2.0f;
+ }
+
+ /* Then, compute the other weights in the upper right quadrant, making sure to add quadruple
+ * the weight to the sum of weights because the filter is symmetric and we only loop over one
+ * quadrant of it. Skip the weights along the y and x axis already computed by dropping the
+ * front index. */
+ for (const int y : IndexRange(size.y).drop_front(1)) {
+ for (const int x : IndexRange(size.x).drop_front(1)) {
+ const float weight = RE_filter_value(type, math::length(float2(x, y) * scale));
+ weights[size.x * y + x] = weight;
+ sum += weight * 4.0f;
+ }
+ }
+
+ /* Finally, normalize the weights. */
+ for (const int y : IndexRange(size.y)) {
+ for (const int x : IndexRange(size.x)) {
+ weights[size.x * y + x] /= sum;
+ }
+ }
+
+ texture_ = GPU_texture_create_2d("Weights", size.x, size.y, 1, GPU_R16F, weights.data());
+}
+
+SymmetricBlurWeights::~SymmetricBlurWeights()
+{
+ GPU_texture_free(texture_);
+}
+
+void SymmetricBlurWeights::bind_as_texture(GPUShader *shader, const char *texture_name) const
+{
+ const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
+ GPU_texture_bind(texture_, texture_image_unit);
+}
+
+void SymmetricBlurWeights::unbind_as_texture() const
+{
+ GPU_texture_unbind(texture_);
+}
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_separable_blur_weights.cc b/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_separable_blur_weights.cc
new file mode 100644
index 00000000000..b8c47d5a5d0
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/cached_resources/intern/symmetric_separable_blur_weights.cc
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <cstdint>
+
+#include "BLI_array.hh"
+#include "BLI_hash.hh"
+#include "BLI_index_range.hh"
+#include "BLI_math_base.hh"
+
+#include "RE_pipeline.h"
+
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_symmetric_separable_blur_weights.hh"
+
+namespace blender::realtime_compositor {
+
+/* --------------------------------------------------------------------
+ * Symmetric Separable Blur Weights Key.
+ */
+
+SymmetricSeparableBlurWeightsKey::SymmetricSeparableBlurWeightsKey(int type, float radius)
+ : type(type), radius(radius)
+{
+}
+
+uint64_t SymmetricSeparableBlurWeightsKey::hash() const
+{
+ return get_default_hash_2(type, radius);
+}
+
+bool operator==(const SymmetricSeparableBlurWeightsKey &a,
+ const SymmetricSeparableBlurWeightsKey &b)
+{
+ return a.type == b.type && a.radius == b.radius;
+}
+
+/* --------------------------------------------------------------------
+ * Symmetric Separable Blur Weights.
+ */
+
+SymmetricSeparableBlurWeights::SymmetricSeparableBlurWeights(int type, float radius)
+{
+ /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only
+ * compute half of it and no doubling happens. We add 1 to make sure the filter size is always
+ * odd and there is a center weight. */
+ const int size = math::ceil(radius) + 1;
+ Array<float> weights(size);
+
+ float sum = 0.0f;
+
+ /* First, compute the center weight. */
+ const float center_weight = RE_filter_value(type, 0.0f);
+ weights[0] = center_weight;
+ sum += center_weight;
+
+ /* Second, compute the other weights in the positive direction, making sure to add double the
+ * weight to the sum of weights because the filter is symmetric and we only loop over half of
+ * it. Skip the center weight already computed by dropping the front index. */
+ const float scale = radius > 0.0f ? 1.0f / radius : 0.0f;
+ for (const int i : weights.index_range().drop_front(1)) {
+ const float weight = RE_filter_value(type, i * scale);
+ weights[i] = weight;
+ sum += weight * 2.0f;
+ }
+
+ /* Finally, normalize the weights. */
+ for (const int i : weights.index_range()) {
+ weights[i] /= sum;
+ }
+
+ texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data());
+}
+
+SymmetricSeparableBlurWeights::~SymmetricSeparableBlurWeights()
+{
+ GPU_texture_free(texture_);
+}
+
+void SymmetricSeparableBlurWeights::bind_as_texture(GPUShader *shader,
+ const char *texture_name) const
+{
+ const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
+ GPU_texture_bind(texture_, texture_image_unit);
+}
+
+void SymmetricSeparableBlurWeights::unbind_as_texture() const
+{
+ GPU_texture_unbind(texture_);
+}
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/intern/context.cc b/source/blender/compositor/realtime_compositor/intern/context.cc
index 924398f6747..0b123a2c271 100644
--- a/source/blender/compositor/realtime_compositor/intern/context.cc
+++ b/source/blender/compositor/realtime_compositor/intern/context.cc
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_context.hh"
+#include "COM_static_cache_manager.hh"
#include "COM_static_shader_manager.hh"
#include "COM_texture_pool.hh"
@@ -32,4 +33,9 @@ StaticShaderManager &Context::shader_manager()
return shader_manager_;
}
+StaticCacheManager &Context::cache_manager()
+{
+ return cache_manager_;
+}
+
} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
index 3743b9bba87..dd585aedec6 100644
--- a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
+++ b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
@@ -96,7 +96,7 @@ ConvertFloatToVectorOperation::ConvertFloatToVectorOperation(Context &context)
void ConvertFloatToVectorOperation::execute_single(const Result &input, Result &output)
{
- output.set_vector_value(float3(input.get_float_value()));
+ output.set_vector_value(float4(float3(input.get_float_value()), 0.0f));
}
GPUShader *ConvertFloatToVectorOperation::get_conversion_shader() const
@@ -175,7 +175,7 @@ ConvertColorToVectorOperation::ConvertColorToVectorOperation(Context &context)
void ConvertColorToVectorOperation::execute_single(const Result &input, Result &output)
{
float4 color = input.get_color_value();
- output.set_vector_value(float3(color));
+ output.set_vector_value(float4(float3(color), 0.0f));
}
GPUShader *ConvertColorToVectorOperation::get_conversion_shader() const
@@ -200,7 +200,7 @@ ConvertVectorToFloatOperation::ConvertVectorToFloatOperation(Context &context)
void ConvertVectorToFloatOperation::execute_single(const Result &input, Result &output)
{
- float3 vector = input.get_vector_value();
+ float4 vector = input.get_vector_value();
output.set_float_value((vector[0] + vector[1] + vector[2]) / 3.0f);
}
@@ -226,7 +226,7 @@ ConvertVectorToColorOperation::ConvertVectorToColorOperation(Context &context)
void ConvertVectorToColorOperation::execute_single(const Result &input, Result &output)
{
- output.set_color_value(float4(input.get_vector_value(), 1.0f));
+ output.set_color_value(float4(float3(input.get_vector_value()), 1.0f));
}
GPUShader *ConvertVectorToColorOperation::get_conversion_shader() const
diff --git a/source/blender/compositor/realtime_compositor/intern/evaluator.cc b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
index 48457bec199..1cd7d4f8951 100644
--- a/source/blender/compositor/realtime_compositor/intern/evaluator.cc
+++ b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
@@ -28,6 +28,7 @@ Evaluator::Evaluator(Context &context, bNodeTree &node_tree)
void Evaluator::evaluate()
{
+ context_.cache_manager().reset();
context_.texture_pool().reset();
if (!is_compiled_) {
diff --git a/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc b/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc
index b3cc86b5f79..99f7cd90557 100644
--- a/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc
+++ b/source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc
@@ -38,7 +38,7 @@ void InputSingleValueOperation::execute()
break;
case ResultType::Vector:
result.set_vector_value(
- float3(bsocket->default_value_typed<bNodeSocketValueVector>()->value));
+ float4(float3(bsocket->default_value_typed<bNodeSocketValueVector>()->value), 0.0f));
break;
case ResultType::Color:
result.set_color_value(float4(bsocket->default_value_typed<bNodeSocketValueRGBA>()->value));
diff --git a/source/blender/compositor/realtime_compositor/intern/result.cc b/source/blender/compositor/realtime_compositor/intern/result.cc
index 8059367d211..d89f1c86167 100644
--- a/source/blender/compositor/realtime_compositor/intern/result.cc
+++ b/source/blender/compositor/realtime_compositor/intern/result.cc
@@ -62,7 +62,7 @@ void Result::allocate_invalid()
set_float_value(0.0f);
break;
case ResultType::Vector:
- set_vector_value(float3(0.0f));
+ set_vector_value(float4(0.0f));
break;
case ResultType::Color:
set_color_value(float4(0.0f));
@@ -125,7 +125,7 @@ float Result::get_float_value() const
return float_value_;
}
-float3 Result::get_vector_value() const
+float4 Result::get_vector_value() const
{
return vector_value_;
}
@@ -143,7 +143,7 @@ float Result::get_float_value_default(float default_value) const
return default_value;
}
-float3 Result::get_vector_value_default(const float3 &default_value) const
+float4 Result::get_vector_value_default(const float4 &default_value) const
{
if (is_single_value()) {
return get_vector_value();
@@ -165,7 +165,7 @@ void Result::set_float_value(float value)
GPU_texture_update(texture_, GPU_DATA_FLOAT, &float_value_);
}
-void Result::set_vector_value(const float3 &value)
+void Result::set_vector_value(const float4 &value)
{
vector_value_ = value;
GPU_texture_update(texture_, GPU_DATA_FLOAT, vector_value_);
diff --git a/source/blender/compositor/realtime_compositor/intern/static_cache_manager.cc b/source/blender/compositor/realtime_compositor/intern/static_cache_manager.cc
new file mode 100644
index 00000000000..da78412a815
--- /dev/null
+++ b/source/blender/compositor/realtime_compositor/intern/static_cache_manager.cc
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <memory>
+
+#include "BLI_math_vec_types.hh"
+
+#include "COM_morphological_distance_feather_weights.hh"
+#include "COM_symmetric_blur_weights.hh"
+#include "COM_symmetric_separable_blur_weights.hh"
+
+#include "COM_static_cache_manager.hh"
+
+namespace blender::realtime_compositor {
+
+/* --------------------------------------------------------------------
+ * Static Cache Manager.
+ */
+
+void StaticCacheManager::reset()
+{
+ /* First, delete all resources that are no longer needed. */
+ symmetric_blur_weights_.remove_if([](auto item) { return !item.value->needed; });
+ symmetric_separable_blur_weights_.remove_if([](auto item) { return !item.value->needed; });
+ morphological_distance_feather_weights_.remove_if([](auto item) { return !item.value->needed; });
+
+ /* Second, reset the needed status of the remaining resources to false to ready them to track
+ * their needed status for the next evaluation. */
+ for (auto &value : symmetric_blur_weights_.values()) {
+ value->needed = false;
+ }
+ for (auto &value : symmetric_separable_blur_weights_.values()) {
+ value->needed = false;
+ }
+ for (auto &value : morphological_distance_feather_weights_.values()) {
+ value->needed = false;
+ }
+}
+
+SymmetricBlurWeights &StaticCacheManager::get_symmetric_blur_weights(int type, float2 radius)
+{
+ const SymmetricBlurWeightsKey key(type, radius);
+
+ auto &weights = *symmetric_blur_weights_.lookup_or_add_cb(
+ key, [&]() { return std::make_unique<SymmetricBlurWeights>(type, radius); });
+
+ weights.needed = true;
+ return weights;
+}
+
+SymmetricSeparableBlurWeights &StaticCacheManager::get_symmetric_separable_blur_weights(
+ int type, float radius)
+{
+ const SymmetricSeparableBlurWeightsKey key(type, radius);
+
+ auto &weights = *symmetric_separable_blur_weights_.lookup_or_add_cb(
+ key, [&]() { return std::make_unique<SymmetricSeparableBlurWeights>(type, radius); });
+
+ weights.needed = true;
+ return weights;
+}
+
+MorphologicalDistanceFeatherWeights &StaticCacheManager::
+ get_morphological_distance_feather_weights(int type, int radius)
+{
+ const MorphologicalDistanceFeatherWeightsKey key(type, radius);
+
+ auto &weights = *morphological_distance_feather_weights_.lookup_or_add_cb(
+ key, [&]() { return std::make_unique<MorphologicalDistanceFeatherWeights>(type, radius); });
+
+ weights.needed = true;
+ return weights;
+}
+
+} // namespace blender::realtime_compositor
diff --git a/source/blender/compositor/realtime_compositor/intern/texture_pool.cc b/source/blender/compositor/realtime_compositor/intern/texture_pool.cc
index 6bf2041e6ba..4b476574d72 100644
--- a/source/blender/compositor/realtime_compositor/intern/texture_pool.cc
+++ b/source/blender/compositor/realtime_compositor/intern/texture_pool.cc
@@ -64,7 +64,7 @@ GPUTexture *TexturePool::acquire_color(int2 size)
GPUTexture *TexturePool::acquire_vector(int2 size)
{
- /* Vectors are stored in RGBA textures because RGB textures have limited support. */
+ /* Vectors are 4D, and are thus stored in RGBA textures. */
return acquire(size, GPU_RGBA16F);
}
diff --git a/source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_alpha_crop.glsl
index d55c8efd4c6..d55c8efd4c6 100644
--- a/source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_alpha_crop.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_bilateral_blur.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_bilateral_blur.glsl
index c7c5ada7a9f..c7c5ada7a9f 100644
--- a/source/blender/gpu/shaders/compositor/compositor_bilateral_blur.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_bilateral_blur.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_blur.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_blur.glsl
index c7ac620f99b..c7ac620f99b 100644
--- a/source/blender/gpu/shaders/compositor/compositor_blur.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_blur.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_blur_variable_size.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_blur_variable_size.glsl
index 9383bbf9825..9383bbf9825 100644
--- a/source/blender/gpu/shaders/compositor/compositor_blur_variable_size.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_blur_variable_size.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_bokeh_image.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_bokeh_image.glsl
index 6e98aa9fe17..6e98aa9fe17 100644
--- a/source/blender/gpu/shaders/compositor/compositor_bokeh_image.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_bokeh_image.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_box_mask.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_box_mask.glsl
index fad23f28fde..fad23f28fde 100644
--- a/source/blender/gpu/shaders/compositor/compositor_box_mask.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_box_mask.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_convert.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_convert.glsl
index 044fb057ca5..044fb057ca5 100644
--- a/source/blender/gpu/shaders/compositor/compositor_convert.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_convert.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_despeckle.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_despeckle.glsl
index e4743d69d17..e4743d69d17 100644
--- a/source/blender/gpu/shaders/compositor/compositor_despeckle.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_despeckle.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_directional_blur.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_directional_blur.glsl
index 1805cb5a7f5..1805cb5a7f5 100644
--- a/source/blender/gpu/shaders/compositor/compositor_directional_blur.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_directional_blur.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_edge_filter.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_edge_filter.glsl
index 67e27c22602..67e27c22602 100644
--- a/source/blender/gpu/shaders/compositor/compositor_edge_filter.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_edge_filter.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_ellipse_mask.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_ellipse_mask.glsl
index 28f725067e0..28f725067e0 100644
--- a/source/blender/gpu/shaders/compositor/compositor_ellipse_mask.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_ellipse_mask.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_filter.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_filter.glsl
index e501c563dda..e501c563dda 100644
--- a/source/blender/gpu/shaders/compositor/compositor_filter.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_filter.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_flip.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_flip.glsl
index 919c454ee63..919c454ee63 100644
--- a/source/blender/gpu/shaders/compositor/compositor_flip.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_flip.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_image_crop.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_image_crop.glsl
index f20e033dee4..f20e033dee4 100644
--- a/source/blender/gpu/shaders/compositor/compositor_image_crop.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_image_crop.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_morphological_distance.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance.glsl
index 09f896b7a9d..09f896b7a9d 100644
--- a/source/blender/gpu/shaders/compositor/compositor_morphological_distance.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_morphological_distance_feather.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_feather.glsl
index acdd8a40342..acdd8a40342 100644
--- a/source/blender/gpu/shaders/compositor/compositor_morphological_distance_feather.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_feather.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_morphological_distance_threshold.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_threshold.glsl
index e6625e7419f..e6625e7419f 100644
--- a/source/blender/gpu/shaders/compositor/compositor_morphological_distance_threshold.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_distance_threshold.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_morphological_step.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_step.glsl
index 6992bc2afa5..6992bc2afa5 100644
--- a/source/blender/gpu/shaders/compositor/compositor_morphological_step.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_morphological_step.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_normalize.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_normalize.glsl
index 53dfeb01730..53dfeb01730 100644
--- a/source/blender/gpu/shaders/compositor/compositor_normalize.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_normalize.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_parallel_reduction.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_parallel_reduction.glsl
index f6f84aa24c1..f6f84aa24c1 100644
--- a/source/blender/gpu/shaders/compositor/compositor_parallel_reduction.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_parallel_reduction.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_projector_lens_distortion.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_projector_lens_distortion.glsl
index ab44dac93e6..ab44dac93e6 100644
--- a/source/blender/gpu/shaders/compositor/compositor_projector_lens_distortion.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_projector_lens_distortion.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_realize_on_domain.glsl
index b8561e5f059..b8561e5f059 100644
--- a/source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_realize_on_domain.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_screen_lens_distortion.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
index dc572ea5aaf..dc572ea5aaf 100644
--- a/source/blender/gpu/shaders/compositor/compositor_screen_lens_distortion.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_set_alpha.glsl
index 7dd40581790..7dd40581790 100644
--- a/source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_set_alpha.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_split_viewer.glsl
index 866b9045da2..866b9045da2 100644
--- a/source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_split_viewer.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_symmetric_blur.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_blur.glsl
index df08991a35c..df08991a35c 100644
--- a/source/blender/gpu/shaders/compositor/compositor_symmetric_blur.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_blur.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_symmetric_separable_blur.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_separable_blur.glsl
index ab0c7baa787..ab0c7baa787 100644
--- a/source/blender/gpu/shaders/compositor/compositor_symmetric_separable_blur.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_symmetric_separable_blur.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_tone_map_photoreceptor.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_photoreceptor.glsl
index 167006585ca..167006585ca 100644
--- a/source/blender/gpu/shaders/compositor/compositor_tone_map_photoreceptor.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_photoreceptor.glsl
diff --git a/source/blender/gpu/shaders/compositor/compositor_tone_map_simple.glsl b/source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_simple.glsl
index ce42d021dd1..ce42d021dd1 100644
--- a/source/blender/gpu/shaders/compositor/compositor_tone_map_simple.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/compositor_tone_map_simple.glsl
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_alpha_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh
index 11f2f329cd8..11f2f329cd8 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_alpha_crop_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_alpha_crop_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_bilateral_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh
index 301cd6acd9e..301cd6acd9e 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_bilateral_blur_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bilateral_blur_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_info.hh
index 36b772aa486..36b772aa486 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_blur_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_blur_variable_size_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_variable_size_info.hh
index 05b6385fd1e..05b6385fd1e 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_blur_variable_size_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_blur_variable_size_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_bokeh_image_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh
index 3541de53070..3541de53070 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_bokeh_image_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_bokeh_image_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_box_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh
index ecb253bbab1..ecb253bbab1 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_box_mask_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_box_mask_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh
index 35e60056736..35e60056736 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_convert_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_despeckle_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh
index df86c3a8258..df86c3a8258 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_despeckle_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_despeckle_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_directional_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh
index bb9199dcd26..bb9199dcd26 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_directional_blur_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_directional_blur_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_edge_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh
index 916ec62bdba..916ec62bdba 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_edge_filter_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_edge_filter_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_ellipse_mask_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh
index 52db91c94e5..52db91c94e5 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_ellipse_mask_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_ellipse_mask_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh
index 9d565cf4b8a..9d565cf4b8a 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_filter_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_flip_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh
index db831518cb7..db831518cb7 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_flip_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_flip_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_image_crop_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh
index e7736744c40..e7736744c40 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_image_crop_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_image_crop_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_feather_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh
index 9f17f60129d..9f17f60129d 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_feather_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_feather_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh
index fc960e119e5..fc960e119e5 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_threshold_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh
index b1d64f61b80..b1d64f61b80 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_distance_threshold_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_step_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh
index e97ffd9feea..e97ffd9feea 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_morphological_step_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_morphological_step_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_normalize_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh
index 02fdc424014..02fdc424014 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_normalize_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_normalize_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh
index e2252b14758..e2252b14758 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_parallel_reduction_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_projector_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh
index 98fe1731703..98fe1731703 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_projector_lens_distortion_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_projector_lens_distortion_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh
index 4528649ae98..4528649ae98 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_realize_on_domain_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_screen_lens_distortion_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh
index c42f2b328d4..c42f2b328d4 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_screen_lens_distortion_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_screen_lens_distortion_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_set_alpha_info.hh
index ca28194e921..ca28194e921 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_set_alpha_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_split_viewer_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_viewer_info.hh
index d5793b0ce59..d5793b0ce59 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_split_viewer_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_split_viewer_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_symmetric_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh
index 8ba2b4e04ef..8ba2b4e04ef 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_symmetric_blur_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_blur_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_symmetric_separable_blur_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh
index 57247dba4b8..57247dba4b8 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_symmetric_separable_blur_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_tone_map_photoreceptor_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh
index a460c9d58a6..a460c9d58a6 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_tone_map_photoreceptor_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_tone_map_simple_info.hh b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh
index 2b220af9460..2b220af9460 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_tone_map_simple_info.hh
+++ b/source/blender/compositor/realtime_compositor/shaders/infos/compositor_tone_map_simple_info.hh
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_alpha_over.glsl
index 8e3e033147f..8e3e033147f 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_alpha_over.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_blur_common.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_blur_common.glsl
index e404c03bbb0..e404c03bbb0 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_blur_common.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_blur_common.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_bright_contrast.glsl
index ce71b4fd8a4..ce71b4fd8a4 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_bright_contrast.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_channel_matte.glsl
index f2dcc9543f2..f2dcc9543f2 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_channel_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_chroma_matte.glsl
index 5d6bea0c9db..5d6bea0c9db 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_chroma_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_balance.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_balance.glsl
index bffb94cdedb..bffb94cdedb 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_balance.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_correction.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_correction.glsl
index 9b4858f03be..9b4858f03be 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_correction.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_matte.glsl
index 038471bc1bc..038471bc1bc 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_spill.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_spill.glsl
index 0adad53ad80..0adad53ad80 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_spill.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_spill.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_to_luminance.glsl
index bcdd625bd4f..bcdd625bd4f 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_color_to_luminance.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_difference_matte.glsl
index d769cadce3c..d769cadce3c 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_difference_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_distance_matte.glsl
index 9beed66826c..9beed66826c 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_distance_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_exposure.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_exposure.glsl
index f246635a91e..f246635a91e 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_exposure.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_exposure.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_gamma.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_gamma.glsl
index 53070d4b0e2..53070d4b0e2 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_gamma.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_gamma.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_correct.glsl
index 99eb125cdf2..99eb125cdf2 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_correct.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_saturation_value.glsl
index dd5eb33d318..dd5eb33d318 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_hue_saturation_value.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_invert.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_invert.glsl
index 59be746da7f..59be746da7f 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_invert.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_invert.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_luminance_matte.glsl
index 3647ac583fe..3647ac583fe 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_luminance_matte.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_main.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_main.glsl
index 27624223dbc..27624223dbc 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_main.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_main.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_map_value.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_map_value.glsl
index 20874b4ef44..20874b4ef44 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_map_value.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_map_value.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_normal.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_normal.glsl
index a2e3b6c4aaa..a2e3b6c4aaa 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_normal.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_normal.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_posterize.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_posterize.glsl
index ee8ae234abe..ee8ae234abe 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_posterize.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_posterize.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_separate_combine.glsl
index d72d2260394..d72d2260394 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_separate_combine.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_set_alpha.glsl
index 95380d1ed0f..95380d1ed0f 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_set_alpha.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_store_output.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_store_output.glsl
index 7fba26907b5..7fba26907b5 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_store_output.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_store_output.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
index 128fc6aeaf5..128fc6aeaf5 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
diff --git a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_type_conversion.glsl
index 75c76fd7341..75c76fd7341 100644
--- a/source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl
+++ b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_type_conversion.glsl
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index 4636011e18b..34df9a537e1 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -191,8 +191,8 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data)
bool is_neg_scale = is_negative_m4(dob->mat);
SET_FLAG_FROM_TEST(data->temp_dupli_object.transflag, is_neg_scale, OB_NEG_SCALE);
- copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
- invert_m4_m4(data->temp_dupli_object.imat, data->temp_dupli_object.obmat);
+ copy_m4_m4(data->temp_dupli_object.object_to_world, dob->mat);
+ invert_m4_m4(data->temp_dupli_object.world_to_object, data->temp_dupli_object.object_to_world);
data->next_object = &data->temp_dupli_object;
BLI_assert(deg::deg_validate_copy_on_write_datablock(&data->temp_dupli_object.id));
return true;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index a5b29ae56a9..62a9158928d 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -284,7 +284,7 @@ void invalidate_tagged_evaluated_transform(ID *id)
switch (id_type) {
case ID_OB: {
Object *object = (Object *)id;
- copy_vn_fl((float *)object->obmat, 16, NAN);
+ copy_vn_fl((float *)object->object_to_world, 16, NAN);
break;
}
default:
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 4010b491141..5902dc18165 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -24,6 +24,8 @@ set(INC
../render
../render/intern
../compositor/realtime_compositor
+ ../compositor/realtime_compositor/algorithms
+ ../compositor/realtime_compositor/cached_resources
../windowmanager
../../../intern/atomic
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index eee6a5a7cb5..05e62764bb1 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -182,7 +182,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
}
}
- const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool do_cull = (draw_ctx->v3d &&
(draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING));
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 9bf0cce2af2..26a264c1716 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -142,7 +142,7 @@ typedef struct EEVEE_LightBake {
struct GPUTexture *dummy_layer_color;
int total, done; /* to compute progress */
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
/** For only handling the resources. */
@@ -778,7 +778,7 @@ wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm,
}
if (old_lbake->stop != NULL) {
- *old_lbake->stop = 1;
+ *old_lbake->stop = true;
}
BLI_mutex_unlock(old_lbake->mutex);
}
@@ -1359,13 +1359,13 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake,
DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake);
lbake->done += 1;
*lbake->progress = lbake->done / (float)lbake->total;
- *lbake->do_update = 1;
+ *lbake->do_update = true;
eevee_lightbake_context_disable(lbake);
return true;
}
-void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress)
+void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress)
{
EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data;
Depsgraph *depsgraph = lbake->depsgraph;
@@ -1394,8 +1394,8 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
/* Resource allocation can fail. Early exit in this case. */
if (lbake->lcache->flag & LIGHTCACHE_INVALID) {
- *lbake->stop = 1;
- *lbake->do_update = 1;
+ *lbake->stop = true;
+ *lbake->do_update = true;
lbake->lcache->flag &= ~LIGHTCACHE_BAKING;
eevee_lightbake_context_disable(lbake);
eevee_lightbake_delete_resources(lbake);
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h
index 4e94e1914a7..73961f1919d 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.h
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.h
@@ -42,7 +42,7 @@ void *EEVEE_lightbake_job_data_alloc(struct Main *bmain,
int frame);
void EEVEE_lightbake_job_data_free(void *custom_data);
void EEVEE_lightbake_update(void *custom_data);
-void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress);
+void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress);
/**
* This is to update the world irradiance and reflection contribution from
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 942ab5502c7..eb111610706 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -403,7 +403,7 @@ static bool eevee_lightprobes_culling_test(Object *ob)
const float max[3] = {1.0f, 1.0f, 1.0f};
BKE_boundbox_init_from_minmax(&bbox, min, max);
- copy_m4_m4(tmp, ob->obmat);
+ copy_m4_m4(tmp, ob->object_to_world);
normalize_v3(tmp[2]);
mul_v3_fl(tmp[2], probe->distinf);
@@ -445,7 +445,7 @@ void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata
/* Debug Display */
DRWCallBuffer *grp = vedata->stl->g_data->planar_display_shgrp;
if (grp && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
- DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->obmat);
+ DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->object_to_world);
}
pinfo->num_planar++;
@@ -488,30 +488,30 @@ void EEVEE_lightprobes_grid_data_from_object(Object *ob, EEVEE_LightGrid *egrid,
mul_v3_v3fl(half_cell_dim, cell_dim, 0.5f);
/* Matrix converting world space to cell ranges. */
- invert_m4_m4(egrid->mat, ob->obmat);
+ invert_m4_m4(egrid->mat, ob->object_to_world);
/* First cell. */
copy_v3_fl(egrid->corner, -1.0f);
add_v3_v3(egrid->corner, half_cell_dim);
- mul_m4_v3(ob->obmat, egrid->corner);
+ mul_m4_v3(ob->object_to_world, egrid->corner);
/* Opposite neighbor cell. */
copy_v3_fl3(egrid->increment_x, cell_dim[0], 0.0f, 0.0f);
add_v3_v3(egrid->increment_x, half_cell_dim);
add_v3_fl(egrid->increment_x, -1.0f);
- mul_m4_v3(ob->obmat, egrid->increment_x);
+ mul_m4_v3(ob->object_to_world, egrid->increment_x);
sub_v3_v3(egrid->increment_x, egrid->corner);
copy_v3_fl3(egrid->increment_y, 0.0f, cell_dim[1], 0.0f);
add_v3_v3(egrid->increment_y, half_cell_dim);
add_v3_fl(egrid->increment_y, -1.0f);
- mul_m4_v3(ob->obmat, egrid->increment_y);
+ mul_m4_v3(ob->object_to_world, egrid->increment_y);
sub_v3_v3(egrid->increment_y, egrid->corner);
copy_v3_fl3(egrid->increment_z, 0.0f, 0.0f, cell_dim[2]);
add_v3_v3(egrid->increment_z, half_cell_dim);
add_v3_fl(egrid->increment_z, -1.0f);
- mul_m4_v3(ob->obmat, egrid->increment_z);
+ mul_m4_v3(ob->object_to_world, egrid->increment_z);
sub_v3_v3(egrid->increment_z, egrid->corner);
/* Visibility bias */
@@ -527,7 +527,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob
LightProbe *probe = (LightProbe *)ob->data;
/* Update transforms */
- copy_v3_v3(eprobe->position, ob->obmat[3]);
+ copy_v3_v3(eprobe->position, ob->object_to_world[3]);
/* Attenuation */
eprobe->attenuation_type = probe->attenuation_type;
@@ -535,7 +535,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob
unit_m4(eprobe->attenuationmat);
scale_m4_fl(eprobe->attenuationmat, probe->distinf);
- mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat);
+ mul_m4_m4m4(eprobe->attenuationmat, ob->object_to_world, eprobe->attenuationmat);
invert_m4(eprobe->attenuationmat);
/* Parallax */
@@ -550,7 +550,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob
scale_m4_fl(eprobe->parallaxmat, probe->distinf);
}
- mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat);
+ mul_m4_m4m4(eprobe->parallaxmat, ob->object_to_world, eprobe->parallaxmat);
invert_m4(eprobe->parallaxmat);
}
@@ -566,8 +566,8 @@ void EEVEE_lightprobes_planar_data_from_object(Object *ob,
vis_test->cached = false;
/* Computing mtx : matrix that mirror position around object's XY plane. */
- normalize_m4_m4(normat, ob->obmat); /* object > world */
- invert_m4_m4(imat, normat); /* world > object */
+ normalize_m4_m4(normat, ob->object_to_world); /* object > world */
+ invert_m4_m4(imat, normat); /* world > object */
/* XY reflection plane */
imat[0][2] = -imat[0][2];
imat[1][2] = -imat[1][2];
@@ -576,38 +576,38 @@ void EEVEE_lightprobes_planar_data_from_object(Object *ob,
mul_m4_m4m4(eplanar->mtx, normat, imat); /* world > object > mirrored obj > world */
/* Compute clip plane equation / normal. */
- copy_v3_v3(eplanar->plane_equation, ob->obmat[2]);
+ copy_v3_v3(eplanar->plane_equation, ob->object_to_world[2]);
normalize_v3(eplanar->plane_equation); /* plane normal */
- eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->obmat[3]);
+ eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->object_to_world[3]);
eplanar->clipsta = probe->clipsta;
/* Compute XY clip planes. */
- normalize_v3_v3(eplanar->clip_vec_x, ob->obmat[0]);
- normalize_v3_v3(eplanar->clip_vec_y, ob->obmat[1]);
+ normalize_v3_v3(eplanar->clip_vec_x, ob->object_to_world[0]);
+ normalize_v3_v3(eplanar->clip_vec_y, ob->object_to_world[1]);
float vec[3] = {0.0f, 0.0f, 0.0f};
vec[0] = 1.0f;
vec[1] = 0.0f;
vec[2] = 0.0f;
- mul_m4_v3(ob->obmat, vec); /* Point on the edge */
+ mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */
eplanar->clip_edge_x_pos = dot_v3v3(eplanar->clip_vec_x, vec);
vec[0] = 0.0f;
vec[1] = 1.0f;
vec[2] = 0.0f;
- mul_m4_v3(ob->obmat, vec); /* Point on the edge */
+ mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */
eplanar->clip_edge_y_pos = dot_v3v3(eplanar->clip_vec_y, vec);
vec[0] = -1.0f;
vec[1] = 0.0f;
vec[2] = 0.0f;
- mul_m4_v3(ob->obmat, vec); /* Point on the edge */
+ mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */
eplanar->clip_edge_x_neg = dot_v3v3(eplanar->clip_vec_x, vec);
vec[0] = 0.0f;
vec[1] = -1.0f;
vec[2] = 0.0f;
- mul_m4_v3(ob->obmat, vec); /* Point on the edge */
+ mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */
eplanar->clip_edge_y_neg = dot_v3v3(eplanar->clip_vec_y, vec);
/* Facing factors */
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index 312305a31f7..f8250f9520d 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -132,7 +132,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
const float light_threshold = draw_ctx->scene->eevee.light_threshold;
/* Position */
- copy_v3_v3(evli->position, ob->obmat[3]);
+ copy_v3_v3(evli->position, ob->object_to_world[3]);
/* Color */
copy_v3_v3(evli->color, &la->r);
@@ -153,7 +153,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
evli->invsqrdist_volume = 1.0f / max_ff(1e-4f, square_f(att_radius_volume));
/* Vectors */
- normalize_m4_m4_ex(mat, ob->obmat, scale);
+ normalize_m4_m4_ex(mat, ob->object_to_world, scale);
copy_v3_v3(evli->forwardvec, mat[2]);
normalize_v3(evli->forwardvec);
negate_v3(evli->forwardvec);
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 068b18f1117..b134d7f6dc6 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -810,7 +810,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
if (ob->sculpt && ob->sculpt->pbvh) {
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index a3ca19c88e1..9f7fb1c154c 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -292,7 +292,7 @@ void EEVEE_motion_blur_curves_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata)
int mb_step = effects->motion_blur_step;
/* Store transform. */
- copy_m4_m4(mb_data->obmat[mb_step], ob->obmat);
+ copy_m4_m4(mb_data->obmat[mb_step], ob->object_to_world);
EEVEE_HairMotionData *mb_curves = EEVEE_motion_blur_curves_data_get(mb_data);
@@ -362,7 +362,7 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
if (mb_data) {
int mb_step = effects->motion_blur_step;
/* Store transform. */
- copy_m4_m4(mb_data->obmat[mb_step], ob->obmat);
+ copy_m4_m4(mb_data->obmat[mb_step], ob->object_to_world);
EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get(mb_data);
diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c
index 9e571b1d15b..1cf3c7c6da1 100644
--- a/source/blender/draw/engines/eevee/eevee_shadows.c
+++ b/source/blender/draw/engines/eevee/eevee_shadows.c
@@ -153,7 +153,7 @@ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
for (int i = 0; i < 8; i++) {
float vec[3];
copy_v3_v3(vec, bb->vec[i]);
- mul_m4_v3(ob->obmat, vec);
+ mul_m4_v3(ob->object_to_world, vec);
minmax_v3v3_v3(min, max, vec);
}
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c
index 05b2bafdb3a..872696a8b7c 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -299,7 +299,7 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata,
}
float size[3];
- mat4_to_size(size, ob->obmat);
+ mat4_to_size(size, ob->object_to_world);
/* Check if any of the axes have 0 length. (see T69070) */
const float epsilon = 1e-8f;
if ((size[0] < epsilon) || (size[1] < epsilon) || (size[2] < epsilon)) {
diff --git a/source/blender/draw/engines/eevee_next/eevee_light.cc b/source/blender/draw/engines/eevee_next/eevee_light.cc
index 8a5de15229d..aa8268dbaa7 100644
--- a/source/blender/draw/engines/eevee_next/eevee_light.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_light.cc
@@ -58,7 +58,7 @@ void Light::sync(/* ShadowModule &shadows , */ const Object *ob, float threshold
this->influence_radius_invsqr_volume = 1.0f / square_f(max_ff(influence_radius_volume, 1e-8f));
this->color = float3(&la->r) * la->energy;
- normalize_m4_m4_ex(this->object_mat.ptr(), ob->obmat, scale);
+ normalize_m4_m4_ex(this->object_mat.ptr(), ob->object_to_world, scale);
/* Make sure we have consistent handedness (in case of negatively scaled Z axis). */
float3 cross = math::cross(float3(this->_right), float3(this->_up));
if (math::dot(cross, float3(this->_back)) < 0.0f) {
diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
index e6b37b4ad47..0242f732f27 100644
--- a/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.cc
@@ -182,7 +182,7 @@ PassMain::Sub *ForwardPipeline::prepass_transparent_add(const Object *ob,
if (blender_mat->blend_flag & MA_BL_CULL_BACKFACE) {
state |= DRW_STATE_CULL_BACK;
}
- float sorting_value = math::dot(float3(ob->obmat[3]), camera_forward_);
+ float sorting_value = math::dot(float3(ob->object_to_world[3]), camera_forward_);
PassMain::Sub *pass = &transparent_ps_.sub(GPU_material_get_name(gpumat), sorting_value);
pass->state_set(state);
pass->material_set(*inst_.manager, gpumat);
@@ -197,7 +197,7 @@ PassMain::Sub *ForwardPipeline::material_transparent_add(const Object *ob,
if (blender_mat->blend_flag & MA_BL_CULL_BACKFACE) {
state |= DRW_STATE_CULL_BACK;
}
- float sorting_value = math::dot(float3(ob->obmat[3]), camera_forward_);
+ float sorting_value = math::dot(float3(ob->object_to_world[3]), camera_forward_);
PassMain::Sub *pass = &transparent_ps_.sub(GPU_material_get_name(gpumat), sorting_value);
pass->state_set(state);
pass->material_set(*inst_.manager, gpumat);
diff --git a/source/blender/draw/engines/eevee_next/eevee_velocity.cc b/source/blender/draw/engines/eevee_next/eevee_velocity.cc
index b9a78e8547e..52401c8003e 100644
--- a/source/blender/draw/engines/eevee_next/eevee_velocity.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_velocity.cc
@@ -106,16 +106,16 @@ bool VelocityModule::step_object_sync(Object *ob,
vel.obj.ofs[step_] = object_steps_usage[step_]++;
vel.obj.resource_id = resource_handle.resource_index();
vel.id = (ID *)ob->data;
- object_steps[step_]->get_or_resize(vel.obj.ofs[step_]) = ob->obmat;
+ object_steps[step_]->get_or_resize(vel.obj.ofs[step_]) = ob->object_to_world;
if (step_ == STEP_CURRENT) {
/* Replace invalid steps. Can happen if object was hidden in one of those steps. */
if (vel.obj.ofs[STEP_PREVIOUS] == -1) {
vel.obj.ofs[STEP_PREVIOUS] = object_steps_usage[STEP_PREVIOUS]++;
- object_steps[STEP_PREVIOUS]->get_or_resize(vel.obj.ofs[STEP_PREVIOUS]) = ob->obmat;
+ object_steps[STEP_PREVIOUS]->get_or_resize(vel.obj.ofs[STEP_PREVIOUS]) = ob->object_to_world;
}
if (vel.obj.ofs[STEP_NEXT] == -1) {
vel.obj.ofs[STEP_NEXT] = object_steps_usage[STEP_NEXT]++;
- object_steps[STEP_NEXT]->get_or_resize(vel.obj.ofs[STEP_NEXT]) = ob->obmat;
+ object_steps[STEP_NEXT]->get_or_resize(vel.obj.ofs[STEP_NEXT]) = ob->object_to_world;
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index a41918e7e0d..06bf531cded 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -39,9 +39,9 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
tgp_ob->layers.first = tgp_ob->layers.last = NULL;
tgp_ob->vfx.first = tgp_ob->vfx.last = NULL;
- tgp_ob->camera_z = dot_v3v3(pd->camera_z_axis, ob->obmat[3]);
+ tgp_ob->camera_z = dot_v3v3(pd->camera_z_axis, ob->object_to_world[3]);
tgp_ob->is_drawmode3d = (gpd->draw_mode == GP_DRAWMODE_3D) || pd->draw_depth_only;
- tgp_ob->object_scale = mat4_to_scale(ob->obmat);
+ tgp_ob->object_scale = mat4_to_scale(ob->object_to_world);
/* Check if any material with holdout flag enabled. */
tgp_ob->do_mat_holdout = false;
@@ -71,7 +71,7 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
add_v3_fl(size, 1e-8f);
rescale_m4(mat, size);
/* BBox space to World. */
- mul_m4_m4m4(mat, ob->obmat, mat);
+ mul_m4_m4m4(mat, ob->object_to_world, mat);
if (DRW_view_is_persp_get(NULL)) {
/* BBox center to camera vector. */
sub_v3_v3v3(tgp_ob->plane_normal, pd->camera_pos, mat[3]);
@@ -96,9 +96,9 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
unit_m4(tgp_ob->plane_mat);
copy_v3_v3(tgp_ob->plane_mat[2], tgp_ob->plane_normal);
orthogonalize_m4(tgp_ob->plane_mat, 2);
- mul_mat3_m4_v3(ob->obmat, size);
+ mul_mat3_m4_v3(ob->object_to_world, size);
float radius = len_v3(size);
- mul_m4_v3(ob->obmat, center);
+ mul_m4_v3(ob->object_to_world, center);
rescale_m4(tgp_ob->plane_mat, (float[3]){radius, radius, radius});
copy_v3_v3(tgp_ob->plane_mat[3], center);
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index e54ac99a888..1ebf3982a12 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -380,27 +380,27 @@ void gpencil_light_pool_populate(GPENCIL_LightPool *lightpool, Object *ob)
float(*mat)[4] = (float(*)[4])gp_light->right;
if (la->type == LA_SPOT) {
- copy_m4_m4(mat, ob->imat);
+ copy_m4_m4(mat, ob->world_to_object);
gp_light->type = GP_LIGHT_TYPE_SPOT;
gp_light->spot_size = cosf(la->spotsize * 0.5f);
gp_light->spot_blend = (1.0f - gp_light->spot_size) * la->spotblend;
}
else if (la->type == LA_AREA) {
/* Simulate area lights using a spot light. */
- normalize_m4_m4(mat, ob->obmat);
+ normalize_m4_m4(mat, ob->object_to_world);
invert_m4(mat);
gp_light->type = GP_LIGHT_TYPE_SPOT;
gp_light->spot_size = cosf(M_PI_2);
gp_light->spot_blend = (1.0f - gp_light->spot_size) * 1.0f;
}
else if (la->type == LA_SUN) {
- normalize_v3_v3(gp_light->forward, ob->obmat[2]);
+ normalize_v3_v3(gp_light->forward, ob->object_to_world[2]);
gp_light->type = GP_LIGHT_TYPE_SUN;
}
else {
gp_light->type = GP_LIGHT_TYPE_POINT;
}
- copy_v4_v4(gp_light->position, ob->obmat[3]);
+ copy_v4_v4(gp_light->position, ob->object_to_world[3]);
copy_v3_v3(gp_light->color, &la->r);
mul_v3_fl(gp_light->color, la->energy * light_power_get(la));
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index a7d8570dbaa..9b1129e77be 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -96,7 +96,7 @@ static void gpencil_vfx_blur(BlurShaderFxData *fx, Object *ob, gpIterVfxData *it
float winmat[4][4], persmat[4][4];
float blur_size[2] = {fx->radius[0], fx->radius[1]};
DRW_view_persmat_get(NULL, persmat, false);
- const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->obmat[3]));
+ const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->object_to_world[3]));
if (fx->flag & FX_BLUR_DOF_MODE) {
/* Compute circle of confusion size. */
@@ -108,7 +108,7 @@ static void gpencil_vfx_blur(BlurShaderFxData *fx, Object *ob, gpIterVfxData *it
DRW_view_winmat_get(NULL, winmat, false);
const float *vp_size = DRW_viewport_size_get();
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(ob->obmat);
+ float scale = mat4_to_scale(ob->object_to_world);
float distance_factor = world_pixel_scale * scale * winmat[1][1] * vp_size[1] / w;
mul_v2_fl(blur_size, distance_factor);
}
@@ -175,11 +175,11 @@ static void gpencil_vfx_rim(RimShaderFxData *fx, Object *ob, gpIterVfxData *iter
const float *vp_size = DRW_viewport_size_get();
const float *vp_size_inv = DRW_viewport_invert_size_get();
- const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->obmat[3]));
+ const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->object_to_world[3]));
/* Modify by distance to camera and object scale. */
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(ob->obmat);
+ float scale = mat4_to_scale(ob->object_to_world);
float distance_factor = (world_pixel_scale * scale * winmat[1][1] * vp_size[1]) / w;
mul_v2_fl(offset, distance_factor);
mul_v2_v2(offset, vp_size_inv);
@@ -248,8 +248,8 @@ static void gpencil_vfx_pixelize(PixelShaderFxData *fx, Object *ob, gpIterVfxDat
mul_v2_v2(pixel_size, vp_size_inv);
/* Fixed pixelisation center from object center. */
- const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->obmat[3]));
- mul_v3_m4v3(ob_center, persmat, ob->obmat[3]);
+ const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->object_to_world[3]));
+ mul_v3_m4v3(ob_center, persmat, ob->object_to_world[3]);
mul_v3_fl(ob_center, 1.0f / w);
const bool use_antialiasing = ((fx->flag & FX_PIXEL_FILTER_NEAREST) == 0);
@@ -260,7 +260,7 @@ static void gpencil_vfx_pixelize(PixelShaderFxData *fx, Object *ob, gpIterVfxDat
/* Modify by distance to camera and object scale. */
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(ob->obmat);
+ float scale = mat4_to_scale(ob->object_to_world);
mul_v2_fl(pixel_size, (world_pixel_scale * scale * winmat[1][1] * vp_size[1]) / w);
/* Center to texel */
@@ -310,7 +310,9 @@ static void gpencil_vfx_shadow(ShadowShaderFxData *fx, Object *ob, gpIterVfxData
const float *vp_size_inv = DRW_viewport_invert_size_get();
const float ratio = vp_size_inv[1] / vp_size_inv[0];
- copy_v3_v3(rot_center, (use_obj_pivot && fx->object) ? fx->object->obmat[3] : ob->obmat[3]);
+ copy_v3_v3(rot_center,
+ (use_obj_pivot && fx->object) ? fx->object->object_to_world[3] :
+ ob->object_to_world[3]);
const float w = fabsf(mul_project_m4_v3_zfac(persmat, rot_center));
mul_v3_m4v3(rot_center, persmat, rot_center);
@@ -318,7 +320,7 @@ static void gpencil_vfx_shadow(ShadowShaderFxData *fx, Object *ob, gpIterVfxData
/* Modify by distance to camera and object scale. */
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(ob->obmat);
+ float scale = mat4_to_scale(ob->object_to_world);
float distance_factor = (world_pixel_scale * scale * winmat[1][1] * vp_size[1]) / w;
mul_v2_fl(offset, distance_factor);
mul_v2_v2(offset, vp_size_inv);
@@ -485,13 +487,13 @@ static void gpencil_vfx_wave(WaveShaderFxData *fx, Object *ob, gpIterVfxData *it
const float *vp_size = DRW_viewport_size_get();
const float *vp_size_inv = DRW_viewport_invert_size_get();
- const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->obmat[3]));
- mul_v3_m4v3(wave_center, persmat, ob->obmat[3]);
+ const float w = fabsf(mul_project_m4_v3_zfac(persmat, ob->object_to_world[3]));
+ mul_v3_m4v3(wave_center, persmat, ob->object_to_world[3]);
mul_v3_fl(wave_center, 1.0f / w);
/* Modify by distance to camera and object scale. */
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(ob->obmat);
+ float scale = mat4_to_scale(ob->object_to_world);
float distance_factor = (world_pixel_scale * scale * winmat[1][1] * vp_size[1]) / w;
wave_center[0] = wave_center[0] * 0.5f + 0.5f;
@@ -542,7 +544,7 @@ static void gpencil_vfx_swirl(SwirlShaderFxData *fx, Object *UNUSED(ob), gpIterV
DRW_view_persmat_get(NULL, persmat, false);
const float *vp_size = DRW_viewport_size_get();
- copy_v3_v3(swirl_center, fx->object->obmat[3]);
+ copy_v3_v3(swirl_center, fx->object->object_to_world[3]);
const float w = fabsf(mul_project_m4_v3_zfac(persmat, swirl_center));
mul_v3_m4v3(swirl_center, persmat, swirl_center);
@@ -550,7 +552,7 @@ static void gpencil_vfx_swirl(SwirlShaderFxData *fx, Object *UNUSED(ob), gpIterV
/* Modify by distance to camera and object scale. */
float world_pixel_scale = 1.0f / GPENCIL_PIXEL_FACTOR;
- float scale = mat4_to_scale(fx->object->obmat);
+ float scale = mat4_to_scale(fx->object->object_to_world);
float distance_factor = (world_pixel_scale * scale * winmat[1][1] * vp_size[1]) / w;
mul_v2_fl(swirl_center, 0.5f);
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index 9b1db09ab3c..2e7544cea29 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -71,7 +71,7 @@ void main()
/* Use the index of the point as depth.
* This means the stroke can overlap itself. */
float point_index = float(ma1.z);
- gp_interp.depth = (point_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
+ gp_interp.depth = (point_index + gpStrokeIndexOffset + 2.0) * 0.0000002;
}
else {
/* Use the index of first point of the stroke as depth.
@@ -80,12 +80,12 @@ void main()
* We offset by one so that the fill can be overlapped by its stroke.
* The offset is ok since we pad the strokes data because of adjacency infos. */
float stroke_index = float(ma1.y);
- gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
+ gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 2.0) * 0.0000002;
}
}
else {
int stroke_point_id = gpencil_stroke_point_id();
- vec4 uv1 = texelFetch(gp_col_tx, stroke_point_id * 2 + 2);
+ vec4 uv1 = texelFetch(gp_pos_tx, stroke_point_id * 3 + 2);
vec4 fcol1 = texelFetch(gp_col_tx, stroke_point_id * 2 + 1);
vec4 fill_col = gp_mat.fill_color;
@@ -128,7 +128,7 @@ void main()
else {
/* Use the index of first point of the stroke as depth. */
float stroke_index = float(ma1.y);
- gp_interp.depth = (stroke_index + gpStrokeIndexOffset) * 0.0000002;
+ gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
}
}
}
diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc
index 0cf9d91804a..8c9587e7a9a 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.cc
+++ b/source/blender/draw/engines/overlay/overlay_armature.cc
@@ -441,7 +441,7 @@ static void drw_shgroup_bone_octahedral(ArmatureDrawContext *ctx,
const float outline_color[4])
{
BoneInstanceData inst_data;
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
if (ctx->solid) {
OVERLAY_bone_instance_data_set_color(&inst_data, bone_color);
OVERLAY_bone_instance_data_set_color_hint(&inst_data, hint_color);
@@ -461,7 +461,7 @@ static void drw_shgroup_bone_box(ArmatureDrawContext *ctx,
const float outline_color[4])
{
BoneInstanceData inst_data;
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
if (ctx->solid) {
OVERLAY_bone_instance_data_set_color(&inst_data, bone_color);
OVERLAY_bone_instance_data_set_color_hint(&inst_data, hint_color);
@@ -479,9 +479,9 @@ static void drw_shgroup_bone_wire(ArmatureDrawContext *ctx,
const float color[4])
{
float head[3], tail[3];
- mul_v3_m4v3(head, ctx->ob->obmat, bone_mat[3]);
+ mul_v3_m4v3(head, ctx->ob->object_to_world, bone_mat[3]);
add_v3_v3v3(tail, bone_mat[3], bone_mat[1]);
- mul_m4_v3(ctx->ob->obmat, tail);
+ mul_m4_v3(ctx->ob->object_to_world, tail);
DRW_buffer_add_entry(ctx->wire, head, color);
DRW_buffer_add_entry(ctx->wire, tail, color);
@@ -496,9 +496,9 @@ static void drw_shgroup_bone_stick(ArmatureDrawContext *ctx,
const float col_tail[4])
{
float head[3], tail[3];
- mul_v3_m4v3(head, ctx->ob->obmat, bone_mat[3]);
+ mul_v3_m4v3(head, ctx->ob->object_to_world, bone_mat[3]);
add_v3_v3v3(tail, bone_mat[3], bone_mat[1]);
- mul_m4_v3(ctx->ob->obmat, tail);
+ mul_m4_v3(ctx->ob->object_to_world, tail);
DRW_buffer_add_entry(ctx->stick, head, tail, col_wire, col_bone, col_head, col_tail);
}
@@ -517,11 +517,11 @@ static void drw_shgroup_bone_envelope_distance(ArmatureDrawContext *ctx,
mul_m4_v4(bone_mat, head_sph);
mul_m4_v4(bone_mat, tail_sph);
mul_m4_v4(bone_mat, xaxis);
- mul_m4_v4(ctx->ob->obmat, head_sph);
- mul_m4_v4(ctx->ob->obmat, tail_sph);
- mul_m4_v4(ctx->ob->obmat, xaxis);
+ mul_m4_v4(ctx->ob->object_to_world, head_sph);
+ mul_m4_v4(ctx->ob->object_to_world, tail_sph);
+ mul_m4_v4(ctx->ob->object_to_world, xaxis);
sub_v3_v3(xaxis, head_sph);
- float obscale = mat4_to_scale(ctx->ob->obmat);
+ float obscale = mat4_to_scale(ctx->ob->object_to_world);
head_sph[3] = *radius_head * obscale;
head_sph[3] += *distance * obscale;
tail_sph[3] = *radius_tail * obscale;
@@ -544,10 +544,10 @@ static void drw_shgroup_bone_envelope(ArmatureDrawContext *ctx,
mul_m4_v4(bone_mat, head_sph);
mul_m4_v4(bone_mat, tail_sph);
mul_m4_v4(bone_mat, xaxis);
- mul_m4_v4(ctx->ob->obmat, head_sph);
- mul_m4_v4(ctx->ob->obmat, tail_sph);
- mul_m4_v4(ctx->ob->obmat, xaxis);
- float obscale = mat4_to_scale(ctx->ob->obmat);
+ mul_m4_v4(ctx->ob->object_to_world, head_sph);
+ mul_m4_v4(ctx->ob->object_to_world, tail_sph);
+ mul_m4_v4(ctx->ob->object_to_world, xaxis);
+ float obscale = mat4_to_scale(ctx->ob->object_to_world);
head_sph[3] = *radius_head * obscale;
tail_sph[3] = *radius_tail * obscale;
@@ -651,7 +651,7 @@ static void drw_shgroup_bone_custom_solid_mesh(ArmatureDrawContext *ctx,
DRWCallBuffer *buf;
if (surf || edges || ledges) {
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
}
if (surf && ctx->custom_solid) {
@@ -692,7 +692,7 @@ static void drw_shgroup_bone_custom_mesh_wire(ArmatureDrawContext *ctx,
if (geom) {
DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, geom);
BoneInstanceData inst_data;
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
OVERLAY_bone_instance_data_set_color_hint(&inst_data, color);
OVERLAY_bone_instance_data_set_color(&inst_data, color);
DRW_buffer_add_entry_struct(buf, inst_data.mat);
@@ -724,7 +724,7 @@ static void drw_shgroup_custom_bone_curve(ArmatureDrawContext *ctx,
if (ledges) {
BoneInstanceData inst_data;
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, ledges);
OVERLAY_bone_instance_data_set_color_hint(&inst_data, outline_color);
@@ -785,7 +785,7 @@ static void drw_shgroup_bone_custom_empty(ArmatureDrawContext *ctx,
{
const float final_color[4] = {color[0], color[1], color[2], 1.0f};
float mat[4][4];
- mul_m4_m4m4(mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(mat, ctx->ob->object_to_world, bone_mat);
switch (custom->empty_drawtype) {
case OB_PLAINAXES:
@@ -811,7 +811,7 @@ static void drw_shgroup_bone_point(ArmatureDrawContext *ctx,
const float outline_color[4])
{
BoneInstanceData inst_data;
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, bone_mat);
if (ctx->point_solid) {
OVERLAY_bone_instance_data_set_color(&inst_data, bone_color);
OVERLAY_bone_instance_data_set_color_hint(&inst_data, hint_color);
@@ -829,7 +829,7 @@ static void drw_shgroup_bone_axes(ArmatureDrawContext *ctx,
const float color[4])
{
float mat[4][4];
- mul_m4_m4m4(mat, ctx->ob->obmat, bone_mat);
+ mul_m4_m4m4(mat, ctx->ob->object_to_world, bone_mat);
/* Move to bone tail. */
add_v3_v3(mat[3], mat[1]);
OVERLAY_empty_shape(ctx->extras, mat, 0.25f, OB_ARROWS, color);
@@ -842,8 +842,8 @@ static void drw_shgroup_bone_relationship_lines_ex(ArmatureDrawContext *ctx,
const float color[4])
{
float s[3], e[3];
- mul_v3_m4v3(s, ctx->ob->obmat, start);
- mul_v3_m4v3(e, ctx->ob->obmat, end);
+ mul_v3_m4v3(s, ctx->ob->object_to_world, start);
+ mul_v3_m4v3(e, ctx->ob->object_to_world, end);
/* reverse order to have less stipple overlap */
OVERLAY_extra_line_dashed(ctx->extras, s, e, color);
}
@@ -1909,7 +1909,7 @@ static void draw_bone_degrees_of_freedom(ArmatureDrawContext *ctx, bPoseChannel
mul_m4_m4m4(posetrans, posetrans, tmp);
/* into world space. */
- mul_m4_m4m4(inst_data.mat, ctx->ob->obmat, posetrans);
+ mul_m4_m4m4(inst_data.mat, ctx->ob->object_to_world, posetrans);
if ((pchan->ikflag & BONE_IK_XLIMIT) && (pchan->ikflag & BONE_IK_ZLIMIT)) {
bone_instance_data_set_angle_minmax(
@@ -2079,7 +2079,7 @@ static void draw_bone_name(ArmatureDrawContext *ctx,
float *head = pchan ? pchan->pose_head : eBone->head;
float *tail = pchan ? pchan->pose_tail : eBone->tail;
mid_v3_v3v3(vec, head, tail);
- mul_m4_v3(ctx->ob->obmat, vec);
+ mul_m4_v3(ctx->ob->object_to_world, vec);
DRW_text_cache_add(dt,
vec,
@@ -2177,7 +2177,8 @@ static bool pchan_culling_test_envelope(const DRWView *view,
BoundSphere bsphere;
pchan_culling_calc_bsphere(ob, pchan, &bsphere);
bsphere.radius += max_ff(pchan->bone->rad_head, pchan->bone->rad_tail) *
- mat4_to_size_max_axis(ob->obmat) * mat4_to_size_max_axis(pchan->disp_mat);
+ mat4_to_size_max_axis(ob->object_to_world) *
+ mat4_to_size_max_axis(pchan->disp_mat);
return DRW_culling_sphere_test(view, &bsphere);
}
@@ -2188,13 +2189,13 @@ static bool pchan_culling_test_bbone(const DRWView *view,
const bArmature *arm = static_cast<bArmature *>(ob->data);
BLI_assert(arm->drawtype == ARM_B_BONE);
UNUSED_VARS_NDEBUG(arm);
- const float ob_scale = mat4_to_size_max_axis(ob->obmat);
+ const float ob_scale = mat4_to_size_max_axis(ob->object_to_world);
const Mat4 *bbones_mat = (const Mat4 *)pchan->draw_data->bbone_matrix;
for (int i = pchan->bone->segments; i--; bbones_mat++) {
BoundSphere bsphere;
float size[3];
mat4_to_size(size, bbones_mat->mat);
- mul_v3_m4v3(bsphere.center, ob->obmat, bbones_mat->mat[3]);
+ mul_v3_m4v3(bsphere.center, ob->object_to_world, bbones_mat->mat[3]);
bsphere.radius = len_v3(size) * ob_scale;
if (DRW_culling_sphere_test(view, &bsphere)) {
return true;
diff --git a/source/blender/draw/engines/overlay/overlay_edit_text.cc b/source/blender/draw/engines/overlay/overlay_edit_text.cc
index ebadaa530e4..d1bca705ae6 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_text.cc
+++ b/source/blender/draw/engines/overlay/overlay_edit_text.cc
@@ -119,7 +119,7 @@ static void edit_text_cache_populate_select(OVERLAY_Data *vedata, Object *ob)
add_v2_v2(box[3], &sb->x);
}
v2_quad_corners_to_mat4(box, final_mat);
- mul_m4_m4m4(final_mat, ob->obmat, final_mat);
+ mul_m4_m4m4(final_mat, ob->object_to_world, final_mat);
DRW_shgroup_call_obmat(pd->edit_text_selection_grp, geom, final_mat);
}
@@ -134,7 +134,7 @@ static void edit_text_cache_populate_cursor(OVERLAY_Data *vedata, Object *ob)
float mat[4][4];
v2_quad_corners_to_mat4(cursor, mat);
- mul_m4_m4m4(mat, ob->obmat, mat);
+ mul_m4_m4m4(mat, ob->object_to_world, mat);
struct GPUBatch *geom = DRW_cache_quad_get();
DRW_shgroup_call_obmat(pd->edit_text_cursor_grp, geom, mat);
@@ -162,7 +162,7 @@ static void edit_text_cache_populate_boxes(OVERLAY_Data *vedata, Object *ob)
vecs[3][1] -= tb->h;
for (int j = 0; j < 4; j++) {
- mul_v3_m4v3(vecs[j], ob->obmat, vecs[j]);
+ mul_v3_m4v3(vecs[j], ob->object_to_world, vecs[j]);
}
for (int j = 0; j < 4; j++) {
OVERLAY_extra_line_dashed(cb, vecs[j], vecs[(j + 1) % 4], color);
diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc b/source/blender/draw/engines/overlay/overlay_extra.cc
index 114123ab36e..27afe49a17b 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.cc
+++ b/source/blender/draw/engines/overlay/overlay_extra.cc
@@ -331,7 +331,7 @@ void OVERLAY_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
case OB_EMPTY_CONE:
case OB_ARROWS:
DRW_object_wire_theme_get(ob, view_layer, &color);
- OVERLAY_empty_shape(cb, ob->obmat, ob->empty_drawsize, ob->empty_drawtype, color);
+ OVERLAY_empty_shape(cb, ob->object_to_world, ob->empty_drawsize, ob->empty_drawtype, color);
break;
case OB_EMPTY_IMAGE:
OVERLAY_image_empty_cache_populate(vedata, ob);
@@ -372,7 +372,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
case OB_BOUND_BOX:
size_to_mat4(tmp, size);
copy_v3_v3(tmp[3], center);
- mul_m4_m4m4(tmp, ob->obmat, tmp);
+ mul_m4_m4m4(tmp, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_cube, color, tmp);
break;
case OB_BOUND_SPHERE:
@@ -380,7 +380,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
size[1] = size[2] = size[0];
size_to_mat4(tmp, size);
copy_v3_v3(tmp[3], center);
- mul_m4_m4m4(tmp, ob->obmat, tmp);
+ mul_m4_m4m4(tmp, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_sphere, color, tmp);
break;
case OB_BOUND_CYLINDER:
@@ -388,7 +388,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
size[1] = size[0];
size_to_mat4(tmp, size);
copy_v3_v3(tmp[3], center);
- mul_m4_m4m4(tmp, ob->obmat, tmp);
+ mul_m4_m4m4(tmp, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_cylinder, color, tmp);
break;
case OB_BOUND_CONE:
@@ -399,7 +399,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
/* Cone batch has base at 0 and is pointing towards +Y. */
swap_v3_v3(tmp[1], tmp[2]);
tmp[3][2] -= size[2];
- mul_m4_m4m4(tmp, ob->obmat, tmp);
+ mul_m4_m4m4(tmp, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_cone, color, tmp);
break;
case OB_BOUND_CAPSULE:
@@ -408,14 +408,14 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
scale_m4_fl(tmp, size[0]);
copy_v2_v2(tmp[3], center);
tmp[3][2] = center[2] + max_ff(0.0f, size[2] - size[0]);
- mul_m4_m4m4(final_mat, ob->obmat, tmp);
+ mul_m4_m4m4(final_mat, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_capsule_cap, color, final_mat);
negate_v3(tmp[2]);
tmp[3][2] = center[2] - max_ff(0.0f, size[2] - size[0]);
- mul_m4_m4m4(final_mat, ob->obmat, tmp);
+ mul_m4_m4m4(final_mat, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_capsule_cap, color, final_mat);
tmp[2][2] = max_ff(0.0f, size[2] * 2.0f - size[0] * 2.0f);
- mul_m4_m4m4(final_mat, ob->obmat, tmp);
+ mul_m4_m4m4(final_mat, ob->object_to_world, tmp);
DRW_buffer_add_entry(cb->empty_capsule_body, color, final_mat);
break;
}
@@ -489,7 +489,7 @@ static void OVERLAY_texture_space(OVERLAY_ExtraCallBuffers *cb, Object *ob, cons
unit_m4(mat);
}
- mul_m4_m4m4(mat, ob->obmat, mat);
+ mul_m4_m4m4(mat, ob->object_to_world, mat);
DRW_buffer_add_entry(cb->empty_cube, color, mat);
}
@@ -511,7 +511,7 @@ static void OVERLAY_forcefield(OVERLAY_ExtraCallBuffers *cb, Object *ob, ViewLay
};
} instdata;
- copy_m4_m4(instdata.mat, ob->obmat);
+ copy_m4_m4(instdata.mat, ob->object_to_world);
instdata.size_x = instdata.size_y = instdata.size_z = ob->empty_drawsize;
switch (pd->forcefield) {
@@ -531,16 +531,16 @@ static void OVERLAY_forcefield(OVERLAY_ExtraCallBuffers *cb, Object *ob, ViewLay
instdata.size_x = instdata.size_y = instdata.size_z = pd->f_strength;
float pos[4];
BKE_where_on_path(ob, 0.0f, pos, nullptr, nullptr, nullptr, nullptr);
- copy_v3_v3(instdata.pos, ob->obmat[3]);
+ copy_v3_v3(instdata.pos, ob->object_to_world[3]);
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
DRW_buffer_add_entry(cb->field_curve, color, &instdata);
BKE_where_on_path(ob, 1.0f, pos, nullptr, nullptr, nullptr, nullptr);
- copy_v3_v3(instdata.pos, ob->obmat[3]);
+ copy_v3_v3(instdata.pos, ob->object_to_world[3]);
translate_m4(instdata.mat, pos[0], pos[1], pos[2]);
DRW_buffer_add_entry(cb->field_sphere_limit, color, &instdata);
/* Restore */
- copy_v3_v3(instdata.pos, ob->obmat[3]);
+ copy_v3_v3(instdata.pos, ob->object_to_world[3]);
}
break;
}
@@ -625,7 +625,7 @@ void OVERLAY_light_cache_populate(OVERLAY_Data *vedata, Object *ob)
};
} instdata;
- copy_m4_m4(instdata.mat, ob->obmat);
+ copy_m4_m4(instdata.mat, ob->object_to_world);
/* FIXME / TODO: clip_end has no meaning nowadays.
* In EEVEE, Only clip_sta is used shadow-mapping.
* Clip end is computed automatically based on light power.
@@ -708,7 +708,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
};
} instdata;
- copy_m4_m4(instdata.mat, ob->obmat);
+ copy_m4_m4(instdata.mat, ob->object_to_world);
switch (prb->type) {
case LIGHTPROBE_TYPE_CUBE:
@@ -720,15 +720,15 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
if (show_influence) {
char shape = (prb->attenuation_type == LIGHTPROBE_SHAPE_BOX) ? OB_CUBE : OB_EMPTY_SPHERE;
float f = 1.0f - prb->falloff;
- OVERLAY_empty_shape(cb, ob->obmat, prb->distinf, shape, color_p);
- OVERLAY_empty_shape(cb, ob->obmat, prb->distinf * f, shape, color_p);
+ OVERLAY_empty_shape(cb, ob->object_to_world, prb->distinf, shape, color_p);
+ OVERLAY_empty_shape(cb, ob->object_to_world, prb->distinf * f, shape, color_p);
}
if (show_parallax) {
char shape = (prb->parallax_type == LIGHTPROBE_SHAPE_BOX) ? OB_CUBE : OB_EMPTY_SPHERE;
float dist = ((prb->flag & LIGHTPROBE_FLAG_CUSTOM_PARALLAX) != 0) ? prb->distpar :
prb->distinf;
- OVERLAY_empty_shape(cb, ob->obmat, dist, shape, color_p);
+ OVERLAY_empty_shape(cb, ob->object_to_world, dist, shape, color_p);
}
break;
case LIGHTPROBE_TYPE_GRID:
@@ -738,8 +738,8 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
if (show_influence) {
float f = 1.0f - prb->falloff;
- OVERLAY_empty_shape(cb, ob->obmat, 1.0 + prb->distinf, OB_CUBE, color_p);
- OVERLAY_empty_shape(cb, ob->obmat, 1.0 + prb->distinf * f, OB_CUBE, color_p);
+ OVERLAY_empty_shape(cb, ob->object_to_world, 1.0 + prb->distinf, OB_CUBE, color_p);
+ OVERLAY_empty_shape(cb, ob->object_to_world, 1.0 + prb->distinf * f, OB_CUBE, color_p);
}
/* Data dots */
@@ -777,7 +777,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
zero_v3(instdata.mat[2]);
DRW_buffer_add_entry(cb->empty_cube, color_p, &instdata);
- normalize_m4_m4(instdata.mat, ob->obmat);
+ normalize_m4_m4(instdata.mat, ob->object_to_world);
OVERLAY_empty_shape(cb, instdata.mat, ob->empty_drawsize, OB_SINGLE_ARROW, color_p);
break;
}
@@ -797,7 +797,7 @@ void OVERLAY_speaker_cache_populate(OVERLAY_Data *vedata, Object *ob)
float *color_p;
DRW_object_wire_theme_get(ob, view_layer, &color_p);
- DRW_buffer_add_entry(cb->speaker, color_p, ob->obmat);
+ DRW_buffer_add_entry(cb->speaker, color_p, ob->object_to_world);
}
/** \} */
@@ -890,7 +890,7 @@ static void camera_view3d_reconstruction(
float object_imat[4][4];
invert_m4_m4(object_imat, object_mat);
- mul_m4_m4m4(tracking_object_mat, ob->obmat, object_imat);
+ mul_m4_m4m4(tracking_object_mat, ob->object_to_world, object_imat);
}
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
@@ -1132,14 +1132,17 @@ void OVERLAY_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
DRW_object_wire_theme_get(ob, view_layer, &color_p);
copy_v4_v4(instdata.color, color_p);
- normalize_m4_m4(instdata.mat, ob->obmat);
+ normalize_m4_m4(instdata.mat, ob->object_to_world);
/* BKE_camera_multiview_model_matrix already accounts for scale, don't do it here. */
if (is_selection_camera_stereo) {
copy_v3_fl(scale, 1.0f);
}
else {
- copy_v3_fl3(scale, len_v3(ob->obmat[0]), len_v3(ob->obmat[1]), len_v3(ob->obmat[2]));
+ copy_v3_fl3(scale,
+ len_v3(ob->object_to_world[0]),
+ len_v3(ob->object_to_world[1]),
+ len_v3(ob->object_to_world[2]));
/* Avoid division by 0. */
if (ELEM(0.0f, scale[0], scale[1], scale[2])) {
return;
@@ -1255,7 +1258,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
if (ob->parent && (DRW_object_visibility_in_active_context(ob->parent) & OB_VISIBLE_SELF)) {
float *parent_pos = ob->runtime.parent_display_origin;
- OVERLAY_extra_line_dashed(cb, parent_pos, ob->obmat[3], relation_color);
+ OVERLAY_extra_line_dashed(cb, parent_pos, ob->object_to_world[3], relation_color);
}
/* Drawing the hook lines. */
@@ -1263,9 +1266,9 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
if (md->type == eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData *)md;
float center[3];
- mul_v3_m4v3(center, ob->obmat, hmd->cent);
+ mul_v3_m4v3(center, ob->object_to_world, hmd->cent);
if (hmd->object) {
- OVERLAY_extra_line_dashed(cb, hmd->object->obmat[3], center, relation_color);
+ OVERLAY_extra_line_dashed(cb, hmd->object->object_to_world[3], center, relation_color);
}
OVERLAY_extra_point(cb, center, relation_color);
}
@@ -1275,10 +1278,12 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
Object *rbc_ob1 = ob->rigidbody_constraint->ob1;
Object *rbc_ob2 = ob->rigidbody_constraint->ob2;
if (rbc_ob1 && (DRW_object_visibility_in_active_context(rbc_ob1) & OB_VISIBLE_SELF)) {
- OVERLAY_extra_line_dashed(cb, rbc_ob1->obmat[3], ob->obmat[3], relation_color);
+ OVERLAY_extra_line_dashed(
+ cb, rbc_ob1->object_to_world[3], ob->object_to_world[3], relation_color);
}
if (rbc_ob2 && (DRW_object_visibility_in_active_context(rbc_ob2) & OB_VISIBLE_SELF)) {
- OVERLAY_extra_line_dashed(cb, rbc_ob2->obmat[3], ob->obmat[3], relation_color);
+ OVERLAY_extra_line_dashed(
+ cb, rbc_ob2->object_to_world[3], ob->object_to_world[3], relation_color);
}
}
@@ -1307,7 +1312,8 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
}
if (camob) {
- OVERLAY_extra_line_dashed(cb, camob->obmat[3], ob->obmat[3], constraint_color);
+ OVERLAY_extra_line_dashed(
+ cb, camob->object_to_world[3], ob->object_to_world[3], constraint_color);
}
}
else {
@@ -1330,7 +1336,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
else {
unit_m4(ct->matrix);
}
- OVERLAY_extra_line_dashed(cb, ct->matrix[3], ob->obmat[3], constraint_color);
+ OVERLAY_extra_line_dashed(cb, ct->matrix[3], ob->object_to_world[3], constraint_color);
}
BKE_constraint_targets_flush(curcon, &targets, true);
@@ -1387,7 +1393,7 @@ static void OVERLAY_volume_extra(OVERLAY_ExtraCallBuffers *cb,
copy_v3_v3(voxel_cubemat[3], min);
/* move small cube into the domain (otherwise its centered on vertex of domain object) */
translate_m4(voxel_cubemat, 1.0f, 1.0f, 1.0f);
- mul_m4_m4m4(voxel_cubemat, ob->obmat, voxel_cubemat);
+ mul_m4_m4m4(voxel_cubemat, ob->object_to_world, voxel_cubemat);
DRW_buffer_add_entry(cb->empty_cube, color, voxel_cubemat);
}
@@ -1493,15 +1499,15 @@ static void OVERLAY_object_center(OVERLAY_ExtraCallBuffers *cb,
const bool is_library = ID_REAL_USERS(&ob->id) > 1 || ID_IS_LINKED(ob);
BKE_view_layer_synced_ensure(scene, view_layer);
if (ob == BKE_view_layer_active_object_get(view_layer)) {
- DRW_buffer_add_entry(cb->center_active, ob->obmat[3]);
+ DRW_buffer_add_entry(cb->center_active, ob->object_to_world[3]);
}
else if (ob->base_flag & BASE_SELECTED) {
DRWCallBuffer *cbuf = (is_library) ? cb->center_selected_lib : cb->center_selected;
- DRW_buffer_add_entry(cbuf, ob->obmat[3]);
+ DRW_buffer_add_entry(cbuf, ob->object_to_world[3]);
}
else if (pd->v3d_flag & V3D_DRAW_CENTERS) {
DRWCallBuffer *cbuf = (is_library) ? cb->center_deselected_lib : cb->center_deselected;
- DRW_buffer_add_entry(cbuf, ob->obmat[3]);
+ DRW_buffer_add_entry(cbuf, ob->object_to_world[3]);
}
}
@@ -1513,7 +1519,7 @@ static void OVERLAY_object_name(Object *ob, int theme_id)
UI_GetThemeColor4ubv(theme_id, color);
DRW_text_cache_add(dt,
- ob->obmat[3],
+ ob->object_to_world[3],
ob->id.name + 2,
strlen(ob->id.name + 2),
10,
@@ -1571,7 +1577,7 @@ void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob)
/* Helpers for when we're transforming origins. */
if (draw_xform) {
const float color_xform[4] = {0.15f, 0.15f, 0.15f, 0.7f};
- DRW_buffer_add_entry(cb->origin_xform, color_xform, ob->obmat);
+ DRW_buffer_add_entry(cb->origin_xform, color_xform, ob->object_to_world);
}
/* don't show object extras in set's */
if (!from_dupli) {
@@ -1591,7 +1597,7 @@ void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob)
OVERLAY_collision(cb, ob, color);
}
if (ob->dtx & OB_AXIS) {
- DRW_buffer_add_entry(cb->empty_axes, color, ob->obmat);
+ DRW_buffer_add_entry(cb->empty_axes, color, ob->object_to_world);
}
if (draw_volume) {
OVERLAY_volume_extra(cb, vedata, ob, md, scene, color);
diff --git a/source/blender/draw/engines/overlay/overlay_facing.cc b/source/blender/draw/engines/overlay/overlay_facing.cc
index 825036ecd05..44dab0f0a42 100644
--- a/source/blender/draw/engines/overlay/overlay_facing.cc
+++ b/source/blender/draw/engines/overlay/overlay_facing.cc
@@ -43,7 +43,7 @@ void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob)
}
const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
diff --git a/source/blender/draw/engines/overlay/overlay_fade.cc b/source/blender/draw/engines/overlay/overlay_fade.cc
index d6fd4f9127a..b9523a4eac9 100644
--- a/source/blender/draw/engines/overlay/overlay_fade.cc
+++ b/source/blender/draw/engines/overlay/overlay_fade.cc
@@ -53,7 +53,7 @@ void OVERLAY_fade_cache_populate(OVERLAY_Data *vedata, Object *ob)
}
const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.cc b/source/blender/draw/engines/overlay/overlay_gpencil.cc
index 30765b30ce6..f5988d91e72 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.cc
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.cc
@@ -243,7 +243,7 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
copy_v3_v3(col_grid, gpd->grid.color);
col_grid[3] = max_ff(v3d->overlay.gpencil_grid_opacity, 0.01f);
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
/* Rotate and scale except align to cursor. */
bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
@@ -286,7 +286,7 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
copy_v3_v3(mat[3], cursor->location);
}
else if (ts->gpencil_v3d_align & GP_PROJECT_VIEWSPACE) {
- copy_v3_v3(mat[3], ob->obmat[3]);
+ copy_v3_v3(mat[3], ob->object_to_world[3]);
}
translate_m4(mat, gpd->grid.offset[0], gpd->grid.offset[1], 0.0f);
@@ -397,7 +397,7 @@ static void overlay_gpencil_draw_stroke_color_name(bGPDlayer * /*gpl*/,
UI_GetThemeColor4ubv(theme_id, color);
float fpt[3];
- mul_v3_m4v3(fpt, ob->obmat, &pt->x);
+ mul_v3_m4v3(fpt, ob->object_to_world, &pt->x);
struct DRWTextStore *dt = DRW_text_cache_ensure();
DRW_text_cache_add(dt,
diff --git a/source/blender/draw/engines/overlay/overlay_image.cc b/source/blender/draw/engines/overlay/overlay_image.cc
index f42867622e4..7b99bd6bd18 100644
--- a/source/blender/draw/engines/overlay/overlay_image.cc
+++ b/source/blender/draw/engines/overlay/overlay_image.cc
@@ -392,7 +392,7 @@ void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
float image_aspect[2];
overlay_image_calc_aspect(ima, size, image_aspect);
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
mul_v3_fl(mat[0], image_aspect[0] * 0.5f * ob->empty_drawsize);
mul_v3_fl(mat[1], image_aspect[1] * 0.5f * ob->empty_drawsize);
madd_v3_v3fl(mat[3], mat[0], ob->ima_ofs[0] * 2.0f + 1.0f);
diff --git a/source/blender/draw/engines/overlay/overlay_lattice.cc b/source/blender/draw/engines/overlay/overlay_lattice.cc
index 7b59aa78c89..72c3335d871 100644
--- a/source/blender/draw/engines/overlay/overlay_lattice.cc
+++ b/source/blender/draw/engines/overlay/overlay_lattice.cc
@@ -52,7 +52,7 @@ void OVERLAY_lattice_cache_populate(OVERLAY_Data *vedata, Object *ob)
DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color);
struct GPUBatch *geom = DRW_cache_lattice_wire_get(ob, false);
- OVERLAY_extra_wire(cb, geom, ob->obmat, color);
+ OVERLAY_extra_wire(cb, geom, ob->object_to_world, color);
}
void OVERLAY_edit_lattice_draw(OVERLAY_Data *vedata)
diff --git a/source/blender/draw/engines/overlay/overlay_metaball.cc b/source/blender/draw/engines/overlay/overlay_metaball.cc
index 2fc6910fe44..dd0a862337e 100644
--- a/source/blender/draw/engines/overlay/overlay_metaball.cc
+++ b/source/blender/draw/engines/overlay/overlay_metaball.cc
@@ -45,10 +45,10 @@ static void metaball_instance_data_set(
BoneInstanceData *data, Object *ob, const float *pos, const float radius, const float color[4])
{
/* Bone point radius is 0.05. Compensate for that. */
- mul_v3_v3fl(data->mat[0], ob->obmat[0], radius / 0.05f);
- mul_v3_v3fl(data->mat[1], ob->obmat[1], radius / 0.05f);
- mul_v3_v3fl(data->mat[2], ob->obmat[2], radius / 0.05f);
- mul_v3_m4v3(data->mat[3], ob->obmat, pos);
+ mul_v3_v3fl(data->mat[0], ob->object_to_world[0], radius / 0.05f);
+ mul_v3_v3fl(data->mat[1], ob->object_to_world[1], radius / 0.05f);
+ mul_v3_v3fl(data->mat[2], ob->object_to_world[2], radius / 0.05f);
+ mul_v3_m4v3(data->mat[3], ob->object_to_world, pos);
/* WATCH: Reminder, alpha is wire-size. */
OVERLAY_bone_instance_data_set_color(data, color);
}
diff --git a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc
index 5222abfc743..79ac92a187c 100644
--- a/source/blender/draw/engines/overlay/overlay_mode_transfer.cc
+++ b/source/blender/draw/engines/overlay/overlay_mode_transfer.cc
@@ -85,7 +85,7 @@ void OVERLAY_mode_transfer_cache_populate(OVERLAY_Data *vedata, Object *ob)
}
const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
diff --git a/source/blender/draw/engines/overlay/overlay_outline.cc b/source/blender/draw/engines/overlay/overlay_outline.cc
index 3213fe144e9..c2df665eba3 100644
--- a/source/blender/draw/engines/overlay/overlay_outline.cc
+++ b/source/blender/draw/engines/overlay/overlay_outline.cc
@@ -43,7 +43,7 @@ static void gpencil_depth_plane(Object *ob, float r_plane[4])
add_v3_fl(size, 1e-8f);
rescale_m4(mat, size);
/* BBox space to World. */
- mul_m4_m4m4(mat, ob->obmat, mat);
+ mul_m4_m4m4(mat, ob->object_to_world, mat);
/* BBox center in world space. */
copy_v3_v3(center, mat[3]);
/* View Vector. */
@@ -188,7 +188,7 @@ static void gpencil_layer_cache_populate(bGPDlayer *gpl,
const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0;
const bool is_stroke_order_3d = (gpd->draw_mode == GP_DRAWMODE_3D);
- float object_scale = mat4_to_scale(iter->ob->obmat);
+ float object_scale = mat4_to_scale(iter->ob->object_to_world);
/* Negate thickness sign to tag that strokes are in screen space.
* Convert to world units (by default, 1 meter = 2000 pixels). */
float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / 2000.0f);
diff --git a/source/blender/draw/engines/overlay/overlay_sculpt.cc b/source/blender/draw/engines/overlay/overlay_sculpt.cc
index 8f142d68350..3377aa5394b 100644
--- a/source/blender/draw/engines/overlay/overlay_sculpt.cc
+++ b/source/blender/draw/engines/overlay/overlay_sculpt.cc
@@ -37,7 +37,7 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, Object *ob)
struct GPUBatch *sculpt_overlays;
PBVH *pbvh = ob->sculpt->pbvh;
- const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d);
+ const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d);
if (!pbvh) {
/* It is possible to have SculptSession without PBVH. This happens, for example, when toggling
diff --git a/source/blender/draw/engines/overlay/overlay_viewer_attribute.cc b/source/blender/draw/engines/overlay/overlay_viewer_attribute.cc
index c0d74ea73f3..fd1657b3d59 100644
--- a/source/blender/draw/engines/overlay/overlay_viewer_attribute.cc
+++ b/source/blender/draw/engines/overlay/overlay_viewer_attribute.cc
@@ -90,7 +90,7 @@ static void populate_cache_for_instance(Object &object,
DRWShadingGroup *sub_grp = DRW_shgroup_create_sub(pd.viewer_attribute_instance_grp);
DRW_shgroup_uniform_vec4_copy(sub_grp, "ucolor", color);
GPUBatch *batch = DRW_cache_curve_edge_wire_get(&object);
- DRW_shgroup_call_obmat(sub_grp, batch, object.obmat);
+ DRW_shgroup_call_obmat(sub_grp, batch, object.object_to_world);
break;
}
case OB_CURVES: {
@@ -135,7 +135,7 @@ static void populate_cache_for_geometry(Object &object,
if (curves.attributes().contains(".viewer")) {
GPUBatch *batch = DRW_cache_curve_edge_wire_viewer_attribute_get(&object);
DRW_shgroup_uniform_float_copy(pd.viewer_attribute_curve_grp, "opacity", opacity);
- DRW_shgroup_call_obmat(pd.viewer_attribute_curve_grp, batch, object.obmat);
+ DRW_shgroup_call_obmat(pd.viewer_attribute_curve_grp, batch, object.object_to_world);
}
break;
}
diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.cc b/source/blender/draw/engines/overlay/overlay_wireframe.cc
index bff1bf46923..7053d0039cf 100644
--- a/source/blender/draw/engines/overlay/overlay_wireframe.cc
+++ b/source/blender/draw/engines/overlay/overlay_wireframe.cc
@@ -132,12 +132,12 @@ static void wireframe_hair_cache_populate(OVERLAY_Data *vedata, Object *ob, Part
if (collection != nullptr) {
sub_v3_v3(dupli_mat[3], collection->instance_offset);
}
- mul_m4_m4m4(dupli_mat, dupli_parent->obmat, dupli_mat);
+ mul_m4_m4m4(dupli_mat, dupli_parent->object_to_world, dupli_mat);
}
else {
- copy_m4_m4(dupli_mat, dupli_object->ob->obmat);
+ copy_m4_m4(dupli_mat, dupli_object->ob->object_to_world);
invert_m4(dupli_mat);
- mul_m4_m4m4(dupli_mat, ob->obmat, dupli_mat);
+ mul_m4_m4m4(dupli_mat, ob->object_to_world, dupli_mat);
}
}
else {
@@ -217,7 +217,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
}
if (geom) {
- OVERLAY_extra_wire(cb, geom, ob->obmat, color);
+ OVERLAY_extra_wire(cb, geom, ob->object_to_world, color);
}
}
@@ -230,12 +230,12 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
if (dupli->wire_shgrp == cb->extra_loose_points) {
float *color;
DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color);
- OVERLAY_extra_loose_points(cb, dupli->wire_geom, ob->obmat, color);
+ OVERLAY_extra_loose_points(cb, dupli->wire_geom, ob->object_to_world, color);
}
else if (dupli->wire_shgrp == cb->extra_wire) {
float *color;
DRW_object_wire_theme_get(ob, draw_ctx->view_layer, &color);
- OVERLAY_extra_wire(cb, dupli->wire_geom, ob->obmat, color);
+ OVERLAY_extra_wire(cb, dupli->wire_geom, ob->object_to_world, color);
}
else {
DRW_shgroup_call(dupli->wire_shgrp, dupli->wire_geom, ob);
@@ -264,7 +264,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
struct GPUBatch *geom = DRW_cache_object_face_wireframe_get(ob);
if (geom) {
- OVERLAY_extra_loose_points(cb, geom, ob->obmat, color);
+ OVERLAY_extra_loose_points(cb, geom, ob->object_to_world, color);
}
return;
}
@@ -276,7 +276,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
/* Don't do that in edit Mesh mode, unless there is a modifier preview. */
if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) {
const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != nullptr);
- const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI);
const bool instance_parent_in_edit_mode = is_instance ? DRW_object_is_in_edit_mode(
@@ -318,14 +318,14 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
if (is_mesh_verts_only) {
geom = DRW_cache_mesh_all_verts_get(ob);
if (geom) {
- OVERLAY_extra_loose_points(cb, geom, ob->obmat, color);
+ OVERLAY_extra_loose_points(cb, geom, ob->object_to_world, color);
shgrp = cb->extra_loose_points;
}
}
else {
geom = DRW_cache_mesh_loose_edges_get(ob);
if (geom) {
- OVERLAY_extra_wire(cb, geom, ob->obmat, color);
+ OVERLAY_extra_wire(cb, geom, ob->object_to_world, color);
shgrp = cb->extra_wire;
}
}
diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c
index 026a1f52ac1..07e2a42b808 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -205,7 +205,7 @@ static void select_cache_populate(void *vedata, Object *ob)
struct Mesh *me = ob->data;
if (e_data.context.select_mode & SCE_SELECT_FACE) {
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
- DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_faces, ob->obmat);
+ DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_faces, ob->object_to_world);
}
else if (ob->dt >= OB_SOLID) {
#ifdef USE_CAGE_OCCLUSION
@@ -213,17 +213,17 @@ static void select_cache_populate(void *vedata, Object *ob)
#else
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_surface(me);
#endif
- DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_faces, ob->obmat);
+ DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_faces, ob->object_to_world);
}
if (e_data.context.select_mode & SCE_SELECT_EDGE) {
struct GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
- DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_edges, ob->obmat);
+ DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_edges, ob->object_to_world);
}
if (e_data.context.select_mode & SCE_SELECT_VERTEX) {
struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
- DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_verts, ob->obmat);
+ DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_verts, ob->object_to_world);
}
return;
}
@@ -231,7 +231,7 @@ static void select_cache_populate(void *vedata, Object *ob)
float min[3], max[3];
select_id_object_min_max(ob, min, max);
- if (DRW_culling_min_max_test(stl->g_data->view_subregion, ob->obmat, min, max)) {
+ if (DRW_culling_min_max_test(stl->g_data->view_subregion, ob->object_to_world, min, max)) {
if (sel_data == NULL) {
sel_data = (SELECTID_ObjectData *)DRW_drawdata_ensure(
&ob->id, &draw_engine_select_type, sizeof(SELECTID_ObjectData), NULL, NULL);
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index 8dbddb4265d..15a16539a26 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -267,7 +267,7 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd,
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_active = (ob == draw_ctx->obact);
- const bool is_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
+ const bool is_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
!DRW_state_is_image_render();
const bool is_render = DRW_state_is_image_render() && (draw_ctx->v3d == NULL);
const bool is_texpaint_mode = is_active && (wpd->ctx_mode == CTX_MODE_PAINT_TEXTURE);
diff --git a/source/blender/draw/engines/workbench/workbench_shadow.c b/source/blender/draw/engines/workbench/workbench_shadow.c
index 0b34e849049..211c0e27418 100644
--- a/source/blender/draw/engines/workbench/workbench_shadow.c
+++ b/source/blender/draw/engines/workbench/workbench_shadow.c
@@ -172,7 +172,7 @@ static const BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_Private
{
if (oed->shadow_bbox_dirty || wpd->shadow_changed) {
float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, wpd->shadow_inv, ob->obmat);
+ mul_m4_m4m4(tmp_mat, wpd->shadow_inv, ob->object_to_world);
/* Get AABB in shadow space. */
INIT_MINMAX(oed->shadow_min, oed->shadow_max);
@@ -307,7 +307,8 @@ void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, const boo
NULL);
if (workbench_shadow_object_cast_visible_shadow(wpd, ob, engine_object_data)) {
- mul_v3_mat3_m4v3(engine_object_data->shadow_dir, ob->imat, wpd->shadow_direction_ws);
+ mul_v3_mat3_m4v3(
+ engine_object_data->shadow_dir, ob->world_to_object, wpd->shadow_direction_ws);
DRWShadingGroup *grp;
bool use_shadow_pass_technique = !workbench_shadow_camera_in_object_shadow(
diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c
index ce7773e7439..7c6df93f5a3 100644
--- a/source/blender/draw/engines/workbench/workbench_volume.c
+++ b/source/blender/draw/engines/workbench/workbench_volume.c
@@ -237,7 +237,7 @@ static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata,
/* Combined texture to object, and object to world transform. */
float texture_to_world[4][4];
- mul_m4_m4m4(texture_to_world, ob->obmat, grid->texture_to_object);
+ mul_m4_m4m4(texture_to_world, ob->object_to_world, grid->texture_to_object);
if (use_slice) {
float invviewmat[4][4];
@@ -291,7 +291,7 @@ static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata,
/* Compute density scale. */
const float density_scale = volume->display.density *
- BKE_volume_density_scale(volume, ob->obmat);
+ BKE_volume_density_scale(volume, ob->object_to_world);
DRW_shgroup_uniform_texture(grp, "densityTexture", grid->texture);
/* TODO: implement shadow texture, see manta_smoke_calc_transparency. */
diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc
index c36b90ec32e..0322d048fa5 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -252,7 +252,7 @@ static void curves_batch_cache_fill_segments_proc_pos(
static void curves_batch_cache_ensure_procedural_pos(const Curves &curves,
CurvesEvalCache &cache,
- GPUMaterial *gpu_material)
+ GPUMaterial *UNUSED(gpu_material))
{
if (cache.proc_point_buf == nullptr || DRW_vbo_requested(cache.proc_point_buf)) {
/* Initialize vertex format. */
@@ -331,7 +331,7 @@ static void curves_batch_cache_ensure_procedural_final_attr(CurvesEvalCache &cac
const GPUVertFormat *format,
const int subdiv,
const int index,
- const char *name)
+ const char *UNUSED(name))
{
CurvesEvalFinalCache &final_cache = cache.final[subdiv];
final_cache.attributes_buf[index] = GPU_vertbuf_create_with_format_ex(
diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.cc b/source/blender/draw/intern/draw_cache_impl_gpencil.cc
index 6c38b23f44f..6860fae744b 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.cc
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.cc
@@ -319,7 +319,7 @@ static void gpencil_buffer_add_point(GPUIndexBufBuilder *ibo,
vert->strength = (round_cap0) ? pt->strength : -pt->strength;
vert->u_stroke = pt->uv_fac;
- vert->stroke_id = gps->runtime.stroke_start;
+ vert->stroke_id = gps->runtime.vertex_start;
vert->point_id = v;
vert->thickness = max_ff(0.0f, gps->thickness * pt->pressure) * (round_cap1 ? 1.0f : -1.0f);
/* Tag endpoint material to -1 so they get discarded by vertex shader. */
@@ -612,7 +612,7 @@ static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_fill)
for (int i = 0; i < vert_len; i++) {
ED_gpencil_tpoint_to_point(region, origin, &tpoints[i], &gps->points[i]);
- mul_m4_v3(ob->imat, &gps->points[i].x);
+ mul_m4_v3(ob->world_to_object, &gps->points[i].x);
bGPDspoint *pt = &gps->points[i];
copy_v4_v4(pt->vert_color, tpoints[i].vert_color);
}
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc b/source/blender/draw/intern/draw_cache_impl_mesh.cc
index 5ce658abfe4..031de3e4ef2 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc
@@ -1889,7 +1889,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
is_editmode,
is_paint_mode,
is_mode_active,
- ob->obmat,
+ ob->object_to_world,
false,
true,
scene,
@@ -1906,7 +1906,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
is_editmode,
is_paint_mode,
is_mode_active,
- ob->obmat,
+ ob->object_to_world,
false,
false,
scene,
@@ -1922,7 +1922,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
is_editmode,
is_paint_mode,
is_mode_active,
- ob->obmat,
+ ob->object_to_world,
true,
false,
do_cage,
@@ -1943,7 +1943,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
is_editmode,
is_paint_mode,
is_mode_active,
- ob->obmat,
+ ob->object_to_world,
true,
false,
scene,
diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
index d64fc581942..ddbfe232361 100644
--- a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
+++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
@@ -38,7 +38,7 @@ using namespace blender;
/** \name GPUBatch cache management
* \{ */
-struct PointCloudBatchCache {
+struct PointCloudEvalCache {
/* Dot primitive types. */
GPUBatch *dots;
/* Triangle primitive types. */
@@ -69,10 +69,15 @@ struct PointCloudBatchCache {
* user preferences (`U.vbotimeout`) then garbage collection is performed.
*/
int last_attr_matching_time;
- /* settings to determine if cache is invalid */
- bool is_dirty;
int mat_len;
+};
+
+struct PointCloudBatchCache {
+ PointCloudEvalCache eval_cache;
+
+ /* settings to determine if cache is invalid */
+ bool is_dirty;
/**
* The draw cache extraction is currently not multi-threaded for multiple objects, but if it was,
@@ -94,7 +99,7 @@ static bool pointcloud_batch_cache_valid(PointCloud &pointcloud)
if (cache == nullptr) {
return false;
}
- if (cache->mat_len != DRW_pointcloud_material_count_get(&pointcloud)) {
+ if (cache->eval_cache.mat_len != DRW_pointcloud_material_count_get(&pointcloud)) {
return false;
}
return cache->is_dirty == false;
@@ -109,12 +114,12 @@ static void pointcloud_batch_cache_init(PointCloud &pointcloud)
pointcloud.batch_cache = cache;
}
else {
- memset(cache, 0, sizeof(*cache));
+ cache->eval_cache = {};
}
- cache->mat_len = DRW_pointcloud_material_count_get(&pointcloud);
- cache->surface_per_mat = static_cast<GPUBatch **>(
- MEM_callocN(sizeof(GPUBatch *) * cache->mat_len, __func__));
+ cache->eval_cache.mat_len = DRW_pointcloud_material_count_get(&pointcloud);
+ cache->eval_cache.surface_per_mat = static_cast<GPUBatch **>(
+ MEM_callocN(sizeof(GPUBatch *) * cache->eval_cache.mat_len, __func__));
cache->is_dirty = false;
}
@@ -137,10 +142,10 @@ void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
static void pointcloud_discard_attributes(PointCloudBatchCache &cache)
{
for (const int j : IndexRange(GPU_MAX_ATTR)) {
- GPU_VERTBUF_DISCARD_SAFE(cache.attributes_buf[j]);
+ GPU_VERTBUF_DISCARD_SAFE(cache.eval_cache.attributes_buf[j]);
}
- drw_attributes_clear(&cache.attr_used);
+ drw_attributes_clear(&cache.eval_cache.attr_used);
}
static void pointcloud_batch_cache_clear(PointCloud &pointcloud)
@@ -150,18 +155,18 @@ static void pointcloud_batch_cache_clear(PointCloud &pointcloud)
return;
}
- GPU_BATCH_DISCARD_SAFE(cache->dots);
- GPU_BATCH_DISCARD_SAFE(cache->surface);
- GPU_VERTBUF_DISCARD_SAFE(cache->pos_rad);
- GPU_VERTBUF_DISCARD_SAFE(cache->attr_viewer);
- GPU_INDEXBUF_DISCARD_SAFE(cache->geom_indices);
+ GPU_BATCH_DISCARD_SAFE(cache->eval_cache.dots);
+ GPU_BATCH_DISCARD_SAFE(cache->eval_cache.surface);
+ GPU_VERTBUF_DISCARD_SAFE(cache->eval_cache.pos_rad);
+ GPU_VERTBUF_DISCARD_SAFE(cache->eval_cache.attr_viewer);
+ GPU_INDEXBUF_DISCARD_SAFE(cache->eval_cache.geom_indices);
- if (cache->surface_per_mat) {
- for (int i = 0; i < cache->mat_len; i++) {
- GPU_BATCH_DISCARD_SAFE(cache->surface_per_mat[i]);
+ if (cache->eval_cache.surface_per_mat) {
+ for (int i = 0; i < cache->eval_cache.mat_len; i++) {
+ GPU_BATCH_DISCARD_SAFE(cache->eval_cache.surface_per_mat[i]);
}
}
- MEM_SAFE_FREE(cache->surface_per_mat);
+ MEM_SAFE_FREE(cache->eval_cache.surface_per_mat);
pointcloud_discard_attributes(*cache);
}
@@ -189,15 +194,16 @@ void DRW_pointcloud_batch_cache_free_old(PointCloud *pointcloud, int ctime)
bool do_discard = false;
- if (drw_attributes_overlap(&cache->attr_used_over_time, &cache->attr_used)) {
- cache->last_attr_matching_time = ctime;
+ if (drw_attributes_overlap(&cache->eval_cache.attr_used_over_time,
+ &cache->eval_cache.attr_used)) {
+ cache->eval_cache.last_attr_matching_time = ctime;
}
- if (ctime - cache->last_attr_matching_time > U.vbotimeout) {
+ if (ctime - cache->eval_cache.last_attr_matching_time > U.vbotimeout) {
do_discard = true;
}
- drw_attributes_clear(&cache->attr_used_over_time);
+ drw_attributes_clear(&cache->eval_cache.attr_used_over_time);
if (do_discard) {
pointcloud_discard_attributes(*cache);
@@ -235,7 +241,7 @@ static void pointcloud_extract_indices(const PointCloud &pointcloud, PointCloudB
}
}
- GPU_indexbuf_build_in_place(&builder, cache.geom_indices);
+ GPU_indexbuf_build_in_place(&builder, cache.eval_cache.geom_indices);
}
static void pointcloud_extract_position_and_radius(const PointCloud &pointcloud,
@@ -252,11 +258,11 @@ static void pointcloud_extract_position_and_radius(const PointCloud &pointcloud,
}
GPUUsageType usage_flag = GPU_USAGE_STATIC | GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY;
- GPU_vertbuf_init_with_format_ex(cache.pos_rad, &format, usage_flag);
+ GPU_vertbuf_init_with_format_ex(cache.eval_cache.pos_rad, &format, usage_flag);
- GPU_vertbuf_data_alloc(cache.pos_rad, positions.size());
- MutableSpan<float4> vbo_data{static_cast<float4 *>(GPU_vertbuf_get_data(cache.pos_rad)),
- pointcloud.totpoint};
+ GPU_vertbuf_data_alloc(cache.eval_cache.pos_rad, positions.size());
+ MutableSpan<float4> vbo_data{
+ static_cast<float4 *>(GPU_vertbuf_get_data(cache.eval_cache.pos_rad)), pointcloud.totpoint};
if (radii) {
const VArraySpan<float> radii_span(radii);
threading::parallel_for(vbo_data.index_range(), 4096, [&](IndexRange range) {
@@ -288,7 +294,7 @@ static void pointcloud_extract_attribute(const PointCloud &pointcloud,
{
using namespace blender;
- GPUVertBuf *&attr_buf = cache.attributes_buf[index];
+ GPUVertBuf *&attr_buf = cache.eval_cache.attributes_buf[index];
const bke::AttributeAccessor attributes = pointcloud.attributes();
@@ -322,8 +328,8 @@ static void pointcloud_extract_attribute(const PointCloud &pointcloud,
GPUVertBuf *pointcloud_position_and_radius_get(PointCloud *pointcloud)
{
PointCloudBatchCache *cache = pointcloud_batch_cache_get(*pointcloud);
- DRW_vbo_request(nullptr, &cache->pos_rad);
- return cache->pos_rad;
+ DRW_vbo_request(nullptr, &cache->eval_cache.pos_rad);
+ return cache->eval_cache.pos_rad;
}
GPUBatch **pointcloud_surface_shaded_get(PointCloud *pointcloud,
@@ -350,23 +356,23 @@ GPUBatch **pointcloud_surface_shaded_get(PointCloud *pointcloud,
}
}
- if (!drw_attributes_overlap(&cache->attr_used, &attrs_needed)) {
+ if (!drw_attributes_overlap(&cache->eval_cache.attr_used, &attrs_needed)) {
/* Some new attributes have been added, free all and start over. */
for (const int i : IndexRange(GPU_MAX_ATTR)) {
- GPU_VERTBUF_DISCARD_SAFE(cache->attributes_buf[i]);
+ GPU_VERTBUF_DISCARD_SAFE(cache->eval_cache.attributes_buf[i]);
}
- drw_attributes_merge(&cache->attr_used, &attrs_needed, cache->render_mutex);
+ drw_attributes_merge(&cache->eval_cache.attr_used, &attrs_needed, cache->render_mutex);
}
- drw_attributes_merge(&cache->attr_used_over_time, &attrs_needed, cache->render_mutex);
+ drw_attributes_merge(&cache->eval_cache.attr_used_over_time, &attrs_needed, cache->render_mutex);
- DRW_batch_request(&cache->surface_per_mat[0]);
- return cache->surface_per_mat;
+ DRW_batch_request(&cache->eval_cache.surface_per_mat[0]);
+ return cache->eval_cache.surface_per_mat;
}
GPUBatch *pointcloud_surface_get(PointCloud *pointcloud)
{
PointCloudBatchCache *cache = pointcloud_batch_cache_get(*pointcloud);
- return DRW_batch_request(&cache->surface);
+ return DRW_batch_request(&cache->eval_cache.surface);
}
/** \} */
@@ -379,7 +385,7 @@ GPUBatch *DRW_pointcloud_batch_cache_get_dots(Object *ob)
{
PointCloud &pointcloud = *static_cast<PointCloud *>(ob->data);
PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
- return DRW_batch_request(&cache->dots);
+ return DRW_batch_request(&cache->eval_cache.dots);
}
GPUVertBuf **DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, const char *name)
@@ -392,12 +398,12 @@ GPUVertBuf **DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, const ch
if (drw_custom_data_match_attribute(&pointcloud->pdata, name, &layer_index, &type)) {
DRW_Attributes attributes{};
drw_attributes_add_request(&attributes, name, type, layer_index, domain);
- drw_attributes_merge(&cache.attr_used, &attributes, cache.render_mutex);
+ drw_attributes_merge(&cache.eval_cache.attr_used, &attributes, cache.render_mutex);
}
int request_i = -1;
- for (const int i : IndexRange(cache.attr_used.num_requests)) {
- if (STREQ(cache.attr_used.requests[i].attribute_name, name)) {
+ for (const int i : IndexRange(cache.eval_cache.attr_used.num_requests)) {
+ if (STREQ(cache.eval_cache.attr_used.requests[i].attribute_name, name)) {
request_i = i;
break;
}
@@ -405,7 +411,7 @@ GPUVertBuf **DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, const ch
if (request_i == -1) {
return nullptr;
}
- return &cache.attributes_buf[request_i];
+ return &cache.eval_cache.attributes_buf[request_i];
}
int DRW_pointcloud_material_count_get(PointCloud *pointcloud)
@@ -418,33 +424,33 @@ void DRW_pointcloud_batch_cache_create_requested(Object *ob)
PointCloud *pointcloud = static_cast<PointCloud *>(ob->data);
PointCloudBatchCache &cache = *pointcloud_batch_cache_get(*pointcloud);
- if (DRW_batch_requested(cache.dots, GPU_PRIM_POINTS)) {
- DRW_vbo_request(cache.dots, &cache.pos_rad);
+ if (DRW_batch_requested(cache.eval_cache.dots, GPU_PRIM_POINTS)) {
+ DRW_vbo_request(cache.eval_cache.dots, &cache.eval_cache.pos_rad);
}
- if (DRW_batch_requested(cache.surface, GPU_PRIM_TRIS)) {
- DRW_ibo_request(cache.surface, &cache.geom_indices);
- DRW_vbo_request(cache.surface, &cache.pos_rad);
+ if (DRW_batch_requested(cache.eval_cache.surface, GPU_PRIM_TRIS)) {
+ DRW_ibo_request(cache.eval_cache.surface, &cache.eval_cache.geom_indices);
+ DRW_vbo_request(cache.eval_cache.surface, &cache.eval_cache.pos_rad);
}
- for (int i = 0; i < cache.mat_len; i++) {
- if (DRW_batch_requested(cache.surface_per_mat[i], GPU_PRIM_TRIS)) {
+ for (int i = 0; i < cache.eval_cache.mat_len; i++) {
+ if (DRW_batch_requested(cache.eval_cache.surface_per_mat[i], GPU_PRIM_TRIS)) {
/* TODO(fclem): Per material ranges. */
- DRW_ibo_request(cache.surface_per_mat[i], &cache.geom_indices);
+ DRW_ibo_request(cache.eval_cache.surface_per_mat[i], &cache.eval_cache.geom_indices);
}
}
- for (int j = 0; j < cache.attr_used.num_requests; j++) {
- DRW_vbo_request(nullptr, &cache.attributes_buf[j]);
+ for (int j = 0; j < cache.eval_cache.attr_used.num_requests; j++) {
+ DRW_vbo_request(nullptr, &cache.eval_cache.attributes_buf[j]);
- if (DRW_vbo_requested(cache.attributes_buf[j])) {
- pointcloud_extract_attribute(*pointcloud, cache, cache.attr_used.requests[j], j);
+ if (DRW_vbo_requested(cache.eval_cache.attributes_buf[j])) {
+ pointcloud_extract_attribute(*pointcloud, cache, cache.eval_cache.attr_used.requests[j], j);
}
}
- if (DRW_ibo_requested(cache.geom_indices)) {
+ if (DRW_ibo_requested(cache.eval_cache.geom_indices)) {
pointcloud_extract_indices(*pointcloud, cache);
}
- if (DRW_vbo_requested(cache.pos_rad)) {
+ if (DRW_vbo_requested(cache.eval_cache.pos_rad)) {
pointcloud_extract_position_and_radius(*pointcloud, cache);
}
}
diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc
index 882eda9b31d..6e999815e8d 100644
--- a/source/blender/draw/intern/draw_command.cc
+++ b/source/blender/draw/intern/draw_command.cc
@@ -30,6 +30,11 @@ void ShaderBind::execute(RecordingState &state) const
}
}
+void FramebufferBind::execute() const
+{
+ GPU_framebuffer_bind(framebuffer);
+}
+
void ResourceBind::execute() const
{
if (slot == -1) {
@@ -161,7 +166,10 @@ void StateSet::execute(RecordingState &recording_state) const
*/
BLI_assert(DST.state_lock == 0);
- if (!assign_if_different(recording_state.pipeline_state, new_state)) {
+ bool state_changed = assign_if_different(recording_state.pipeline_state, new_state);
+ bool clip_changed = assign_if_different(recording_state.clip_plane_count, clip_plane_count);
+
+ if (!state_changed && !clip_changed) {
return;
}
@@ -185,12 +193,7 @@ void StateSet::execute(RecordingState &recording_state) const
}
/* TODO: this should be part of shader state. */
- if (new_state & DRW_STATE_CLIP_PLANES) {
- GPU_clip_distances(recording_state.view_clip_plane_count);
- }
- else {
- GPU_clip_distances(0);
- }
+ GPU_clip_distances(recording_state.clip_plane_count);
if (new_state & DRW_STATE_IN_FRONT_SELECT) {
/* XXX `GPU_depth_range` is not a perfect solution
@@ -229,6 +232,11 @@ std::string ShaderBind::serialize() const
return std::string(".shader_bind(") + GPU_shader_get_name(shader) + ")";
}
+std::string FramebufferBind::serialize() const
+{
+ return std::string(".framebuffer_bind(") + GPU_framebuffer_get_name(framebuffer) + ")";
+}
+
std::string ResourceBind::serialize() const
{
switch (type) {
diff --git a/source/blender/draw/intern/draw_command.hh b/source/blender/draw/intern/draw_command.hh
index 5307a242e39..12c9916ee6d 100644
--- a/source/blender/draw/intern/draw_command.hh
+++ b/source/blender/draw/intern/draw_command.hh
@@ -39,7 +39,7 @@ struct RecordingState {
bool front_facing = true;
bool inverted_view = false;
DRWState pipeline_state = DRW_STATE_NO_DRAW;
- int view_clip_plane_count = 0;
+ int clip_plane_count = 0;
/** Used for gl_BaseInstance workaround. */
GPUStorageBuf *resource_id_buf = nullptr;
@@ -88,6 +88,7 @@ enum class Type : uint8_t {
DispatchIndirect,
Draw,
DrawIndirect,
+ FramebufferBind,
PushConstant,
ResourceBind,
ShaderBind,
@@ -118,6 +119,13 @@ struct ShaderBind {
std::string serialize() const;
};
+struct FramebufferBind {
+ GPUFrameBuffer *framebuffer;
+
+ void execute() const;
+ std::string serialize() const;
+};
+
struct ResourceBind {
eGPUSamplerState sampler;
int slot;
@@ -317,6 +325,7 @@ struct Clear {
struct StateSet {
DRWState new_state;
+ int clip_plane_count;
void execute(RecordingState &state) const;
std::string serialize() const;
@@ -473,10 +482,8 @@ class DrawMultiBuf {
uint vertex_first,
ResourceHandle handle)
{
- /* Unsupported for now. Use PassSimple. */
- BLI_assert(vertex_first == 0 || vertex_first == -1);
- BLI_assert(vertex_len == -1);
- UNUSED_VARS_NDEBUG(vertex_len, vertex_first);
+ /* Custom draw-calls cannot be batched and will produce one group per draw. */
+ const bool custom_group = ((vertex_first != 0 && vertex_first != -1) || vertex_len != -1);
instance_len = instance_len != -1 ? instance_len : 1;
@@ -493,8 +500,14 @@ class DrawMultiBuf {
bool inverted = handle.has_inverted_handedness();
- if (group_id == uint(-1)) {
+ DrawPrototype &draw = prototype_buf_.get_or_resize(prototype_count_++);
+ draw.resource_handle = handle.raw;
+ draw.instance_len = instance_len;
+ draw.group_id = group_id;
+
+ if (group_id == uint(-1) || custom_group) {
uint new_group_id = group_count_++;
+ draw.group_id = new_group_id;
DrawGroup &group = group_buf_.get_or_resize(new_group_id);
group.next = cmd.group_first;
@@ -503,11 +516,16 @@ class DrawMultiBuf {
group.gpu_batch = batch;
group.front_proto_len = 0;
group.back_proto_len = 0;
+ group.vertex_len = vertex_len;
+ group.vertex_first = vertex_first;
+ /* Custom group are not to be registered in the group_ids_. */
+ if (!custom_group) {
+ group_id = new_group_id;
+ }
/* For serialization only. */
(inverted ? group.back_proto_len : group.front_proto_len)++;
/* Append to list. */
cmd.group_first = new_group_id;
- group_id = new_group_id;
}
else {
DrawGroup &group = group_buf_[group_id];
@@ -516,11 +534,6 @@ class DrawMultiBuf {
/* For serialization only. */
(inverted ? group.back_proto_len : group.front_proto_len)++;
}
-
- DrawPrototype &draw = prototype_buf_.get_or_resize(prototype_count_++);
- draw.group_id = group_id;
- draw.resource_handle = handle.raw;
- draw.instance_len = instance_len;
}
void bind(RecordingState &state,
diff --git a/source/blender/draw/intern/draw_curves.cc b/source/blender/draw/intern/draw_curves.cc
index ee9045696be..ee9ed4666e0 100644
--- a/source/blender/draw/intern/draw_curves.cc
+++ b/source/blender/draw/intern/draw_curves.cc
@@ -390,7 +390,7 @@ DRWShadingGroup *DRW_shgroup_curves_create_sub(Object *object,
DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &curves_cache->final[subdiv].strands_res, 1);
DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadShape", hair_rad_shape);
- DRW_shgroup_uniform_mat4_copy(shgrp, "hairDupliMatrix", object->obmat);
+ DRW_shgroup_uniform_mat4_copy(shgrp, "hairDupliMatrix", object->object_to_world);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", hair_rad_root);
DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", hair_rad_tip);
DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", hair_close_tip);
diff --git a/source/blender/draw/intern/draw_hair.cc b/source/blender/draw/intern/draw_hair.cc
index 08e5d780cba..c5261f26f76 100644
--- a/source/blender/draw/intern/draw_hair.cc
+++ b/source/blender/draw/intern/draw_hair.cc
@@ -216,12 +216,12 @@ void DRW_hair_duplimat_get(Object *object,
if (collection != nullptr) {
sub_v3_v3(dupli_mat[3], collection->instance_offset);
}
- mul_m4_m4m4(dupli_mat, dupli_parent->obmat, dupli_mat);
+ mul_m4_m4m4(dupli_mat, dupli_parent->object_to_world, dupli_mat);
}
else {
- copy_m4_m4(dupli_mat, dupli_object->ob->obmat);
+ copy_m4_m4(dupli_mat, dupli_object->ob->object_to_world);
invert_m4(dupli_mat);
- mul_m4_m4m4(dupli_mat, object->obmat, dupli_mat);
+ mul_m4_m4m4(dupli_mat, object->object_to_world, dupli_mat);
}
}
else {
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index d0290426af3..4fcfec833eb 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2801,7 +2801,7 @@ void DRW_draw_depth_object(
GPU_matrix_projection_set(rv3d->winmat);
GPU_matrix_set(rv3d->viewmat);
- GPU_matrix_mul(object->obmat);
+ GPU_matrix_mul(object->object_to_world);
/* Setup frame-buffer. */
GPUTexture *depth_tx = GPU_viewport_depth_texture(viewport);
@@ -2821,11 +2821,11 @@ void DRW_draw_depth_object(
const bool use_clipping_planes = RV3D_CLIPPING_ENABLED(v3d, rv3d);
if (use_clipping_planes) {
GPU_clip_distances(6);
- ED_view3d_clipping_local(rv3d, object->obmat);
+ ED_view3d_clipping_local(rv3d, object->object_to_world);
for (int i = 0; i < 6; i++) {
copy_v4_v4(planes.world[i], rv3d->clip_local[i]);
}
- copy_m4_m4(planes.ModelMatrix, object->obmat);
+ copy_m4_m4(planes.ModelMatrix, object->object_to_world);
}
drw_batch_cache_validate(object);
diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc
index b9e0db71122..29b1493ec5e 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -678,7 +678,7 @@ BLI_INLINE void drw_call_matrix_init(DRWObjectMatrix *ob_mats, Object *ob, float
{
copy_m4_m4(ob_mats->model, obmat);
if (ob) {
- copy_m4_m4(ob_mats->modelinverse, ob->imat);
+ copy_m4_m4(ob_mats->modelinverse, ob->world_to_object);
}
else {
/* WATCH: Can be costly. */
@@ -695,7 +695,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
drw_call_calc_orco(ob, ob_infos->orcotexfac);
/* Random float value. */
uint random = (DST.dupli_source) ?
- DST.dupli_source->random_id :
+ DST.dupli_source->random_id :
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
* put it in ob->runtime and make depsgraph ensure it is up to date. */
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
@@ -724,8 +724,8 @@ static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
float corner[3];
/* Get BoundSphere center and radius from the BoundBox. */
mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
- mul_v3_m4v3(corner, ob->obmat, bbox->vec[0]);
- mul_m4_v3(ob->obmat, cull->bsphere.center);
+ mul_v3_m4v3(corner, ob->object_to_world, bbox->vec[0]);
+ mul_m4_v3(ob->object_to_world, cull->bsphere.center);
cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner);
/* Bypass test for very large objects (see T67319). */
@@ -1017,7 +1017,7 @@ void DRW_shgroup_call_ex(DRWShadingGroup *shgroup,
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : obmat, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : obmat, ob);
drw_command_draw(shgroup, geom, handle);
/* Culling data. */
@@ -1042,7 +1042,7 @@ void DRW_shgroup_call_range(
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
drw_command_draw_range(shgroup, geom, handle, v_sta, v_num);
}
@@ -1053,7 +1053,7 @@ void DRW_shgroup_call_instance_range(
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
drw_command_draw_intance_range(shgroup, geom, handle, i_sta, i_num);
}
@@ -1099,7 +1099,7 @@ static void drw_shgroup_call_procedural_add_ex(DRWShadingGroup *shgroup,
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
drw_command_draw_procedural(shgroup, geom, handle, vert_count);
}
@@ -1149,7 +1149,7 @@ void DRW_shgroup_call_procedural_indirect(DRWShadingGroup *shgroup,
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
drw_command_draw_indirect(shgroup, geom, handle, indirect_buf);
}
@@ -1159,7 +1159,7 @@ void DRW_shgroup_call_instances(DRWShadingGroup *shgroup, Object *ob, GPUBatch *
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
drw_command_draw_instance(shgroup, geom, handle, count, false);
}
@@ -1173,7 +1173,7 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup,
if (G.f & G_FLAG_PICKSEL) {
drw_command_set_select_id(shgroup, nullptr, DST.select_id);
}
- DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->obmat : nullptr, ob);
+ DRWResourceHandle handle = drw_resource_handle(shgroup, ob ? ob->object_to_world : nullptr, ob);
GPUBatch *batch = DRW_temp_batch_instance_request(
DST.vmempool->idatalist, nullptr, inst_attributes, geom);
drw_command_draw_instance(shgroup, batch, handle, 0, true);
@@ -1283,7 +1283,7 @@ static void drw_sculpt_get_frustum_planes(Object *ob, float planes[6][4])
* 4x4 matrix is done by multiplying with the transpose inverse.
* The inverse cancels out here since we transform by inverse(obmat). */
float tmat[4][4];
- transpose_m4_m4(tmat, ob->obmat);
+ transpose_m4_m4(tmat, ob->object_to_world);
for (int i = 0; i < 6; i++) {
mul_m4_v4(tmat, planes[i]);
}
@@ -1361,7 +1361,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
if (SCULPT_DEBUG_BUFFERS) {
int debug_node_nr = 0;
- DRW_debug_modelmat(scd->ob->obmat);
+ DRW_debug_modelmat(scd->ob->object_to_world);
BKE_pbvh_draw_debug_cb(
pbvh,
(void (*)(PBVHNode * n, void *d, const float min[3], const float max[3], PBVHNodeFlags f))
diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c
index 40b05dff51f..85701a10f4b 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -64,8 +64,8 @@ static void drw_deferred_shader_compilation_exec(
void *custom_data,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *UNUSED(do_update),
+ bool *stop,
+ bool *UNUSED(do_update),
float *UNUSED(progress))
{
GPU_render_begin();
diff --git a/source/blender/draw/intern/draw_manager_text.cc b/source/blender/draw/intern/draw_manager_text.cc
index 100ef528bc8..1244c46e166 100644
--- a/source/blender/draw/intern/draw_manager_text.cc
+++ b/source/blender/draw/intern/draw_manager_text.cc
@@ -305,11 +305,11 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4, v1_clip, v2_clip)) {
mid_v3_v3v3(vmid, v1_clip, v2_clip);
- mul_m4_v3(ob->obmat, vmid);
+ mul_m4_v3(ob->object_to_world, vmid);
if (do_global) {
- mul_mat3_m4_v3(ob->obmat, v1);
- mul_mat3_m4_v3(ob->obmat, v2);
+ mul_mat3_m4_v3(ob->object_to_world, v1);
+ mul_mat3_m4_v3(ob->object_to_world, v2);
}
if (unit->system) {
@@ -373,7 +373,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
float angle;
mid_v3_v3v3(vmid, v1_clip, v2_clip);
- mul_m4_v3(ob->obmat, vmid);
+ mul_m4_v3(ob->object_to_world, vmid);
if (use_coords) {
copy_v3_v3(no_a, poly_normals[BM_elem_index_get(l_a->f)]);
@@ -385,8 +385,8 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
}
if (do_global) {
- mul_mat3_m4_v3(ob->imat, no_a);
- mul_mat3_m4_v3(ob->imat, no_b);
+ mul_mat3_m4_v3(ob->world_to_object, no_a);
+ mul_mat3_m4_v3(ob->world_to_object, no_b);
normalize_v3(no_a);
normalize_v3(no_b);
}
@@ -443,16 +443,16 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
n += 3;
if (do_global) {
- mul_mat3_m4_v3(ob->obmat, v1);
- mul_mat3_m4_v3(ob->obmat, v2);
- mul_mat3_m4_v3(ob->obmat, v3);
+ mul_mat3_m4_v3(ob->object_to_world, v1);
+ mul_mat3_m4_v3(ob->object_to_world, v2);
+ mul_mat3_m4_v3(ob->object_to_world, v3);
}
area += area_tri_v3(v1, v2, v3);
}
mul_v3_fl(vmid, 1.0f / float(n));
- mul_m4_v3(ob->obmat, vmid);
+ mul_m4_v3(ob->object_to_world, vmid);
if (unit->system) {
numstr_len = BKE_unit_value_as_string(
@@ -522,9 +522,9 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
copy_v3_v3(v2_local, v2);
if (do_global) {
- mul_mat3_m4_v3(ob->obmat, v1);
- mul_mat3_m4_v3(ob->obmat, v2);
- mul_mat3_m4_v3(ob->obmat, v3);
+ mul_mat3_m4_v3(ob->object_to_world, v1);
+ mul_mat3_m4_v3(ob->object_to_world, v2);
+ mul_mat3_m4_v3(ob->object_to_world, v3);
}
float angle = angle_v3v3v3(v1, v2, v3);
@@ -535,7 +535,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
(is_rad) ? angle : RAD2DEGF(angle),
(is_rad) ? "r" : "°");
interp_v3_v3v3(fvec, vmid, v2_local, 0.8f);
- mul_m4_v3(ob->obmat, fvec);
+ mul_m4_v3(ob->object_to_world, fvec);
DRW_text_cache_add(dt, fvec, numstr, numstr_len, 0, 0, txt_flag, col);
}
}
@@ -566,7 +566,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
copy_v3_v3(v1, v->co);
}
- mul_m4_v3(ob->obmat, v1);
+ mul_m4_v3(ob->object_to_world, v1);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
DRW_text_cache_add(dt, v1, numstr, numstr_len, 0, 0, txt_flag, col);
@@ -595,7 +595,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4, v1_clip, v2_clip)) {
mid_v3_v3v3(vmid, v1_clip, v2_clip);
- mul_m4_v3(ob->obmat, vmid);
+ mul_m4_v3(ob->object_to_world, vmid);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
DRW_text_cache_add(
@@ -629,7 +629,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
BM_face_calc_center_median(f, v1);
}
- mul_m4_v3(ob->obmat, v1);
+ mul_m4_v3(ob->object_to_world, v1);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
DRW_text_cache_add(dt, v1, numstr, numstr_len, 0, 0, txt_flag, col);
diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh
index 24dfdd1b97b..2c1fd16928e 100644
--- a/source/blender/draw/intern/draw_pass.hh
+++ b/source/blender/draw/intern/draw_pass.hh
@@ -14,8 +14,7 @@
* #Pass. Use many #PassSub along with a main #Pass to reduce the overhead and allow groupings of
* commands. \note The draw call order inside a batch of multiple draw with the exact same state is
* not guaranteed and is not even deterministic. Use a #PassSimple or #PassSortable if ordering is
- * needed. \note As of now, it is also quite limited in the type of draw command it can record
- * (no custom vertex count, no custom first vertex).
+ * needed. Custom vertex count and custom first vertex will effectively disable batching.
*
* `PassSimple`:
* Does not have the overhead of #PassMain but does not have the culling and batching optimization.
@@ -160,8 +159,10 @@ class PassBase {
*
* IMPORTANT: This does not set the stencil mask/reference values. Add a call to state_stencil()
* to ensure correct behavior of stencil aware draws.
+ *
+ * TODO(fclem): clip_plane_count should be part of shader state.
*/
- void state_set(DRWState state);
+ void state_set(DRWState state, int clip_plane_count = 0);
/**
* Clear the current frame-buffer.
@@ -192,6 +193,12 @@ class PassBase {
void shader_set(GPUShader *shader);
/**
+ * Bind a framebuffer. This is equivalent to a deferred GPU_framebuffer_bind() call.
+ * \note Changes the global GPU state (outside of DRW).
+ */
+ void framebuffer_set(GPUFrameBuffer *framebuffer);
+
+ /**
* Bind a material shader along with its associated resources. Any following bind() or
* push_constant() call will use its interface.
* IMPORTANT: Assumes material is compiled and can be used (no compilation error).
@@ -726,9 +733,13 @@ template<class T> inline void PassBase<T>::barrier(eGPUBarrier type)
/** \name State Implementation
* \{ */
-template<class T> inline void PassBase<T>::state_set(DRWState state)
+template<class T> inline void PassBase<T>::state_set(DRWState state, int clip_plane_count)
{
- create_command(Type::StateSet).state_set = {state};
+ /** \note This is for compatibility with the old clip plane API. */
+ if (clip_plane_count > 0) {
+ state |= DRW_STATE_CLIP_PLANES;
+ }
+ create_command(Type::StateSet).state_set = {state, clip_plane_count};
}
template<class T>
@@ -743,6 +754,11 @@ template<class T> inline void PassBase<T>::shader_set(GPUShader *shader)
create_command(Type::ShaderBind).shader_bind = {shader};
}
+template<class T> inline void PassBase<T>::framebuffer_set(GPUFrameBuffer *framebuffer)
+{
+ create_command(Type::FramebufferBind).framebuffer_bind = {framebuffer};
+}
+
template<class T> inline void PassBase<T>::material_set(Manager &manager, GPUMaterial *material)
{
GPUPass *gpupass = GPU_material_get_pass(material);
diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index 38fb6d55245..b25bb42a8a5 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -951,6 +951,14 @@ struct PBVHBatches {
void create_index_faces(PBVH_GPU_Args *args)
{
+ int *mat_index = static_cast<int *>(
+ CustomData_get_layer_named(args->pdata, CD_PROP_INT32, "material_index"));
+
+ if (mat_index && args->totprim) {
+ int poly_index = args->mlooptri[args->prim_indices[0]].poly;
+ material_index = mat_index[poly_index];
+ }
+
/* Calculate number of edges*/
int edge_count = 0;
for (int i = 0; i < args->totprim; i++) {
@@ -959,6 +967,7 @@ struct PBVHBatches {
if (args->hide_poly && args->hide_poly[lt->poly]) {
continue;
}
+
int r_edges[3];
BKE_mesh_looptri_get_real_edges(args->me, lt, r_edges);
@@ -1030,6 +1039,14 @@ struct PBVHBatches {
void create_index_grids(PBVH_GPU_Args *args)
{
+ int *mat_index = static_cast<int *>(
+ CustomData_get_layer_named(args->pdata, CD_PROP_INT32, "material_index"));
+
+ if (mat_index && args->totprim) {
+ int poly_index = BKE_subdiv_ccg_grid_to_face_index(args->subdiv_ccg, args->grid_indices[0]);
+ material_index = mat_index[poly_index];
+ }
+
needs_tri_index = true;
int gridsize = args->ccg_key.grid_size;
int totgrid = args->totprim;
diff --git a/source/blender/draw/intern/draw_resource.hh b/source/blender/draw/intern/draw_resource.hh
index 2df38e32ed2..b8a0dbb8fa9 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -31,8 +31,8 @@
inline void ObjectMatrices::sync(const Object &object)
{
- model = object.obmat;
- model_inverse = object.imat;
+ model = object.object_to_world;
+ model_inverse = object.world_to_object;
}
inline void ObjectMatrices::sync(const float4x4 &model_matrix)
diff --git a/source/blender/draw/intern/draw_volume.cc b/source/blender/draw/intern/draw_volume.cc
index 2b4b0e3c089..5c1ce7c3111 100644
--- a/source/blender/draw/intern/draw_volume.cc
+++ b/source/blender/draw/intern/draw_volume.cc
@@ -127,7 +127,7 @@ static DRWShadingGroup *drw_volume_object_grids_init(Object *ob,
grp = DRW_shgroup_create_sub(grp);
- volume_infos.density_scale = BKE_volume_density_scale(volume, ob->obmat);
+ volume_infos.density_scale = BKE_volume_density_scale(volume, ob->object_to_world);
volume_infos.color_mul = float4(1.0f);
volume_infos.temperature_mul = 1.0f;
volume_infos.temperature_bias = 0.0f;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
index a968bd07c87..de1f5181ac5 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
@@ -66,7 +66,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
* We could have a flag in the mesh instead or check the modifier stack. */
const MEdge *med = mr->medge;
for (int e_index = 0; e_index < mr->edge_len; e_index++, med++) {
- if ((med->flag & ME_EDGERENDER) == 0) {
+ if ((med->flag & ME_EDGEDRAW) == 0) {
data->use_edge_render = true;
break;
}
@@ -118,7 +118,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
if (data->use_edge_render) {
const MEdge *med = &mr->medge[ml->e];
- data->vbo_data[ml_index] = (med->flag & ME_EDGERENDER) ? 255 : 0;
+ data->vbo_data[ml_index] = (med->flag & ME_EDGEDRAW) ? 255 : 0;
}
else {
diff --git a/source/blender/draw/tests/draw_pass_test.cc b/source/blender/draw/tests/draw_pass_test.cc
index 394ca8bd3cf..95ab8fa2ef1 100644
--- a/source/blender/draw/tests/draw_pass_test.cc
+++ b/source/blender/draw/tests/draw_pass_test.cc
@@ -181,12 +181,19 @@ static void test_draw_pass_multi_draw()
pass.draw_procedural(GPU_PRIM_LINES, 1, -1, -1, {5});
pass.draw_procedural(GPU_PRIM_POINTS, 6, -1, -1, {5});
pass.draw_procedural(GPU_PRIM_TRIS, 3, -1, -1, {6});
+ /* Custom calls should use their own group and never be batched. */
+ pass.draw_procedural(GPU_PRIM_TRIS, 2, 2, 2, {7});
+ pass.draw_procedural(GPU_PRIM_TRIS, 2, 2, 2, {8});
std::string result = pass.serialize();
std::stringstream expected;
expected << ".test.multi_draw" << std::endl;
expected << " .shader_bind(gpu_shader_3D_image_color)" << std::endl;
expected << " .draw_multi(3)" << std::endl;
+ expected << " .group(id=4, len=2)" << std::endl;
+ expected << " .proto(instance_len=2, resource_id=8, front_face)" << std::endl;
+ expected << " .group(id=3, len=2)" << std::endl;
+ expected << " .proto(instance_len=2, resource_id=7, front_face)" << std::endl;
expected << " .group(id=2, len=1)" << std::endl;
expected << " .proto(instance_len=1, resource_id=5, front_face)" << std::endl;
expected << " .group(id=1, len=15)" << std::endl;
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 06a0077df9b..329bc2b46eb 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -329,6 +329,121 @@ short ANIM_get_normalization_flags(bAnimContext *ac)
return 0;
}
+static void fcurve_scene_coord_range_get(Scene *scene,
+ FCurve *fcu,
+ float *r_min_coord,
+ float *r_max_coord)
+{
+ float min_coord = FLT_MAX;
+ float max_coord = -FLT_MAX;
+ const bool use_preview_only = PRVRANGEON;
+
+ if (fcu->bezt || fcu->fpt) {
+ int start = 0;
+ int end = fcu->totvert;
+
+ if (use_preview_only) {
+ start = scene->r.psfra;
+ end = min_ii(scene->r.pefra + 1, fcu->totvert);
+ }
+
+ if (fcu->bezt) {
+ const BezTriple *bezt = fcu->bezt + start;
+ for (int i = start; i < end; i++, bezt++) {
+
+ if (i == 0) {
+ /* We ignore extrapolation flags and handle here, and use the
+ * control point position only. so we normalize "interesting"
+ * part of the curve.
+ *
+ * Here we handle left extrapolation.
+ */
+ max_coord = max_ff(max_coord, bezt->vec[1][1]);
+ min_coord = min_ff(min_coord, bezt->vec[1][1]);
+ }
+ else {
+ const BezTriple *prev_bezt = bezt - 1;
+ if (!ELEM(prev_bezt->ipo, BEZT_IPO_BEZ, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) {
+ /* The points on the curve will lie inside the start and end points.
+ * Calculate min/max using both previous and current CV.
+ */
+ max_coord = max_ff(max_coord, bezt->vec[1][1]);
+ min_coord = min_ff(min_coord, bezt->vec[1][1]);
+ max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
+ min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
+ }
+ else {
+ const int resol = fcu->driver ?
+ 32 :
+ min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])),
+ 32);
+ if (resol < 2) {
+ max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
+ min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
+ }
+ else {
+ if (!ELEM(prev_bezt->ipo, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) {
+ /* Calculate min/max using bezier forward differencing. */
+ float data[120];
+ float v1[2], v2[2], v3[2], v4[2];
+
+ v1[0] = prev_bezt->vec[1][0];
+ v1[1] = prev_bezt->vec[1][1];
+ v2[0] = prev_bezt->vec[2][0];
+ v2[1] = prev_bezt->vec[2][1];
+
+ v3[0] = bezt->vec[0][0];
+ v3[1] = bezt->vec[0][1];
+ v4[0] = bezt->vec[1][0];
+ v4[1] = bezt->vec[1][1];
+
+ BKE_fcurve_correct_bezpart(v1, v2, v3, v4);
+
+ BKE_curve_forward_diff_bezier(
+ v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float[3]));
+ BKE_curve_forward_diff_bezier(
+ v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float[3]));
+
+ for (int j = 0; j <= resol; ++j) {
+ const float *fp = &data[j * 3];
+ max_coord = max_ff(max_coord, fp[1]);
+ min_coord = min_ff(min_coord, fp[1]);
+ }
+ }
+ else {
+ /* Calculate min/max using full fcurve evaluation.
+ * [slower than bezier forward differencing but evaluates Back/Elastic
+ * interpolation as well]. */
+ float step_size = (bezt->vec[1][0] - prev_bezt->vec[1][0]) / resol;
+ for (int j = 0; j <= resol; j++) {
+ float eval_time = prev_bezt->vec[1][0] + step_size * j;
+ float eval_value = evaluate_fcurve_only_curve(fcu, eval_time);
+ max_coord = max_ff(max_coord, eval_value);
+ min_coord = min_ff(min_coord, eval_value);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (fcu->fpt) {
+ const FPoint *fpt = fcu->fpt + start;
+ for (int i = start; i < end; ++i, ++fpt) {
+ min_coord = min_ff(min_coord, fpt->vec[1]);
+ max_coord = max_ff(max_coord, fpt->vec[1]);
+ }
+ }
+ }
+
+ if (r_min_coord) {
+ *r_min_coord = min_coord;
+ }
+ if (r_max_coord) {
+ *r_max_coord = max_coord;
+ }
+}
+
static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, float *r_offset)
{
float factor = 1.0f, offset = 0.0f;
@@ -366,112 +481,23 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
}
fcu->prev_norm_factor = 1.0f;
- if (fcu->bezt) {
- const bool use_preview_only = PRVRANGEON;
- const BezTriple *bezt;
- int i;
- float max_coord = -FLT_MAX;
- float min_coord = FLT_MAX;
- float range;
-
- if (fcu->totvert < 1) {
- return 1.0f;
- }
-
- for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (use_preview_only && !IN_RANGE_INCL(bezt->vec[1][0], scene->r.psfra, scene->r.pefra)) {
- continue;
- }
-
- if (i == 0) {
- /* We ignore extrapolation flags and handle here, and use the
- * control point position only. so we normalize "interesting"
- * part of the curve.
- *
- * Here we handle left extrapolation.
- */
- max_coord = max_ff(max_coord, bezt->vec[1][1]);
- min_coord = min_ff(min_coord, bezt->vec[1][1]);
- }
- else {
- const BezTriple *prev_bezt = bezt - 1;
- if (!ELEM(prev_bezt->ipo, BEZT_IPO_BEZ, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) {
- /* The points on the curve will lie inside the start and end points.
- * Calculate min/max using both previous and current CV.
- */
- max_coord = max_ff(max_coord, bezt->vec[1][1]);
- min_coord = min_ff(min_coord, bezt->vec[1][1]);
- max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
- min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
- }
- else {
- const int resol = fcu->driver ?
- 32 :
- min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])),
- 32);
- if (resol < 2) {
- max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
- min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
- }
- else {
- if (!ELEM(prev_bezt->ipo, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) {
- /* Calculate min/max using bezier forward differencing. */
- float data[120];
- float v1[2], v2[2], v3[2], v4[2];
-
- v1[0] = prev_bezt->vec[1][0];
- v1[1] = prev_bezt->vec[1][1];
- v2[0] = prev_bezt->vec[2][0];
- v2[1] = prev_bezt->vec[2][1];
-
- v3[0] = bezt->vec[0][0];
- v3[1] = bezt->vec[0][1];
- v4[0] = bezt->vec[1][0];
- v4[1] = bezt->vec[1][1];
-
- BKE_fcurve_correct_bezpart(v1, v2, v3, v4);
-
- BKE_curve_forward_diff_bezier(
- v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float[3]));
- BKE_curve_forward_diff_bezier(
- v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float[3]));
-
- for (int j = 0; j <= resol; ++j) {
- const float *fp = &data[j * 3];
- max_coord = max_ff(max_coord, fp[1]);
- min_coord = min_ff(min_coord, fp[1]);
- }
- }
- else {
- /* Calculate min/max using full fcurve evaluation.
- * [slower than bezier forward differencing but evaluates Back/Elastic interpolation
- * as well]. */
- float step_size = (bezt->vec[1][0] - prev_bezt->vec[1][0]) / resol;
- for (int j = 0; j <= resol; j++) {
- float eval_time = prev_bezt->vec[1][0] + step_size * j;
- float eval_value = evaluate_fcurve_only_curve(fcu, eval_time);
- max_coord = max_ff(max_coord, eval_value);
- min_coord = min_ff(min_coord, eval_value);
- }
- }
- }
- }
- }
- }
+ float max_coord = -FLT_MAX;
+ float min_coord = FLT_MAX;
+ fcurve_scene_coord_range_get(scene, fcu, &min_coord, &max_coord);
- if (max_coord > min_coord) {
- range = max_coord - min_coord;
- if (range > FLT_EPSILON) {
- factor = 2.0f / range;
- }
- offset = -min_coord - range / 2.0f;
- }
- else if (max_coord == min_coord) {
- factor = 1.0f;
- offset = -min_coord;
+ if (max_coord > min_coord) {
+ const float range = max_coord - min_coord;
+ if (range > FLT_EPSILON) {
+ factor = 2.0f / range;
}
+ offset = -min_coord - range / 2.0f;
+ }
+ else if (max_coord == min_coord) {
+ factor = 1.0f;
+ offset = -min_coord;
}
+
BLI_assert(factor != 0.0f);
if (r_offset) {
*r_offset = offset;
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c
index 23c1d68b4d6..4a83bb4c800 100644
--- a/source/blender/editors/animation/anim_motion_paths.c
+++ b/source/blender/editors/animation/anim_motion_paths.c
@@ -161,11 +161,11 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe)
}
/* Result must be in world-space. */
- mul_m4_v3(ob_eval->obmat, mpv->co);
+ mul_m4_v3(ob_eval->object_to_world, mpv->co);
}
else {
/* World-space object location. */
- copy_v3_v3(mpv->co, ob_eval->obmat[3]);
+ copy_v3_v3(mpv->co, ob_eval->object_to_world[3]);
}
float mframe = (float)(cframe);
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index c9957b38853..96a9604a6f5 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1044,12 +1044,12 @@ static float *visualkey_get_values(
Object *ob = ptr->data;
/* Loc code is specific... */
if (strstr(identifier, "location")) {
- copy_v3_v3(buffer, ob->obmat[3]);
+ copy_v3_v3(buffer, ob->object_to_world[3]);
*r_count = 3;
return buffer;
}
- copy_m4_m4(tmat, ob->obmat);
+ copy_m4_m4(tmat, ob->object_to_world);
rotmode = ob->rotmode;
}
else if (ptr->type == &RNA_PoseBone) {
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index 17484b2b0b7..806da5ee286 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -181,13 +181,13 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
const View3DCursor *curs = &scene->cursor;
copy_v3_v3(newbone->tail, curs->location);
- sub_v3_v3v3(newbone->tail, newbone->tail, obedit->obmat[3]);
+ sub_v3_v3v3(newbone->tail, newbone->tail, obedit->object_to_world[3]);
if (a == 1) {
newbone->tail[0] = -newbone->tail[0];
}
- copy_m3_m4(mat, obedit->obmat);
+ copy_m3_m4(mat, obedit->object_to_world);
invert_m3_m3(imat, mat);
mul_m3_v3(imat, newbone->tail);
@@ -1569,8 +1569,8 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
copy_v3_v3(curs, CTX_data_scene(C)->cursor.location);
/* Get inverse point for head and orientation for tail */
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_m4_v3(obedit->imat, curs);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_m4_v3(obedit->world_to_object, curs);
if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) {
copy_m3_m4(obmat, rv3d->viewmat);
@@ -1579,7 +1579,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
unit_m3(obmat);
}
- copy_m3_m4(viewmat, obedit->obmat);
+ copy_m3_m4(viewmat, obedit->object_to_world);
mul_m3_m3m3(totmat, obmat, viewmat);
invert_m3_m3(imat, totmat);
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 9e828ebd501..780e2fae00e 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -113,8 +113,8 @@ void ED_armature_origin_set(
/* Find the center-point. */
if (centermode == 2) {
copy_v3_v3(cent, cursor);
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, cent);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->world_to_object, cent);
}
else {
if (around == V3D_AROUND_CENTER_BOUNDS) {
@@ -154,7 +154,7 @@ void ED_armature_origin_set(
/* Adjust object location for new center-point. */
if (centermode && (is_editmode == false)) {
- mul_mat3_m4_v3(ob->obmat, cent); /* omit translation part */
+ mul_mat3_m4_v3(ob->object_to_world, cent); /* omit translation part */
add_v3_v3(ob->loc, cent);
}
}
@@ -282,16 +282,16 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
axis_flip = true;
}
- copy_m3_m4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->object_to_world);
invert_m3(imat);
if (type == CALC_ROLL_CURSOR) { /* Cursor */
float cursor_local[3];
const View3DCursor *cursor = &scene->cursor;
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
copy_v3_v3(cursor_local, cursor->location);
- mul_m4_v3(ob->imat, cursor_local);
+ mul_m4_v3(ob->world_to_object, cursor_local);
/* cursor */
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
@@ -730,8 +730,8 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
ebp = points.first;
/* Get points - cursor (tail) */
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_v3_m4v3(curs, obedit->imat, scene->cursor.location);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_v3_m4v3(curs, obedit->world_to_object, scene->cursor.location);
/* Create a bone */
newbone = add_points_bone(obedit, ebp->vec, curs);
@@ -767,8 +767,8 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
float dist_sq_a, dist_sq_b;
/* get cursor location */
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_v3_m4v3(curs, obedit->imat, scene->cursor.location);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_v3_m4v3(curs, obedit->world_to_object, scene->cursor.location);
/* get distances */
dist_sq_a = len_squared_v3v3(ebp_a->vec, curs);
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index 9f1883ccac0..fccf2964868 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -289,7 +289,7 @@ int ED_armature_join_objects_exec(bContext *C, wmOperator *op)
/* Inverse transform for all selected armatures in this object,
* See #object_join_exec for detailed comment on why the safe version is used. */
- invert_m4_m4_safe_ortho(oimat, ob_active->obmat);
+ invert_m4_m4_safe_ortho(oimat, ob_active->object_to_world);
/* Get edit-bones of active armature to add edit-bones to */
ED_armature_to_edit(arm);
@@ -321,7 +321,7 @@ int ED_armature_join_objects_exec(bContext *C, wmOperator *op)
// BASACT->flag &= ~OB_MODE_POSE;
/* Find the difference matrix */
- mul_m4_m4m4(mat, oimat, ob_iter->obmat);
+ mul_m4_m4m4(mat, oimat, ob_iter->object_to_world);
/* Copy bones and posechannels from the object to the edit armature */
for (pchan = opose->chanbase.first; pchan; pchan = pchann) {
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 6b8f790d30f..3ee0510ca7f 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -1601,8 +1601,8 @@ static const EnumPropertyItem prop_similar_types[] = {
static float bone_length_squared_worldspace_get(Object *ob, EditBone *ebone)
{
float v1[3], v2[3];
- mul_v3_mat3_m4v3(v1, ob->obmat, ebone->head);
- mul_v3_mat3_m4v3(v2, ob->obmat, ebone->tail);
+ mul_v3_mat3_m4v3(v1, ob->object_to_world, ebone->head);
+ mul_v3_mat3_m4v3(v2, ob->object_to_world, ebone->tail);
return len_squared_v3v3(v1, v2);
}
@@ -1650,8 +1650,8 @@ static void bone_direction_worldspace_get(Object *ob, EditBone *ebone, float *r_
copy_v3_v3(v1, ebone->head);
copy_v3_v3(v2, ebone->tail);
- mul_m4_v3(ob->obmat, v1);
- mul_m4_v3(ob->obmat, v2);
+ mul_m4_v3(ob->object_to_world, v1);
+ mul_m4_v3(ob->object_to_world, v2);
sub_v3_v3v3(r_dir, v1, v2);
normalize_v3(r_dir);
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 6155aac621d..3c9c8cf05b3 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -365,8 +365,8 @@ static void add_verts_to_dgroups(ReportList *reports,
copy_v3_v3(tip[j], bone->arm_tail);
}
- mul_m4_v3(par->obmat, root[j]);
- mul_m4_v3(par->obmat, tip[j]);
+ mul_m4_v3(par->object_to_world, root[j]);
+ mul_m4_v3(par->object_to_world, tip[j]);
/* set selected */
if (wpmode) {
@@ -414,7 +414,7 @@ static void add_verts_to_dgroups(ReportList *reports,
if (!vertsfilled) {
copy_v3_v3(verts[i], mesh_verts[i].co);
}
- mul_m4_v3(ob->obmat, verts[i]);
+ mul_m4_v3(ob->object_to_world, verts[i]);
}
/* compute the weights based on gathered vertices and bones */
@@ -438,7 +438,7 @@ static void add_verts_to_dgroups(ReportList *reports,
root,
tip,
selected,
- mat4_to_scale(par->obmat));
+ mat4_to_scale(par->object_to_world));
}
/* only generated in some cases but can call anyway */
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 09174aa5e47..0465606e694 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -703,11 +703,11 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm)
newBone->inherit_scale_mode = eBone->inherit_scale_mode;
if (eBone == arm->act_edbone) {
- /* don't change active selection, this messes up separate which uses
- * editmode toggle and can separate active bone which is de-selected originally */
+ /* Don't change active selection, this messes up separate which uses
+ * edit-mode toggle and can separate active bone which is de-selected originally. */
- /* important, editbones can be active with only 1 point selected */
- /* newBone->flag |= BONE_SELECTED; */
+ /* important, edit-bones can be active with only 1 point selected */
+ /* `newBone->flag |= BONE_SELECTED;` */
arm->act_bone = newBone;
}
newBone->roll = 0.0f;
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 567977e51c4..dfb9e8a79fa 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1788,11 +1788,11 @@ void ED_mesh_deform_bind_callback(Object *object,
mmd_orig->bindcagecos = (float *)mdb.cagecos;
mmd_orig->verts_num = mdb.verts_num;
mmd_orig->cage_verts_num = mdb.cage_verts_num;
- copy_m4_m4(mmd_orig->bindmat, mmd_orig->object->obmat);
+ copy_m4_m4(mmd_orig->bindmat, mmd_orig->object->object_to_world);
/* transform bindcagecos to world space */
for (a = 0; a < mdb.cage_verts_num; a++) {
- mul_m4_v3(mmd_orig->object->obmat, mmd_orig->bindcagecos + a * 3);
+ mul_m4_v3(mmd_orig->object->object_to_world, mmd_orig->bindcagecos + a * 3);
}
/* free */
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 9ed963f0c66..51071815823 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -77,10 +77,10 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
/* apply current transform from parent (not yet destroyed),
* then calculate new parent inverse matrix
*/
- BKE_object_apply_mat4(ob, ob->obmat, false, false);
+ BKE_object_apply_mat4(ob, ob->object_to_world, false, false);
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
}
}
@@ -361,7 +361,7 @@ static void applyarmature_reset_constraints(bPose *pose, const bool use_selected
}
}
-/* set the current pose as the restpose */
+/* Set the current pose as the rest-pose. */
static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -404,10 +404,10 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
}
}
- /* Get editbones of active armature to alter */
+ /* Get edit-bones of active armature to alter. */
ED_armature_to_edit(arm);
- /* get pose of active object and move it out of posemode */
+ /* Get pose of active object and move it out of pose-mode. */
pose = ob->pose;
if (use_selected) {
@@ -429,11 +429,11 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
}
}
- /* convert editbones back to bones, and then free the edit-data */
+ /* Convert edit-bones back to bones, and then free the edit-data. */
ED_armature_from_edit(bmain, arm);
ED_armature_edit_free(arm);
- /* flush positions of posebones */
+ /* Flush positions of pose-bones. */
BKE_pose_where_is(depsgraph, scene, ob);
/* fix parenting of objects which are bone-parented */
diff --git a/source/blender/editors/asset/ED_asset_list.h b/source/blender/editors/asset/ED_asset_list.h
index b54f81004f2..3d2aaa3bda1 100644
--- a/source/blender/editors/asset/ED_asset_list.h
+++ b/source/blender/editors/asset/ED_asset_list.h
@@ -23,6 +23,7 @@ struct wmNotifier;
*/
void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference,
const struct bContext *C);
+bool ED_assetlist_is_loaded(const struct AssetLibraryReference *library_reference);
void ED_assetlist_ensure_previews_job(const struct AssetLibraryReference *library_reference,
const struct bContext *C);
void ED_assetlist_clear(const struct AssetLibraryReference *library_reference, struct bContext *C);
diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc
index 7fdb924d769..bb72c5cc1bb 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -351,7 +351,7 @@ void AssetListStorage::fetch_library(const AssetLibraryReference &library_refere
void AssetListStorage::destruct()
{
- global_storage().~AssetListMap();
+ global_storage().clear();
}
AssetList *AssetListStorage::lookup_list(const AssetLibraryReference &library_ref)
@@ -422,6 +422,18 @@ void ED_assetlist_storage_fetch(const AssetLibraryReference *library_reference,
AssetListStorage::fetch_library(*library_reference, *C);
}
+bool ED_assetlist_is_loaded(const AssetLibraryReference *library_reference)
+{
+ AssetList *list = AssetListStorage::lookup_list(*library_reference);
+ if (!list) {
+ return false;
+ }
+ if (list->needsRefetch()) {
+ return false;
+ }
+ return true;
+}
+
void ED_assetlist_ensure_previews_job(const AssetLibraryReference *library_reference,
const bContext *C)
{
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 61e92f0a1c3..f9377503630 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -4999,7 +4999,7 @@ bool ed_editnurb_spin(
invert_m3_m3(persinv, persmat);
/* imat and center and size */
- copy_m3_m4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->object_to_world);
invert_m3_m3(imat, bmat);
axis_angle_to_mat3(cmat, axis, M_PI_4);
@@ -5095,8 +5095,8 @@ static int spin_exec(bContext *C, wmOperator *op)
continue;
}
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_m4_v3(obedit->imat, cent);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_m4_v3(obedit->world_to_object, cent);
if (!ed_editnurb_spin(viewmat, v3d, obedit, axis, cent)) {
count_failed += 1;
@@ -5574,7 +5574,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "location", location);
- invert_m4_m4(imat, obedit->obmat);
+ invert_m4_m4(imat, obedit->object_to_world);
mul_m4_v3(imat, location);
if (ed_editcurve_addvert(cu, editnurb, v3d, location)) {
@@ -5614,10 +5614,10 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ED_curve_nurb_vert_selected_find(cu, vc.v3d, &nu, &bezt, &bp);
if (bezt) {
- mul_v3_m4v3(location, vc.obedit->obmat, bezt->vec[1]);
+ mul_v3_m4v3(location, vc.obedit->object_to_world, bezt->vec[1]);
}
else if (bp) {
- mul_v3_m4v3(location, vc.obedit->obmat, bp->vec);
+ mul_v3_m4v3(location, vc.obedit->object_to_world, bp->vec);
}
else {
copy_v3_v3(location, vc.scene->cursor.location);
@@ -5662,8 +5662,8 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* get the plane */
float plane[4];
/* only normalize to avoid precision errors */
- normalize_v3_v3(plane, vc.obedit->obmat[2]);
- plane[3] = -dot_v3v3(plane, vc.obedit->obmat[3]);
+ normalize_v3_v3(plane, vc.obedit->object_to_world[2]);
+ plane[3] = -dot_v3v3(plane, vc.obedit->object_to_world[3]);
if (fabsf(dot_v3v3(view_dir, plane)) < eps) {
/* can't project on an aligned plane. */
@@ -6924,7 +6924,7 @@ int ED_curve_join_objects_exec(bContext *C, wmOperator *op)
/* Inverse transform for all selected curves in this object,
* See #object_join_exec for detailed comment on why the safe version is used. */
- invert_m4_m4_safe_ortho(imat, ob_active->obmat);
+ invert_m4_m4_safe_ortho(imat, ob_active->object_to_world);
Curve *cu_active = ob_active->data;
@@ -6936,7 +6936,7 @@ int ED_curve_join_objects_exec(bContext *C, wmOperator *op)
if (cu->nurb.first) {
/* watch it: switch order here really goes wrong */
- mul_m4_m4m4(cmat, imat, ob_iter->obmat);
+ mul_m4_m4m4(cmat, imat, ob_iter->object_to_world);
/* Compensate for different bevel depth. */
bool do_radius = false;
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 7632f1b1e64..af3d439dd2e 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -148,7 +148,7 @@ static void stroke_elem_pressure_set(const struct CurveDrawData *cdd,
const float adjust = stroke_elem_radius_from_pressure(cdd, pressure) -
stroke_elem_radius_from_pressure(cdd, selem->pressure);
madd_v3_v3fl(selem->location_local, selem->normal_local, adjust);
- mul_v3_m4v3(selem->location_world, cdd->vc.obedit->obmat, selem->location_local);
+ mul_v3_m4v3(selem->location_world, cdd->vc.obedit->object_to_world, selem->location_local);
}
selem->pressure = pressure;
}
@@ -245,11 +245,11 @@ static bool stroke_elem_project_fallback(const struct CurveDrawData *cdd,
cdd->vc.v3d, cdd->vc.region, location_fallback_depth, mval_fl, r_location_world);
zero_v3(r_normal_local);
}
- mul_v3_m4v3(r_location_local, cdd->vc.obedit->imat, r_location_world);
+ mul_v3_m4v3(r_location_local, cdd->vc.obedit->world_to_object, r_location_world);
if (!is_zero_v3(r_normal_world)) {
copy_v3_v3(r_normal_local, r_normal_world);
- mul_transposed_mat3_m4_v3(cdd->vc.obedit->obmat, r_normal_local);
+ mul_transposed_mat3_m4_v3(cdd->vc.obedit->object_to_world, r_normal_local);
normalize_v3(r_normal_local);
}
else {
@@ -304,7 +304,7 @@ static void curve_draw_stroke_from_operator_elem(wmOperator *op, PointerRNA *ite
RNA_float_get_array(itemptr, "mouse", selem->mval);
RNA_float_get_array(itemptr, "location", selem->location_world);
- mul_v3_m4v3(selem->location_local, cdd->vc.obedit->imat, selem->location_world);
+ mul_v3_m4v3(selem->location_local, cdd->vc.obedit->world_to_object, selem->location_world);
selem->pressure = RNA_float_get(itemptr, "pressure");
}
@@ -367,7 +367,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
/* scale to edit-mode space */
GPU_matrix_push();
- GPU_matrix_mul(obedit->obmat);
+ GPU_matrix_mul(obedit->object_to_world);
BLI_mempool_iternew(cdd->stroke_elem_pool, &iter);
for (selem = BLI_mempool_iterstep(&iter); selem; selem = BLI_mempool_iterstep(&iter)) {
@@ -445,7 +445,7 @@ static void curve_draw_event_add(wmOperator *op, const wmEvent *event)
struct CurveDrawData *cdd = op->customdata;
Object *obedit = cdd->vc.obedit;
- invert_m4_m4(obedit->imat, obedit->obmat);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
struct StrokeElem *selem = BLI_mempool_calloc(cdd->stroke_elem_pool);
@@ -758,7 +758,7 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
int stroke_len = BLI_mempool_len(cdd->stroke_elem_pool);
const bool is_3d = (cu->flag & CU_3D) != 0;
- invert_m4_m4(obedit->imat, obedit->obmat);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
if (BLI_mempool_len(cdd->stroke_elem_pool) == 0) {
curve_draw_stroke_from_operator(op);
@@ -1073,8 +1073,8 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (CU_IS_2D(cu)) {
/* 2D overrides other options */
- plane_co = obedit->obmat[3];
- plane_no = obedit->obmat[2];
+ plane_co = obedit->object_to_world[3];
+ plane_no = obedit->object_to_world[2];
cdd->project.use_plane = true;
}
else {
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index f71173f951e..b57ce6fc7cf 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -152,8 +152,8 @@ static void update_location_for_2d_curve(const ViewContext *vc, float location[3
/* Get the plane. */
float plane[4];
/* Only normalize to avoid precision errors. */
- normalize_v3_v3(plane, vc->obedit->obmat[2]);
- plane[3] = -dot_v3v3(plane, vc->obedit->obmat[3]);
+ normalize_v3_v3(plane, vc->obedit->object_to_world[2]);
+ plane[3] = -dot_v3v3(plane, vc->obedit->object_to_world[3]);
if (fabsf(dot_v3v3(view_dir, plane)) < eps) {
/* Can't project on an aligned plane. */
@@ -173,7 +173,7 @@ static void update_location_for_2d_curve(const ViewContext *vc, float location[3
}
float imat[4][4];
- invert_m4_m4(imat, vc->obedit->obmat);
+ invert_m4_m4(imat, vc->obedit->object_to_world);
mul_m4_v3(imat, location);
if (CU_IS_2D(cu)) {
@@ -186,7 +186,7 @@ static void screenspace_to_worldspace(const ViewContext *vc,
const float depth[3],
float r_pos_3d[3])
{
- mul_v3_m4v3(r_pos_3d, vc->obedit->obmat, depth);
+ mul_v3_m4v3(r_pos_3d, vc->obedit->object_to_world, depth);
ED_view3d_win_to_3d(vc->v3d, vc->region, r_pos_3d, pos_2d, r_pos_3d);
update_location_for_2d_curve(vc, r_pos_3d);
}
@@ -1082,7 +1082,7 @@ static void extrude_points_from_selected_vertices(const ViewContext *vc,
float location[3];
if (sel_exists) {
- mul_v3_m4v3(location, vc->obedit->obmat, center);
+ mul_v3_m4v3(location, vc->obedit->object_to_world, center);
}
else {
copy_v3_v3(location, vc->scene->cursor.location);
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index 9c0c580f699..da742dd0c61 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -1517,7 +1517,7 @@ static void nurb_bezt_direction_worldspace_get(Object *ob,
{
float rsmat[3][3];
BKE_nurb_bezt_calc_normal(nu, bezt, r_dir);
- copy_m3_m4(rsmat, ob->obmat);
+ copy_m3_m4(rsmat, ob->object_to_world);
mul_m3_v3(rsmat, r_dir);
normalize_v3(r_dir);
}
@@ -1526,7 +1526,7 @@ static void nurb_bpoint_direction_worldspace_get(Object *ob, Nurb *nu, BPoint *b
{
float rsmat[3][3];
BKE_nurb_bpoint_calc_normal(nu, bp, r_dir);
- copy_m3_m4(rsmat, ob->obmat);
+ copy_m3_m4(rsmat, ob->object_to_world);
mul_m3_v3(rsmat, r_dir);
normalize_v3(r_dir);
}
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc
index 38b2b2071b8..1d2b1264477 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -435,7 +435,7 @@ static bke::CurvesGeometry particles_to_curves(Object &object, ParticleSystem &p
bke::CurvesGeometry curves(points_num, curves_num);
curves.offsets_for_write().copy_from(curve_offsets);
- const float4x4 object_to_world_mat = object.obmat;
+ const float4x4 object_to_world_mat = object.object_to_world;
const float4x4 world_to_object_mat = object_to_world_mat.inverted();
MutableSpan<float3> positions = curves.positions_for_write();
@@ -497,7 +497,7 @@ static int curves_convert_from_particle_system_exec(bContext *C, wmOperator * /*
Object *ob_new = BKE_object_add(&bmain, &scene, &view_layer, OB_CURVES, psys_eval->name);
Curves *curves_id = static_cast<Curves *>(ob_new->data);
- BKE_object_apply_mat4(ob_new, ob_from_orig->obmat, true, false);
+ BKE_object_apply_mat4(ob_new, ob_from_orig->object_to_world, true, false);
bke::CurvesGeometry::wrap(curves_id->geometry) = particles_to_curves(*ob_from_eval, *psys_eval);
DEG_relations_tag_update(&bmain);
diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c
index 1ac4ce0bcdf..465c72dd44f 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_presets.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c
@@ -114,7 +114,7 @@ void ED_gizmo_draw_preset_facemap(
}
GPU_matrix_push();
- GPU_matrix_mul(ob->obmat);
+ GPU_matrix_mul(ob->object_to_world);
ED_draw_object_facemap(depsgraph, ob, color, facemap);
GPU_matrix_pop();
diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c
index 5f5a4b41b27..2b7e09b7f05 100644
--- a/source/blender/editors/gpencil/gpencil_armature.c
+++ b/source/blender/editors/gpencil/gpencil_armature.c
@@ -329,8 +329,8 @@ static void gpencil_add_verts_to_dgroups(
copy_v3_v3(tip[j], bone->arm_tail);
}
- mul_m4_v3(ob_arm->obmat, root[j]);
- mul_m4_v3(ob_arm->obmat, tip[j]);
+ mul_m4_v3(ob_arm->object_to_world, root[j]);
+ mul_m4_v3(ob_arm->object_to_world, tip[j]);
selected[j] = 1;
@@ -364,7 +364,7 @@ static void gpencil_add_verts_to_dgroups(
/* transform stroke points to global space */
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
copy_v3_v3(verts[i], &pt->x);
- mul_m4_v3(ob->obmat, verts[i]);
+ mul_m4_v3(ob->object_to_world, verts[i]);
}
/* loop groups and assign weight */
diff --git a/source/blender/editors/gpencil/gpencil_bake_animation.cc b/source/blender/editors/gpencil/gpencil_bake_animation.cc
index 1535fd614fe..4ef2cf9ffd6 100644
--- a/source/blender/editors/gpencil/gpencil_bake_animation.cc
+++ b/source/blender/editors/gpencil/gpencil_bake_animation.cc
@@ -222,7 +222,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op
ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
ob_gpencil = ED_gpencil_add_object(C, scene->cursor.location, local_view_bits);
float invmat[4][4];
- invert_m4_m4(invmat, ob_gpencil->obmat);
+ invert_m4_m4(invmat, ob_gpencil->object_to_world);
bGPdata *gpd_dst = (bGPdata *)ob_gpencil->data;
gpd_dst->draw_mode = GP_DRAWMODE_2D;
@@ -323,7 +323,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op
bGPDspoint *pt = &gps->points[j];
pt->runtime.idx_orig = 0;
pt->runtime.pt_orig = nullptr;
- mul_m4_v3(ob_eval->obmat, &pt->x);
+ mul_m4_v3(ob_eval->object_to_world, &pt->x);
mul_m4_v3(invmat, &pt->x);
}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index c6d7eb294fb..0417694d7bd 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -2914,8 +2914,8 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
float offset_global[3];
float offset_local[3];
- sub_v3_v3v3(offset_global, ob_active->loc, ob_iter->obmat[3]);
- copy_m3_m4(bmat, ob_active->obmat);
+ sub_v3_v3v3(offset_global, ob_active->loc, ob_iter->object_to_world[3]);
+ copy_m3_m4(bmat, ob_active->object_to_world);
/* Inverse transform for all selected curves in this object,
* See #object_join_exec for detailed comment on why the safe version is used. */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 6181b9810e3..f9b40a4c79b 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3848,7 +3848,12 @@ static int gpencil_stroke_start_set_exec(bContext *C, wmOperator *op)
for (int i = 0; i < gps->totpoints; i++) {
pt = &gps->points[i];
if (pt->flag & GP_SPOINT_SELECT) {
- BKE_gpencil_stroke_start_set(gps, i);
+ if (i == gps->totpoints - 1) {
+ BKE_gpencil_stroke_flip(gps);
+ }
+ else {
+ BKE_gpencil_stroke_start_set(gps, i);
+ }
BKE_gpencil_stroke_geometry_update(gpd, gps);
changed = true;
break;
@@ -4157,7 +4162,7 @@ static int gpencil_stroke_outline_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *cam_ob = scene->camera;
if (cam_ob != NULL) {
- invert_m4_m4(viewmat, cam_ob->obmat);
+ invert_m4_m4(viewmat, cam_ob->object_to_world);
}
break;
}
@@ -4224,7 +4229,7 @@ static int gpencil_stroke_outline_exec(bContext *C, wmOperator *op)
/* Apply layer thickness change. */
gps_duplicate->thickness += gpl->line_change;
/* Apply object scale to thickness. */
- gps_duplicate->thickness *= mat4_to_scale(ob->obmat);
+ gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
/* Stroke. */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index b94b413edc2..5c88e719b8c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -317,7 +317,7 @@ static void add_endpoint_radius_help(tGPDfill *tgpf,
/* Rotate to object rotation. */
sub_v3_v3(&pt->x, endpoint);
- mul_mat3_m4_v3(tgpf->ob->obmat, &pt->x);
+ mul_mat3_m4_v3(tgpf->ob->object_to_world, &pt->x);
add_v3_v3(&pt->x, endpoint);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_mesh.cc b/source/blender/editors/gpencil/gpencil_mesh.cc
index d847fbe2aea..2b01fce5bf8 100644
--- a/source/blender/editors/gpencil/gpencil_mesh.cc
+++ b/source/blender/editors/gpencil/gpencil_mesh.cc
@@ -299,7 +299,7 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op)
angle,
thickness,
offset,
- ob_eval->obmat,
+ ob_eval->object_to_world,
frame_offset,
use_seams,
use_faces,
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index a82288e3377..d2ed1720bf8 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -936,7 +936,7 @@ static bGPDstroke *gpencil_stroke_to_outline(tGPsdata *p, bGPDstroke *gps)
/* Apply layer thickness change. */
gps_duplicate->thickness += gpl->line_change;
/* Apply object scale to thickness. */
- gps_duplicate->thickness *= mat4_to_scale(p->ob->obmat);
+ gps_duplicate->thickness *= mat4_to_scale(p->ob->object_to_world);
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
/* Stroke. */
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 9b934876ebb..37c1524c2ff 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -671,7 +671,7 @@ static bool gpencil_brush_pinch_apply(tGP_BrushEditData *gso,
/* 1) Make this point relative to the cursor/midpoint (dvec) */
float fpt[3];
- mul_v3_m4v3(fpt, gso->object->obmat, &pt->x);
+ mul_v3_m4v3(fpt, gso->object->object_to_world, &pt->x);
sub_v3_v3v3(vec, fpt, gso->dvec);
/* 2) Shrink the distance by pulling the point towards the midpoint
@@ -691,7 +691,7 @@ static bool gpencil_brush_pinch_apply(tGP_BrushEditData *gso,
/* 3) Translate back to original space, with the shrinkage applied */
add_v3_v3v3(fpt, gso->dvec, vec);
- mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
+ mul_v3_m4v3(&pt->x, gso->object->world_to_object, fpt);
/* compute lock axis */
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
@@ -743,12 +743,12 @@ static bool gpencil_brush_twist_apply(tGP_BrushEditData *gso,
/* Rotate point */
float fpt[3];
- mul_v3_m4v3(fpt, gso->object->obmat, &pt->x);
+ mul_v3_m4v3(fpt, gso->object->object_to_world, &pt->x);
sub_v3_v3v3(vec, fpt, gso->dvec); /* make relative to center
* (center is stored in dvec) */
mul_m3_v3(rmat, vec);
add_v3_v3v3(fpt, vec, gso->dvec); /* restore */
- mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
+ mul_v3_m4v3(&pt->x, gso->object->world_to_object, fpt);
/* compute lock axis */
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
@@ -1037,11 +1037,11 @@ static void gpencil_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
*/
for (i = 0, pt = new_stroke->points; i < new_stroke->totpoints; i++, pt++) {
/* Rotate around center new position */
- mul_mat3_m4_v3(gso->object->obmat, &pt->x); /* only rotation component */
+ mul_mat3_m4_v3(gso->object->object_to_world, &pt->x); /* only rotation component */
/* assume that the delta can just be applied, and then everything works */
add_v3_v3(&pt->x, delta);
- mul_m4_v3(gso->object->imat, &pt->x);
+ mul_m4_v3(gso->object->world_to_object, &pt->x);
}
/* Store ref for later */
@@ -1172,7 +1172,7 @@ static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op)
gso->object = ob;
if (ob) {
float matrix[4][4];
- copy_m4_m4(matrix, ob->obmat);
+ copy_m4_m4(matrix, ob->object_to_world);
zero_axis_bias_m4(matrix);
invert_m4_m4(gso->inv_mat, matrix);
gso->vrgroup = gso->gpd->vertex_group_active_index - 1;
@@ -1202,6 +1202,9 @@ static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op)
gso->automasking_strokes = BLI_ghash_ptr_new(__func__);
}
else {
+ if (gso->automasking_strokes != NULL) {
+ BLI_ghash_free(gso->automasking_strokes, NULL, NULL);
+ }
gso->automasking_strokes = NULL;
}
/* save mask */
@@ -1292,6 +1295,10 @@ static void gpencil_sculpt_brush_exit(bContext *C, wmOperator *op)
}
default:
+ if (gso->stroke_customdata != NULL) {
+ BLI_ghash_free(gso->stroke_customdata, NULL, NULL);
+ gso->stroke_customdata = NULL;
+ }
break;
}
@@ -2075,6 +2082,20 @@ static void gpencil_sculpt_brush_apply_event(bContext *C, wmOperator *op, const
if (gso->brush == NULL) {
gso->brush = gso->brush_prev;
}
+ Brush *brush = gso->brush;
+ if (brush->gpencil_settings->sculpt_mode_flag &
+ (GP_SCULPT_FLAGMODE_AUTOMASK_STROKE | GP_SCULPT_FLAGMODE_AUTOMASK_LAYER |
+ GP_SCULPT_FLAGMODE_AUTOMASK_MATERIAL)) {
+ if (gso->automasking_strokes == NULL) {
+ gso->automasking_strokes = BLI_ghash_ptr_new(__func__);
+ }
+ }
+ else {
+ if (gso->automasking_strokes != NULL) {
+ BLI_ghash_free(gso->automasking_strokes, NULL, NULL);
+ }
+ gso->automasking_strokes = NULL;
+ }
}
else {
if (gso->brush_prev != NULL) {
diff --git a/source/blender/editors/gpencil/gpencil_trace_ops.c b/source/blender/editors/gpencil/gpencil_trace_ops.c
index 36165c6b7c0..1a18e10412e 100644
--- a/source/blender/editors/gpencil/gpencil_trace_ops.c
+++ b/source/blender/editors/gpencil/gpencil_trace_ops.c
@@ -45,7 +45,7 @@
typedef struct TraceJob {
/* from wmJob */
struct Object *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
bContext *C;
@@ -198,7 +198,7 @@ static void trace_initialize_job_data(TraceJob *trace_job)
}
}
-static void trace_start_job(void *customdata, short *stop, short *do_update, float *progress)
+static void trace_start_job(void *customdata, bool *stop, bool *do_update, float *progress)
{
TraceJob *trace_job = customdata;
@@ -257,7 +257,7 @@ static void trace_start_job(void *customdata, short *stop, short *do_update, flo
trace_job->success = !trace_job->was_canceled;
*do_update = true;
- *stop = 0;
+ *stop = false;
}
static void trace_end_job(void *customdata)
@@ -339,7 +339,7 @@ static int gpencil_trace_image_exec(bContext *C, wmOperator *op)
ED_object_base_activate(job->C, job->base_active);
if ((job->image->source == IMA_SRC_FILE) || (job->frame_num > 0)) {
- short stop = 0, do_update = true;
+ bool stop = false, do_update = true;
float progress;
trace_start_job(job, &stop, &do_update, &progress);
trace_end_job(job);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index cc13f667e48..7d814b43196 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -900,7 +900,7 @@ void ED_gpencil_drawing_reference_get(const Scene *scene,
}
else {
/* use object location */
- copy_v3_v3(r_vec, ob->obmat[3]);
+ copy_v3_v3(r_vec, ob->object_to_world[3]);
/* Apply layer offset. */
bGPdata *gpd = ob->data;
bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
@@ -984,7 +984,7 @@ void ED_gpencil_project_stroke_to_plane(const Scene *scene,
/* if object, apply object rotation */
if (ob && (ob->type == OB_GPENCIL)) {
float mat[4][4];
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
/* move origin to cursor */
if ((ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) {
@@ -1206,7 +1206,7 @@ void ED_gpencil_project_point_to_plane(const Scene *scene,
/* if object, apply object rotation */
if (ob && (ob->type == OB_GPENCIL)) {
float mat[4][4];
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
if ((ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) {
if (gpl != NULL) {
add_v3_v3(mat[3], gpl->location);
@@ -1233,7 +1233,7 @@ void ED_gpencil_project_point_to_plane(const Scene *scene,
/* move origin to object */
if ((ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) {
- copy_v3_v3(mat[3], ob->obmat[3]);
+ copy_v3_v3(mat[3], ob->object_to_world[3]);
}
mul_mat3_m4_v3(mat, plane_normal);
@@ -1365,16 +1365,16 @@ void ED_gpencil_reset_layers_parent(Depsgraph *depsgraph, Object *obact, bGPdata
if (gpl->parent != NULL) {
/* calculate new matrix */
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
- invert_m4_m4(cur_mat, gpl->parent->obmat);
- copy_v3_v3(gpl_loc, obact->obmat[3]);
+ invert_m4_m4(cur_mat, gpl->parent->object_to_world);
+ copy_v3_v3(gpl_loc, obact->object_to_world[3]);
}
else if (gpl->partype == PARBONE) {
bPoseChannel *pchan = BKE_pose_channel_find_name(gpl->parent->pose, gpl->parsubstr);
if (pchan) {
float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, gpl->parent->obmat, pchan->pose_mat);
+ mul_m4_m4m4(tmp_mat, gpl->parent->object_to_world, pchan->pose_mat);
invert_m4_m4(cur_mat, tmp_mat);
- copy_v3_v3(gpl_loc, obact->obmat[3]);
+ copy_v3_v3(gpl_loc, obact->object_to_world[3]);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_uv.c b/source/blender/editors/gpencil/gpencil_uv.c
index 51cb08cf592..0144ffa07c7 100644
--- a/source/blender/editors/gpencil/gpencil_uv.c
+++ b/source/blender/editors/gpencil/gpencil_uv.c
@@ -138,7 +138,7 @@ static bool gpencil_uv_transform_init(bContext *C, wmOperator *op)
opdata->array_loc = NULL;
opdata->array_rot = NULL;
opdata->array_scale = NULL;
- opdata->ob_scale = mat4_to_scale(opdata->ob->obmat);
+ opdata->ob_scale = mat4_to_scale(opdata->ob->object_to_world);
opdata->vinit_rotation[0] = 1.0f;
opdata->vinit_rotation[1] = 0.0f;
@@ -158,7 +158,7 @@ static bool gpencil_uv_transform_init(bContext *C, wmOperator *op)
float r_center[3];
gpencil_stroke_center(gps, r_center);
/* Add object location. */
- add_v3_v3(r_center, opdata->ob->obmat[3]);
+ add_v3_v3(r_center, opdata->ob->object_to_world[3]);
add_v3_v3(center, r_center);
i++;
}
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 7e9422ff867..66b3d9fba6b 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -133,6 +133,8 @@ enum {
/** #uiBlock.flag (controls) */
enum {
UI_BLOCK_LOOP = 1 << 0,
+ /** Indicate that items in a popup are drawn with inverted order. Used for arrow key navigation
+ * so that it knows to invert the navigation direction to match the drawing order. */
UI_BLOCK_IS_FLIP = 1 << 1,
UI_BLOCK_NO_FLIP = 1 << 2,
UI_BLOCK_NUMSELECT = 1 << 3,
@@ -784,6 +786,9 @@ void UI_block_set_search_only(uiBlock *block, bool search_only);
* Can be called with C==NULL.
*/
void UI_block_free(const struct bContext *C, uiBlock *block);
+
+void UI_block_listen(const uiBlock *block, const struct wmRegionListenerParams *listener_params);
+
/**
* Can be called with C==NULL.
*/
@@ -2525,6 +2530,7 @@ void uiTemplateNodeView(uiLayout *layout,
struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *input);
+void uiTemplateNodeAssetMenuItems(uiLayout *layout, struct bContext *C, const char *catalog_path);
void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
/**
* Button to quickly show texture in Properties Editor texture tab.
@@ -3197,9 +3203,6 @@ void UI_interface_tag_script_reload(void);
/* Support click-drag motion which presses the button and closes a popover (like a menu). */
#define USE_UI_POPOVER_ONCE
-void UI_block_views_listen(const uiBlock *block,
- const struct wmRegionListenerParams *listener_params);
-
bool UI_view_item_is_active(const uiViewItemHandle *item_handle);
bool UI_view_item_matches(const uiViewItemHandle *a_handle, const uiViewItemHandle *b_handle);
/**
diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_depth.c b/source/blender/editors/interface/eyedroppers/eyedropper_depth.c
index 3fb5a74944b..c6d950112b9 100644
--- a/source/blender/editors/interface/eyedroppers/eyedropper_depth.c
+++ b/source/blender/editors/interface/eyedroppers/eyedropper_depth.c
@@ -162,7 +162,7 @@ static void depthdropper_depth_sample_pt(bContext *C,
View3D *v3d = area->spacedata.first;
RegionView3D *rv3d = region->regiondata;
/* weak, we could pass in some reference point */
- const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3];
+ const float *view_co = v3d->camera ? v3d->camera->object_to_world[3] : rv3d->viewinv[3];
const int mval[2] = {m_xy[0] - region->winrct.xmin, m_xy[1] - region->winrct.ymin};
copy_v2_v2_int(ddr->name_pos, mval);
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index 1f88d25af2b..331d1581db5 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -3474,6 +3474,7 @@ void UI_block_free(const bContext *C, uiBlock *block)
BLI_freelistN(&block->saferct);
BLI_freelistN(&block->color_pickers.list);
+ BLI_freelistN(&block->dynamic_listeners);
ui_block_free_button_groups(block);
ui_block_free_views(block);
@@ -3481,6 +3482,20 @@ void UI_block_free(const bContext *C, uiBlock *block)
MEM_freeN(block);
}
+void UI_block_listen(const uiBlock *block, const wmRegionListenerParams *listener_params)
+{
+ /* Don't need to let invisible blocks (old blocks from previous redraw) listen. */
+ if (!block->active) {
+ return;
+ }
+
+ LISTBASE_FOREACH (uiBlockDynamicListener *, listener, &block->dynamic_listeners) {
+ listener->listener_func(listener_params);
+ }
+
+ ui_block_views_listen(block, listener_params);
+}
+
void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb)
{
ARegion *region = CTX_wm_region(C);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 34f33b71fb8..ac16d41dabe 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3519,7 +3519,7 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonData *data)
{
- /* label and roundbox can overlap real buttons (backdrops...) */
+ /* Label and round-box can overlap real buttons (backdrops...). */
if (ELEM(actbut->type,
UI_BTYPE_LABEL,
UI_BTYPE_SEPR,
@@ -3551,7 +3551,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonData *data)
{
- /* label and roundbox can overlap real buttons (backdrops...) */
+ /* Label and round-box can overlap real buttons (backdrops...). */
if (ELEM(actbut->type,
UI_BTYPE_LABEL,
UI_BTYPE_SEPR,
@@ -3894,7 +3894,7 @@ static void ui_do_but_textedit(
}
if (event->type == WM_IME_COMPOSITE_EVENT && ime_data->result_len) {
if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
- strcmp(ime_data->str_result, "\xE3\x80\x82") == 0) {
+ STREQ(ime_data->str_result, "\xE3\x80\x82")) {
/* Convert Ideographic Full Stop (U+3002) to decimal point when entering numbers. */
ui_textedit_insert_ascii(but, data, '.');
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 9a4f98ebcd6..a5e2cd02f3b 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1309,8 +1309,8 @@ static void ui_id_preview_image_render_size(
const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job);
static void ui_studiolight_icon_job_exec(void *customdata,
- short *UNUSED(stop),
- short *UNUSED(do_update),
+ bool *UNUSED(stop),
+ bool *UNUSED(do_update),
float *UNUSED(progress))
{
Icon **tmp = (Icon **)customdata;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 6ef81ad897e..982ac1753e1 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -477,6 +477,12 @@ typedef enum uiButtonGroupFlag {
} uiButtonGroupFlag;
ENUM_OPERATORS(uiButtonGroupFlag, UI_BUTTON_GROUP_PANEL_HEADER);
+typedef struct uiBlockDynamicListener {
+ struct uiBlockDynamicListener *next, *prev;
+
+ void (*listener_func)(const struct wmRegionListenerParams *params);
+} uiBlockDynamicListener;
+
struct uiBlock {
uiBlock *next, *prev;
@@ -499,6 +505,8 @@ struct uiBlock {
* state that is persistent over redraws (e.g. collapsed tree-view items). */
ListBase views;
+ ListBase dynamic_listeners; /* #uiBlockDynamicListener */
+
char name[UI_MAX_NAME_STR];
float winmat[4][4];
@@ -1540,6 +1548,8 @@ void ui_interface_tag_script_reload_queries(void);
/* interface_view.cc */
void ui_block_free_views(struct uiBlock *block);
+void ui_block_views_listen(const uiBlock *block,
+ const struct wmRegionListenerParams *listener_params);
uiViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock *new_block,
const uiViewHandle *new_view);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 496f72c089a..a456cef7be6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5814,6 +5814,14 @@ void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout)
printf("%s: opening menu \"%s\"\n", __func__, mt->idname);
}
+ if (mt->listener) {
+ /* Forward the menu type listener to the block we're drawing in. */
+ uiBlock *block = uiLayoutGetBlock(layout);
+ uiBlockDynamicListener *listener = MEM_mallocN(sizeof(*listener), "uiBlockDynamicListener");
+ listener->listener_func = mt->listener;
+ BLI_addtail(&block->dynamic_listeners, listener);
+ }
+
if (layout->context) {
CTX_store_set(C, layout->context);
}
diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc
index e089642963d..2d06dd2c465 100644
--- a/source/blender/editors/interface/interface_ops.cc
+++ b/source/blender/editors/interface/interface_ops.cc
@@ -1859,8 +1859,7 @@ static void edittranslation_find_po_file(const char *root,
/* First, full lang code. */
BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);
- BLI_path_join(path, maxlen, root, uilng);
- BLI_path_append(path, maxlen, tstr);
+ BLI_path_join(path, maxlen, root, uilng, tstr);
if (BLI_is_file(path)) {
return;
}
diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc
index 24d8281aad8..05b6ecf29d5 100644
--- a/source/blender/editors/interface/interface_panel.cc
+++ b/source/blender/editors/interface/interface_panel.cc
@@ -2026,7 +2026,7 @@ static void ui_panel_drag_collapse_handler_add(const bContext *C, const bool was
ui_panel_drag_collapse_handler,
ui_panel_drag_collapse_handler_remove,
dragcol_data,
- 0);
+ eWM_EventHandlerFlag(0));
}
/**
@@ -2510,8 +2510,12 @@ static void panel_handle_data_ensure(const bContext *C,
{
if (panel->activedata == nullptr) {
panel->activedata = MEM_callocN(sizeof(uiHandlePanelData), __func__);
- WM_event_add_ui_handler(
- C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, panel, 0);
+ WM_event_add_ui_handler(C,
+ &win->modalhandlers,
+ ui_handler_panel,
+ ui_handler_remove_panel,
+ panel,
+ eWM_EventHandlerFlag(0));
}
uiHandlePanelData *data = static_cast<uiHandlePanelData *>(panel->activedata);
diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc b/source/blender/editors/interface/interface_region_menu_popup.cc
index 569f657a544..871fd5c6166 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.cc
+++ b/source/blender/editors/interface/interface_region_menu_popup.cc
@@ -10,6 +10,7 @@
#include <cstdarg>
#include <cstdlib>
#include <cstring>
+#include <functional>
#include "MEM_guardedalloc.h"
@@ -166,28 +167,80 @@ struct uiPopupMenu {
uiBut *but;
ARegion *butregion;
+ /* Menu hash is created from this, to keep a memory of recently opened menus. */
+ const char *title;
+
int mx, my;
bool popup, slideout;
- uiMenuCreateFunc menu_func;
- void *menu_arg;
+ std::function<void(bContext *C, uiLayout *layout)> menu_func;
};
+/**
+ * \param title: Optional. If set, it will be used to store recently opened menus so they can be
+ * opened with the mouse over the last chosen entry again.
+ */
+static void ui_popup_menu_create_block(bContext *C,
+ uiPopupMenu *pup,
+ const char *title,
+ const char *block_name)
+{
+ const uiStyle *style = UI_style_get_dpi();
+
+ pup->block = UI_block_begin(C, nullptr, block_name, UI_EMBOSS_PULLDOWN);
+ if (!pup->but) {
+ pup->block->flag |= UI_BLOCK_NO_FLIP;
+ }
+ if (title && title[0]) {
+ pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
+ pup->block->puphash = ui_popup_menu_hash(title);
+ }
+ pup->layout = UI_block_layout(
+ pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
+
+ /* NOTE: this intentionally differs from the menu & sub-menu default because many operators
+ * use popups like this to select one of their options -
+ * where having invoke doesn't make sense.
+ * When the menu was opened from a button, use invoke still for compatibility. This used to be
+ * the default and changing now could cause issues. */
+ const wmOperatorCallContext opcontext = pup->but ? WM_OP_INVOKE_REGION_WIN :
+ WM_OP_EXEC_REGION_WIN;
+
+ uiLayoutSetOperatorContext(pup->layout, opcontext);
+
+ if (pup->but) {
+ if (pup->but->context) {
+ uiLayoutContextCopy(pup->layout, pup->but->context);
+ }
+ }
+}
+
static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, void *arg_pup)
{
uiPopupMenu *pup = static_cast<uiPopupMenu *>(arg_pup);
- if (pup->menu_func) {
- pup->block->handle = handle;
- pup->menu_func(C, pup->layout, pup->menu_arg);
- pup->block->handle = nullptr;
+ int minwidth = 0;
+
+ if (!pup->layout) {
+ ui_popup_menu_create_block(C, pup, pup->title, __func__);
+
+ if (pup->menu_func) {
+ pup->block->handle = handle;
+ pup->menu_func(C, pup->layout);
+ pup->block->handle = nullptr;
+ }
+
+ if (uiLayoutGetUnitsX(pup->layout) != 0.0f) {
+ /* Use the minimum width from the layout if it's set. */
+ minwidth = uiLayoutGetUnitsX(pup->layout) * UI_UNIT_X;
+ }
+
+ pup->layout = nullptr;
}
/* Find block minimum width. */
- int minwidth;
- if (uiLayoutGetUnitsX(pup->layout) != 0.0f) {
- /* Use the minimum width from the layout if it's set. */
- minwidth = uiLayoutGetUnitsX(pup->layout) * UI_UNIT_X;
+ if (minwidth) {
+ /* Skip. */
}
else if (pup->but) {
/* Minimum width to enforce. */
@@ -236,7 +289,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
if (pup->popup) {
- int offset[2];
+ int offset[2] = {0, 0};
uiBut *but_activate = nullptr;
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT);
@@ -244,36 +297,42 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
UI_block_direction_set(block, direction);
/* offset the mouse position, possibly based on earlier selection */
- uiBut *bt;
- if ((block->flag & UI_BLOCK_POPUP_MEMORY) && (bt = ui_popup_menu_memory_get(block))) {
- /* position mouse on last clicked item, at 0.8*width of the
- * button, so it doesn't overlap the text too much, also note
- * the offset is negative because we are inverse moving the
- * block to be under the mouse */
- offset[0] = -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect));
- offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y);
-
- if (ui_but_is_editable(bt)) {
- but_activate = bt;
- }
- }
- else {
- /* position mouse at 0.8*width of the button and below the tile
- * on the first item */
- offset[0] = 0;
- LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
- offset[0] = min_ii(offset[0],
- -(but_iter->rect.xmin + 0.8f * BLI_rctf_size_x(&but_iter->rect)));
+ if (!handle->refresh) {
+ uiBut *bt;
+ if ((block->flag & UI_BLOCK_POPUP_MEMORY) && (bt = ui_popup_menu_memory_get(block))) {
+ /* position mouse on last clicked item, at 0.8*width of the
+ * button, so it doesn't overlap the text too much, also note
+ * the offset is negative because we are inverse moving the
+ * block to be under the mouse */
+ offset[0] = -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect));
+ offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y);
+
+ if (ui_but_is_editable(bt)) {
+ but_activate = bt;
+ }
}
+ else {
+ /* position mouse at 0.8*width of the button and below the tile
+ * on the first item */
+ offset[0] = 0;
+ LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
+ offset[0] = min_ii(offset[0],
+ -(but_iter->rect.xmin + 0.8f * BLI_rctf_size_x(&but_iter->rect)));
+ }
- offset[1] = 2.1 * UI_UNIT_Y;
+ offset[1] = 2.1 * UI_UNIT_Y;
- LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
- if (ui_but_is_editable(but_iter)) {
- but_activate = but_iter;
- break;
+ LISTBASE_FOREACH (uiBut *, but_iter, &block->buttons) {
+ if (ui_but_is_editable(but_iter)) {
+ but_activate = but_iter;
+ break;
+ }
}
}
+ copy_v2_v2_int(handle->prev_bounds_offset, offset);
+ }
+ else {
+ copy_v2_v2_int(offset, handle->prev_bounds_offset);
}
/* in rare cases this is needed since moving the popup
@@ -312,27 +371,35 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
return pup->block;
}
-uiPopupBlockHandle *ui_popup_menu_create(
- bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
+static void ui_block_free_func_POPUP(void *arg_pup)
+{
+ uiPopupMenu *pup = static_cast<uiPopupMenu *>(arg_pup);
+ MEM_delete(pup);
+}
+
+static uiPopupBlockHandle *ui_popup_menu_create(
+ bContext *C,
+ ARegion *butregion,
+ uiBut *but,
+ const char *title,
+ std::function<void(bContext *, uiLayout *)> menu_func)
{
wmWindow *window = CTX_wm_window(C);
- const uiStyle *style = UI_style_get_dpi();
- uiPopupMenu *pup = MEM_cnew<uiPopupMenu>(__func__);
- pup->block = UI_block_begin(C, nullptr, __func__, UI_EMBOSS_PULLDOWN);
- pup->block->flag |= UI_BLOCK_NUMSELECT; /* Default menus to numeric-selection. */
- pup->layout = UI_block_layout(
- pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
- pup->slideout = but ? ui_block_is_menu(but->block) : false;
- pup->but = but;
- uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
+ uiPopupMenu *pup = MEM_new<uiPopupMenu>(__func__);
+ pup->title = title;
+ /* menu is created from a callback */
+ pup->menu_func = menu_func;
+ if (but) {
+ pup->slideout = ui_block_is_menu(but->block);
+ pup->but = but;
+ }
if (!but) {
/* no button to start from, means we are a popup */
pup->mx = window->eventstate->xy[0];
pup->my = window->eventstate->xy[1];
pup->popup = true;
- pup->block->flag |= UI_BLOCK_NO_FLIP;
}
/* some enums reversing is strange, currently we have no good way to
* reverse some enum's but not others, so reverse all so the first menu
@@ -346,17 +413,10 @@ uiPopupBlockHandle *ui_popup_menu_create(
pup->block->flag |= UI_BLOCK_NO_FLIP;
}
#endif
- if (but->context) {
- uiLayoutContextCopy(pup->layout, but->context);
- }
}
- /* menu is created from a callback */
- pup->menu_func = menu_func;
- pup->menu_arg = arg;
-
uiPopupBlockHandle *handle = ui_popup_block_create(
- C, butregion, but, nullptr, ui_block_func_POPUP, pup, nullptr);
+ C, butregion, but, nullptr, ui_block_func_POPUP, pup, ui_block_free_func_POPUP);
if (!but) {
handle->popup = true;
@@ -365,68 +425,75 @@ uiPopupBlockHandle *ui_popup_menu_create(
WM_event_add_mousemove(window);
}
- MEM_freeN(pup);
-
return handle;
}
+uiPopupBlockHandle *ui_popup_menu_create(
+ bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
+{
+ return ui_popup_menu_create(
+ C, butregion, but, nullptr, [menu_func, arg](bContext *C, uiLayout *layout) {
+ menu_func(C, layout, arg);
+ });
+}
+
/** \} */
/* -------------------------------------------------------------------- */
/** \name Popup Menu API with begin & end
* \{ */
+static void create_title_button(uiLayout *layout, const char *title, int icon)
+{
+ uiBlock *block = uiLayoutGetBlock(layout);
+ char titlestr[256];
+
+ if (icon) {
+ BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
+ uiDefIconTextBut(block,
+ UI_BTYPE_LABEL,
+ 0,
+ icon,
+ titlestr,
+ 0,
+ 0,
+ 200,
+ UI_UNIT_Y,
+ nullptr,
+ 0.0,
+ 0.0,
+ 0,
+ 0,
+ "");
+ }
+ else {
+ uiBut *but = uiDefBut(
+ block, UI_BTYPE_LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, nullptr, 0.0, 0.0, 0, 0, "");
+ but->drawflag = UI_BUT_TEXT_LEFT;
+ }
+
+ uiItemS(layout);
+}
+
+/* Used to directly create a popup menu that is not refreshed on redraw. */
uiPopupMenu *UI_popup_menu_begin_ex(bContext *C,
const char *title,
const char *block_name,
int icon)
{
- const uiStyle *style = UI_style_get_dpi();
- uiPopupMenu *pup = MEM_cnew<uiPopupMenu>(__func__);
+ uiPopupMenu *pup = MEM_new<uiPopupMenu>(__func__);
- pup->block = UI_block_begin(C, nullptr, block_name, UI_EMBOSS_PULLDOWN);
- pup->block->flag |= UI_BLOCK_POPUP_MEMORY | UI_BLOCK_IS_FLIP;
- pup->block->puphash = ui_popup_menu_hash(title);
- pup->layout = UI_block_layout(
- pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
+ pup->title = title;
- /* NOTE: this intentionally differs from the menu & sub-menu default because many operators
- * use popups like this to select one of their options -
- * where having invoke doesn't make sense */
- uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
+ ui_popup_menu_create_block(C, pup, title, block_name);
+ /* Further buttons will be laid out top to bottom by default. */
+ pup->block->flag |= UI_BLOCK_IS_FLIP;
/* create in advance so we can let buttons point to retval already */
pup->block->handle = MEM_cnew<uiPopupBlockHandle>(__func__);
- /* create title button */
if (title[0]) {
- char titlestr[256];
-
- if (icon) {
- BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
- uiDefIconTextBut(pup->block,
- UI_BTYPE_LABEL,
- 0,
- icon,
- titlestr,
- 0,
- 0,
- 200,
- UI_UNIT_Y,
- nullptr,
- 0.0,
- 0.0,
- 0,
- 0,
- "");
- }
- else {
- uiBut *but = uiDefBut(
- pup->block, UI_BTYPE_LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, nullptr, 0.0, 0.0, 0, 0, "");
- but->drawflag = UI_BUT_TEXT_LEFT;
- }
-
- uiItemS(pup->layout);
+ create_title_button(pup->layout, title, icon);
}
return pup;
@@ -465,7 +532,7 @@ void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
UI_popup_handlers_add(C, &window->modalhandlers, menu, 0);
WM_event_add_mousemove(window);
- MEM_freeN(pup);
+ MEM_delete(pup);
}
bool UI_popup_menu_end_or_cancel(bContext *C, uiPopupMenu *pup)
@@ -477,7 +544,7 @@ bool UI_popup_menu_end_or_cancel(bContext *C, uiPopupMenu *pup)
UI_block_layout_resolve(pup->block, nullptr, nullptr);
MEM_freeN(pup->block->handle);
UI_block_free(C, pup->block);
- MEM_freeN(pup);
+ MEM_delete(pup);
return false;
}
@@ -541,6 +608,22 @@ void UI_popup_menu_reports(bContext *C, ReportList *reports)
}
}
+static void ui_popup_menu_create_from_menutype(bContext *C,
+ MenuType *mt,
+ const char *title,
+ const int icon)
+{
+ uiPopupBlockHandle *handle = ui_popup_menu_create(
+ C, nullptr, nullptr, title, [mt, title, icon](bContext *C, uiLayout *layout) -> void {
+ if (title && title[0]) {
+ create_title_button(layout, title, icon);
+ }
+ ui_item_menutype_func(C, layout, mt);
+ });
+
+ handle->can_refresh = true;
+}
+
int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports)
{
MenuType *mt = WM_menutype_find(idname, true);
@@ -554,14 +637,21 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports)
/* cancel but allow event to pass through, just like operators do */
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
+ /* For now always recreate menus on redraw that were invoked with this function. Maybe we want to
+ * make that optional somehow. */
+ const bool allow_refresh = true;
- uiPopupMenu *pup = UI_popup_menu_begin(
- C, CTX_IFACE_(mt->translation_context, mt->label), ICON_NONE);
- uiLayout *layout = UI_popup_menu_layout(pup);
-
- UI_menutype_draw(C, mt, layout);
-
- UI_popup_menu_end(C, pup);
+ const char *title = CTX_IFACE_(mt->translation_context, mt->label);
+ if (allow_refresh) {
+ ui_popup_menu_create_from_menutype(C, mt, title, ICON_NONE);
+ }
+ else {
+ /* If no refresh is needed, create the block directly. */
+ uiPopupMenu *pup = UI_popup_menu_begin(C, title, ICON_NONE);
+ uiLayout *layout = UI_popup_menu_layout(pup);
+ UI_menutype_draw(C, mt, layout);
+ UI_popup_menu_end(C, pup);
+ }
return OPERATOR_INTERFACE;
}
diff --git a/source/blender/editors/interface/views/interface_view.cc b/source/blender/editors/interface/views/interface_view.cc
index c568a8cab74..71974b4d2f9 100644
--- a/source/blender/editors/interface/views/interface_view.cc
+++ b/source/blender/editors/interface/views/interface_view.cc
@@ -81,7 +81,7 @@ void ui_block_free_views(uiBlock *block)
}
}
-void UI_block_views_listen(const uiBlock *block, const wmRegionListenerParams *listener_params)
+void ui_block_views_listen(const uiBlock *block, const wmRegionListenerParams *listener_params)
{
ARegion *region = listener_params->region;
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc
index 888a8340d51..1c6d1747516 100644
--- a/source/blender/editors/mesh/editface.cc
+++ b/source/blender/editors/mesh/editface.cc
@@ -383,7 +383,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
return ok;
}
- copy_m3_m4(bmat, ob->obmat);
+ copy_m3_m4(bmat, ob->object_to_world);
const Span<MVert> verts = me->verts();
const Span<MPoly> polys = me->polys();
@@ -403,7 +403,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
const MLoop *ml = &loops[poly.loopstart];
for (int b = 0; b < poly.totloop; b++, ml++) {
mul_v3_m3v3(vec, bmat, verts[ml->v].co);
- add_v3_v3v3(vec, vec, ob->obmat[3]);
+ add_v3_v3v3(vec, vec, ob->object_to_world[3]);
minmax_v3v3_v3(r_min, r_max, vec);
}
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index f5090c0143d..03c6104bb0d 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -316,8 +316,8 @@ static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op)
PropertyRNA *prop_matrix = RNA_struct_find_property(op->ptr, "matrix");
if (RNA_property_is_set(op->ptr, prop_matrix)) {
RNA_property_float_get_array(op->ptr, prop_matrix, &matrix[0][0]);
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_m4_m4m4(matrix, obedit->imat, matrix);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_m4_m4m4(matrix, obedit->world_to_object, matrix);
}
else {
/* For the first update the widget may not set the matrix. */
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 3284cd70646..92e993f74a2 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -170,7 +170,7 @@ static void edbm_bevel_update_status_text(bContext *C, wmOperator *op)
sizeof(status_text),
TIP_("%s: Confirm, "
"%s: Cancel, "
- "%s: Mode (%s), "
+ "%s: Width Type (%s), "
"%s: Width (%s), "
"%s: Segments (%d), "
"%s: Profile (%.3f), "
@@ -244,7 +244,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
- float scale = mat4_to_scale(obedit->obmat);
+ float scale = mat4_to_scale(obedit->object_to_world);
opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em->bm->totvertsel > 0) {
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index 5c5a12b3e64..aab33678bec 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -314,9 +314,9 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op)
copy_v3_v3(plane_co_local, plane_co);
copy_v3_v3(plane_no_local, plane_no);
- invert_m4_m4(imat, obedit->obmat);
+ invert_m4_m4(imat, obedit->object_to_world);
mul_m4_v3(imat, plane_co_local);
- mul_transposed_mat3_m4_v3(obedit->obmat, plane_no_local);
+ mul_transposed_mat3_m4_v3(obedit->object_to_world, plane_no_local);
BMOperator bmop;
EDBM_op_init(
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index 55e9c32e41b..88bcefc5cc8 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -55,8 +55,8 @@ static void edbm_extrude_edge_exclude_mirror(
float mtx[4][4];
if (mmd->mirror_ob) {
float imtx[4][4];
- invert_m4_m4(imtx, mmd->mirror_ob->obmat);
- mul_m4_m4m4(mtx, imtx, obedit->obmat);
+ invert_m4_m4(imtx, mmd->mirror_ob->object_to_world);
+ mul_m4_m4m4(mtx, imtx, obedit->object_to_world);
}
BM_ITER_MESH (edge, &iter, bm, BM_EDGES_OF_MESH) {
@@ -293,7 +293,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
- copy_m3_m4(tmat, obedit->obmat);
+ copy_m3_m4(tmat, obedit->object_to_world);
invert_m3(tmat);
mul_v3_m3v3(offset_local, tmat, offset);
@@ -736,7 +736,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
}
mul_v3_fl(local_center, 1.0f / (float)local_verts_len);
- mul_m4_v3(vc.obedit->obmat, local_center);
+ mul_m4_v3(vc.obedit->object_to_world, local_center);
mul_v3_fl(local_center, (float)local_verts_len);
add_v3_v3(center, local_center);
@@ -761,11 +761,11 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
continue;
}
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ invert_m4_m4(vc.obedit->world_to_object, vc.obedit->object_to_world);
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
float local_center[3];
- mul_v3_m4v3(local_center, vc.obedit->imat, center);
+ mul_v3_m4v3(local_center, vc.obedit->world_to_object, center);
/* call extrude? */
if (verts_len != 0) {
@@ -810,11 +810,11 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
float view_vec[3], cross[3];
/* convert the 2D normal into 3D */
- mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* World-space. */
- mul_mat3_m4_v3(vc.obedit->imat, nor); /* Local-space. */
+ mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* World-space. */
+ mul_mat3_m4_v3(vc.obedit->world_to_object, nor); /* Local-space. */
/* correct the normal to be aligned on the view plane */
- mul_v3_mat3_m4v3(view_vec, vc.obedit->imat, vc.rv3d->viewinv[2]);
+ mul_v3_mat3_m4v3(view_vec, vc.obedit->world_to_object, vc.rv3d->viewinv[2]);
cross_v3_v3v3(cross, nor, view_vec);
cross_v3_v3v3(nor, view_vec, cross);
normalize_v3(nor);
@@ -823,9 +823,9 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
/* center */
copy_v3_v3(ofs, local_center);
- mul_m4_v3(vc.obedit->obmat, ofs); /* view space */
+ mul_m4_v3(vc.obedit->object_to_world, ofs); /* view space */
ED_view3d_win_to_3d_int(vc.v3d, vc.region, ofs, event->mval, ofs);
- mul_m4_v3(vc.obedit->imat, ofs); /* back in object space */
+ mul_m4_v3(vc.obedit->world_to_object, ofs); /* back in object space */
sub_v3_v3(ofs, local_center);
@@ -876,7 +876,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
copy_v3_v3(local_center, cursor);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, local_center, event->mval, local_center);
- mul_m4_v3(vc.obedit->imat, local_center); /* back in object space */
+ mul_m4_v3(vc.obedit->world_to_object, local_center); /* back in object space */
EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", local_center);
BMO_op_exec(vc.em->bm, &bmop);
diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c
index be2d04b14a1..9d0bcfe4e90 100644
--- a/source/blender/editors/mesh/editmesh_extrude_screw.c
+++ b/source/blender/editors/mesh/editmesh_extrude_screw.c
@@ -102,11 +102,11 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
continue;
}
- copy_v3_v3(nor, obedit->obmat[2]);
+ copy_v3_v3(nor, obedit->object_to_world[2]);
/* calculate dvec */
- mul_v3_m4v3(v1_co_global, obedit->obmat, v1->co);
- mul_v3_m4v3(v2_co_global, obedit->obmat, v2->co);
+ mul_v3_m4v3(v1_co_global, obedit->object_to_world, v1->co);
+ mul_v3_m4v3(v2_co_global, obedit->object_to_world, v2->co);
sub_v3_v3v3(dvec, v1_co_global, v2_co_global);
mul_v3_fl(dvec, 1.0f / steps);
@@ -126,7 +126,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
dvec,
turns * steps,
DEG2RADF(360.0f * turns),
- obedit->obmat,
+ obedit->object_to_world,
false)) {
continue;
}
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c
index 1b9c98db5eb..756d7f73d10 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin.c
@@ -77,7 +77,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
d,
steps,
-angle,
- obedit->obmat,
+ obedit->object_to_world,
use_normal_flip,
dupli,
use_auto_merge)) {
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index 687f06c8dcf..19e23f4f212 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -362,7 +362,7 @@ static void gizmo_mesh_spin_init_refresh(const bContext *C, wmGizmoGroup *gzgrou
}
if (totsel) {
mul_v3_fl(select_center, 1.0f / totsel);
- mul_m4_v3(obedit->obmat, select_center);
+ mul_m4_v3(obedit->object_to_world, select_center);
copy_v3_v3(ggd->data.select_center, select_center);
ggd->data.use_select_center = true;
}
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 068e6215c26..fa4ae7f984c 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -136,7 +136,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
Object *obedit = objects[ob_index];
- float scale = mat4_to_scale(obedit->obmat);
+ float scale = mat4_to_scale(obedit->object_to_world);
opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
if (em->bm->totvertsel > 0) {
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index a147594b25b..369162e80a3 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -586,9 +586,9 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd,
float axis[3];
float arc_angle;
- const float inverse_average_scale = 1 /
- (kcd->curr.ob->obmat[0][0] + kcd->curr.ob->obmat[1][1] +
- kcd->curr.ob->obmat[2][2]);
+ const float inverse_average_scale = 1 / (kcd->curr.ob->object_to_world[0][0] +
+ kcd->curr.ob->object_to_world[1][1] +
+ kcd->curr.ob->object_to_world[2][2]);
const float px_scale =
3.0f * inverse_average_scale *
@@ -1194,7 +1194,7 @@ static void knife_bm_tri_cagecos_get_worldspace(const KnifeTool_OpData *kcd,
knife_bm_tri_cagecos_get(kcd, ob_index, tri_index, cos);
const Object *ob = kcd->objects[ob_index];
for (int i = 0; i < 3; i++) {
- mul_m4_v3(ob->obmat, cos[i]);
+ mul_m4_v3(ob->object_to_world, cos[i]);
}
}
@@ -1744,7 +1744,7 @@ static KnifeVert *get_bm_knife_vert(KnifeTool_OpData *kcd, BMVert *v, Object *ob
}
float cageco_ws[3];
- mul_v3_m4v3(cageco_ws, ob->obmat, cageco);
+ mul_v3_m4v3(cageco_ws, ob->object_to_world, cageco);
kfv = new_knife_vert(kcd, v->co, cageco_ws);
kfv->v = v;
@@ -2657,14 +2657,14 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd)
if (cagecos) {
for (int i = 0; i < em->bm->totvert; i++) {
copy_v3_v3(ws, cagecos[i]);
- mul_m4_v3(ob->obmat, ws);
+ mul_m4_v3(ob->object_to_world, ws);
minmax_v3v3_v3(min, max, ws);
}
}
else {
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
copy_v3_v3(ws, v->co);
- mul_m4_v3(ob->obmat, ws);
+ mul_m4_v3(ob->object_to_world, ws);
minmax_v3v3_v3(min, max, ws);
}
}
@@ -5072,7 +5072,7 @@ void EDBM_mesh_knife(ViewContext *vc,
BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
float cent[3], cent_ss[2];
BM_face_calc_point_in_face(f, cent);
- mul_m4_v3(ob->obmat, cent);
+ mul_m4_v3(ob->object_to_world, cent);
knife_project_v2(kcd, cent, cent_ss);
if (edbm_mesh_knife_point_isect(polys, cent_ss)) {
BM_elem_flag_enable(f, BM_ELEM_TAG);
@@ -5113,7 +5113,7 @@ void EDBM_mesh_knife(ViewContext *vc,
if (found) {
float cent[3], cent_ss[2];
BM_face_calc_point_in_face(f, cent);
- mul_m4_v3(ob->obmat, cent);
+ mul_m4_v3(ob->object_to_world, cent);
knife_project_v2(kcd, cent, cent_ss);
if ((kcd->cut_through || point_is_visible(kcd, cent, cent_ss, (BMElem *)f)) &&
edbm_mesh_knife_point_isect(polys, cent_ss)) {
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 494e0ff4a27..9a91d7836fe 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -88,7 +88,7 @@ typedef struct RingSelOpData {
static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
{
RingSelOpData *lcd = arg;
- EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->obmat);
+ EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->object_to_world);
}
static void edgering_select(RingSelOpData *lcd)
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index bf9664fa10d..cfd07a6ff35 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -124,7 +124,7 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C,
BMEditMesh *em = vc.em;
BMesh *bm = em->bm;
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ invert_m4_m4(vc.obedit->world_to_object, vc.obedit->object_to_world);
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
if (!ele_act) {
@@ -192,7 +192,7 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
BMEditMesh *em = vc.em;
BMesh *bm = em->bm;
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ invert_m4_m4(vc.obedit->world_to_object, vc.obedit->object_to_world);
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
if (!ele_act) {
@@ -286,7 +286,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
BMEditMesh *em = vc.em;
BMesh *bm = em->bm;
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ invert_m4_m4(vc.obedit->world_to_object, vc.obedit->object_to_world);
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX);
@@ -294,9 +294,9 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
if (ele_act == NULL || ele_act->head.htype == BM_FACE) {
/* Just add vert */
copy_v3_v3(center, vc.scene->cursor.location);
- mul_v3_m4v3(center, vc.obedit->obmat, center);
+ mul_v3_m4v3(center, vc.obedit->object_to_world, center);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
- mul_m4_v3(vc.obedit->imat, center);
+ mul_m4_v3(vc.obedit->world_to_object, center);
BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP);
edbm_flag_disable_all_multi(vc.scene, vc.view_layer, vc.v3d, BM_ELEM_SELECT);
@@ -309,9 +309,9 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
BMFace *f_reference = e_act->l ? e_act->l->f : NULL;
mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co);
- mul_m4_v3(vc.obedit->obmat, center);
+ mul_m4_v3(vc.obedit->object_to_world, center);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
- mul_m4_v3(vc.obedit->imat, center);
+ mul_m4_v3(vc.obedit->world_to_object, center);
if (f_reference->len == 3 && RNA_boolean_get(op->ptr, "create_quads")) {
const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co);
BMVert *v_new = BM_edge_split(bm, e_act, e_act->v1, NULL, CLAMPIS(fac, 0.0f, 1.0f));
@@ -364,9 +364,9 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
BMFace *f_reference = e_pair[0]->l ? e_pair[0]->l->f : NULL;
- mul_v3_m4v3(center, vc.obedit->obmat, v_act->co);
+ mul_v3_m4v3(center, vc.obedit->object_to_world, v_act->co);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
- mul_m4_v3(vc.obedit->imat, center);
+ mul_m4_v3(vc.obedit->world_to_object, center);
BMVert *v_quad[4];
v_quad[0] = v_act;
@@ -386,9 +386,9 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
}
else {
/* Just add edge */
- mul_m4_v3(vc.obedit->obmat, center);
+ mul_m4_v3(vc.obedit->object_to_world, center);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, v_act->co, event->mval, center);
- mul_m4_v3(vc.obedit->imat, center);
+ mul_m4_v3(vc.obedit->world_to_object, center);
BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP);
@@ -464,7 +464,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
BMEditMesh *em = vc.em;
BMesh *bm = em->bm;
- invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+ invert_m4_m4(vc.obedit->world_to_object, vc.obedit->object_to_world);
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
edbm_selectmode_ensure(vc.scene, vc.em, SCE_SELECT_VERTEX);
@@ -475,9 +475,9 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
if (ele_act->head.htype == BM_EDGE) {
BMEdge *e_act = (BMEdge *)ele_act;
mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co);
- mul_m4_v3(vc.obedit->obmat, center);
+ mul_m4_v3(vc.obedit->object_to_world, center);
ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
- mul_m4_v3(vc.obedit->imat, center);
+ mul_m4_v3(vc.obedit->world_to_object, center);
const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co);
BMVert *v_new = BM_edge_split(bm, e_act, e_act->v1, NULL, CLAMPIS(fac, 0.0f, 1.0f));
diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c
index cf73e579700..5d8ce7cae44 100644
--- a/source/blender/editors/mesh/editmesh_preselect_elem.c
+++ b/source/blender/editors/mesh/editmesh_preselect_elem.c
@@ -243,9 +243,9 @@ static void view3d_preselect_update_preview_triangle_from_vert(struct EditMesh_P
}
if (e_pair[1] != NULL) {
- mul_v3_m4v3(center, vc->obedit->obmat, v_act->co);
+ mul_v3_m4v3(center, vc->obedit->object_to_world, v_act->co);
ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center);
- mul_m4_v3(vc->obedit->imat, center);
+ mul_m4_v3(vc->obedit->world_to_object, center);
psel->preview_tris = MEM_mallocN(sizeof(*psel->preview_tris) * 2, __func__);
psel->preview_lines = MEM_mallocN(sizeof(*psel->preview_lines) * 4, __func__);
@@ -311,9 +311,9 @@ static void view3d_preselect_update_preview_triangle_from_edge(struct EditMesh_P
psel->preview_tris = MEM_mallocN(sizeof(*psel->preview_tris), __func__);
psel->preview_lines = MEM_mallocN(sizeof(*psel->preview_lines) * 3, __func__);
mid_v3_v3v3(center, eed->v1->co, eed->v2->co);
- mul_m4_v3(vc->obedit->obmat, center);
+ mul_m4_v3(vc->obedit->object_to_world, center);
ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center);
- mul_m4_v3(vc->obedit->imat, center);
+ mul_m4_v3(vc->obedit->world_to_object, center);
copy_v3_v3(psel->preview_tris[0][0], eed->v1->co);
copy_v3_v3(psel->preview_tris[0][1], eed->v2->co);
diff --git a/source/blender/editors/mesh/editmesh_select.cc b/source/blender/editors/mesh/editmesh_select.cc
index 76d0bab8a52..2ef2772d404 100644
--- a/source/blender/editors/mesh/editmesh_select.cc
+++ b/source/blender/editors/mesh/editmesh_select.cc
@@ -1060,7 +1060,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
float imat3[3][3];
ED_view3d_viewcontext_init_object(vc, obedit);
- copy_m3_m4(imat3, obedit->obmat);
+ copy_m3_m4(imat3, obedit->object_to_world);
invert_m3(imat3);
const float(*coords)[3] = nullptr;
@@ -1085,7 +1085,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
for (uint j = 0; j < 2; j++) {
BMVert *v = *((&e->v1) + j);
float point[3];
- mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co);
+ mul_v3_m4v3(
+ point, obedit->object_to_world, coords ? coords[BM_elem_index_get(v)] : v->co);
const float dist_sq_test = dist_squared_to_ray_v3_normalized(
ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best_vert) {
@@ -1114,7 +1115,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
else {
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
- mul_m4_v3(obedit->obmat, point);
+ mul_m4_v3(obedit->object_to_world, point);
const float dist_sq_test = dist_squared_to_ray_v3_normalized(
ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best_edge) {
@@ -1139,7 +1140,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == false) {
float point[3];
- mul_v3_m4v3(point, obedit->obmat, coords ? coords[BM_elem_index_get(v)] : v->co);
+ mul_v3_m4v3(
+ point, obedit->object_to_world, coords ? coords[BM_elem_index_get(v)] : v->co);
const float dist_sq_test = dist_squared_to_ray_v3_normalized(
ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best_vert) {
@@ -1169,7 +1171,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
else {
mid_v3_v3v3(point, e->v1->co, e->v2->co);
}
- mul_m4_v3(obedit->obmat, point);
+ mul_m4_v3(obedit->object_to_world, point);
const float dist_sq_test = dist_squared_to_ray_v3_normalized(
ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best_edge) {
@@ -1198,7 +1200,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
else {
BM_face_calc_center_median(f, point);
}
- mul_m4_v3(obedit->obmat, point);
+ mul_m4_v3(obedit->object_to_world, point);
const float dist_sq_test = dist_squared_to_ray_v3_normalized(
ray_origin, ray_direction, point);
if (dist_sq_test < dist_sq_best_face) {
@@ -4947,7 +4949,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
{
float vertex_world[3];
- mul_v3_m4v3(vertex_world, obedit->obmat, v_act->co);
+ mul_v3_m4v3(vertex_world, obedit->object_to_world, v_act->co);
value = dot_v3v3(axis_vector, vertex_world);
}
@@ -4977,7 +4979,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN | BM_ELEM_SELECT)) {
float v_iter_world[3];
- mul_v3_m4v3(v_iter_world, obedit_iter->obmat, v->co);
+ mul_v3_m4v3(v_iter_world, obedit_iter->object_to_world, v->co);
const float value_iter = dot_v3v3(axis_vector, v_iter_world);
switch (sign) {
case SELECT_AXIS_ALIGN:
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index 47c76b7709b..d9721db326a 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -135,9 +135,9 @@ static void face_to_plane(const Object *ob, BMFace *face, float r_plane[4])
{
float normal[3], co[3];
copy_v3_v3(normal, face->no);
- mul_transposed_mat3_m4_v3(ob->imat, normal);
+ mul_transposed_mat3_m4_v3(ob->world_to_object, normal);
normalize_v3(normal);
- mul_v3_m4v3(co, ob->obmat, BM_FACE_FIRST_LOOP(face)->v->co);
+ mul_v3_m4v3(co, ob->object_to_world, BM_FACE_FIRST_LOOP(face)->v->co);
plane_from_point_normal_v3(r_plane, co, normal);
}
@@ -206,7 +206,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BKE_editmesh_from_object(ob);
BMesh *bm = em->bm;
Material ***material_array = NULL;
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
int custom_data_offset = 0;
if (bm->totfacesel == 0) {
@@ -214,7 +214,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
}
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
switch (type) {
case SIMFACE_MATERIAL: {
@@ -269,7 +269,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
case SIMFACE_NORMAL: {
float normal[3];
copy_v3_v3(normal, face->no);
- mul_transposed_mat3_m4_v3(ob->imat, normal);
+ mul_transposed_mat3_m4_v3(ob->world_to_object, normal);
normalize_v3(normal);
BLI_kdtree_3d_insert(tree_3d, tree_index++, normal);
break;
@@ -335,7 +335,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
int custom_data_offset;
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
bool has_custom_data_layer = false;
switch (type) {
@@ -414,7 +414,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
case SIMFACE_NORMAL: {
float normal[3];
copy_v3_v3(normal, face->no);
- mul_transposed_mat3_m4_v3(ob->imat, normal);
+ mul_transposed_mat3_m4_v3(ob->world_to_object, normal);
normalize_v3(normal);
/* We are treating the normals as coordinates, the "nearest" one will
@@ -559,8 +559,8 @@ static void edge_pos_direction_worldspace_get(Object *ob, BMEdge *edge, float *r
copy_v3_v3(v1, edge->v1->co);
copy_v3_v3(v2, edge->v2->co);
- mul_m4_v3(ob->obmat, v1);
- mul_m4_v3(ob->obmat, v2);
+ mul_m4_v3(ob->object_to_world, v1);
+ mul_m4_v3(ob->object_to_world, v2);
sub_v3_v3v3(r_dir, v1, v2);
normalize_v3(r_dir);
@@ -586,8 +586,8 @@ static float edge_length_squared_worldspace_get(Object *ob, BMEdge *edge)
{
float v1[3], v2[3];
- mul_v3_mat3_m4v3(v1, ob->obmat, edge->v1->co);
- mul_v3_mat3_m4v3(v2, ob->obmat, edge->v2->co);
+ mul_v3_mat3_m4v3(v1, ob->object_to_world, edge->v1->co);
+ mul_v3_mat3_m4v3(v2, ob->object_to_world, edge->v2->co);
return len_squared_v3v3(v1, v2);
}
@@ -705,7 +705,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
float ob_m3[3][3], ob_m3_inv[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
invert_m3_m3(ob_m3_inv, ob_m3);
BMEdge *edge; /* Mesh edge. */
@@ -812,7 +812,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
}
float ob_m3[3][3], ob_m3_inv[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
invert_m3_m3(ob_m3_inv, ob_m3);
BMEdge *edge; /* Mesh edge. */
@@ -1028,7 +1028,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
BLI_bitmap *defbase_selected = NULL;
int defbase_len = 0;
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
if (bm->totvertsel == 0) {
continue;
@@ -1067,7 +1067,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
case SIMVERT_NORMAL: {
float normal[3];
copy_v3_v3(normal, vert->no);
- mul_transposed_mat3_m4_v3(ob->imat, normal);
+ mul_transposed_mat3_m4_v3(ob->world_to_object, normal);
normalize_v3(normal);
BLI_kdtree_3d_insert(tree_3d, normal_tree_index++, normal);
@@ -1217,7 +1217,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
case SIMVERT_NORMAL: {
float normal[3];
copy_v3_v3(normal, vert->no);
- mul_transposed_mat3_m4_v3(ob->imat, normal);
+ mul_transposed_mat3_m4_v3(ob->world_to_object, normal);
normalize_v3(normal);
/* We are treating the normals as coordinates, the "nearest" one will
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9f3ef8af17d..8b29472f687 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3356,8 +3356,8 @@ static bool merge_target(BMEditMesh *em,
if (use_cursor) {
vco = scene->cursor.location;
copy_v3_v3(co, vco);
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, co);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->world_to_object, co);
}
else {
float fac;
@@ -6684,7 +6684,7 @@ static void sort_bmelem_flag(bContext *C,
int coidx = (action == SRT_VIEW_ZAXIS) ? 2 : 0;
/* Apply the view matrix to the object matrix. */
- mul_m4_m4m4(mat, rv3d->viewmat, ob->obmat);
+ mul_m4_m4m4(mat, rv3d->viewmat, ob->object_to_world);
if (totelem[0]) {
pb = pblock[0] = MEM_callocN(sizeof(char) * totelem[0], "sort_bmelem vert pblock");
@@ -6753,7 +6753,7 @@ static void sort_bmelem_flag(bContext *C,
copy_v3_v3(cur, scene->cursor.location);
- invert_m4_m4(mat, ob->obmat);
+ invert_m4_m4(mat, ob->object_to_world);
mul_m4_v3(mat, cur);
if (totelem[0]) {
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 4fc44f01ea0..f6ffbec094e 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1858,7 +1858,7 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
ED_view3d_win_to_segment_clipped(depsgraph, region, v3d, mval_f, origin, end, false);
- invert_m4_m4(invmat, obedit->obmat);
+ invert_m4_m4(invmat, obedit->object_to_world);
mul_m4_v3(invmat, origin);
copy_v3_v3(co1, e->v1->co);
@@ -1942,7 +1942,7 @@ void EDBM_project_snap_verts(
NULL,
co_proj,
NULL)) {
- mul_v3_m4v3(eve->co, obedit->imat, co_proj);
+ mul_v3_m4v3(eve->co, obedit->world_to_object, co_proj);
}
}
}
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index 122b8fa7d89..9901f4e1836 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -787,7 +787,7 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
if (me->edit_mesh) {
/* Tag edges as sharp according to smooth threshold if needed,
- * to preserve autosmooth shading. */
+ * to preserve auto-smooth shading. */
if (me->flag & ME_AUTOSMOOTH) {
BM_edges_sharp_from_angle_set(me->edit_mesh->bm, me->smoothresh);
}
@@ -796,7 +796,7 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
}
else {
/* Tag edges as sharp according to smooth threshold if needed,
- * to preserve autosmooth shading. */
+ * to preserve auto-smooth shading. */
if (me->flag & ME_AUTOSMOOTH) {
const Span<MVert> verts = me->verts();
MutableSpan<MEdge> edges = me->edges_for_write();
@@ -1191,7 +1191,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
MutableSpan<MEdge> edges = mesh->edges_for_write();
for (MEdge &edge : edges.take_back(len)) {
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc
index 4d75ab7f041..147c26e521f 100644
--- a/source/blender/editors/mesh/meshtools.cc
+++ b/source/blender/editors/mesh/meshtools.cc
@@ -132,7 +132,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
float cmat[4][4];
/* Watch this: switch matrix multiplication order really goes wrong. */
- mul_m4_m4m4(cmat, imat, ob_src->obmat);
+ mul_m4_m4m4(cmat, imat, ob_src->object_to_world);
/* transform vertex coordinates into new space */
for (a = 0; a < me->totvert; a++, mvert++) {
@@ -386,7 +386,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
* NOTE: This doesn't apply recursive parenting. */
if (join_parent) {
ob->parent = nullptr;
- BKE_object_apply_mat4_ex(ob, ob->obmat, ob->parent, ob->parentinv, false);
+ BKE_object_apply_mat4_ex(ob, ob->object_to_world, ob->parent, ob->parentinv, false);
}
/* that way the active object is always selected */
@@ -594,7 +594,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
/* Inverse transform for all selected meshes in this object,
* See #object_join_exec for detailed comment on why the safe version is used. */
- invert_m4_m4_safe_ortho(imat, ob->obmat);
+ invert_m4_m4_safe_ortho(imat, ob->object_to_world);
/* Add back active mesh first.
* This allows to keep things similar as they were, as much as possible
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc
index f6eee7c0c9e..6075e4250eb 100644
--- a/source/blender/editors/object/object_add.cc
+++ b/source/blender/editors/object/object_add.cc
@@ -322,7 +322,7 @@ void ED_object_base_init_transform_on_add(Object *object, const float loc[3], co
copy_v3_v3(object->rot, rot);
}
- BKE_object_to_mat4(object, object->obmat);
+ BKE_object_to_mat4(object, object->object_to_world);
}
float ED_object_new_primitive_matrix(bContext *C,
@@ -342,14 +342,14 @@ float ED_object_new_primitive_matrix(bContext *C,
invert_m3(rmat);
/* inverse transform for initial rotation and object */
- copy_m3_m4(mat, obedit->obmat);
+ copy_m3_m4(mat, obedit->object_to_world);
mul_m3_m3m3(cmat, rmat, mat);
invert_m3_m3(imat, cmat);
copy_m4_m3(r_primmat, imat);
/* center */
copy_v3_v3(r_primmat[3], loc);
- sub_v3_v3v3(r_primmat[3], r_primmat[3], obedit->obmat[3]);
+ sub_v3_v3v3(r_primmat[3], r_primmat[3], obedit->object_to_world[3]);
invert_m3_m3(imat, mat);
mul_m3_v3(imat, r_primmat[3]);
@@ -2084,7 +2084,7 @@ static int object_curves_empty_hair_add_exec(bContext *C, wmOperator *op)
Object *curves_ob = ED_object_add_type(
C, OB_CURVES, nullptr, nullptr, nullptr, false, local_view_bits);
- BKE_object_apply_mat4(curves_ob, surface_ob->obmat, false, false);
+ BKE_object_apply_mat4(curves_ob, surface_ob->object_to_world, false, false);
/* Set surface object. */
Curves *curves_id = static_cast<Curves *>(curves_ob->data);
@@ -2561,8 +2561,8 @@ static void make_object_duplilist_real(bContext *C,
id_us_min((ID *)ob_dst->instance_collection);
ob_dst->instance_collection = nullptr;
- copy_m4_m4(ob_dst->obmat, dob->mat);
- BKE_object_apply_mat4(ob_dst, ob_dst->obmat, false, false);
+ copy_m4_m4(ob_dst->object_to_world, dob->mat);
+ BKE_object_apply_mat4(ob_dst, ob_dst->object_to_world, false, false);
BLI_ghash_insert(dupli_gh, dob, ob_dst);
if (parent_gh) {
@@ -3017,7 +3017,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
float loc[3], size[3], rot[3][3], eul[3];
float matrix[4][4];
- mat4_to_loc_rot_size(loc, rot, size, ob->obmat);
+ mat4_to_loc_rot_size(loc, rot, size, ob->object_to_world);
mat3_to_eul(eul, rot);
Object *ob_gpencil = ED_gpencil_add_object(C, loc, local_view_bits);
@@ -3871,8 +3871,8 @@ static int object_add_named_exec(bContext *C, wmOperator *op)
PropertyRNA *prop_matrix = RNA_struct_find_property(op->ptr, "matrix");
if (RNA_property_is_set(op->ptr, prop_matrix)) {
Object *ob_add = basen->object;
- RNA_property_float_get_array(op->ptr, prop_matrix, &ob_add->obmat[0][0]);
- BKE_object_apply_mat4(ob_add, ob_add->obmat, true, true);
+ RNA_property_float_get_array(op->ptr, prop_matrix, &ob_add->object_to_world[0][0]);
+ BKE_object_apply_mat4(ob_add, ob_add->object_to_world, true, true);
DEG_id_tag_update(&ob_add->id, ID_RECALC_TRANSFORM);
}
@@ -3969,7 +3969,7 @@ static int object_transform_to_mouse_exec(bContext *C, wmOperator *op)
float mat_dst_unit[4][4];
float final_delta[4][4];
- normalize_m4_m4(mat_src_unit, ob->obmat);
+ normalize_m4_m4(mat_src_unit, ob->object_to_world);
normalize_m4_m4(mat_dst_unit, matrix);
invert_m4(mat_src_unit);
mul_m4_m4m4(final_delta, mat_dst_unit, mat_src_unit);
@@ -4124,7 +4124,7 @@ static int object_join_exec(bContext *C, wmOperator *op)
* If the zero scale is removed, the data on this axis remains un-scaled
* (something that wouldn't work for #invert_m4_m4_safe). */
float imat_test[4][4];
- if (!invert_m4_m4(imat_test, ob->obmat)) {
+ if (!invert_m4_m4(imat_test, ob->object_to_world)) {
BKE_report(op->reports,
RPT_WARNING,
"Active object final transform has one or more zero scaled axes");
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 4b6ce69294f..91641de1605 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -461,7 +461,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
CTX_DATA_END;
}
-static void multiresbake_startjob(void *bkv, short *stop, short *do_update, float *progress)
+static void multiresbake_startjob(void *bkv, bool *stop, bool *do_update, float *progress)
{
MultiresBakerJobData *data;
MultiresBakeJob *bkj = bkv;
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 781866db6a0..260d65fc5dc 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -106,7 +106,7 @@ typedef struct BakeAPIRender {
/* Progress Callbacks. */
float *progress;
- short *do_update;
+ bool *do_update;
/* Operator state. */
ReportList *reports;
@@ -150,12 +150,12 @@ static int bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
* for exec() when there is no render job
* NOTE: this won't check for the escape key being pressed, but doing so isn't thread-safe.
*/
-static int bake_break(void *UNUSED(rjv))
+static bool bake_break(void *UNUSED(rjv))
{
if (G.is_break) {
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static void bake_update_image(ScrArea *area, Image *image)
@@ -1518,10 +1518,10 @@ static int bake(const BakeAPIRender *bkr,
highpoly[i].me = BKE_mesh_new_from_object(NULL, highpoly[i].ob_eval, false, false);
/* Low-poly to high-poly transformation matrix. */
- copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->obmat);
+ copy_m4_m4(highpoly[i].obmat, highpoly[i].ob->object_to_world);
invert_m4_m4(highpoly[i].imat, highpoly[i].obmat);
- highpoly[i].is_flip_object = is_negative_m4(highpoly[i].ob->obmat);
+ highpoly[i].is_flip_object = is_negative_m4(highpoly[i].ob->object_to_world);
i++;
}
@@ -1540,18 +1540,19 @@ static int bake(const BakeAPIRender *bkr,
pixel_array_high = MEM_mallocN(sizeof(BakePixel) * targets.pixels_num,
"bake pixels high poly");
- if (!RE_bake_pixels_populate_from_objects(me_low_eval,
- pixel_array_low,
- pixel_array_high,
- highpoly,
- tot_highpoly,
- targets.pixels_num,
- ob_cage != NULL,
- bkr->cage_extrusion,
- bkr->max_ray_distance,
- ob_low_eval->obmat,
- (ob_cage ? ob_cage->obmat : ob_low_eval->obmat),
- me_cage_eval)) {
+ if (!RE_bake_pixels_populate_from_objects(
+ me_low_eval,
+ pixel_array_low,
+ pixel_array_high,
+ highpoly,
+ tot_highpoly,
+ targets.pixels_num,
+ ob_cage != NULL,
+ bkr->cage_extrusion,
+ bkr->max_ray_distance,
+ ob_low_eval->object_to_world,
+ (ob_cage ? ob_cage->object_to_world : ob_low_eval->object_to_world),
+ me_cage_eval)) {
BKE_report(reports, RPT_ERROR, "Error handling selected objects");
goto cleanup;
}
@@ -1629,7 +1630,7 @@ static int bake(const BakeAPIRender *bkr,
targets.result,
me_low_eval,
bkr->normal_swizzle,
- ob_low_eval->obmat);
+ ob_low_eval->object_to_world);
}
else {
/* From multi-resolution. */
@@ -1655,7 +1656,7 @@ static int bake(const BakeAPIRender *bkr,
targets.result,
(me_nores) ? me_nores : me_low_eval,
bkr->normal_swizzle,
- ob_low_eval->obmat);
+ ob_low_eval->object_to_world);
if (md) {
BKE_id_free(NULL, &me_nores->id);
@@ -1853,7 +1854,7 @@ finally:
return result;
}
-static void bake_startjob(void *bkv, short *UNUSED(stop), short *do_update, float *progress)
+static void bake_startjob(void *bkv, bool *UNUSED(stop), bool *do_update, float *progress)
{
BakeAPIRender *bkr = (BakeAPIRender *)bkv;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index fa9ded0f989..1386da5dbde 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -2327,14 +2327,14 @@ static bool get_new_constraint_target(
/* Since by default, IK targets the tip of the last bone,
* use the tip of the active PoseChannel if adding a target for an IK Constraint. */
if (con_type == CONSTRAINT_TYPE_KINEMATIC) {
- mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_tail);
+ mul_v3_m4v3(obt->loc, obact->object_to_world, pchanact->pose_tail);
}
else {
- mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_head);
+ mul_v3_m4v3(obt->loc, obact->object_to_world, pchanact->pose_head);
}
}
else {
- copy_v3_v3(obt->loc, obact->obmat[3]);
+ copy_v3_v3(obt->loc, obact->object_to_world[3]);
}
/* restore, BKE_object_add sets active */
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 27659042f50..d52c7f0b8d4 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -535,7 +535,7 @@ static int add_hook_object(const bContext *C,
ob = add_hook_object_new(bmain, scene, view_layer, v3d, obedit);
/* transform cent to global coords for loc */
- mul_v3_m4v3(ob->loc, obedit->obmat, cent);
+ mul_v3_m4v3(ob->loc, obedit->object_to_world, cent);
}
md = obedit->modifiers.first;
@@ -556,13 +556,13 @@ static int add_hook_object(const bContext *C,
unit_m4(pose_mat);
- invert_m4_m4(obedit->imat, obedit->obmat);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
if (mode == OBJECT_ADDHOOK_NEWOB) {
/* pass */
}
else {
/* may overwrite with pose-bone location, below */
- mul_v3_m4v3(cent, obedit->imat, ob->obmat[3]);
+ mul_v3_m4v3(cent, obedit->world_to_object, ob->object_to_world[3]);
}
if (mode == OBJECT_ADDHOOK_SELOB_BONE) {
@@ -576,8 +576,8 @@ static int add_hook_object(const bContext *C,
pchan_act = BKE_pose_channel_active_if_layer_visible(ob);
if (LIKELY(pchan_act)) {
invert_m4_m4(pose_mat, pchan_act->pose_mat);
- mul_v3_m4v3(cent, ob->obmat, pchan_act->pose_mat[3]);
- mul_v3_m4v3(cent, obedit->imat, cent);
+ mul_v3_m4v3(cent, ob->object_to_world, pchan_act->pose_mat[3]);
+ mul_v3_m4v3(cent, obedit->world_to_object, cent);
}
}
else {
@@ -588,16 +588,16 @@ static int add_hook_object(const bContext *C,
copy_v3_v3(hmd->cent, cent);
/* matrix calculus */
- /* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
+ /* vert x (obmat x hook->world_to_object) x hook->object_to_world x ob->world_to_object */
/* (parentinv ) */
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);
- invert_m4_m4(object_eval->imat, object_eval->obmat);
+ invert_m4_m4(object_eval->world_to_object, object_eval->object_to_world);
/* apparently this call goes from right to left... */
- mul_m4_series(hmd->parentinv, pose_mat, object_eval->imat, obedit->obmat);
+ mul_m4_series(hmd->parentinv, pose_mat, object_eval->world_to_object, obedit->object_to_world);
DEG_relations_tag_update(bmain);
@@ -834,10 +834,10 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
}
/* recenter functionality */
- copy_m3_m4(bmat, ob->obmat);
+ copy_m3_m4(bmat, ob->object_to_world);
invert_m3_m3(imat, bmat);
- sub_v3_v3v3(hmd->cent, scene->cursor.location, ob->obmat[3]);
+ sub_v3_v3v3(hmd->cent, scene->cursor.location, ob->object_to_world[3]);
mul_m3_v3(imat, hmd->cent);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc
index 85a35861329..a87e52db129 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -614,7 +614,7 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * /*reports*/,
if (k) {
medge->v1 = cvert - 1;
medge->v2 = cvert;
- medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
+ medge->flag = ME_EDGEDRAW | ME_LOOSEEDGE;
medge++;
}
else {
@@ -633,7 +633,7 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * /*reports*/,
if (k) {
medge->v1 = cvert - 1;
medge->v2 = cvert;
- medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
+ medge->flag = ME_EDGEDRAW | ME_LOOSEEDGE;
medge++;
}
else {
@@ -3023,7 +3023,7 @@ static bool ocean_bake_poll(bContext *C)
struct OceanBakeJob {
/* from wmJob */
struct Object *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
int current_frame;
struct OceanCache *och;
@@ -3062,7 +3062,7 @@ static void oceanbake_update(void *customdata, float progress, int *cancel)
*(oj->progress) = progress;
}
-static void oceanbake_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void oceanbake_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
OceanBakeJob *oj = static_cast<OceanBakeJob *>(customdata);
@@ -3075,7 +3075,7 @@ static void oceanbake_startjob(void *customdata, short *stop, short *do_update,
BKE_ocean_bake(oj->ocean, oj->och, oceanbake_update, (void *)oj);
*do_update = true;
- *stop = 0;
+ *stop = false;
}
static void oceanbake_endjob(void *customdata)
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 5da19d76259..10068def991 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -272,7 +272,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
else {
ob->partype = PARVERT1;
@@ -280,7 +280,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
}
}
@@ -401,7 +401,7 @@ void ED_object_parent_clear(Object *ob, const int type)
/* remove parent, and apply the parented transform
* result as object's local transforms */
ob->parent = NULL;
- BKE_object_apply_mat4(ob, ob->obmat, true, false);
+ BKE_object_apply_mat4(ob, ob->object_to_world, true, false);
break;
}
case CLEAR_PARENT_INVERSE: {
@@ -584,7 +584,7 @@ bool ED_object_parent_set(ReportList *reports,
if (keep_transform) {
/* Was removed because of bug T23577,
* but this can be handy in some cases too T32616, so make optional. */
- BKE_object_apply_mat4(ob, ob->obmat, false, false);
+ BKE_object_apply_mat4(ob, ob->object_to_world, false, false);
}
/* Set the parent (except for follow-path constraint option). */
@@ -706,7 +706,7 @@ bool ED_object_parent_set(ReportList *reports,
BKE_constraint_target_matrix_get(
depsgraph, scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
- sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
+ sub_v3_v3v3(vec, ob->object_to_world[3], cmat[3]);
copy_v3_v3(ob->loc, vec);
}
@@ -729,7 +729,7 @@ bool ED_object_parent_set(ReportList *reports,
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
else if (is_armature_parent && (ob->type == OB_GPENCIL) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE) {
@@ -747,7 +747,7 @@ bool ED_object_parent_set(ReportList *reports,
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
else if ((ob->type == OB_GPENCIL) && (par->type == OB_LATTICE)) {
/* Add Lattice modifier */
@@ -758,12 +758,12 @@ bool ED_object_parent_set(ReportList *reports,
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
else {
/* calculate inverse parent matrix */
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
}
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
@@ -772,7 +772,7 @@ bool ED_object_parent_set(ReportList *reports,
static void parent_set_vert_find(KDTree_3d *tree, Object *child, int vert_par[3], bool is_tri)
{
- const float *co_find = child->obmat[3];
+ const float *co_find = child->object_to_world[3];
if (is_tri) {
KDTreeNearest_3d nearest[3];
int tot;
@@ -1186,7 +1186,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
}
if (type == CLEAR_TRACK_KEEP_TRANSFORM) {
- BKE_object_apply_mat4(ob, ob->obmat, true, true);
+ BKE_object_apply_mat4(ob, ob->object_to_world, true, true);
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc
index 8358bf632d3..a50fb28805e 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -296,7 +296,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion * /*ar*/, void *arg)
uint pos3d = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
GPU_matrix_push();
- GPU_matrix_mul(cd->active_object->obmat);
+ GPU_matrix_mul(cd->active_object->object_to_world);
/* Draw Rect */
immUniformColor4f(0.9f, 0.9f, 0.9f, 0.8f);
@@ -494,10 +494,10 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
float view_normal[3] = {0.0f, 0.0f, 1.0f};
/* Calculate the view normal. */
- invert_m4_m4(active_object->imat, active_object->obmat);
+ invert_m4_m4(active_object->world_to_object, active_object->object_to_world);
copy_m3_m4(mat, rv3d->viewinv);
mul_m3_v3(mat, view_normal);
- copy_m3_m4(mat, active_object->imat);
+ copy_m3_m4(mat, active_object->world_to_object);
mul_m3_v3(mat, view_normal);
normalize_v3(view_normal);
@@ -535,7 +535,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
/* Project the selected face in the previous step of the Bounding Box. */
for (int i = 0; i < 4; i++) {
float preview_plane_world_space[3];
- mul_v3_m4v3(preview_plane_world_space, active_object->obmat, cd->preview_plane[i]);
+ mul_v3_m4v3(preview_plane_world_space, active_object->object_to_world, cd->preview_plane[i]);
ED_view3d_project_v2(region, preview_plane_world_space, preview_plane_proj[i]);
}
@@ -582,7 +582,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
/* Invert object scale. */
float scale[3];
- mat4_to_size(scale, active_object->obmat);
+ mat4_to_size(scale, active_object->object_to_world);
invert_v3(scale);
size_to_mat4(scale_mat, scale);
@@ -593,7 +593,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
/* Scale the text to constant viewport size. */
float text_pos_word_space[3];
- mul_v3_m4v3(text_pos_word_space, active_object->obmat, text_pos);
+ mul_v3_m4v3(text_pos_word_space, active_object->object_to_world, text_pos);
const float pixelsize = ED_view3d_pixel_size(rv3d, text_pos_word_space);
scale_m4_fl(scale_mat, pixelsize * 0.5f);
mul_m4_m4_post(cd->text_mat, scale_mat);
@@ -654,7 +654,7 @@ enum eSymmetryAxes {
struct QuadriFlowJob {
/* from wmJob */
struct Object *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
const struct wmOperator *op;
@@ -836,7 +836,7 @@ static Mesh *remesh_symmetry_mirror(Object *ob, Mesh *mesh, eSymmetryAxes symmet
return mesh_mirror;
}
-static void quadriflow_start_job(void *customdata, short *stop, short *do_update, float *progress)
+static void quadriflow_start_job(void *customdata, bool *stop, bool *do_update, float *progress)
{
QuadriFlowJob *qj = static_cast<QuadriFlowJob *>(customdata);
@@ -884,7 +884,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
if (new_mesh == nullptr) {
*do_update = true;
- *stop = 0;
+ *stop = false;
if (qj->success == 1) {
/* This is not a user cancellation event. */
qj->success = 0;
@@ -917,7 +917,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
BKE_mesh_batch_cache_dirty_tag(static_cast<Mesh *>(ob->data), BKE_MESH_BATCH_DIRTY_ALL);
*do_update = true;
- *stop = 0;
+ *stop = false;
}
static void quadriflow_end_job(void *customdata)
@@ -992,7 +992,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
if (op->flag == 0) {
/* This is called directly from the exec operator, this operation is now blocking */
job->is_nonblocking_job = false;
- short stop = 0, do_update = true;
+ bool stop = false, do_update = true;
float progress;
quadriflow_start_job(job, &stop, &do_update, &progress);
quadriflow_end_job(job);
diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc
index 6604e3da4d2..0c2aca8b97b 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -527,9 +527,9 @@ static void ignore_parent_tx(Main *bmain, Depsgraph *depsgraph, Scene *scene, Ob
LISTBASE_FOREACH (Object *, ob_child, &bmain->objects) {
if (ob_child->parent == ob) {
Object *ob_child_eval = DEG_get_evaluated_object(depsgraph, ob_child);
- BKE_object_apply_mat4(ob_child_eval, ob_child_eval->obmat, true, false);
+ BKE_object_apply_mat4(ob_child_eval, ob_child_eval->object_to_world, true, false);
BKE_object_workob_calc_parent(depsgraph, scene, ob_child_eval, &workob);
- invert_m4_m4(ob_child->parentinv, workob.obmat);
+ invert_m4_m4(ob_child->parentinv, workob.object_to_world);
/* Copy result of BKE_object_apply_mat4(). */
BKE_object_transform_copy(ob_child, ob_child_eval);
/* Make sure evaluated object is in a consistent state with the original one.
@@ -660,11 +660,11 @@ static int apply_objects_internal(bContext *C,
if (do_multi_user) {
obact = CTX_data_active_object(C);
- invert_m4_m4(obact_invmat, obact->obmat);
+ invert_m4_m4(obact_invmat, obact->object_to_world);
Object workob;
BKE_object_workob_calc_parent(depsgraph, scene, obact, &workob);
- copy_m4_m4(obact_parent, workob.obmat);
+ copy_m4_m4(obact_parent, workob.object_to_world);
copy_m4_m4(obact_parentinv, obact->parentinv);
if (apply_objects_internal_need_single_user(C)) {
@@ -989,7 +989,7 @@ static int apply_objects_internal(bContext *C,
float _obmat[4][4], _iobmat[4][4];
float _mat[4][4];
- copy_m4_m4(_obmat, ob->obmat);
+ copy_m4_m4(_obmat, ob->object_to_world);
invert_m4_m4(_iobmat, _obmat);
copy_m4_m4(_mat, _obmat);
@@ -1075,7 +1075,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator * /*op*/)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
BKE_object_where_is_calc(depsgraph, scene, ob_eval);
- BKE_object_apply_mat4(ob_eval, ob_eval->obmat, true, true);
+ BKE_object_apply_mat4(ob_eval, ob_eval->object_to_world, true, true);
BKE_object_transform_copy(ob, ob_eval);
/* update for any children that may get moved */
@@ -1274,8 +1274,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (centermode == ORIGIN_TO_CURSOR) {
copy_v3_v3(cent, cursor);
- invert_m4_m4(obedit->imat, obedit->obmat);
- mul_m4_v3(obedit->imat, cent);
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world);
+ mul_m4_v3(obedit->world_to_object, cent);
}
else {
if (around == V3D_AROUND_CENTER_BOUNDS) {
@@ -1342,8 +1342,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (centermode == ORIGIN_TO_CURSOR) {
copy_v3_v3(cent, cursor);
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, cent);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->world_to_object, cent);
}
if (ob->data == nullptr) {
@@ -1363,8 +1363,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
INIT_MINMAX(min, max);
BKE_object_minmax_dupli(depsgraph, scene, ob, min, max, true);
mid_v3_v3v3(cent, min, max);
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, cent);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->world_to_object, cent);
}
add_v3_v3(ob->instance_collection->instance_offset, cent);
@@ -1554,7 +1554,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (centermode == ORIGIN_TO_GEOMETRY) {
zero_v3(gpcenter);
BKE_gpencil_centroid_3d(gpd, gpcenter);
- add_v3_v3(gpcenter, ob->obmat[3]);
+ add_v3_v3(gpcenter, ob->object_to_world[3]);
}
if (centermode == ORIGIN_TO_CURSOR) {
copy_v3_v3(gpcenter, cursor);
@@ -1566,8 +1566,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float offset_local[3];
int i;
- sub_v3_v3v3(offset_global, gpcenter, ob->obmat[3]);
- copy_m3_m4(bmat, obact->obmat);
+ sub_v3_v3v3(offset_global, gpcenter, ob->object_to_world[3]);
+ copy_m3_m4(bmat, obact->object_to_world);
invert_m3_m3(imat, bmat);
mul_m3_v3(imat, offset_global);
mul_v3_m3v3(offset_local, imat, offset_global);
@@ -1699,7 +1699,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
ob_other->flag |= OB_DONE;
DEG_id_tag_update(&ob_other->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */
+ mul_v3_mat3_m4v3(centn, ob_other->object_to_world, cent); /* omit translation part */
add_v3_v3(ob_other->loc, centn);
Object *ob_other_eval = DEG_get_evaluated_object(depsgraph, ob_other);
@@ -1873,9 +1873,9 @@ static void object_transform_axis_target_calc_depth_init(XFormAxisData *xfd, con
int center_tot = 0;
for (XFormAxisItem &item : xfd->object_data) {
const Object *ob = item.ob;
- const float *ob_co_a = ob->obmat[3];
+ const float *ob_co_a = ob->object_to_world[3];
float ob_co_b[3];
- add_v3_v3v3(ob_co_b, ob->obmat[3], ob->obmat[2]);
+ add_v3_v3v3(ob_co_b, ob->object_to_world[3], ob->object_to_world[2]);
float view_isect[3], ob_isect[3];
if (isect_line_line_v3(view_co_a, view_co_b, ob_co_a, ob_co_b, view_isect, ob_isect)) {
add_v3_v3(center, view_isect);
@@ -1946,7 +1946,7 @@ static void object_apply_location(Object *ob, const float loc[3])
/* quick but weak */
Object ob_prev = blender::dna::shallow_copy(*ob);
float mat[4][4];
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
copy_v3_v3(mat[3], loc);
BKE_object_apply_mat4(ob, mat, true, true);
copy_v3_v3(mat[3], ob->loc);
@@ -1961,7 +1961,7 @@ static bool object_orient_to_location(Object *ob,
const bool z_flip)
{
float delta[3];
- sub_v3_v3v3(delta, ob->obmat[3], location);
+ sub_v3_v3v3(delta, ob->object_to_world[3], location);
if (normalize_v3(delta) != 0.0f) {
if (z_flip) {
negate_v3(delta);
@@ -2139,7 +2139,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
float xform_rot_offset_inv_first[3][3];
for (const int i : xfd->object_data.index_range()) {
XFormAxisItem &item = xfd->object_data[i];
- copy_m3_m4(item.xform_rot_offset, item.ob->obmat);
+ copy_m3_m4(item.xform_rot_offset, item.ob->object_to_world);
normalize_m3(item.xform_rot_offset);
if (i == 0) {
@@ -2158,8 +2158,8 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
XFormAxisItem &item = xfd->object_data[i];
if (is_translate_init) {
float ob_axis[3];
- item.xform_dist = len_v3v3(item.ob->obmat[3], location_world);
- normalize_v3_v3(ob_axis, item.ob->obmat[2]);
+ item.xform_dist = len_v3v3(item.ob->object_to_world[3], location_world);
+ normalize_v3_v3(ob_axis, item.ob->object_to_world[2]);
/* Scale to avoid adding distance when moving between surfaces. */
if (normal_found) {
float scale = fabsf(dot_v3v3(ob_axis, normal));
@@ -2173,7 +2173,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
copy_v3_v3(target_normal, normal);
}
else {
- normalize_v3_v3(target_normal, item.ob->obmat[2]);
+ normalize_v3_v3(target_normal, item.ob->object_to_world[2]);
}
#ifdef USE_RELATIVE_ROTATION
@@ -2190,7 +2190,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
madd_v3_v3fl(loc, target_normal, item.xform_dist);
object_apply_location(item.ob, loc);
/* so orient behaves as expected */
- copy_v3_v3(item.ob->obmat[3], loc);
+ copy_v3_v3(item.ob->object_to_world[3], loc);
}
object_orient_to_location(
diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c
index 50ba5b8af5f..1387282357f 100644
--- a/source/blender/editors/object/object_utils.c
+++ b/source/blender/editors/object/object_utils.c
@@ -114,20 +114,20 @@ bool ED_object_calc_active_center(Object *ob, const bool select_only, float r_ce
{
if (ob->mode & OB_MODE_EDIT) {
if (ED_object_calc_active_center_for_editmode(ob, select_only, r_center)) {
- mul_m4_v3(ob->obmat, r_center);
+ mul_m4_v3(ob->object_to_world, r_center);
return true;
}
return false;
}
if (ob->mode & OB_MODE_POSE) {
if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
- mul_m4_v3(ob->obmat, r_center);
+ mul_m4_v3(ob->object_to_world, r_center);
return true;
}
return false;
}
if (!select_only || (ob->base_flag & BASE_SELECTED)) {
- copy_v3_v3(r_center, ob->obmat[3]);
+ copy_v3_v3(r_center, ob->object_to_world[3]);
return true;
}
return false;
@@ -245,11 +245,11 @@ void ED_object_xform_skip_child_container_item_ensure(struct XFormObjectSkipChil
if (!BLI_ghash_ensure_p(xcs->obchild_in_obmode_map, ob, &xf_p)) {
struct XFormObjectSkipChild *xf = MEM_mallocN(sizeof(*xf), __func__);
copy_m4_m4(xf->parentinv_orig, ob->parentinv);
- copy_m4_m4(xf->obmat_orig, ob->obmat);
- copy_m4_m4(xf->parent_obmat_orig, ob->parent->obmat);
- invert_m4_m4(xf->parent_obmat_inv_orig, ob->parent->obmat);
+ copy_m4_m4(xf->obmat_orig, ob->object_to_world);
+ copy_m4_m4(xf->parent_obmat_orig, ob->parent->object_to_world);
+ invert_m4_m4(xf->parent_obmat_inv_orig, ob->parent->object_to_world);
if (ob_parent_recurse) {
- copy_m4_m4(xf->parent_recurse_obmat_orig, ob_parent_recurse->obmat);
+ copy_m4_m4(xf->parent_recurse_obmat_orig, ob_parent_recurse->object_to_world);
}
xf->mode = mode;
xf->ob_parent_recurse = ob_parent_recurse;
@@ -274,14 +274,14 @@ void ED_object_xform_skip_child_container_update_all(struct XFormObjectSkipChild
if (xf->mode == XFORM_OB_SKIP_CHILD_PARENT_IS_XFORM) {
/* Parent is transformed, this isn't so compensate. */
Object *ob_parent_eval = DEG_get_evaluated_object(depsgraph, ob->parent);
- mul_m4_m4m4(dmat, xf->parent_obmat_inv_orig, ob_parent_eval->obmat);
+ mul_m4_m4m4(dmat, xf->parent_obmat_inv_orig, ob_parent_eval->object_to_world);
invert_m4(dmat);
}
else if (xf->mode == XFORM_OB_SKIP_CHILD_PARENT_IS_XFORM_INDIRECT) {
/* Calculate parent matrix (from the root transform). */
Object *ob_parent_recurse_eval = DEG_get_evaluated_object(depsgraph, xf->ob_parent_recurse);
float parent_recurse_obmat_inv[4][4];
- invert_m4_m4(parent_recurse_obmat_inv, ob_parent_recurse_eval->obmat);
+ invert_m4_m4(parent_recurse_obmat_inv, ob_parent_recurse_eval->object_to_world);
mul_m4_m4m4(dmat, xf->parent_recurse_obmat_orig, parent_recurse_obmat_inv);
invert_m4(dmat);
float parent_obmat_calc[4][4];
@@ -296,7 +296,7 @@ void ED_object_xform_skip_child_container_update_all(struct XFormObjectSkipChild
/* Transform this - without transform data. */
Object *ob_parent_recurse_eval = DEG_get_evaluated_object(depsgraph, xf->ob_parent_recurse);
float parent_recurse_obmat_inv[4][4];
- invert_m4_m4(parent_recurse_obmat_inv, ob_parent_recurse_eval->obmat);
+ invert_m4_m4(parent_recurse_obmat_inv, ob_parent_recurse_eval->object_to_world);
mul_m4_m4m4(dmat, xf->parent_recurse_obmat_orig, parent_recurse_obmat_inv);
invert_m4(dmat);
float obmat_calc[4][4];
@@ -350,7 +350,7 @@ void ED_object_data_xform_container_item_ensure(struct XFormObjectData_Container
void **xf_p;
if (!BLI_ghash_ensure_p(xds->obdata_in_obmode_map, ob->data, &xf_p)) {
struct XFormObjectData_Extra *xf = MEM_mallocN(sizeof(*xf), __func__);
- copy_m4_m4(xf->obmat_orig, ob->obmat);
+ copy_m4_m4(xf->obmat_orig, ob->object_to_world);
xf->ob = ob;
/* Result may be NULL, that's OK. */
xf->xod = ED_object_data_xform_create(ob->data);
@@ -378,7 +378,7 @@ void ED_object_data_xform_container_update_all(struct XFormObjectData_Container
Object *ob_eval = DEG_get_evaluated_object(depsgraph, xf->ob);
float imat[4][4], dmat[4][4];
invert_m4_m4(imat, xf->obmat_orig);
- mul_m4_m4m4(dmat, imat, ob_eval->obmat);
+ mul_m4_m4m4(dmat, imat, ob_eval->object_to_world);
invert_m4(dmat);
ED_object_data_xform_by_mat4(xf->xod, dmat);
diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c
index a1d53cadd06..d1e6e7000d9 100644
--- a/source/blender/editors/object/object_warp.c
+++ b/source/blender/editors/object/object_warp.c
@@ -38,7 +38,7 @@ static void object_warp_calc_view_matrix(float r_mat_view[4][4],
mul_m4_m4m4(viewmat_roll, mat_offset, viewmat);
/* apply the view and the object matrix */
- mul_m4_m4m4(r_mat_view, viewmat_roll, obedit->obmat);
+ mul_m4_m4m4(r_mat_view, viewmat_roll, obedit->object_to_world);
/* get the view-space cursor */
mul_v3_m4v3(r_center_view, viewmat_roll, center);
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 41238eb171b..1a3f0f0f2ac 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -285,7 +285,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
typedef struct DynamicPaintBakeJob {
/* from wmJob */
void *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
struct Main *bmain;
@@ -429,7 +429,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job)
ED_update_for_newframe(job->bmain, job->depsgraph);
}
-static void dpaint_bake_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void dpaint_bake_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
DynamicPaintBakeJob *job = customdata;
@@ -450,7 +450,7 @@ static void dpaint_bake_startjob(void *customdata, short *stop, short *do_update
dynamicPaint_bakeImageSequence(job);
*do_update = true;
- *stop = 0;
+ *stop = false;
}
/*
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index e6d0aca7902..22295c260e2 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3920,8 +3920,8 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
mul_m4_v3(mat, co);
/* Use `kco` as the object space version of world-space `co`,
- * `ob->imat` is set before calling. */
- mul_v3_m4v3(kco, data->ob->imat, co);
+ * `ob->world_to_object` is set before calling. */
+ mul_v3_m4v3(kco, data->ob->world_to_object, co);
point_index = BLI_kdtree_3d_find_nearest(edit->emitter_field, kco, NULL);
if (point_index == -1) {
@@ -3930,7 +3930,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
copy_v3_v3(co_root, co);
copy_v3_v3(no_root, &edit->emitter_cosnos[point_index * 6 + 3]);
- mul_mat3_m4_v3(data->ob->obmat, no_root); /* normal into global-space */
+ mul_mat3_m4_v3(data->ob->object_to_world, no_root); /* normal into global-space */
normalize_v3(no_root);
if (puff_volume) {
@@ -4010,14 +4010,14 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
mul_m4_v3(mat, oco);
/* Use `kco` as the object space version of world-space `co`,
- * `ob->imat` is set before calling. */
- mul_v3_m4v3(kco, data->ob->imat, oco);
+ * `ob->world_to_object` is set before calling. */
+ mul_v3_m4v3(kco, data->ob->world_to_object, oco);
point_index = BLI_kdtree_3d_find_nearest(edit->emitter_field, kco, NULL);
if (point_index != -1) {
copy_v3_v3(onor, &edit->emitter_cosnos[point_index * 6 + 3]);
- mul_mat3_m4_v3(data->ob->obmat, onor); /* Normal into world-space. */
- mul_mat3_m4_v3(imat, onor); /* World-space into particle-space. */
+ mul_mat3_m4_v3(data->ob->object_to_world, onor); /* Normal into world-space. */
+ mul_mat3_m4_v3(imat, onor); /* World-space into particle-space. */
normalize_v3(onor);
}
else {
@@ -4412,7 +4412,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
short size = pset->brush[PE_BRUSH_ADD].size;
RNG *rng;
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
if (psys->flag & PSYS_GLOBAL_HAIR) {
return 0;
@@ -4797,7 +4797,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.combfac = 1.0f - data.combfac;
}
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
ED_view3d_win_to_delta(region, xy_delta, bedit->zfac, vec);
data.dvec = vec;
@@ -4865,7 +4865,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
}
data.invert = (brush->invert ^ flip);
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
foreach_mouse_hit_point(&data, brush_puff, selected);
}
@@ -4895,7 +4895,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
data.smoothfac = brush->strength;
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
foreach_mouse_hit_key(&data, brush_smooth_get, selected);
@@ -5112,7 +5112,7 @@ static bool shape_cut_test_point(PEData *data, ParticleEditSettings *pset, Parti
userdata.num_hits = 0;
float co_shape[3];
- mul_v3_m4v3(co_shape, pset->shape_object->imat, key->co);
+ mul_v3_m4v3(co_shape, pset->shape_object->world_to_object, key->co);
BLI_bvhtree_ray_cast_all(
shape_bvh->tree, co_shape, dir, 0.0f, BVH_RAYCAST_DIST_MAX, point_inside_bvh_cb, &userdata);
@@ -5153,8 +5153,8 @@ static void shape_cut(PEData *data, int pa_index)
float dir_shape[3];
float len_shape;
- mul_v3_m4v3(co_curr_shape, pset->shape_object->imat, key->co);
- mul_v3_m4v3(co_next_shape, pset->shape_object->imat, (key + 1)->co);
+ mul_v3_m4v3(co_curr_shape, pset->shape_object->world_to_object, key->co);
+ mul_v3_m4v3(co_next_shape, pset->shape_object->world_to_object, (key + 1)->co);
sub_v3_v3v3(dir_shape, co_next_shape, co_curr_shape);
len_shape = normalize_v3(dir_shape);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 210757173eb..852156f9403 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -726,8 +726,8 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
edit_point = target_edit ? target_edit->points : NULL;
- invert_m4_m4(from_ob_imat, ob->obmat);
- invert_m4_m4(to_ob_imat, target_ob->obmat);
+ invert_m4_m4(from_ob_imat, ob->object_to_world);
+ invert_m4_m4(to_ob_imat, target_ob->object_to_world);
invert_m4_m4(from_imat, from_mat);
invert_m4_m4(to_imat, to_mat);
@@ -843,7 +843,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
float offset[3];
if (to_global) {
- copy_m4_m4(imat, target_ob->obmat);
+ copy_m4_m4(imat, target_ob->object_to_world);
}
else {
/* NOTE: using target_dm here, which is in target_ob object space and has full modifiers.
@@ -923,8 +923,8 @@ static bool connect_hair(Depsgraph *depsgraph, Scene *scene, Object *ob, Particl
ob,
psys,
psys->edit,
- ob->obmat,
- ob->obmat,
+ ob->object_to_world,
+ ob->object_to_world,
psys->flag & PSYS_GLOBAL_HAIR,
false);
if (ok) {
@@ -1174,8 +1174,8 @@ static bool copy_particle_systems_to_object(const bContext *C,
to_mat = I;
break;
case PAR_COPY_SPACE_WORLD:
- from_mat = ob_from->obmat;
- to_mat = ob_to->obmat;
+ from_mat = ob_from->object_to_world;
+ to_mat = ob_to->object_to_world;
break;
default:
/* should not happen */
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 314796e96e4..d5e55c99444 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -61,7 +61,7 @@
typedef struct FluidJob {
/* from wmJob */
void *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
const char *type;
const char *name;
@@ -349,7 +349,7 @@ static void fluid_bake_endjob(void *customdata)
}
}
-static void fluid_bake_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void fluid_bake_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
FluidJob *job = customdata;
FluidDomainSettings *fds = job->fmd->domain;
@@ -428,7 +428,7 @@ static void fluid_bake_startjob(void *customdata, short *stop, short *do_update,
*do_update = true;
}
if (stop) {
- *stop = 0;
+ *stop = false;
}
}
@@ -461,7 +461,7 @@ static void fluid_free_endjob(void *customdata)
}
}
-static void fluid_free_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void fluid_free_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
FluidJob *job = customdata;
FluidDomainSettings *fds = job->fmd->domain;
@@ -504,7 +504,7 @@ static void fluid_free_startjob(void *customdata, short *stop, short *do_update,
#endif
*do_update = true;
- *stop = 0;
+ *stop = false;
/* Update scene so that viewport shows freed up scene */
ED_update_for_newframe(job->bmain, job->depsgraph);
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 97cd0d1d149..9fac93187ee 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -86,7 +86,7 @@ static bool ptcache_add_remove_poll(bContext *C)
typedef struct PointCacheJob {
wmWindowManager *wm;
void *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
PTCacheBaker *baker;
@@ -126,7 +126,7 @@ static void ptcache_job_update(void *customdata, float progress, int *cancel)
*(job->progress) = progress;
}
-static void ptcache_job_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void ptcache_job_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
PointCacheJob *job = customdata;
@@ -144,7 +144,7 @@ static void ptcache_job_startjob(void *customdata, short *stop, short *do_update
BKE_ptcache_bake(job->baker);
*do_update = true;
- *stop = 0;
+ *stop = false;
}
static void ptcache_job_endjob(void *customdata)
diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc
index e66cabbc9f8..b05f430d198 100644
--- a/source/blender/editors/render/render_internal.cc
+++ b/source/blender/editors/render/render_internal.cc
@@ -69,7 +69,7 @@
#include "render_intern.hh"
/* Render Callbacks */
-static int render_break(void *rjv);
+static bool render_break(void *rjv);
struct RenderJob {
Main *main;
@@ -87,8 +87,8 @@ struct RenderJob {
Image *image;
ImageUser iuser;
bool image_outdated;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
ReportList *reports;
int orig_layer;
@@ -637,7 +637,7 @@ static void current_scene_update(void *rjv, Scene *scene)
rj->iuser.scene = scene;
}
-static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
+static void render_startjob(void *rjv, bool *stop, bool *do_update, float *progress)
{
RenderJob *rj = static_cast<RenderJob *>(rjv);
@@ -791,29 +791,29 @@ static void render_endjob(void *rjv)
}
/* called by render, check job 'stop' value or the global */
-static int render_breakjob(void *rjv)
+static bool render_breakjob(void *rjv)
{
RenderJob *rj = static_cast<RenderJob *>(rjv);
if (G.is_break) {
- return 1;
+ return true;
}
if (rj->stop && *(rj->stop)) {
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/**
* For exec() when there is no render job
* NOTE: this won't check for the escape key being pressed, but doing so isn't thread-safe.
*/
-static int render_break(void * /*rjv*/)
+static bool render_break(void * /*rjv*/)
{
if (G.is_break) {
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* runs in thread, no cursor setting here works. careful with notifiers too (malloc conflicts) */
diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc
index 140199209da..8e50e8c04d1 100644
--- a/source/blender/editors/render/render_preview.cc
+++ b/source/blender/editors/render/render_preview.cc
@@ -104,7 +104,7 @@ static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect);
struct ShaderPreview {
/* from wmJob */
void *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
Scene *scene;
ID *id, *id_copy;
@@ -785,7 +785,7 @@ static Object *object_preview_camera_create(Main *preview_main,
float rotmat[3][3];
float dummyscale[3];
- mat4_to_loc_rot_size(camera->loc, rotmat, dummyscale, preview_object->obmat);
+ mat4_to_loc_rot_size(camera->loc, rotmat, dummyscale, preview_object->object_to_world);
/* Camera is Y up, so needs additional rotations to obliquely face the front. */
float drotmat[3][3];
@@ -1047,7 +1047,7 @@ static void shader_preview_update(void *spv, RenderResult * /*rr*/, struct rcti
}
/* called by renderer, checks job value */
-static int shader_preview_break(void *spv)
+static bool shader_preview_break(void *spv)
{
ShaderPreview *sp = static_cast<ShaderPreview *>(spv);
@@ -1223,7 +1223,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
}
/* runs inside thread for material and icons */
-static void shader_preview_startjob(void *customdata, short *stop, short *do_update)
+static void shader_preview_startjob(void *customdata, bool *stop, bool *do_update)
{
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
@@ -1408,7 +1408,7 @@ static void set_alpha(char *cp, int sizex, int sizey, char alpha)
}
}
-static void icon_preview_startjob(void *customdata, short *stop, short *do_update)
+static void icon_preview_startjob(void *customdata, bool *stop, bool *do_update)
{
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
@@ -1488,8 +1488,8 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
* does not run two of them at the same time. */
static void common_preview_startjob(void *customdata,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float * /*progress*/)
{
ShaderPreview *sp = static_cast<ShaderPreview *>(customdata);
@@ -1509,8 +1509,8 @@ static void common_preview_startjob(void *customdata,
static void other_id_types_preview_render(IconPreview *ip,
IconPreviewSize *cur_size,
const ePreviewRenderMethod pr_method,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ShaderPreview *sp = MEM_cnew<ShaderPreview>("Icon ShaderPreview");
@@ -1570,8 +1570,8 @@ static int icon_previewimg_size_index_get(const IconPreviewSize *icon_size,
}
static void icon_preview_startjob_all_sizes(void *customdata,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
IconPreview *ip = (IconPreview *)customdata;
@@ -1735,7 +1735,7 @@ class PreviewLoadJob {
void push_load_request(PreviewImage *preview, eIconSizes icon_size);
private:
- static void run_fn(void *customdata, short *stop, short *do_update, float *progress);
+ static void run_fn(void *customdata, bool *stop, bool *do_update, float *progress);
static void update_fn(void *customdata);
static void end_fn(void *customdata);
static void free_fn(void *customdata);
@@ -1755,7 +1755,8 @@ PreviewLoadJob::~PreviewLoadJob()
PreviewLoadJob &PreviewLoadJob::ensure_job(wmWindowManager *wm, wmWindow *win)
{
- wmJob *wm_job = WM_jobs_get(wm, win, nullptr, "Load Previews", 0, WM_JOB_TYPE_LOAD_PREVIEW);
+ wmJob *wm_job = WM_jobs_get(
+ wm, win, nullptr, "Load Previews", eWM_JobFlag(0), WM_JOB_TYPE_LOAD_PREVIEW);
if (!WM_jobs_is_running(wm_job)) {
PreviewLoadJob *job_data = MEM_new<PreviewLoadJob>("PreviewLoadJobData");
@@ -1776,7 +1777,7 @@ void PreviewLoadJob::load_jobless(PreviewImage *preview, const eIconSizes icon_s
job_data.push_load_request(preview, icon_size);
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0;
run_fn(&job_data, &stop, &do_update, &progress);
update_fn(&job_data);
@@ -1798,7 +1799,7 @@ void PreviewLoadJob::push_load_request(PreviewImage *preview, const eIconSizes i
BLI_thread_queue_push(todo_queue_, &requested_previews_.back());
}
-void PreviewLoadJob::run_fn(void *customdata, short *stop, short *do_update, float * /*progress*/)
+void PreviewLoadJob::run_fn(void *customdata, bool *stop, bool *do_update, float * /*progress*/)
{
PreviewLoadJob *job_data = static_cast<PreviewLoadJob *>(customdata);
@@ -1936,7 +1937,7 @@ void ED_preview_icon_render(
}
IconPreview ip = {nullptr};
- short stop = false, update = false;
+ bool stop = false, update = false;
float progress = 0.0f;
ED_preview_ensure_dbase();
diff --git a/source/blender/editors/render/render_shading.cc b/source/blender/editors/render/render_shading.cc
index 83ce447e8cf..e5c2b9702e5 100644
--- a/source/blender/editors/render/render_shading.cc
+++ b/source/blender/editors/render/render_shading.cc
@@ -1398,7 +1398,7 @@ static int light_cache_bake_exec(bContext *C, wmOperator *op)
light_cache_bake_tag_cache(scene, op);
- short stop = 0, do_update;
+ bool stop = false, do_update;
float progress; /* Not actually used. */
EEVEE_lightbake_job(rj, &stop, &do_update, &progress);
EEVEE_lightbake_job_data_free(rj);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 8db968cbb8a..a62e027ba03 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -147,7 +147,7 @@ void ED_region_do_listen(wmRegionListenerParams *params)
}
LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
- UI_block_views_listen(block, params);
+ UI_block_listen(block, params);
}
LISTBASE_FOREACH (uiList *, list, &region->ui_lists) {
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index e276bae6697..8172eb8a5d7 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -185,7 +185,7 @@ std::optional<CurvesBrush3D> sample_curves_3d_brush(const Depsgraph &depsgraph,
/* Shorten ray when the surface object is hit. */
if (surface_object_eval != nullptr) {
- const float4x4 surface_to_world_mat = surface_object->obmat;
+ const float4x4 surface_to_world_mat = surface_object->object_to_world;
const float4x4 world_to_surface_mat = surface_to_world_mat.inverted();
Mesh *surface_eval = BKE_object_get_evaluated_mesh(surface_object_eval);
@@ -218,7 +218,7 @@ std::optional<CurvesBrush3D> sample_curves_3d_brush(const Depsgraph &depsgraph,
}
}
- const float4x4 curves_to_world_mat = curves_object.obmat;
+ const float4x4 curves_to_world_mat = curves_object.object_to_world;
const float4x4 world_to_curves_mat = curves_to_world_mat.inverted();
const float3 center_ray_start_cu = world_to_curves_mat * center_ray_start_wo;
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index 6366da310b6..df7dd871a94 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -220,8 +220,10 @@ static int sculpt_curves_stroke_invoke(bContext *C, wmOperator *op, const wmEven
int return_value = op->type->modal(C, op, event);
if (return_value == OPERATOR_FINISHED) {
- paint_stroke_free(C, op, op_data->stroke);
- MEM_delete(op_data);
+ if (op->customdata != nullptr) {
+ paint_stroke_free(C, op, op_data->stroke);
+ MEM_delete(op_data);
+ }
return OPERATOR_FINISHED;
}
@@ -236,16 +238,19 @@ static int sculpt_curves_stroke_modal(bContext *C, wmOperator *op, const wmEvent
int return_value = paint_stroke_modal(C, op, event, &op_data->stroke);
if (ELEM(return_value, OPERATOR_FINISHED, OPERATOR_CANCELLED)) {
MEM_delete(op_data);
+ op->customdata = nullptr;
}
return return_value;
}
static void sculpt_curves_stroke_cancel(bContext *C, wmOperator *op)
{
- SculptCurvesBrushStrokeData *op_data = static_cast<SculptCurvesBrushStrokeData *>(
- op->customdata);
- paint_stroke_cancel(C, op, op_data->stroke);
- MEM_delete(op_data);
+ if (op->customdata != nullptr) {
+ SculptCurvesBrushStrokeData *op_data = static_cast<SculptCurvesBrushStrokeData *>(
+ op->customdata);
+ paint_stroke_cancel(C, op, op_data->stroke);
+ MEM_delete(op_data);
+ }
}
static void SCULPT_CURVES_OT_brush_stroke(struct wmOperatorType *ot)
@@ -786,7 +791,7 @@ static void select_grow_invoke_per_curve(Curves &curves_id,
});
});
- float4x4 curves_to_world_mat = curves_ob.obmat;
+ float4x4 curves_to_world_mat = curves_ob.object_to_world;
float4x4 world_to_curves_mat = curves_to_world_mat.inverted();
float4x4 projection;
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 71ec444098e..b85b878af7d 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1071,7 +1071,7 @@ static void cursor_draw_tiling_preview(const uint gpuattr,
for (int dim = 0; dim < 3; dim++) {
location[dim] = cur[dim] * step[dim] + orgLoc[dim];
}
- cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3);
}
}
}
@@ -1092,7 +1092,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr,
/* Axis Symmetry. */
flip_v3_v3(location, true_location, (char)i);
- cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3);
/* Tiling. */
cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius);
@@ -1107,7 +1107,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr,
mul_m4_v3(symm_rot_mat, location);
cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius);
- cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->object_to_world, 3);
}
}
}
@@ -1334,7 +1334,7 @@ static void paint_cursor_update_pixel_radius(PaintCursorContext *pcontext)
}
copy_v3_v3(pcontext->scene_space_location, pcontext->location);
- mul_m4_v3(pcontext->vc.obact->obmat, pcontext->scene_space_location);
+ mul_m4_v3(pcontext->vc.obact->object_to_world, pcontext->scene_space_location);
}
else {
Sculpt *sd = CTX_data_tool_settings(pcontext->C)->sculpt;
@@ -1464,7 +1464,7 @@ static void paint_cursor_drawing_setup_cursor_space(PaintCursorContext *pcontext
float cursor_trans[4][4], cursor_rot[4][4];
const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
float quat[4];
- copy_m4_m4(cursor_trans, pcontext->vc.obact->obmat);
+ copy_m4_m4(cursor_trans, pcontext->vc.obact->object_to_world);
translate_m4(cursor_trans, pcontext->location[0], pcontext->location[1], pcontext->location[2]);
rotation_between_vecs_to_quat(quat, z_axis, pcontext->normal);
quat_to_mat4(cursor_rot, quat);
@@ -1508,7 +1508,7 @@ static void paint_cursor_pose_brush_origins_draw(PaintCursorContext *pcontext)
cursor_draw_point_screen_space(pcontext->pos,
pcontext->region,
ss->pose_ik_chain_preview->segments[i].initial_orig,
- pcontext->vc.obact->obmat,
+ pcontext->vc.obact->object_to_world,
3);
}
}
@@ -1526,7 +1526,7 @@ static void paint_cursor_preview_boundary_data_pivot_draw(PaintCursorContext *pc
pcontext->pos,
pcontext->region,
SCULPT_vertex_co_get(pcontext->ss, pcontext->ss->boundary_preview->pivot_vertex),
- pcontext->vc.obact->obmat,
+ pcontext->vc.obact->object_to_world,
3);
}
@@ -1634,7 +1634,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
pcontext->pos,
pcontext->region,
SCULPT_vertex_co_get(pcontext->ss, pcontext->ss->expand_cache->initial_active_vertex),
- pcontext->vc.obact->obmat,
+ pcontext->vc.obact->object_to_world,
2);
}
@@ -1656,7 +1656,7 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext *
NULL);
GPU_matrix_push();
- GPU_matrix_mul(pcontext->vc.obact->obmat);
+ GPU_matrix_mul(pcontext->vc.obact->object_to_world);
/* Drawing Cursor overlays in 3D object space. */
if (is_brush_tool && brush->sculpt_tool == SCULPT_TOOL_GRAB &&
@@ -1747,7 +1747,7 @@ static void paint_cursor_cursor_draw_3d_view_brush_cursor_active(PaintCursorCont
NULL,
NULL);
GPU_matrix_push();
- GPU_matrix_mul(pcontext->vc.obact->obmat);
+ GPU_matrix_mul(pcontext->vc.obact->object_to_world);
/* Draw the special active cursors different tools may have. */
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 22d6626ab16..26f76d46f85 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -44,7 +44,7 @@ bool paint_curve_poll(bContext *C)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
SpaceImage *sima;
- if (rv3d && !(ob && ((ob->mode & OB_MODE_ALL_PAINT) != 0))) {
+ if (rv3d && !(ob && ((ob->mode & (OB_MODE_ALL_PAINT | OB_MODE_SCULPT_CURVES)) != 0))) {
return false;
}
@@ -676,6 +676,9 @@ static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op))
case PAINT_MODE_SCULPT:
name = "SCULPT_OT_brush_stroke";
break;
+ case PAINT_MODE_SCULPT_CURVES:
+ name = "SCULPT_CURVES_OT_brush_stroke";
+ break;
default:
return OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index d9aa11a2847..ea33449f0dd 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -3684,7 +3684,7 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
ps->viewDir[1] = 0.0f;
ps->viewDir[2] = 1.0f;
- copy_m4_m4(ps->obmat, ps->ob->obmat);
+ copy_m4_m4(ps->obmat, ps->ob->object_to_world);
if (symmetry_flag) {
int i;
@@ -3742,7 +3742,7 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
CameraParams params;
/* viewmat & viewinv */
- copy_m4_m4(viewinv, cam_ob_eval->obmat);
+ copy_m4_m4(viewinv, cam_ob_eval->object_to_world);
normalize_m4(viewinv);
invert_m4_m4(viewmat, viewinv);
@@ -4462,7 +4462,7 @@ static void project_paint_begin(const bContext *C,
if (ps->source == PROJ_SRC_VIEW) {
/* faster clipping lookups */
- ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat);
+ ED_view3d_clipping_local(ps->rv3d, ps->ob->object_to_world);
}
ps->do_face_sel = ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) != 0);
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 571ebd79764..ce7db91571c 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -348,7 +348,7 @@ static void sculpt_gesture_context_init_common(bContext *C,
copy_m3_m4(mat, sgcontext->vc.rv3d->viewinv);
mul_m3_v3(mat, view_dir);
normalize_v3_v3(sgcontext->world_space_view_normal, view_dir);
- copy_m3_m4(mat, ob->imat);
+ copy_m3_m4(mat, ob->world_to_object);
mul_m3_v3(mat, view_dir);
normalize_v3_v3(sgcontext->true_view_normal, view_dir);
@@ -460,12 +460,12 @@ static void sculpt_gesture_line_plane_from_tri(float *r_plane,
{
float normal[3];
normal_tri_v3(normal, p1, p2, p3);
- mul_v3_mat3_m4v3(normal, sgcontext->vc.obact->imat, normal);
+ mul_v3_mat3_m4v3(normal, sgcontext->vc.obact->world_to_object, normal);
if (flip) {
mul_v3_fl(normal, -1.0f);
}
float plane_point_object_space[3];
- mul_v3_m4v3(plane_point_object_space, sgcontext->vc.obact->imat, p1);
+ mul_v3_m4v3(plane_point_object_space, sgcontext->vc.obact->world_to_object, p1);
plane_from_point_normal_v3(r_plane, plane_point_object_space, normal);
}
@@ -1009,11 +1009,12 @@ static void sculpt_gesture_trim_shape_origin_normal_get(SculptGestureContext *sg
copy_v3_v3(r_normal, sgcontext->world_space_view_normal);
break;
case SCULPT_GESTURE_TRIM_ORIENTATION_SURFACE:
- mul_v3_m4v3(r_origin, sgcontext->vc.obact->obmat, sgcontext->ss->gesture_initial_location);
+ mul_v3_m4v3(
+ r_origin, sgcontext->vc.obact->object_to_world, sgcontext->ss->gesture_initial_location);
/* Transforming the normal does not take non uniform scaling into account. Sculpt mode is not
* expected to work on object with non uniform scaling. */
copy_v3_v3(r_normal, sgcontext->ss->gesture_initial_normal);
- mul_mat3_m4_v3(sgcontext->vc.obact->obmat, r_normal);
+ mul_mat3_m4_v3(sgcontext->vc.obact->object_to_world, r_normal);
break;
}
}
@@ -1044,7 +1045,7 @@ static void sculpt_gesture_trim_calculate_depth(SculptGestureContext *sgcontext)
* mesh, coordinates are first calculated in world space, then converted to object space to
* store them. */
float world_space_vco[3];
- mul_v3_m4v3(world_space_vco, vc->obact->obmat, vco);
+ mul_v3_m4v3(world_space_vco, vc->obact->object_to_world, vco);
const float dist = dist_signed_to_plane_v3(world_space_vco, shape_plane);
trim_operation->depth_front = min_ff(dist, trim_operation->depth_front);
trim_operation->depth_back = max_ff(dist, trim_operation->depth_back);
@@ -1052,8 +1053,9 @@ static void sculpt_gesture_trim_calculate_depth(SculptGestureContext *sgcontext)
if (trim_operation->use_cursor_depth) {
float world_space_gesture_initial_location[3];
- mul_v3_m4v3(
- world_space_gesture_initial_location, vc->obact->obmat, ss->gesture_initial_location);
+ mul_v3_m4v3(world_space_gesture_initial_location,
+ vc->obact->object_to_world,
+ ss->gesture_initial_location);
float mid_point_depth;
if (trim_operation->orientation == SCULPT_GESTURE_TRIM_ORIENTATION_VIEW) {
@@ -1132,7 +1134,7 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
sculpt_gesture_trim_shape_origin_normal_get(sgcontext, shape_origin, shape_normal);
plane_from_point_normal_v3(shape_plane, shape_origin, shape_normal);
- const float(*ob_imat)[4] = vc->obact->imat;
+ const float(*ob_imat)[4] = vc->obact->world_to_object;
/* Write vertices coordinates for the front face. */
MVert *verts = BKE_mesh_verts_for_write(trim_operation->mesh);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index bc4c6dc4148..97f5bd77d47 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -564,7 +564,7 @@ static void paint_brush_stroke_add_step(
if (SCULPT_stroke_get_location(
C, world_space_position, stroke->last_mouse_position, stroke->original)) {
copy_v3_v3(stroke->last_world_space_position, world_space_position);
- mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
+ mul_m4_v3(stroke->vc.obact->object_to_world, stroke->last_world_space_position);
}
else {
add_v3_v3(stroke->last_world_space_position, stroke->last_scene_spacing_delta);
@@ -681,8 +681,9 @@ static float paint_space_stroke_spacing(bContext *C,
if (paint_stroke_use_scene_spacing(brush, mode)) {
if (!BKE_brush_use_locked_size(scene, brush)) {
float last_object_space_position[3];
- mul_v3_m4v3(
- last_object_space_position, stroke->vc.obact->imat, stroke->last_world_space_position);
+ mul_v3_m4v3(last_object_space_position,
+ stroke->vc.obact->world_to_object,
+ stroke->last_world_space_position);
size_clamp = paint_calc_object_space_radius(&stroke->vc, last_object_space_position, size);
}
else {
@@ -825,7 +826,7 @@ static int paint_space_stroke(bContext *C,
if (use_scene_spacing) {
float world_space_position[3];
bool hit = SCULPT_stroke_get_location(C, world_space_position, final_mouse, stroke->original);
- mul_m4_v3(stroke->vc.obact->obmat, world_space_position);
+ mul_m4_v3(stroke->vc.obact->object_to_world, world_space_position);
if (hit && stroke->stroke_over_mesh) {
sub_v3_v3v3(d_world_space_position, world_space_position, stroke->last_world_space_position);
length = len_v3(d_world_space_position);
@@ -1216,8 +1217,8 @@ static void paint_line_strokes_spacing(bContext *C,
C, world_space_position_old, old_pos, stroke->original);
bool hit_new = SCULPT_stroke_get_location(
C, world_space_position_new, new_pos, stroke->original);
- mul_m4_v3(stroke->vc.obact->obmat, world_space_position_old);
- mul_m4_v3(stroke->vc.obact->obmat, world_space_position_new);
+ mul_m4_v3(stroke->vc.obact->object_to_world, world_space_position_old);
+ mul_m4_v3(stroke->vc.obact->object_to_world, world_space_position_new);
if (hit_old && hit_new && stroke->stroke_over_mesh) {
sub_v3_v3v3(d_world_space_position, world_space_position_new, world_space_position_old);
length = len_v3(d_world_space_position);
@@ -1360,7 +1361,7 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
if (paint_stroke_use_scene_spacing(br, BKE_paintmode_get_active_from_context(C))) {
stroke->stroke_over_mesh = SCULPT_stroke_get_location(
C, stroke->last_world_space_position, data + 2 * j, stroke->original);
- mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
+ mul_m4_v3(stroke->vc.obact->object_to_world, stroke->last_world_space_position);
}
stroke->stroke_started = stroke->test_start(C, op, stroke->last_mouse_position);
@@ -1492,7 +1493,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
if (paint_stroke_use_scene_spacing(br, mode)) {
stroke->stroke_over_mesh = SCULPT_stroke_get_location(
C, stroke->last_world_space_position, sample_average.mouse, stroke->original);
- mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
+ mul_m4_v3(stroke->vc.obact->object_to_world, stroke->last_world_space_position);
}
stroke->stroke_started = stroke->test_start(C, op, sample_average.mouse);
BLI_assert((stroke->stroke_started & ~1) == 0); /* 0/1 */
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index ce4a5151a20..f87ca073c82 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -135,12 +135,12 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3], flo
float delta[3], scale, loc[3];
const float xy_delta[2] = {pixel_radius, 0.0f};
- mul_v3_m4v3(loc, ob->obmat, center);
+ mul_v3_m4v3(loc, ob->object_to_world, center);
const float zfac = ED_view3d_calc_zfac(vc->rv3d, loc);
ED_view3d_win_to_delta(vc->region, xy_delta, zfac, delta);
- scale = fabsf(mat4_to_scale(ob->obmat));
+ scale = fabsf(mat4_to_scale(ob->object_to_world));
scale = (scale == 0.0f) ? 1.0f : scale;
return len_v3(delta) / scale;
@@ -297,7 +297,7 @@ static void imapaint_pick_uv(
GPU_matrix_model_view_get(matrix);
GPU_matrix_projection_get(proj);
view[0] = view[1] = 0;
- mul_m4_m4m4(matrix, matrix, ob_eval->obmat);
+ mul_m4_m4m4(matrix, matrix, ob_eval->object_to_world);
mul_m4_m4m4(matrix, proj, matrix);
minabsw = 1e10;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc
index acd8b1a6bb1..8e790ac435e 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex.cc
@@ -1647,10 +1647,10 @@ static void vwpaint_update_cache_invariants(
/* cache projection matrix */
ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat);
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
copy_m3_m4(mat, cache->vc->rv3d->viewinv);
mul_m3_v3(mat, view_dir);
- copy_m3_m4(mat, ob->imat);
+ copy_m3_m4(mat, ob->world_to_object);
mul_m3_v3(mat, view_dir);
normalize_v3_v3(cache->true_view_normal, view_dir);
@@ -2518,7 +2518,7 @@ static void wpaint_stroke_update_step(bContext *C,
ED_view3d_init_mats_rv3d(ob, vc->rv3d);
/* load projection matrix */
- mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
+ mul_m4_m4m4(mat, vc->rv3d->persmat, ob->object_to_world);
Mesh *mesh = static_cast<Mesh *>(ob->data);
@@ -2556,7 +2556,7 @@ static void wpaint_stroke_update_step(bContext *C,
/* Calculate pivot for rotation around selection if needed.
* also needed for "Frame Selected" on last stroke. */
float loc_world[3];
- mul_v3_m4v3(loc_world, ob->obmat, ss->cache->true_location);
+ mul_v3_m4v3(loc_world, ob->object_to_world, ss->cache->true_location);
paint_last_stroke_update(scene, loc_world);
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
@@ -3847,7 +3847,7 @@ static void vpaint_stroke_update_step_intern(bContext *C, PaintStroke *stroke, P
ED_view3d_init_mats_rv3d(ob, vc->rv3d);
/* load projection matrix */
- mul_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
+ mul_m4_m4m4(mat, vc->rv3d->persmat, ob->object_to_world);
swap_m4m4(vc->rv3d->persmat, mat);
@@ -3870,7 +3870,7 @@ static void vpaint_stroke_update_step_intern(bContext *C, PaintStroke *stroke, P
/* Calculate pivot for rotation around selection if needed.
* also needed for "Frame Selected" on last stroke. */
float loc_world[3];
- mul_v3_m4v3(loc_world, ob->obmat, ss->cache->true_location);
+ mul_v3_m4v3(loc_world, ob->object_to_world, ss->cache->true_location);
paint_last_stroke_update(scene, loc_world);
ED_region_tag_redraw(vc->region);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 95192114429..3477285814e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1121,8 +1121,8 @@ void SCULPT_tag_update_overlays(bContext *C)
DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
- View3D *v3d = CTX_wm_view3d(C);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ if (!BKE_sculptsession_use_pbvh_draw(ob, rv3d)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
}
@@ -2773,14 +2773,14 @@ static void calc_local_y(ViewContext *vc, const float center[3], float y[3])
float loc[3];
const float xy_delta[2] = {0.0f, 1.0f};
- mul_v3_m4v3(loc, ob->imat, center);
+ mul_v3_m4v3(loc, ob->world_to_object, center);
const float zfac = ED_view3d_calc_zfac(vc->rv3d, loc);
ED_view3d_win_to_delta(vc->region, xy_delta, zfac, y);
normalize_v3(y);
add_v3_v3(y, ob->loc);
- mul_m4_v3(ob->imat, y);
+ mul_m4_v3(ob->world_to_object, y);
}
static void calc_brush_local_mat(const Brush *brush, Object *ob, float local_mat[4][4])
@@ -2792,8 +2792,8 @@ static void calc_brush_local_mat(const Brush *brush, Object *ob, float local_mat
float angle, v[3];
float up[3];
- /* Ensure `ob->imat` is up to date. */
- invert_m4_m4(ob->imat, ob->obmat);
+ /* Ensure `ob->world_to_object` is up to date. */
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
/* Initialize last column of matrix. */
mat[0][3] = 0.0f;
@@ -2833,13 +2833,13 @@ void SCULPT_tilt_apply_to_normal(float r_normal[3], StrokeCache *cache, const fl
return;
}
const float rot_max = M_PI_2 * tilt_strength * SCULPT_TILT_SENSITIVITY;
- mul_v3_mat3_m4v3(r_normal, cache->vc->obact->obmat, r_normal);
+ mul_v3_mat3_m4v3(r_normal, cache->vc->obact->object_to_world, r_normal);
float normal_tilt_y[3];
rotate_v3_v3v3fl(normal_tilt_y, r_normal, cache->vc->rv3d->viewinv[0], cache->y_tilt * rot_max);
float normal_tilt_xy[3];
rotate_v3_v3v3fl(
normal_tilt_xy, normal_tilt_y, cache->vc->rv3d->viewinv[1], cache->x_tilt * rot_max);
- mul_v3_mat3_m4v3(r_normal, cache->vc->obact->imat, normal_tilt_xy);
+ mul_v3_mat3_m4v3(r_normal, cache->vc->obact->world_to_object, normal_tilt_xy);
normalize_v3(r_normal);
}
@@ -3284,7 +3284,7 @@ static void sculpt_topology_update(Sculpt *sd,
/* Update average stroke position. */
copy_v3_v3(location, ss->cache->true_location);
- mul_m4_v3(ob->obmat, location);
+ mul_m4_v3(ob->object_to_world, location);
}
static void do_brush_action_task_cb(void *__restrict userdata,
@@ -3615,7 +3615,7 @@ static void do_brush_action(Sculpt *sd,
/* Update average stroke position. */
copy_v3_v3(location, ss->cache->true_location);
- mul_m4_v3(ob->obmat, location);
+ mul_m4_v3(ob->object_to_world, location);
add_v3_v3(ups->average_stroke_accum, location);
ups->average_stroke_counter++;
@@ -4201,8 +4201,8 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
/* Store matrix for mirror object clipping. */
if (mmd->mirror_ob) {
float imtx_mirror_ob[4][4];
- invert_m4_m4(imtx_mirror_ob, mmd->mirror_ob->obmat);
- mul_m4_m4m4(ss->cache->clip_mirror_mtx, imtx_mirror_ob, ob->obmat);
+ invert_m4_m4(imtx_mirror_ob, mmd->mirror_ob->object_to_world);
+ mul_m4_m4m4(ss->cache->clip_mirror_mtx, imtx_mirror_ob, ob->object_to_world);
}
}
}
@@ -4354,10 +4354,10 @@ static void sculpt_update_cache_invariants(
/* Cache projection matrix. */
ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat);
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
copy_m3_m4(mat, cache->vc->rv3d->viewinv);
mul_m3_v3(mat, viewDir);
- copy_m3_m4(mat, ob->imat);
+ copy_m3_m4(mat, ob->world_to_object);
mul_m3_v3(mat, viewDir);
normalize_v3_v3(cache->true_view_normal, viewDir);
@@ -4373,7 +4373,7 @@ static void sculpt_update_cache_invariants(
if (sd->gravity_object) {
Object *gravity_object = sd->gravity_object;
- copy_v3_v3(cache->true_gravity_direction, gravity_object->obmat[2]);
+ copy_v3_v3(cache->true_gravity_direction, gravity_object->object_to_world[2]);
}
else {
cache->true_gravity_direction[0] = cache->true_gravity_direction[1] = 0.0f;
@@ -4527,27 +4527,27 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
}
/* Compute 3d coordinate at same z from original location + mval. */
- mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location);
+ mul_v3_m4v3(loc, ob->object_to_world, cache->orig_grab_location);
ED_view3d_win_to_3d(cache->vc->v3d, cache->vc->region, loc, mval, grab_location);
/* Compute delta to move verts by. */
if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) {
if (sculpt_needs_delta_from_anchored_origin(brush)) {
sub_v3_v3v3(delta, grab_location, cache->old_grab_location);
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
mul_mat3_m4_v3(imat, delta);
add_v3_v3(cache->grab_delta, delta);
}
else if (sculpt_needs_delta_for_tip_orientation(brush)) {
if (brush->flag & BRUSH_ANCHORED) {
float orig[3];
- mul_v3_m4v3(orig, ob->obmat, cache->orig_grab_location);
+ mul_v3_m4v3(orig, ob->object_to_world, cache->orig_grab_location);
sub_v3_v3v3(cache->grab_delta, grab_location, orig);
}
else {
sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
}
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
mul_mat3_m4_v3(imat, cache->grab_delta);
}
else {
@@ -4592,7 +4592,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
/* Handle 'rake' */
cache->is_rake_rotation_valid = false;
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
mul_mat3_m4_v3(imat, grab_location);
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) {
@@ -4813,12 +4813,12 @@ static bool sculpt_needs_connectivity_info(const Sculpt *sd,
void SCULPT_stroke_modifiers_check(const bContext *C, Object *ob, const Brush *brush)
{
SculptSession *ss = ob->sculpt;
- View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
bool need_pmap = sculpt_needs_connectivity_info(sd, brush, ss, 0);
if (ss->shapekey_active || ss->deform_modifiers_active ||
- (!BKE_sculptsession_use_pbvh_draw(ob, v3d) && need_pmap)) {
+ (!BKE_sculptsession_use_pbvh_draw(ob, rv3d) && need_pmap)) {
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
BKE_sculpt_update_object_for_edit(
depsgraph, ob, need_pmap, false, SCULPT_tool_is_paint(brush->sculpt_tool));
@@ -4913,7 +4913,7 @@ float SCULPT_raycast_init(ViewContext *vc,
ED_view3d_win_to_segment_clipped(
vc->depsgraph, vc->region, vc->v3d, mval, ray_start, ray_end, true);
- invert_m4_m4(obimat, ob->obmat);
+ invert_m4_m4(obimat, ob->object_to_world);
mul_m4_v3(obimat, ray_start);
mul_m4_v3(obimat, ray_end);
@@ -5021,10 +5021,10 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
float radius;
/* Update cursor data in SculptSession. */
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
copy_m3_m4(mat, vc.rv3d->viewinv);
mul_m3_v3(mat, viewDir);
- copy_m3_m4(mat, ob->imat);
+ copy_m3_m4(mat, ob->world_to_object);
mul_m3_v3(mat, viewDir);
normalize_v3_v3(ss->cursor_view_normal, viewDir);
copy_v3_v3(ss->cursor_normal, srd.face_normal);
@@ -5249,7 +5249,6 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
SculptSession *ss = ob->sculpt;
ARegion *region = CTX_wm_region(C);
MultiresModifierData *mmd = ss->multires.modifier;
- View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
@@ -5274,7 +5273,7 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
/* Only current viewport matters, slower update for all viewports will
* be done in sculpt_flush_update_done. */
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
+ if (!BKE_sculptsession_use_pbvh_draw(ob, rv3d)) {
/* Slow update with full dependency graph update and all that comes with it.
* Needed when there are modifiers or full shading in the 3D viewport. */
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
@@ -5316,16 +5315,15 @@ void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType up
/* After we are done drawing the stroke, check if we need to do a more
* expensive depsgraph tag to update geometry. */
wmWindowManager *wm = CTX_wm_manager(C);
- View3D *current_v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ RegionView3D *current_rv3d = CTX_wm_region_view3d(C);
SculptSession *ss = ob->sculpt;
Mesh *mesh = ob->data;
/* Always needed for linked duplicates. */
bool need_tag = (ID_REAL_USERS(&mesh->id) > 1);
- if (rv3d) {
- rv3d->rflag &= ~RV3D_PAINTING;
+ if (current_rv3d) {
+ current_rv3d->rflag &= ~RV3D_PAINTING;
}
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
@@ -5335,16 +5333,17 @@ void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType up
if (sl->spacetype != SPACE_VIEW3D) {
continue;
}
- View3D *v3d = (View3D *)sl;
- if (v3d != current_v3d) {
- need_tag |= !BKE_sculptsession_use_pbvh_draw(ob, v3d);
- }
/* Tag all 3D viewports for redraw now that we are done. Others
* viewports did not get a full redraw, and anti-aliasing for the
* current viewport was deactivated. */
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
+ if (rv3d != current_rv3d) {
+ need_tag |= !BKE_sculptsession_use_pbvh_draw(ob, rv3d);
+ }
+
ED_region_tag_redraw(region);
}
}
@@ -5378,15 +5377,17 @@ void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType up
BKE_sculpt_attributes_destroy_temporary_stroke(ob);
- if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
- BKE_pbvh_bmesh_after_stroke(ss->pbvh);
- }
+ if (update_flags & SCULPT_UPDATE_COORDS) {
+ if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
+ BKE_pbvh_bmesh_after_stroke(ss->pbvh);
+ }
- /* Optimization: if there is locked key and active modifiers present in */
- /* the stack, keyblock is updating at each step. otherwise we could update */
- /* keyblock only when stroke is finished. */
- if (ss->shapekey_active && !ss->deform_modifiers_active) {
- sculpt_update_keyblock(ob);
+ /* Optimization: if there is locked key and active modifiers present in */
+ /* the stack, keyblock is updating at each step. otherwise we could update */
+ /* keyblock only when stroke is finished. */
+ if (ss->shapekey_active && !ss->deform_modifiers_active) {
+ sculpt_update_keyblock(ob);
+ }
}
if (need_tag) {
@@ -5511,7 +5512,8 @@ static void sculpt_stroke_update_step(bContext *C,
sculpt_restore_mesh(sd, ob);
if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL)) {
- float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ float object_space_constant_detail = 1.0f / (sd->constant_detail *
+ mat4_to_scale(ob->object_to_world));
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
}
else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
@@ -5625,6 +5627,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
}
else {
BKE_sculpt_attributes_destroy_temporary_stroke(ob);
+ SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COLOR);
}
}
else {
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index b6bb4c185f9..cf7e1d027f7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -667,15 +667,15 @@ static void cloth_brush_solve_collision(Object *object,
BVHTreeRayHit hit;
float obmat_inv[4][4];
- invert_m4_m4(obmat_inv, object->obmat);
+ invert_m4_m4(obmat_inv, object->object_to_world);
for (collider_cache = cloth_sim->collider_list->first; collider_cache;
collider_cache = collider_cache->next) {
float ray_start[3], ray_normal[3];
float pos_world_space[3], prev_pos_world_space[3];
- mul_v3_m4v3(pos_world_space, object->obmat, cloth_sim->pos[i]);
- mul_v3_m4v3(prev_pos_world_space, object->obmat, cloth_sim->last_iteration_pos[i]);
+ mul_v3_m4v3(pos_world_space, object->object_to_world, cloth_sim->pos[i]);
+ mul_v3_m4v3(prev_pos_world_space, object->object_to_world, cloth_sim->last_iteration_pos[i]);
sub_v3_v3v3(ray_normal, pos_world_space, prev_pos_world_space);
copy_v3_v3(ray_start, prev_pos_world_space);
hit.index = -1;
@@ -1419,7 +1419,7 @@ static void cloth_filter_apply_forces_task_cb(void *__restrict userdata,
float sculpt_gravity[3] = {0.0f};
if (sd->gravity_object) {
- copy_v3_v3(sculpt_gravity, sd->gravity_object->obmat[2]);
+ copy_v3_v3(sculpt_gravity, sd->gravity_object->object_to_world[2]);
}
else {
sculpt_gravity[2] = -1.0f;
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c
index 6dd718d6a0c..0e46fd50f3b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_paint/sculpt_detail.c
@@ -102,7 +102,8 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op)
size = max_fff(dim[0], dim[1], dim[2]);
/* Update topology size. */
- float object_space_constant_detail = 1.0f / (sd->constant_detail * mat4_to_scale(ob->obmat));
+ float object_space_constant_detail = 1.0f /
+ (sd->constant_detail * mat4_to_scale(ob->object_to_world));
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
SCULPT_undo_push_begin(ob, op);
@@ -223,7 +224,7 @@ static void sample_detail_dyntopo(bContext *C, ViewContext *vc, const int mval[2
if (srd.hit && srd.edge_length > 0.0f) {
/* Convert edge length to world space detail resolution. */
- sd->constant_detail = 1 / (srd.edge_length * mat4_to_scale(ob->obmat));
+ sd->constant_detail = 1 / (srd.edge_length * mat4_to_scale(ob->object_to_world));
}
}
@@ -473,8 +474,8 @@ static void dyntopo_detail_size_parallel_lines_draw(uint pos3d,
bool flip,
const float angle)
{
- float object_space_constant_detail = 1.0f /
- (cd->detail_size * mat4_to_scale(cd->active_object->obmat));
+ float object_space_constant_detail = 1.0f / (cd->detail_size *
+ mat4_to_scale(cd->active_object->object_to_world));
/* The constant detail represents the maximum edge length allowed before subdividing it. If the
* triangle grid preview is created with this value it will represent an ideal mesh density where
@@ -592,7 +593,8 @@ static void dyntopo_detail_size_sample_from_surface(Object *ob,
if (num_neighbors > 0) {
const float avg_edge_len = len_accum / num_neighbors;
/* Use 0.7 as the average of min and max dyntopo edge length. */
- const float detail_size = 0.7f / (avg_edge_len * mat4_to_scale(cd->active_object->obmat));
+ const float detail_size = 0.7f /
+ (avg_edge_len * mat4_to_scale(cd->active_object->object_to_world));
cd->detail_size = clamp_f(detail_size, 1.0f, 500.0f);
}
}
@@ -716,7 +718,7 @@ static int dyntopo_detail_size_edit_invoke(bContext *C, wmOperator *op, const wm
float cursor_trans[4][4], cursor_rot[4][4];
const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
float quat[4];
- copy_m4_m4(cursor_trans, active_object->obmat);
+ copy_m4_m4(cursor_trans, active_object->object_to_world);
translate_m4(
cursor_trans, ss->cursor_location[0], ss->cursor_location[1], ss->cursor_location[2]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
index 8fb4dea668e..40835172be9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
@@ -917,7 +917,7 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op)
UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
float location[3];
copy_v3_v3(location, SCULPT_active_vertex_co_get(ss));
- mul_m4_v3(ob->obmat, location);
+ mul_m4_v3(ob->object_to_world, location);
copy_v3_v3(ups->average_stroke_accum, location);
ups->average_stroke_counter = 1;
ups->last_stroke_valid = true;
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index 1fa53eaa006..c158cf33f6d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -146,8 +146,8 @@ void SCULPT_filter_cache_init(bContext *C,
0, ss->filter_cache->totnode, &data, filter_cache_init_task_cb, &settings);
/* Setup orientation matrices. */
- copy_m4_m4(ss->filter_cache->obmat, ob->obmat);
- invert_m4_m4(ss->filter_cache->obmat_inv, ob->obmat);
+ copy_m4_m4(ss->filter_cache->obmat, ob->object_to_world);
+ invert_m4_m4(ss->filter_cache->obmat_inv, ob->object_to_world);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewContext vc;
@@ -203,7 +203,7 @@ void SCULPT_filter_cache_init(bContext *C,
/* Update last stroke location */
- mul_m4_v3(ob->obmat, co);
+ mul_m4_v3(ob->object_to_world, co);
add_v3_v3(ups->average_stroke_accum, co);
ups->average_stroke_counter++;
@@ -221,10 +221,10 @@ void SCULPT_filter_cache_init(bContext *C,
ED_view3d_ob_project_mat_get(vc.rv3d, ob, projection_mat);
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
copy_m3_m4(mat, vc.rv3d->viewinv);
mul_m3_v3(mat, viewDir);
- copy_m3_m4(mat, ob->imat);
+ copy_m3_m4(mat, ob->world_to_object);
mul_m3_v3(mat, viewDir);
normalize_v3_v3(ss->filter_cache->view_normal, viewDir);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index a740ec2773b..8affb0e9d53 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -323,7 +323,7 @@ void ED_object_sculptmode_enter_ex(Main *bmain,
BKE_report(
reports, RPT_WARNING, "Object has non-uniform scale, sculpting may be unpredictable");
}
- else if (is_negative_m4(ob->obmat)) {
+ else if (is_negative_m4(ob->object_to_world)) {
BKE_report(reports, RPT_WARNING, "Object has negative scale, sculpting may be unpredictable");
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 13e3dd64521..eb92c865f18 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -857,7 +857,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
BKE_view_layer_synced_ensure(scene, view_layer);
Object *ob = BKE_view_layer_active_object_get(view_layer);
SculptSession *ss = ob->sculpt;
@@ -911,7 +911,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
}
DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
+ if (!BKE_sculptsession_use_pbvh_draw(ob, rv3d)) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
@@ -1070,7 +1070,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
}
}
- tag_update |= ID_REAL_USERS(ob->data) > 1 || !BKE_sculptsession_use_pbvh_draw(ob, v3d) ||
+ tag_update |= ID_REAL_USERS(ob->data) > 1 || !BKE_sculptsession_use_pbvh_draw(ob, rv3d) ||
ss->shapekey_active || ss->deform_modifiers_active;
if (tag_update) {
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index eb56c6c4b54..343975919e2 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -104,7 +104,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
UI_block_draw(C, block);
}
- /* free tempolary channels */
+ /* Free temporary channels. */
ANIM_animdata_freelist(&anim_data);
}
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index a9ce9a3d723..9c8d46a41f9 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -41,7 +41,7 @@
/* -------------------------------------------------------------------- */
/** \name Start / Clear Search Filter Operators
*
- * \note Almost a duplicate of the file browser operator #FILE_OT_start_filter.
+ * \note Almost a duplicate of the file browser operator #FILE_OT_start_filter.
* \{ */
static int buttons_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
@@ -205,7 +205,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
if (BLI_is_dir(path)) {
/* Do this first so '//' isn't converted to '//\' on windows. */
- BLI_path_slash_ensure(path);
+ BLI_path_slash_ensure(path, sizeof(path));
if (is_relative) {
BLI_path_rel(path, BKE_main_blendfile_path(bmain));
str_len = strlen(path);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 9a690f36aab..10a037a1c3c 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -676,8 +676,8 @@ typedef struct PrefetchQueue {
SpinLock spin;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
} PrefetchQueue;
@@ -819,7 +819,7 @@ static uchar *prefetch_thread_next_frame(PrefetchQueue *queue,
(queue->initial_frame - queue->current_frame);
}
- *queue->do_update = 1;
+ *queue->do_update = true;
*queue->progress = (float)frames_processed / (queue->end_frame - queue->start_frame);
}
}
@@ -868,7 +868,7 @@ static void prefetch_task_func(TaskPool *__restrict pool, void *task_data)
if (!result) {
/* no more space in the cache, stop reading frames */
- *queue->stop = 1;
+ *queue->stop = true;
break;
}
}
@@ -880,8 +880,8 @@ static void start_prefetch_threads(MovieClip *clip,
int end_frame,
short render_size,
short render_flag,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
int tot_thread = BLI_task_scheduler_num_threads();
@@ -918,7 +918,7 @@ static bool prefetch_movie_frame(MovieClip *clip,
int frame,
short render_size,
short render_flag,
- short *stop)
+ bool *stop)
{
MovieClipUser user = *DNA_struct_default_get(MovieClipUser);
@@ -940,14 +940,14 @@ static bool prefetch_movie_frame(MovieClip *clip,
if (!result) {
/* no more space in the cache, we could stop prefetching here */
- *stop = 1;
+ *stop = true;
}
IMB_freeImBuf(ibuf);
}
else {
/* error reading frame, fair enough stop attempting further reading */
- *stop = 1;
+ *stop = true;
}
}
@@ -961,8 +961,8 @@ static void do_prefetch_movie(MovieClip *clip,
int end_frame,
short render_size,
short render_flag,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
int frame;
@@ -976,7 +976,7 @@ static void do_prefetch_movie(MovieClip *clip,
frames_processed++;
- *do_update = 1;
+ *do_update = true;
*progress = (float)frames_processed / (end_frame - start_frame);
}
@@ -988,12 +988,12 @@ static void do_prefetch_movie(MovieClip *clip,
frames_processed++;
- *do_update = 1;
+ *do_update = true;
*progress = (float)frames_processed / (end_frame - start_frame);
}
}
-static void prefetch_startjob(void *pjv, short *stop, short *do_update, float *progress)
+static void prefetch_startjob(void *pjv, bool *stop, bool *do_update, float *progress)
{
PrefetchJob *pj = pjv;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 486f9f9ccb0..2c0668625a0 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1219,8 +1219,8 @@ static void do_movie_proxy(void *pjv,
int UNUSED(build_count),
int *build_undistort_sizes,
int build_undistort_count,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ProxyJob *pj = pjv;
@@ -1285,8 +1285,8 @@ typedef struct ProxyQueue {
int efra;
SpinLock spin;
- const short *stop;
- short *do_update;
+ const bool *stop;
+ bool *do_update;
float *progress;
} ProxyQueue;
@@ -1343,7 +1343,7 @@ static uchar *proxy_thread_next_frame(ProxyQueue *queue,
queue->cfra++;
close(file);
- *queue->do_update = 1;
+ *queue->do_update = true;
*queue->progress = (float)(queue->cfra - queue->sfra) / (queue->efra - queue->sfra);
}
BLI_spin_unlock(&queue->spin);
@@ -1392,8 +1392,8 @@ static void do_sequence_proxy(void *pjv,
int build_undistort_count,
/* Cannot be const, because it is assigned to a non-const variable.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ProxyJob *pj = pjv;
@@ -1452,7 +1452,7 @@ static void do_sequence_proxy(void *pjv,
MEM_freeN(handles);
}
-static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
+static void proxy_startjob(void *pjv, bool *stop, bool *do_update, float *progress)
{
ProxyJob *pj = pjv;
MovieClip *clip = pj->clip;
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index bfa45053e96..ddfcaa282e3 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -87,7 +87,7 @@ static void solve_camera_updatejob(void *scv)
BLI_strncpy(tracking->stats->message, scj->stats_message, sizeof(tracking->stats->message));
}
-static void solve_camera_startjob(void *scv, short *stop, short *do_update, float *progress)
+static void solve_camera_startjob(void *scv, bool *stop, bool *do_update, float *progress)
{
SolveCameraJob *scj = (SolveCameraJob *)scv;
BKE_tracking_reconstruction_solve(
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index f6fd2980c19..2753af609e7 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -204,8 +204,8 @@ static void track_markers_startjob(
void *tmv,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
@@ -353,7 +353,7 @@ static int track_markers(bContext *C, wmOperator *op, bool use_job)
return OPERATOR_RUNNING_MODAL;
}
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
track_markers_startjob(tmj, &stop, &do_update, &progress);
track_markers_endjob(tmj);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index a4d4bf98474..f68d329329f 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -197,13 +197,12 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
}
else if (file->redirection_path) {
BLI_strncpy(params->dir, file->redirection_path, sizeof(params->dir));
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
- BLI_path_slash_ensure(params->dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir, sizeof(params->dir));
+ BLI_path_slash_ensure(params->dir, sizeof(params->dir));
}
else {
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
- strcat(params->dir, file->relpath);
- BLI_path_slash_ensure(params->dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir, sizeof(params->dir));
+ BLI_path_append_dir(params->dir, sizeof(params->dir), file->relpath);
}
ED_file_change_dir(C);
@@ -1095,7 +1094,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
RNA_property_string_get(op->ptr, prop, entry);
BLI_strncpy(params->dir, entry, sizeof(params->dir));
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir, sizeof(params->dir));
ED_file_change_dir(C);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
@@ -1564,7 +1563,13 @@ void file_sfile_to_operator_ex(
PropertyRNA *prop;
/* XXX, not real length */
- BLI_path_join(filepath, FILE_MAX, params->dir, params->file);
+ if (params->file[0]) {
+ BLI_path_join(filepath, FILE_MAX, params->dir, params->file);
+ }
+ else {
+ BLI_strncpy(filepath, params->dir, FILE_MAX);
+ BLI_path_slash_ensure(filepath, FILE_MAX);
+ }
if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) {
if (RNA_property_boolean_get(op->ptr, prop)) {
@@ -1791,8 +1796,7 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
}
else {
BLI_path_normalize(BKE_main_blendfile_path(bmain), params->dir);
- BLI_path_append(params->dir, sizeof(params->dir) - 1, file->relpath);
- BLI_path_slash_ensure(params->dir);
+ BLI_path_append_dir(params->dir, sizeof(params->dir), file->relpath);
}
ED_file_change_dir(C);
}
@@ -1955,7 +1959,7 @@ static int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
if (params) {
if (BLI_path_parent_dir(params->dir)) {
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir, sizeof(params->dir));
ED_file_change_dir(C);
if (params->recursion_level > 1) {
/* Disable 'dirtree' recursion when going up in tree. */
@@ -2538,7 +2542,7 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
}
}
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir, sizeof(params->dir));
if (filelist_is_dir(sfile->files, params->dir)) {
if (!STREQ(params->dir, old_dir)) { /* Avoids flickering when nothing's changed. */
@@ -2625,7 +2629,7 @@ void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg
/* if directory, open it and empty filename field */
if (filelist_is_dir(sfile->files, filepath)) {
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), filepath);
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), filepath, sizeof(filepath));
BLI_strncpy(params->dir, filepath, sizeof(params->dir));
params->file[0] = '\0';
ED_file_change_dir(C);
diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc
index 9f40cf92747..4580b2e2fa8 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -31,6 +31,7 @@
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_stack.h"
+#include "BLI_string_utils.h"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
@@ -245,7 +246,7 @@ struct FileList {
bool (*check_dir_fn)(struct FileList *, char *, const bool);
/* Fill filelist (to be called by read job). */
- void (*read_job_fn)(struct FileListReadJob *, short *, short *, float *);
+ void (*read_job_fn)(struct FileListReadJob *, bool *, bool *, float *);
/* Filter an entry of current filelist. */
bool (*filter_fn)(struct FileListInternEntry *, const char *, FileListFilter *);
@@ -294,24 +295,24 @@ enum {
static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
static void filelist_readjob_main(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
static void filelist_readjob_lib(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
static void filelist_readjob_dir(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
static void filelist_readjob_asset_library(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
static void filelist_readjob_main_assets(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
/* helper, could probably go in BKE actually? */
@@ -1208,7 +1209,7 @@ static int filelist_geticon_ex(const FileDirEntry *file,
}
else if (root) {
BLI_path_join(fullpath, sizeof(fullpath), root, file->relpath);
- BLI_path_slash_ensure(fullpath);
+ BLI_path_slash_ensure(fullpath, sizeof(fullpath));
}
for (; tfsm; tfsm = tfsm->next) {
if (STREQ(tfsm->path, target)) {
@@ -1952,7 +1953,7 @@ void filelist_setdir(struct FileList *filelist, char *r_dir)
const bool allow_invalid = filelist->asset_library_ref != nullptr;
BLI_assert(strlen(r_dir) < FILE_MAX_LIBEXTRA);
- BLI_path_normalize_dir(BKE_main_blendfile_path_from_global(), r_dir);
+ BLI_path_normalize_dir(BKE_main_blendfile_path_from_global(), r_dir, FILE_MAX_LIBEXTRA);
const bool is_valid_path = filelist->check_dir_fn(filelist, r_dir, !allow_invalid);
BLI_assert(is_valid_path || allow_invalid);
UNUSED_VARS_NDEBUG(is_valid_path);
@@ -2920,7 +2921,7 @@ static int filelist_readjob_list_dir(const char *root,
if (BLI_file_alias_target(full_path, entry->redirection_path)) {
if (BLI_is_dir(entry->redirection_path)) {
entry->typeflag = FILE_TYPE_DIR;
- BLI_path_slash_ensure(entry->redirection_path);
+ BLI_path_slash_ensure(entry->redirection_path, FILE_MAXDIR);
}
else {
entry->typeflag = (eFileSel_File_Types)ED_path_extension_type(entry->redirection_path);
@@ -3400,7 +3401,7 @@ struct FileListReadJob {
static void filelist_readjob_append_entries(FileListReadJob *job_params,
ListBase *from_entries,
int from_entries_num,
- short *do_update)
+ bool *do_update)
{
BLI_assert(BLI_listbase_count(from_entries) == from_entries_num);
if (from_entries_num <= 0) {
@@ -3455,8 +3456,8 @@ static bool filelist_readjob_should_recurse_into_entry(const int max_recursion,
static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
FileListReadJob *job_params,
- const short *stop,
- short *do_update,
+ const bool *stop,
+ bool *do_update,
float *progress)
{
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3476,7 +3477,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
BLI_strncpy(dir, filelist->filelist.root, sizeof(dir));
BLI_strncpy(filter_glob, filelist->filter_data.filter_glob, sizeof(filter_glob));
- BLI_path_normalize_dir(job_params->main_name, dir);
+ BLI_path_normalize_dir(job_params->main_name, dir, sizeof(dir));
td_dir->dir = BLI_strdup(dir);
/* Init the file indexer. */
@@ -3507,7 +3508,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
* Note that in the end, this means we 'cache' valid relative subdir once here,
* this is actually better. */
BLI_strncpy(rel_subdir, subdir, sizeof(rel_subdir));
- BLI_path_normalize_dir(root, rel_subdir);
+ BLI_path_normalize_dir(root, rel_subdir, sizeof(rel_subdir));
BLI_path_rel(rel_subdir, root);
bool is_lib = false;
@@ -3542,9 +3543,10 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
LISTBASE_FOREACH (FileListInternEntry *, entry, &entries) {
entry->uid = filelist_uid_generate(filelist);
- /* When loading entries recursive, the rel_path should be relative from the root dir.
- * we combine the relative path to the subdir with the relative path of the entry. */
- BLI_path_join(dir, sizeof(dir), rel_subdir, entry->relpath);
+ /* When loading entries recursive, the `rel_path` should be relative from the root dir.
+ * we combine the relative path to the `subdir` with the relative path of the entry.
+ * Using #BLI_path_join works but isn't needed as `rel_subdir` has a trailing slash. */
+ BLI_string_join(dir, sizeof(dir), rel_subdir, entry->relpath);
MEM_freeN(entry->relpath);
entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//'
* added by BLI_path_rel to rel_subdir. */
@@ -3553,9 +3555,10 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
if (filelist_readjob_should_recurse_into_entry(
max_recursion, is_lib, recursion_level, entry)) {
- /* We have a directory we want to list, add it to todo list! */
- BLI_path_join(dir, sizeof(dir), root, entry->relpath);
- BLI_path_normalize_dir(job_params->main_name, dir);
+ /* We have a directory we want to list, add it to todo list!
+ * Using #BLI_path_join works but isn't needed as `root` has a trailing slash. */
+ BLI_string_join(dir, sizeof(dir), root, entry->relpath);
+ BLI_path_normalize_dir(job_params->main_name, dir, sizeof(dir));
td_dir = static_cast<TodoDir *>(BLI_stack_push_r(todo_dirs));
td_dir->level = recursion_level + 1;
td_dir->dir = BLI_strdup(dir);
@@ -3591,8 +3594,8 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
static void filelist_readjob_do(const bool do_lib,
FileListReadJob *job_params,
- const short *stop,
- short *do_update,
+ const bool *stop,
+ bool *do_update,
float *progress)
{
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3608,16 +3611,16 @@ static void filelist_readjob_do(const bool do_lib,
}
static void filelist_readjob_dir(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
filelist_readjob_do(false, job_params, stop, do_update, progress);
}
static void filelist_readjob_lib(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
filelist_readjob_do(true, job_params, stop, do_update, progress);
@@ -3640,7 +3643,7 @@ static void filelist_asset_library_path(const FileListReadJob *job_params,
/**
* Load asset library data, which currently means loading the asset catalogs for the library.
*/
-static void filelist_readjob_load_asset_library_data(FileListReadJob *job_params, short *do_update)
+static void filelist_readjob_load_asset_library_data(FileListReadJob *job_params, bool *do_update)
{
FileList *tmp_filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3664,8 +3667,8 @@ static void filelist_readjob_load_asset_library_data(FileListReadJob *job_params
}
static void filelist_readjob_main_assets_add_items(FileListReadJob *job_params,
- short * /*stop*/,
- short *do_update,
+ bool * /*stop*/,
+ bool *do_update,
float * /*progress*/)
{
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3726,8 +3729,8 @@ static bool filelist_contains_main(const FileList *filelist, const Main *bmain)
}
static void filelist_readjob_asset_library(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3750,8 +3753,8 @@ static void filelist_readjob_asset_library(FileListReadJob *job_params,
}
static void filelist_readjob_main(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
/* TODO! */
@@ -3759,8 +3762,8 @@ static void filelist_readjob_main(FileListReadJob *job_params,
}
static void filelist_readjob_main_assets(FileListReadJob *job_params,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
@@ -3788,7 +3791,7 @@ static bool filelist_readjob_is_partial_read(const FileListReadJob *read_job)
* some current entries are kept and we just call the readjob to update the main files (see
* #FileListReadJob.only_main_data).
*/
-static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update, float *progress)
+static void filelist_readjob_startjob(void *flrjv, bool *stop, bool *do_update, float *progress)
{
FileListReadJob *flrj = static_cast<FileListReadJob *>(flrjv);
@@ -3936,8 +3939,8 @@ void filelist_readjob_start(FileList *filelist, const int space_notifier, const
const bool no_threads = (filelist->tags & FILELIST_TAGS_NO_THREADS) || flrj->only_main_data;
if (no_threads) {
- short dummy_stop = false;
- short dummy_do_update = false;
+ bool dummy_stop = false;
+ bool dummy_do_update = false;
float dummy_progress = 0.0f;
/* Single threaded execution. Just directly call the callbacks. */
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index df7e9702e85..af2c9d4e757 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -197,7 +197,7 @@ static FileSelectParams *fileselect_ensure_updated_file_params(SpaceFile *sfile)
}
if (params->dir[0]) {
- BLI_path_normalize_dir(blendfile_path, params->dir);
+ BLI_path_normalize_dir(blendfile_path, params->dir, sizeof(params->dir));
BLI_path_abs(params->dir, blendfile_path);
}
@@ -1187,7 +1187,7 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
match = UI_autocomplete_end(autocpl, str);
if (match == AUTOCOMPLETE_FULL_MATCH) {
- BLI_path_slash_ensure(str);
+ BLI_path_slash_ensure(str, FILE_MAX);
}
}
}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index cea53908d4f..959f8b01ec8 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -1147,8 +1147,8 @@ static void fsmenu_bookmark_validate_job_startjob(
void *fsmenuv,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *UNUSED(progress))
{
FSMenu *fsmenu = fsmenuv;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 41a8368152d..f8a0dff3a41 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -1446,7 +1446,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
GPU_blend(GPU_BLEND_NONE);
}
- /* free tempolary channels */
+ /* Free temporary channels. */
ANIM_animdata_freelist(&anim_data);
}
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index f57c9fead56..45bbe50eedd 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -905,7 +905,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region)
}
}
- /* free tempolary channels */
+ /* Free temporary channels. */
ANIM_animdata_freelist(&anim_data);
}
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index d7eccbf0b68..ff9e5352d0a 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -29,6 +29,7 @@ set(INC
set(SRC
add_node_search.cc
+ add_menu_assets.cc
drawnode.cc
link_drag_search.cc
node_add.cc
diff --git a/source/blender/editors/space_node/add_menu_assets.cc b/source/blender/editors/space_node/add_menu_assets.cc
new file mode 100644
index 00000000000..1ba1d67d854
--- /dev/null
+++ b/source/blender/editors/space_node/add_menu_assets.cc
@@ -0,0 +1,314 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "BLI_multi_value_map.hh"
+
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+
+#include "BKE_asset.h"
+#include "BKE_asset_catalog.hh"
+#include "BKE_asset_library.hh"
+#include "BKE_idprop.h"
+#include "BKE_screen.h"
+
+#include "BLT_translation.h"
+
+#include "RNA_access.h"
+#include "RNA_prototypes.h"
+
+#include "ED_asset.h"
+#include "ED_screen.h"
+
+#include "node_intern.hh"
+
+namespace blender::ed::space_node {
+
+static bool node_add_menu_poll(const bContext *C, MenuType * /*mt*/)
+{
+ return CTX_wm_space_node(C);
+}
+
+static void node_add_menu_assets_listen_fn(const wmRegionListenerParams *params)
+{
+ const wmNotifier *wmn = params->notifier;
+ ARegion *region = params->region;
+
+ switch (wmn->category) {
+ case NC_ASSET:
+ if (wmn->data == ND_ASSET_LIST_READING) {
+ ED_region_tag_refresh_ui(region);
+ }
+ break;
+ }
+}
+
+struct LibraryAsset {
+ AssetLibraryReference library_ref;
+ AssetHandle handle;
+};
+
+struct LibraryCatalog {
+ bke::AssetLibrary *library;
+ const bke::AssetCatalog *catalog;
+};
+
+struct AssetItemTree {
+ bke::AssetCatalogTree catalogs;
+ MultiValueMap<bke::AssetCatalogPath, LibraryAsset> assets_per_path;
+ Map<const bke::AssetCatalogTreeItem *, bke::AssetCatalogPath> full_catalog_per_tree_item;
+};
+
+static bool all_loading_finished()
+{
+ for (const AssetLibraryReference &library : bke::all_valid_asset_library_refs()) {
+ if (!ED_assetlist_is_loaded(&library)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+static AssetItemTree build_catalog_tree(const bContext &C, const bNodeTree *node_tree)
+{
+ if (!node_tree) {
+ return {};
+ }
+ const Main &bmain = *CTX_data_main(&C);
+ const Vector<AssetLibraryReference> all_libraries = bke::all_valid_asset_library_refs();
+
+ /* Merge catalogs from all libraries to deduplicate menu items. Also store the catalog and
+ * library for each asset ID in order to use them later when retrieving assets and removing
+ * empty catalogs. */
+ Map<bke::CatalogID, LibraryCatalog> id_to_catalog_map;
+ bke::AssetCatalogTree catalogs_from_all_libraries;
+ for (const AssetLibraryReference &library_ref : all_libraries) {
+ if (bke::AssetLibrary *library = BKE_asset_library_load(&bmain, library_ref)) {
+ if (bke::AssetCatalogTree *tree = library->catalog_service->get_catalog_tree()) {
+ tree->foreach_item([&](bke::AssetCatalogTreeItem &item) {
+ const bke::CatalogID &id = item.get_catalog_id();
+ bke::AssetCatalog *catalog = library->catalog_service->find_catalog(id);
+ catalogs_from_all_libraries.insert_item(*catalog);
+ id_to_catalog_map.add(item.get_catalog_id(), LibraryCatalog{library, catalog});
+ });
+ }
+ }
+ }
+
+ /* Find all the matching node group assets for every catalog path. */
+ MultiValueMap<bke::AssetCatalogPath, LibraryAsset> assets_per_path;
+ for (const AssetLibraryReference &library_ref : all_libraries) {
+ AssetFilterSettings type_filter{};
+ type_filter.id_types = FILTER_ID_NT;
+
+ ED_assetlist_storage_fetch(&library_ref, &C);
+ ED_assetlist_ensure_previews_job(&library_ref, &C);
+ ED_assetlist_iterate(library_ref, [&](AssetHandle asset) {
+ if (!ED_asset_filter_matches_asset(&type_filter, &asset)) {
+ return true;
+ }
+ const AssetMetaData &meta_data = *ED_asset_handle_get_metadata(&asset);
+ const IDProperty *tree_type = BKE_asset_metadata_idprop_find(&meta_data, "type");
+ if (tree_type == nullptr || IDP_Int(tree_type) != node_tree->type) {
+ return true;
+ }
+ if (BLI_uuid_is_nil(meta_data.catalog_id)) {
+ return true;
+ }
+ const LibraryCatalog &library_catalog = id_to_catalog_map.lookup(meta_data.catalog_id);
+ assets_per_path.add(library_catalog.catalog->path, LibraryAsset{library_ref, asset});
+ return true;
+ });
+ }
+
+ /* Build the final tree without any of the catalogs that don't have proper node group assets. */
+ bke::AssetCatalogTree catalogs_with_node_assets;
+ catalogs_from_all_libraries.foreach_item([&](bke::AssetCatalogTreeItem &item) {
+ if (!assets_per_path.lookup(item.catalog_path()).is_empty()) {
+ const bke::CatalogID &id = item.get_catalog_id();
+ const LibraryCatalog &library_catalog = id_to_catalog_map.lookup(id);
+ bke::AssetCatalog *catalog = library_catalog.library->catalog_service->find_catalog(id);
+ catalogs_with_node_assets.insert_item(*catalog);
+ }
+ });
+
+ /* Build another map storing full asset paths for each tree item, in order to have stable
+ * pointers to asset catalog paths to use for context pointers. This is necessary because
+ * #bke::AssetCatalogTreeItem doesn't store its full path directly. */
+ Map<const bke::AssetCatalogTreeItem *, bke::AssetCatalogPath> full_catalog_per_tree_item;
+ catalogs_with_node_assets.foreach_item([&](bke::AssetCatalogTreeItem &item) {
+ full_catalog_per_tree_item.add_new(&item, item.catalog_path());
+ });
+
+ return {std::move(catalogs_with_node_assets),
+ std::move(assets_per_path),
+ std::move(full_catalog_per_tree_item)};
+}
+
+static void node_add_catalog_assets_draw(const bContext *C, Menu *menu)
+{
+ bScreen &screen = *CTX_wm_screen(C);
+ const SpaceNode &snode = *CTX_wm_space_node(C);
+ if (!snode.runtime->assets_for_menu) {
+ BLI_assert_unreachable();
+ return;
+ }
+ AssetItemTree &tree = *snode.runtime->assets_for_menu;
+ const bNodeTree *edit_tree = snode.edittree;
+ if (!edit_tree) {
+ return;
+ }
+
+ const PointerRNA menu_path_ptr = CTX_data_pointer_get(C, "asset_catalog_path");
+ if (RNA_pointer_is_null(&menu_path_ptr)) {
+ return;
+ }
+ const bke::AssetCatalogPath &menu_path = *static_cast<const bke::AssetCatalogPath *>(
+ menu_path_ptr.data);
+
+ const Span<LibraryAsset> asset_items = tree.assets_per_path.lookup(menu_path);
+ bke::AssetCatalogTreeItem *catalog_item = tree.catalogs.find_item(menu_path);
+ BLI_assert(catalog_item != nullptr);
+
+ if (asset_items.is_empty() && !catalog_item->has_children()) {
+ return;
+ }
+
+ uiLayout *layout = menu->layout;
+ uiItemS(layout);
+
+ for (const LibraryAsset &item : asset_items) {
+ uiLayout *col = uiLayoutColumn(layout, false);
+ PointerRNA file{
+ &screen.id, &RNA_FileSelectEntry, const_cast<FileDirEntry *>(item.handle.file_data)};
+ uiLayoutSetContextPointer(col, "active_file", &file);
+
+ PointerRNA library_ptr{&screen.id,
+ &RNA_AssetLibraryReference,
+ const_cast<AssetLibraryReference *>(&item.library_ref)};
+ uiLayoutSetContextPointer(col, "asset_library_ref", &library_ptr);
+
+ uiItemO(col, ED_asset_handle_get_name(&item.handle), ICON_NONE, "NODE_OT_add_group_asset");
+ }
+
+ catalog_item->foreach_child([&](bke::AssetCatalogTreeItem &child_item) {
+ const bke::AssetCatalogPath &path = tree.full_catalog_per_tree_item.lookup(&child_item);
+ PointerRNA path_ptr{
+ &screen.id, &RNA_AssetCatalogPath, const_cast<bke::AssetCatalogPath *>(&path)};
+ uiLayout *col = uiLayoutColumn(layout, false);
+ uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
+ uiItemM(col, "NODE_MT_node_add_catalog_assets", path.name().c_str(), ICON_NONE);
+ });
+}
+
+static void add_root_catalogs_draw(const bContext *C, Menu *menu)
+{
+ bScreen &screen = *CTX_wm_screen(C);
+ SpaceNode &snode = *CTX_wm_space_node(C);
+ const bNodeTree *edit_tree = snode.edittree;
+ uiLayout *layout = menu->layout;
+
+ snode.runtime->assets_for_menu = std::make_shared<AssetItemTree>(
+ build_catalog_tree(*C, edit_tree));
+
+ const bool loading_finished = all_loading_finished();
+
+ AssetItemTree &tree = *snode.runtime->assets_for_menu;
+ if (tree.catalogs.is_empty() && loading_finished) {
+ return;
+ }
+
+ uiItemS(layout);
+
+ if (!loading_finished) {
+ uiItemL(layout, IFACE_("Loading Asset Libraries"), ICON_INFO);
+ }
+
+ /* Avoid adding a separate root catalog when the assets have already been added to one of the
+ * builtin menus.
+ * TODO: The need to define the builtin menu labels here is completely non-ideal. We don't have
+ * any UI introspection that can do this though. This can be solved in the near future by
+ * removing the need to define the add menu completely, instead using a per-node-type path which
+ * can be merged with catalog tree.
+ */
+ static Set<std::string> all_builtin_menus = []() {
+ Set<std::string> menus;
+ menus.add_new("Attribute");
+ menus.add_new("Color");
+ menus.add_new("Curve");
+ menus.add_new("Curve Primitives");
+ menus.add_new("Curve Topology");
+ menus.add_new("Geometry");
+ menus.add_new("Input");
+ menus.add_new("Instances");
+ menus.add_new("Material");
+ menus.add_new("Mesh");
+ menus.add_new("Mesh Primitives");
+ menus.add_new("Mesh Topology");
+ menus.add_new("Output");
+ menus.add_new("Point");
+ menus.add_new("Text");
+ menus.add_new("Texture");
+ menus.add_new("Utilities");
+ menus.add_new("UV");
+ menus.add_new("Vector");
+ menus.add_new("Volume");
+ menus.add_new("Group");
+ menus.add_new("Layout");
+ return menus;
+ }();
+
+ tree.catalogs.foreach_root_item([&](bke::AssetCatalogTreeItem &item) {
+ if (all_builtin_menus.contains(item.get_name())) {
+ return;
+ }
+ const bke::AssetCatalogPath &path = tree.full_catalog_per_tree_item.lookup(&item);
+ PointerRNA path_ptr{
+ &screen.id, &RNA_AssetCatalogPath, const_cast<bke::AssetCatalogPath *>(&path)};
+ uiLayout *col = uiLayoutColumn(layout, false);
+ uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
+ uiItemM(col, "NODE_MT_node_add_catalog_assets", path.name().c_str(), ICON_NONE);
+ });
+}
+
+MenuType add_catalog_assets_menu_type()
+{
+ MenuType type{};
+ BLI_strncpy(type.idname, "NODE_MT_node_add_catalog_assets", sizeof(type.idname));
+ type.poll = node_add_menu_poll;
+ type.draw = node_add_catalog_assets_draw;
+ type.listener = node_add_menu_assets_listen_fn;
+ return type;
+}
+
+MenuType add_root_catalogs_menu_type()
+{
+ MenuType type{};
+ BLI_strncpy(type.idname, "NODE_MT_node_add_root_catalogs", sizeof(type.idname));
+ type.poll = node_add_menu_poll;
+ type.draw = add_root_catalogs_draw;
+ type.listener = node_add_menu_assets_listen_fn;
+ return type;
+}
+
+} // namespace blender::ed::space_node
+
+/* Note: This is only necessary because Python can't set an asset catalog path context item. */
+void uiTemplateNodeAssetMenuItems(uiLayout *layout, bContext *C, const char *catalog_path)
+{
+ using namespace blender;
+ using namespace blender::ed::space_node;
+ bScreen &screen = *CTX_wm_screen(C);
+ SpaceNode &snode = *CTX_wm_space_node(C);
+ AssetItemTree &tree = *snode.runtime->assets_for_menu;
+ const bke::AssetCatalogTreeItem *item = tree.catalogs.find_root_item(catalog_path);
+ if (!item) {
+ return;
+ }
+ const bke::AssetCatalogPath &path = tree.full_catalog_per_tree_item.lookup(item);
+ PointerRNA path_ptr{
+ &screen.id, &RNA_AssetCatalogPath, const_cast<bke::AssetCatalogPath *>(&path)};
+ uiItemS(layout);
+ uiLayout *col = uiLayoutColumn(layout, false);
+ uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
+ uiItemMContents(col, "NODE_MT_node_add_catalog_assets");
+}
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc
index 07eecff320a..41f70a6d8cf 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -30,6 +30,7 @@
#include "DEG_depsgraph_build.h"
+#include "ED_asset.h"
#include "ED_node.h" /* own include */
#include "ED_render.h"
#include "ED_screen.h"
@@ -244,38 +245,36 @@ void NODE_OT_add_reroute(wmOperatorType *ot)
/** \name Add Node Group Operator
* \{ */
-static bNodeTree *node_add_group_get_and_poll_group_node_tree(Main *bmain,
- wmOperator *op,
- bNodeTree *ntree)
+static bool node_group_add_poll(const bNodeTree &node_tree,
+ const bNodeTree &node_group,
+ ReportList &reports)
{
- bNodeTree *node_group = reinterpret_cast<bNodeTree *>(
- WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_NT));
- if (!node_group) {
- return nullptr;
+ if (node_group.type != node_tree.type) {
+ return false;
}
const char *disabled_hint = nullptr;
- if ((node_group->type != ntree->type) || !nodeGroupPoll(ntree, node_group, &disabled_hint)) {
+ if (!nodeGroupPoll(&node_tree, &node_group, &disabled_hint)) {
if (disabled_hint) {
- BKE_reportf(op->reports,
+ BKE_reportf(&reports,
RPT_ERROR,
"Can not add node group '%s' to '%s':\n %s",
- node_group->id.name + 2,
- ntree->id.name + 2,
+ node_group.id.name + 2,
+ node_tree.id.name + 2,
disabled_hint);
}
else {
- BKE_reportf(op->reports,
+ BKE_reportf(&reports,
RPT_ERROR,
"Can not add node group '%s' to '%s'",
- node_group->id.name + 2,
- ntree->id.name + 2);
+ node_group.id.name + 2,
+ node_tree.id.name + 2);
}
- return nullptr;
+ return false;
}
- return node_group;
+ return true;
}
static int node_add_group_exec(bContext *C, wmOperator *op)
@@ -284,10 +283,14 @@ static int node_add_group_exec(bContext *C, wmOperator *op)
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
- bNodeTree *node_group = node_add_group_get_and_poll_group_node_tree(bmain, op, ntree);
+ bNodeTree *node_group = reinterpret_cast<bNodeTree *>(
+ WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, ID_NT));
if (!node_group) {
return OPERATOR_CANCELLED;
}
+ if (!node_group_add_poll(*ntree, *node_group, *op->reports)) {
+ return OPERATOR_CANCELLED;
+ }
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
@@ -320,9 +323,8 @@ static bool node_add_group_poll(bContext *C)
}
const SpaceNode *snode = CTX_wm_space_node(C);
if (snode->edittree->type == NTREE_CUSTOM) {
- CTX_wm_operator_poll_msg_set(C,
- "This node editor displays a custom (Python defined) node tree. "
- "Dropping node groups isn't supported for this");
+ CTX_wm_operator_poll_msg_set(
+ C, "Adding node groups isn't supported for custom (Python defined) node trees");
return false;
}
return true;
@@ -367,6 +369,105 @@ void NODE_OT_add_group(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Add Node Group Asset Operator
+ * \{ */
+
+static bool add_node_group_asset(const bContext &C,
+ const AssetLibraryReference &library_ref,
+ const AssetHandle asset,
+ ReportList &reports)
+{
+ Main &bmain = *CTX_data_main(&C);
+ SpaceNode &snode = *CTX_wm_space_node(&C);
+ bNodeTree &edit_tree = *snode.edittree;
+
+ bNodeTree *node_group = reinterpret_cast<bNodeTree *>(
+ asset::get_local_id_from_asset_or_append_and_reuse(bmain, library_ref, asset));
+ if (!node_group) {
+ return false;
+ }
+ if (!node_group_add_poll(edit_tree, *node_group, reports)) {
+ /* Remove the node group if it was newly appended but can't be added to the tree. */
+ id_us_plus(&node_group->id);
+ BKE_id_free_us(&bmain, node_group);
+ return false;
+ }
+
+ ED_preview_kill_jobs(CTX_wm_manager(&C), CTX_data_main(&C));
+
+ bNode *group_node = add_node(
+ C, ntreeTypeFind(node_group->idname)->group_idname, snode.runtime->cursor);
+ if (!group_node) {
+ BKE_report(&reports, RPT_WARNING, "Could not add node group");
+ return false;
+ }
+ /* By default, don't show the data-block selector since it's not usually necessary for assets. */
+ group_node->flag &= ~NODE_OPTIONS;
+
+ group_node->id = &node_group->id;
+ id_us_plus(group_node->id);
+ BKE_ntree_update_tag_node_property(&edit_tree, group_node);
+
+ nodeSetActive(&edit_tree, group_node);
+ ED_node_tree_propagate_change(&C, &bmain, nullptr);
+ DEG_relations_tag_update(&bmain);
+
+ return true;
+}
+
+static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ ARegion &region = *CTX_wm_region(C);
+ SpaceNode &snode = *CTX_wm_space_node(C);
+
+ const AssetLibraryReference *library_ref = CTX_wm_asset_library_ref(C);
+ if (!library_ref) {
+ return OPERATOR_CANCELLED;
+ }
+ bool is_valid;
+ const AssetHandle handle = CTX_wm_asset_handle(C, &is_valid);
+ if (!is_valid) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* Convert mouse coordinates to v2d space. */
+ UI_view2d_region_to_view(&region.v2d,
+ event->mval[0],
+ event->mval[1],
+ &snode.runtime->cursor[0],
+ &snode.runtime->cursor[1]);
+
+ snode.runtime->cursor /= UI_DPI_FAC;
+
+ if (!add_node_group_asset(*C, *library_ref, handle, *op->reports)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ wmOperatorType *ot = WM_operatortype_find("NODE_OT_translate_attach_remove_on_cancel", true);
+ BLI_assert(ot);
+ PointerRNA ptr;
+ WM_operator_properties_create_ptr(&ptr, ot);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr);
+ WM_operator_properties_free(&ptr);
+
+ return OPERATOR_FINISHED;
+}
+
+void NODE_OT_add_group_asset(wmOperatorType *ot)
+{
+ ot->name = "Add Node Group Asset";
+ ot->description = "Add a node group asset to the active node tree";
+ ot->idname = "NODE_OT_add_group_asset";
+
+ ot->invoke = node_add_group_asset_invoke;
+ ot->poll = node_add_group_poll;
+
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Add Node Object Operator
* \{ */
@@ -393,7 +494,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op)
bNodeSocket *sock = nodeFindSocket(object_node, SOCK_IN, "Object");
if (!sock) {
- BKE_report(op->reports, RPT_WARNING, "Could not find node object socket");
+ BLI_assert_unreachable();
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index 48b3d711bdf..e6eba45d45e 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -89,8 +89,8 @@ struct CompoJob {
Depsgraph *compositor_depsgraph;
bNodeTree *localtree;
/* Jon system integration. */
- const short *stop;
- short *do_update;
+ const bool *stop;
+ bool *do_update;
float *progress;
};
@@ -166,7 +166,7 @@ static int compo_get_recalc_flags(const bContext *C)
}
/* called by compo, only to check job 'stop' value */
-static int compo_breakjob(void *cjv)
+static bool compo_breakjob(void *cjv)
{
CompoJob *cj = (CompoJob *)cjv;
@@ -250,8 +250,8 @@ static void compo_progressjob(void *cjv, float progress)
static void compo_startjob(void *cjv,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
CompoJob *cj = (CompoJob *)cjv;
diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc
index aedceb1d368..329f78860a4 100644
--- a/source/blender/editors/space_node/node_group.cc
+++ b/source/blender/editors/space_node/node_group.cc
@@ -14,6 +14,7 @@
#include "BLI_linklist.h"
#include "BLI_listbase.h"
+#include "BLI_map.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_string.h"
#include "BLI_vector.hh"
@@ -735,6 +736,74 @@ static int node_get_selected_minmax(
return totselect;
}
+/**
+ * Redirect a link that are connecting a non-selected node to selected one.
+ * Create new socket or reuse an existing one that was connected from the same input.
+ * The output sockets of group nodes usually have consciously given names so they have
+ * precedence over socket names the link points to.
+ *
+ * \param ntree: The node tree that the node group is being created from.
+ * \param ngroup: The node tree of the new node group.
+ * \param gnode: The new group node in the original tree.
+ * \param input_node: The input node of the new node group.
+ * \param link: The incoming link that needs to be altered.
+ * \param reusable_sockets: Map for input socket interface lookup.
+ */
+static void node_group_make_redirect_incoming_link(
+ bNodeTree &ntree,
+ bNodeTree *ngroup,
+ bNode *gnode,
+ bNode *input_node,
+ bNodeLink *link,
+ Map<bNodeSocket *, bNodeSocket *> &reusable_sockets)
+{
+ bNodeSocket *input_socket = reusable_sockets.lookup_default(link->fromsock, nullptr);
+ if (input_socket) {
+ /* The incoming link is from a socket that has already been linked to
+ * a socket interface of the input node.
+ * Change the source of the link to the previously created socket interface.
+ * Move the link into the node tree of the new group. */
+ link->fromnode = input_node;
+ link->fromsock = input_socket;
+ BLI_remlink(&ntree.links, link);
+ BLI_addtail(&ngroup->links, link);
+ }
+ else {
+ bNode *node_for_typeinfo = nullptr;
+ bNodeSocket *socket_for_typeinfo = nullptr;
+ /* Find a socket where typeinfo and name may come from. */
+ node_socket_skip_reroutes(
+ &ntree.links, link->tonode, link->tosock, &node_for_typeinfo, &socket_for_typeinfo);
+ bNodeSocket *socket_for_naming = socket_for_typeinfo;
+
+ /* Use the name of group node output sockets. */
+ if (ELEM(link->fromnode->type, NODE_GROUP_INPUT, NODE_GROUP, NODE_CUSTOM_GROUP)) {
+ socket_for_naming = link->fromsock;
+ }
+
+ bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocketWithName(ngroup,
+ node_for_typeinfo,
+ socket_for_typeinfo,
+ socket_for_naming->idname,
+ socket_for_naming->name);
+
+ /* Update the group node and interface sockets so the new interface socket can be linked. */
+ node_group_update(&ntree, gnode);
+ node_group_input_update(ngroup, input_node);
+
+ /* Create new internal link. */
+ bNodeSocket *input_sock = node_group_input_find_socket(input_node, iosock->identifier);
+ nodeAddLink(ngroup, input_node, input_sock, link->tonode, link->tosock);
+
+ /* Redirect external link. */
+ link->tonode = gnode;
+ link->tosock = node_group_find_input_socket(gnode, iosock->identifier);
+
+ /* Remember which interface socket the link has been redirected to. */
+ reusable_sockets.add_new(link->fromsock, input_sock);
+ }
+}
+
static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree, bNode *gnode)
{
Main *bmain = CTX_data_main(&C);
@@ -834,6 +903,10 @@ static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree,
output_node->locy = -offsety;
/* relink external sockets */
+
+ /* A map from link sources to input sockets already connected. */
+ Map<bNodeSocket *, bNodeSocket *> reusable_sockets;
+
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree.links) {
const bool fromselect = node_group_make_use_node(*link->fromnode, gnode);
const bool toselect = node_group_make_use_node(*link->tonode, gnode);
@@ -851,24 +924,8 @@ static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree,
continue;
}
- bNodeSocket *link_sock;
- bNode *link_node;
- node_socket_skip_reroutes(&ntree.links, link->tonode, link->tosock, &link_node, &link_sock);
- bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link_node, link_sock);
-
- /* update the group node and interface node sockets,
- * so the new interface socket can be linked.
- */
- node_group_update(&ntree, gnode);
- node_group_input_update(ngroup, input_node);
-
- /* create new internal link */
- bNodeSocket *input_sock = node_group_input_find_socket(input_node, iosock->identifier);
- nodeAddLink(ngroup, input_node, input_sock, link->tonode, link->tosock);
-
- /* redirect external link */
- link->tonode = gnode;
- link->tosock = node_group_find_input_socket(gnode, iosock->identifier);
+ node_group_make_redirect_incoming_link(
+ ntree, ngroup, gnode, input_node, link, reusable_sockets);
}
else if (fromselect && !toselect) {
/* Remove hidden links to not create unconnected sockets in the interface. */
diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh
index 1c3026628a6..88be9a52c61 100644
--- a/source/blender/editors/space_node/node_intern.hh
+++ b/source/blender/editors/space_node/node_intern.hh
@@ -38,6 +38,8 @@ extern const char *node_context_dir[];
namespace blender::ed::space_node {
+struct AssetItemTree;
+
/** Temporary data used in node link drag modal operator. */
struct bNodeLinkDrag {
/** Links dragged by the operator. */
@@ -96,6 +98,15 @@ struct SpaceNode_Runtime {
/* XXX hack for translate_attach op-macros to pass data from transform op to insert_offset op */
/** Temporary data for node insert offset (in UI called Auto-offset). */
struct NodeInsertOfsData *iofsd;
+
+ /**
+ * Temporary data for node add menu in order to provide longer-term storage for context pointers.
+ * Recreated every time the root menu is opened. In the future this will be replaced with an "all
+ * libraries" cache in the asset system itself.
+ *
+ * Stored with a shared pointer so that it can be forward declared.
+ */
+ std::shared_ptr<AssetItemTree> assets_for_menu;
};
enum NodeResizeDirection {
@@ -253,6 +264,7 @@ bNode *add_static_node(const bContext &C, int type, const float2 &location);
void NODE_OT_add_reroute(wmOperatorType *ot);
void NODE_OT_add_search(wmOperatorType *ot);
void NODE_OT_add_group(wmOperatorType *ot);
+void NODE_OT_add_group_asset(wmOperatorType *ot);
void NODE_OT_add_object(wmOperatorType *ot);
void NODE_OT_add_collection(wmOperatorType *ot);
void NODE_OT_add_file(wmOperatorType *ot);
@@ -383,4 +395,9 @@ void invoke_node_link_drag_add_menu(bContext &C,
void invoke_add_node_search_menu(bContext &C, const float2 &cursor, bool use_transform);
+/* add_menu_assets.cc */
+
+MenuType add_catalog_assets_menu_type();
+MenuType add_root_catalogs_menu_type();
+
} // namespace blender::ed::space_node
diff --git a/source/blender/editors/space_node/node_ops.cc b/source/blender/editors/space_node/node_ops.cc
index d45c33a3c59..104d1acf3b4 100644
--- a/source/blender/editors/space_node/node_ops.cc
+++ b/source/blender/editors/space_node/node_ops.cc
@@ -78,6 +78,7 @@ void node_operatortypes()
WM_operatortype_append(NODE_OT_add_search);
WM_operatortype_append(NODE_OT_add_group);
+ WM_operatortype_append(NODE_OT_add_group_asset);
WM_operatortype_append(NODE_OT_add_object);
WM_operatortype_append(NODE_OT_add_collection);
WM_operatortype_append(NODE_OT_add_file);
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index ac49115959c..5754e77399f 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -1170,5 +1170,8 @@ void ED_spacetype_node()
art->draw = node_toolbar_region_draw;
BLI_addhead(&st->regiontypes, art);
+ WM_menutype_add(MEM_new<MenuType>(__func__, add_catalog_assets_menu_type()));
+ WM_menutype_add(MEM_new<MenuType>(__func__, add_root_catalogs_menu_type()));
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_channels_draw.c b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
index 8abd7e424d1..901417c152f 100644
--- a/source/blender/editors/space_sequencer/sequencer_channels_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
@@ -357,6 +357,10 @@ void draw_channels(const bContext *C, ARegion *region)
SeqChannelDrawContext context;
channel_draw_context_init(C, region, &context);
+ if (round_fl_to_int(context.channel_height) == 0) {
+ return;
+ }
+
UI_view2d_view_ortho(context.v2d);
draw_channel_headers(&context);
diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.c b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
index c892e7d7e55..d43ce26d2a1 100644
--- a/source/blender/editors/space_sequencer/sequencer_drag_drop.c
+++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
@@ -505,8 +505,8 @@ typedef struct DropJobData {
} DropJobData;
static void prefetch_data_fn(void *custom_data,
- short *UNUSED(stop),
- short *UNUSED(do_update),
+ bool *UNUSED(stop),
+ bool *UNUSED(do_update),
float *UNUSED(progress))
{
DropJobData *job_data = (DropJobData *)custom_data;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index a6916f9d031..3a2c62326de 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -890,8 +890,7 @@ static size_t draw_seq_text_get_overlay_string(const Scene *scene,
BLI_assert(i <= ARRAY_SIZE(text_array));
- return BLI_string_join_array(r_overlay_string, overlay_string_len, text_array, i) -
- r_overlay_string;
+ return BLI_string_join_array(r_overlay_string, overlay_string_len, text_array, i);
}
/* Draw info text on a sequence strip. */
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index 2820edc95aa..2410055d76d 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -51,7 +51,7 @@ static void free_preview_job(void *data)
}
/* Only this runs inside thread. */
-static void preview_startjob(void *data, short *stop, short *do_update, float *progress)
+static void preview_startjob(void *data, bool *stop, bool *do_update, float *progress)
{
PreviewJob *pj = data;
PreviewJobAudio *previewjb;
diff --git a/source/blender/editors/space_sequencer/sequencer_proxy.c b/source/blender/editors/space_sequencer/sequencer_proxy.c
index c851d3a29d4..30817771015 100644
--- a/source/blender/editors/space_sequencer/sequencer_proxy.c
+++ b/source/blender/editors/space_sequencer/sequencer_proxy.c
@@ -118,7 +118,7 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
if (seq->flag & SELECT) {
ListBase queue = {NULL, NULL};
LinkData *link;
- short stop = 0, do_update;
+ bool stop = false, do_update;
float progress;
SEQ_proxy_rebuild_context(bmain, depsgraph, scene, seq, file_list, &queue, false);
@@ -126,7 +126,7 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
for (link = queue.first; link; link = link->next) {
struct SeqIndexBuildContext *context = link->data;
SEQ_proxy_rebuild(context, &stop, &do_update, &progress);
- SEQ_proxy_rebuild_finish(context, 0);
+ SEQ_proxy_rebuild_finish(context, false);
}
SEQ_relations_free_imbuf(scene, &ed->seqbase, false);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
index 460054f3b44..d1606b14152 100644
--- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c
+++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
@@ -132,8 +132,8 @@ static void seq_get_thumb_image_dimensions(Sequence *seq,
}
static void thumbnail_start_job(void *data,
- short *stop,
- short *UNUSED(do_update),
+ bool *stop,
+ bool *UNUSED(do_update),
float *UNUSED(progress))
{
ThumbnailDrawJob *tj = data;
diff --git a/source/blender/editors/space_view3d/space_view3d.cc b/source/blender/editors/space_view3d/space_view3d.cc
index 635fbd75d74..05fb0c6a720 100644
--- a/source/blender/editors/space_view3d/space_view3d.cc
+++ b/source/blender/editors/space_view3d/space_view3d.cc
@@ -175,11 +175,11 @@ bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion
void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d)
{
/* local viewmat and persmat, to calculate projections */
- mul_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->obmat);
- mul_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->obmat);
+ mul_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->object_to_world);
+ mul_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->object_to_world);
/* initializes object space clipping, speeds up clip tests */
- ED_view3d_clipping_local(rv3d, ob->obmat);
+ ED_view3d_clipping_local(rv3d, ob->object_to_world);
}
void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d)
@@ -189,7 +189,7 @@ void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *r
/* We have to multiply instead of loading `viewmatob` to make
* it work with duplis using display-lists, otherwise it will
* override the dupli-matrix. */
- GPU_matrix_mul(ob->obmat);
+ GPU_matrix_mul(ob->object_to_world);
}
#ifdef DEBUG
@@ -710,7 +710,7 @@ static void view3d_ob_drop_matrix_from_snap(V3DSnapCursorState *snap_state,
copy_v3_v3(obmat_final[3], snap_data->loc);
float scale[3];
- mat4_to_size(scale, ob->obmat);
+ mat4_to_size(scale, ob->object_to_world);
rescale_m4(obmat_final, scale);
const BoundBox *bb = BKE_object_boundbox_get(ob);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 4153f19f8be..f71ce54729c 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -474,7 +474,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
/* Location, X/Y/Z */
mul_v3_fl(median_basis.generic.location, 1.0f / (float)tot);
if (v3d->flag & V3D_GLOBAL_STATS) {
- mul_m4_v3(ob->obmat, median_basis.generic.location);
+ mul_m4_v3(ob->object_to_world, median_basis.generic.location);
}
if (has_meshdata) {
@@ -954,9 +954,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
memcpy(&ve_median_basis, &tfp->ve_median, sizeof(tfp->ve_median));
if (v3d->flag & V3D_GLOBAL_STATS) {
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_v3(ob->imat, median_basis.generic.location);
- mul_m4_v3(ob->imat, ve_median_basis.generic.location);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_v3(ob->world_to_object, median_basis.generic.location);
+ mul_m4_v3(ob->world_to_object, ve_median_basis.generic.location);
}
sub_vn_vnvn((float *)&median_basis,
(float *)&ve_median_basis,
@@ -1215,7 +1215,7 @@ static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d
BKE_object_dimensions_get(ob, tfp->ob_dims);
copy_v3_v3(tfp->ob_dims_orig, tfp->ob_dims);
copy_v3_v3(tfp->ob_scale_orig, ob->scale);
- copy_m4_m4(tfp->ob_obmat_orig, ob->obmat);
+ copy_m4_m4(tfp->ob_obmat_orig, ob->object_to_world);
uiDefBut(block,
UI_BTYPE_LABEL,
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index b5962647278..299c8638b02 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -142,7 +142,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph
vctrl->obtfm = BKE_object_tfm_backup(ob_back);
BKE_object_where_is_calc(depsgraph, scene, v3d->camera);
- negate_v3_v3(rv3d->ofs, v3d->camera->obmat[3]);
+ negate_v3_v3(rv3d->ofs, v3d->camera->object_to_world[3]);
rv3d->dist = 0.0;
}
@@ -251,7 +251,7 @@ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl,
invert_m4_m4(prev_view_imat, vctrl->view_mat_prev);
mul_m4_m4m4(diff_mat, view_mat, prev_view_imat);
- mul_m4_m4m4(parent_mat, diff_mat, vctrl->root_parent->obmat);
+ mul_m4_m4m4(parent_mat, diff_mat, vctrl->root_parent->object_to_world);
if (object_apply_mat4_with_protect(vctrl->root_parent, parent_mat, false, rv3d, view_mat)) {
/* Calculate again since the view locking changes the matrix. */
diff --git a/source/blender/editors/space_view3d/view3d_draw.cc b/source/blender/editors/space_view3d/view3d_draw.cc
index 8a86889f2d0..31b26ba4cda 100644
--- a/source/blender/editors/space_view3d/view3d_draw.cc
+++ b/source/blender/editors/space_view3d/view3d_draw.cc
@@ -2066,7 +2066,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
rv3d.persp = RV3D_CAMOB;
- copy_m4_m4(rv3d.viewinv, v3d.camera->obmat);
+ copy_m4_m4(rv3d.viewinv, v3d.camera->object_to_world);
normalize_m4(rv3d.viewinv);
invert_m4_m4(rv3d.viewmat, rv3d.viewinv);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
index 4f73e2fada2..8a4301d1314 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c
@@ -188,7 +188,7 @@ static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmGizmoGroup
bspline_group->handles[i].index = i;
float mat[4][4];
- mul_m4_m4m4(mat, ob->obmat, (i == 0) ? pchan->disp_mat : pchan->disp_tail_mat);
+ mul_m4_m4m4(mat, ob->object_to_world, (i == 0) ? pchan->disp_mat : pchan->disp_tail_mat);
copy_m4_m4(gz->matrix_space, mat);
/* need to set property here for undo. TODO: would prefer to do this in _init. */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index 952ef56710b..56a1f6212a0 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -85,7 +85,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *gzgroup)
struct CameraWidgetGroup *cagzgroup = MEM_callocN(sizeof(struct CameraWidgetGroup), __func__);
gzgroup->customdata = cagzgroup;
- negate_v3_v3(dir, ob->obmat[2]);
+ negate_v3_v3(dir, ob->object_to_world[2]);
/* dof distance */
{
@@ -138,11 +138,11 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
RNA_pointer_create(&ca->id, &RNA_Camera, ca, &camera_ptr);
- negate_v3_v3(dir, ob->obmat[2]);
+ negate_v3_v3(dir, ob->object_to_world[2]);
if ((ca->flag & CAM_SHOWLIMITS) && (v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_DOF_DIST)) {
- WM_gizmo_set_matrix_location(cagzgroup->dop_dist, ob->obmat[3]);
- WM_gizmo_set_matrix_rotation_from_yz_axis(cagzgroup->dop_dist, ob->obmat[1], dir);
+ WM_gizmo_set_matrix_location(cagzgroup->dop_dist, ob->object_to_world[3]);
+ WM_gizmo_set_matrix_rotation_from_yz_axis(cagzgroup->dop_dist, ob->object_to_world[1], dir);
WM_gizmo_set_scale(cagzgroup->dop_dist, ca->drawsize);
WM_gizmo_set_flag(cagzgroup->dop_dist, WM_GIZMO_HIDDEN, false);
@@ -183,17 +183,17 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
aspect[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f;
unit_m4(widget->matrix_basis);
- WM_gizmo_set_matrix_location(widget, ob->obmat[3]);
- WM_gizmo_set_matrix_rotation_from_yz_axis(widget, ob->obmat[1], dir);
+ WM_gizmo_set_matrix_location(widget, ob->object_to_world[3]);
+ WM_gizmo_set_matrix_rotation_from_yz_axis(widget, ob->object_to_world[1], dir);
if (is_ortho) {
scale_matrix = ca->ortho_scale * 0.5f;
}
else {
const float ob_scale_inv[3] = {
- 1.0f / len_v3(ob->obmat[0]),
- 1.0f / len_v3(ob->obmat[1]),
- 1.0f / len_v3(ob->obmat[2]),
+ 1.0f / len_v3(ob->object_to_world[0]),
+ 1.0f / len_v3(ob->object_to_world[1]),
+ 1.0f / len_v3(ob->object_to_world[2]),
};
const float ob_scale_uniform_inv = (ob_scale_inv[0] + ob_scale_inv[1] + ob_scale_inv[2]) /
3.0f;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index 41a763192ce..03fc7328e39 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -139,7 +139,7 @@ static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmGizmoGroup *gzg
BKE_view_layer_synced_ensure(scene, view_layer);
Object *ob = BKE_view_layer_active_object_get(view_layer);
- copy_m4_m4(gz->matrix_basis, ob->obmat);
+ copy_m4_m4(gz->matrix_basis, ob->object_to_world);
RNA_enum_set(gz->ptr,
"transform",
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
index 58b43301397..d194e2a6279 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
@@ -87,8 +87,8 @@ static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmGizmoGroup *gzgr
PointerRNA field_ptr;
RNA_pointer_create(&ob->id, &RNA_FieldSettings, pd, &field_ptr);
- WM_gizmo_set_matrix_location(gz, ob->obmat[3]);
- WM_gizmo_set_matrix_rotation_from_z_axis(gz, ob->obmat[2]);
+ WM_gizmo_set_matrix_location(gz, ob->object_to_world[3]);
+ WM_gizmo_set_matrix_rotation_from_z_axis(gz, ob->object_to_world[2]);
WM_gizmo_set_matrix_offset_location(gz, ofs);
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
WM_gizmo_target_property_def_rna(gz, "offset", &field_ptr, "strength", -1);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c
index 4401dbf7935..0b115bc0604 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_light.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c
@@ -85,10 +85,10 @@ static void WIDGETGROUP_light_spot_refresh(const bContext *C, wmGizmoGroup *gzgr
Light *la = ob->data;
float dir[3];
- negate_v3_v3(dir, ob->obmat[2]);
+ negate_v3_v3(dir, ob->object_to_world[2]);
WM_gizmo_set_matrix_rotation_from_z_axis(gz, dir);
- WM_gizmo_set_matrix_location(gz, ob->obmat[3]);
+ WM_gizmo_set_matrix_location(gz, ob->object_to_world[3]);
/* need to set property here for undo. TODO: would prefer to do this in _init. */
PointerRNA lamp_ptr;
@@ -199,7 +199,7 @@ static void WIDGETGROUP_light_area_refresh(const bContext *C, wmGizmoGroup *gzgr
Light *la = ob->data;
wmGizmo *gz = wwrapper->gizmo;
- copy_m4_m4(gz->matrix_basis, ob->obmat);
+ copy_m4_m4(gz->matrix_basis, ob->object_to_world);
int flag = ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE;
if (ELEM(la->area_shape, LA_AREA_SQUARE, LA_AREA_DISK)) {
@@ -296,7 +296,7 @@ static void WIDGETGROUP_light_target_draw_prepare(const bContext *C, wmGizmoGrou
Object *ob = BKE_view_layer_active_object_get(view_layer);
wmGizmo *gz = wwrapper->gizmo;
- normalize_m4_m4(gz->matrix_basis, ob->obmat);
+ normalize_m4_m4(gz->matrix_basis, ob->object_to_world);
unit_m4(gz->matrix_offset);
if (ob->type == OB_LAMP) {
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.cc b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.cc
index 793ada4f577..86aecfb6c34 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.cc
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.cc
@@ -97,7 +97,7 @@ static void gizmo_preselect_elem_draw(const bContext *C, wmGizmo *gz)
MeshElemGizmo3D *gz_ele = (MeshElemGizmo3D *)gz;
if (gz_ele->base_index != -1) {
Object *ob = gz_ele->bases[gz_ele->base_index]->object;
- EDBM_preselect_elem_draw(gz_ele->psel, ob->obmat);
+ EDBM_preselect_elem_draw(gz_ele->psel, ob->object_to_world);
}
}
@@ -185,7 +185,7 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
BMVert *vert = (BMVert *)eve_test;
float vert_p_co[2], vert_co[3];
const float mval_f[2] = {float(vc.mval[0]), float(vc.mval[1])};
- mul_v3_m4v3(vert_co, gz_ele->bases[base_index_vert]->object->obmat, vert->co);
+ mul_v3_m4v3(vert_co, gz_ele->bases[base_index_vert]->object->object_to_world, vert->co);
ED_view3d_project_v2(vc.region, vert_co, vert_p_co);
float len = len_v2v2(vert_p_co, mval_f);
if (len < 35) {
@@ -330,7 +330,7 @@ static void gizmo_preselect_edgering_draw(const bContext *C, wmGizmo *gz)
MeshEdgeRingGizmo3D *gz_ring = (MeshEdgeRingGizmo3D *)gz;
if (gz_ring->base_index != -1) {
Object *ob = gz_ring->bases[gz_ring->base_index]->object;
- EDBM_preselect_edgering_draw(gz_ring->psel, ob->obmat);
+ EDBM_preselect_edgering_draw(gz_ring->psel, ob->object_to_world);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_iterators.cc b/source/blender/editors/space_view3d/view3d_iterators.cc
index 932563863fe..aaa817ec00c 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.cc
+++ b/source/blender/editors/space_view3d/view3d_iterators.cc
@@ -307,7 +307,7 @@ void meshobject_foreachScreenVert(
&me->vdata, CD_PROP_BOOL, ".hide_vert");
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
- ED_view3d_clipping_local(vc->rv3d, vc->obact->obmat);
+ ED_view3d_clipping_local(vc->rv3d, vc->obact->object_to_world);
}
BKE_mesh_foreach_mapped_vert(me, meshobject_foreachScreenVert__mapFunc, &data, MESH_FOREACH_NOP);
@@ -353,7 +353,8 @@ void mesh_foreachScreenVert(
data.clip_flag = clip_flag;
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
- ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+ ED_view3d_clipping_local(vc->rv3d,
+ vc->obedit->object_to_world); /* for local clipping lookups */
}
BM_mesh_elem_table_ensure(vc->em->bm, BM_VERT);
@@ -422,7 +423,8 @@ void mesh_foreachScreenEdge(ViewContext *vc,
data.clip_flag = clip_flag;
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
- ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+ ED_view3d_clipping_local(vc->rv3d,
+ vc->obedit->object_to_world); /* for local clipping lookups */
}
if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) {
@@ -520,7 +522,8 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
BM_mesh_elem_table_ensure(vc->em->bm, BM_EDGE);
if ((clip_flag & V3D_PROJ_TEST_CLIP_BB) && (vc->rv3d->clipbb != nullptr)) {
- ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups. */
+ ED_view3d_clipping_local(vc->rv3d,
+ vc->obedit->object_to_world); /* for local clipping lookups. */
BKE_mesh_foreach_mapped_edge(
me, vc->em->bm->totedge, mesh_foreachScreenEdge_clip_bb_segment__mapFunc, &data);
}
@@ -612,7 +615,8 @@ void nurbs_foreachScreenVert(ViewContext *vc,
ED_view3d_check_mats_rv3d(vc->rv3d);
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
- ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+ ED_view3d_clipping_local(vc->rv3d,
+ vc->obedit->object_to_world); /* for local clipping lookups */
}
LISTBASE_FOREACH (Nurb *, nu, nurbs) {
@@ -732,7 +736,7 @@ void lattice_foreachScreenVert(ViewContext *vc,
ED_view3d_check_mats_rv3d(vc->rv3d);
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
- ED_view3d_clipping_local(vc->rv3d, obedit->obmat); /* for local clipping lookups */
+ ED_view3d_clipping_local(vc->rv3d, obedit->object_to_world); /* for local clipping lookups */
}
for (i = 0; i < N; i++, bp++, co += 3) {
diff --git a/source/blender/editors/space_view3d/view3d_navigate.c b/source/blender/editors/space_view3d/view3d_navigate.c
index 25073d02a7f..7d2beecd9a3 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_navigate.c
@@ -185,7 +185,7 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
copy_v3_v3(lastofs, stroke);
}
else {
- copy_v3_v3(lastofs, ob_act_eval->obmat[3]);
+ copy_v3_v3(lastofs, ob_act_eval->object_to_world[3]);
}
is_set = true;
}
@@ -199,7 +199,7 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
}
mul_v2_fl(lastofs, 1.0f / 4.0f);
- mul_m4_v3(ob_act_eval->obmat, lastofs);
+ mul_m4_v3(ob_act_eval->object_to_world, lastofs);
is_set = true;
}
@@ -219,11 +219,11 @@ bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
BKE_boundbox_calc_center_aabb(ob_eval->runtime.bb, cent);
- mul_m4_v3(ob_eval->obmat, cent);
+ mul_m4_v3(ob_eval->object_to_world, cent);
add_v3_v3(select_center, cent);
}
else {
- add_v3_v3(select_center, ob_eval->obmat[3]);
+ add_v3_v3(select_center, ob_eval->object_to_world[3]);
}
tot++;
}
@@ -626,7 +626,7 @@ static void view3d_object_calc_minmax(Depsgraph *depsgraph,
if (BKE_object_minmax_dupli(depsgraph, scene, ob_eval, min, max, false) == 0) {
/* Use if duplis aren't found. */
if (only_center) {
- minmax_v3v3_v3(min, max, ob_eval->obmat[3]);
+ minmax_v3v3_v3(min, max, ob_eval->object_to_world[3]);
}
else {
BKE_object_minmax(ob_eval, min, max, false);
@@ -934,8 +934,8 @@ static int viewselected_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if ((ob_eval) && (ok)) {
- mul_m4_v3(ob_eval->obmat, min);
- mul_m4_v3(ob_eval->obmat, max);
+ mul_m4_v3(ob_eval->object_to_world, min);
+ mul_m4_v3(ob_eval->object_to_world, max);
}
}
else if (is_face_map) {
diff --git a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
index 6b150d1e771..a5eee436fdb 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
@@ -259,7 +259,7 @@ void ED_view3d_smooth_view_ex(
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera);
if (sview->ofs != NULL) {
sms.dst.dist = ED_view3d_offset_distance(
- ob_camera_eval->obmat, sview->ofs, VIEW3D_DIST_FALLBACK);
+ ob_camera_eval->object_to_world, sview->ofs, VIEW3D_DIST_FALLBACK);
}
ED_view3d_from_object(ob_camera_eval, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens);
sms.to_camera = true; /* restore view3d values in end */
@@ -282,7 +282,8 @@ void ED_view3d_smooth_view_ex(
if (sview->camera_old) {
Object *ob_camera_old_eval = DEG_get_evaluated_object(depsgraph, sview->camera_old);
if (sview->ofs != NULL) {
- sms.src.dist = ED_view3d_offset_distance(ob_camera_old_eval->obmat, sview->ofs, 0.0f);
+ sms.src.dist = ED_view3d_offset_distance(
+ ob_camera_old_eval->object_to_world, sview->ofs, 0.0f);
}
ED_view3d_from_object(
ob_camera_old_eval, sms.src.ofs, sms.src.quat, &sms.src.dist, &sms.src.lens);
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index c5f951bd64c..2718f14c855 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -80,7 +80,7 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *region,
float r_co[2])
{
eV3DProjStatus ret = ED_view3d_project_float_global(
- region, base->object->obmat[3], r_co, V3D_PROJ_TEST_CLIP_DEFAULT);
+ region, base->object->object_to_world[3], r_co, V3D_PROJ_TEST_CLIP_DEFAULT);
/* Prevent uninitialized values when projection fails,
* although the callers should check the return value. */
@@ -687,7 +687,7 @@ void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob, fl
{
float vmat[4][4];
- mul_m4_m4m4(vmat, rv3d->viewmat, ob->obmat);
+ mul_m4_m4m4(vmat, rv3d->viewmat, ob->object_to_world);
mul_m4_m4m4(r_pmat, rv3d->winmat, vmat);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc
index 2a84d61c561..48a3cb386fd 100644
--- a/source/blender/editors/space_view3d/view3d_select.cc
+++ b/source/blender/editors/space_view3d/view3d_select.cc
@@ -2303,7 +2303,7 @@ static Base *mouse_select_object_center(ViewContext *vc, Base *startbase, const
if (BASE_SELECTABLE(v3d, base)) {
float screen_co[2];
if (ED_view3d_project_float_global(
- region, base->object->obmat[3], screen_co, V3D_PROJ_TEST_CLIP_DEFAULT) ==
+ region, base->object->object_to_world[3], screen_co, V3D_PROJ_TEST_CLIP_DEFAULT) ==
V3D_PROJ_RET_OK) {
float dist_test = len_manhattan_v2v2(mval_fl, screen_co);
if (base == oldbasact) {
@@ -2616,6 +2616,12 @@ static bool ed_object_select_pick(bContext *C,
Base *basact = nullptr;
const eObjectMode object_mode = oldbasact ? static_cast<eObjectMode>(oldbasact->object->mode) :
OB_MODE_OBJECT;
+ /* For the most part this is equivalent to `(object_mode & OB_MODE_POSE) != 0`
+ * however this logic should also run with weight-paint + pose selection.
+ * Without this, selection in weight-paint mode can de-select armatures which isn't useful,
+ * see: T101686. */
+ const bool has_pose_old = (oldbasact &&
+ BKE_object_pose_armature_get_with_wpaint_check(oldbasact->object));
/* When enabled, don't attempt any further selection. */
bool handled = false;
@@ -2654,7 +2660,7 @@ static bool ed_object_select_pick(bContext *C,
*
* This way prioritizing based on pose-mode has a bias to stay in pose-mode
* without having to enforce this through locking the object mode. */
- bool do_bones_get_priotity = (object_mode & OB_MODE_POSE) != 0;
+ bool do_bones_get_priotity = has_pose_old;
basact = (gpu->hits > 0) ? mouse_select_eval_buffer(&vc,
gpu->buffer,
@@ -2666,10 +2672,14 @@ static bool ed_object_select_pick(bContext *C,
nullptr;
}
+ /* See comment for `has_pose_old`, the same rationale applies here. */
+ const bool has_pose_new = (basact &&
+ BKE_object_pose_armature_get_with_wpaint_check(basact->object));
+
/* Select pose-bones or camera-tracks. */
if (((gpu->hits > 0) && gpu->has_bones) ||
/* Special case, even when there are no hits, pose logic may de-select all bones. */
- ((gpu->hits == 0) && (object_mode & OB_MODE_POSE))) {
+ ((gpu->hits == 0) && has_pose_old)) {
if (basact && (gpu->has_bones && (basact->object->type == OB_CAMERA))) {
MovieClip *clip = BKE_object_movieclip_get(scene, basact->object, false);
@@ -2729,7 +2739,7 @@ static bool ed_object_select_pick(bContext *C,
handled = true;
}
- else if ((object_mode & OB_MODE_POSE) && (basact->object->mode & OB_MODE_POSE)) {
+ else if (has_pose_old && has_pose_new) {
/* Within pose-mode, keep the current selection when switching pose bones,
* this is noticeable when in pose mode with multiple objects at once.
* Where selecting the bone of a different object would de-select this one.
@@ -2955,6 +2965,9 @@ static bool ed_wpaint_vertex_select_pick(bContext *C,
changed = true;
}
+ else {
+ select_vert.finish();
+ }
if (changed) {
paintvert_tag_select_update(C, obact);
@@ -4728,9 +4741,10 @@ static bool object_circle_select(ViewContext *vc,
LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) {
if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) {
float screen_co[2];
- if (ED_view3d_project_float_global(
- vc->region, base->object->obmat[3], screen_co, V3D_PROJ_TEST_CLIP_DEFAULT) ==
- V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(vc->region,
+ base->object->object_to_world[3],
+ screen_co,
+ V3D_PROJ_TEST_CLIP_DEFAULT) == V3D_PROJ_RET_OK) {
if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
changed = true;
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index ee6b1886dc2..8c6f4387851 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -86,18 +86,18 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
}
if (tvs.transverts_tot != 0) {
- copy_m3_m4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->object_to_world);
invert_m3_m3(imat, bmat);
tv = tvs.transverts;
for (a = 0; a < tvs.transverts_tot; a++, tv++) {
copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
- add_v3_v3(vec, obedit->obmat[3]);
+ add_v3_v3(vec, obedit->object_to_world[3]);
vec[0] = gridf * floorf(0.5f + vec[0] / gridf);
vec[1] = gridf * floorf(0.5f + vec[1] / gridf);
vec[2] = gridf * floorf(0.5f + vec[2] / gridf);
- sub_v3_v3(vec, obedit->obmat[3]);
+ sub_v3_v3(vec, obedit->object_to_world[3]);
mul_m3_v3(imat, vec);
copy_v3_v3(tv->loc, vec);
@@ -118,7 +118,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
bPoseChannel *pchan_eval;
bArmature *arm_eval = ob_eval->data;
- invert_m4_m4(ob_eval->imat, ob_eval->obmat);
+ invert_m4_m4(ob_eval->world_to_object, ob_eval->object_to_world);
for (pchan_eval = ob_eval->pose->chanbase.first; pchan_eval; pchan_eval = pchan_eval->next) {
if (pchan_eval->bone->flag & BONE_SELECTED) {
@@ -129,12 +129,12 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
/* get nearest grid point to snap to */
copy_v3_v3(nLoc, pchan_eval->pose_mat[3]);
/* We must operate in world space! */
- mul_m4_v3(ob_eval->obmat, nLoc);
+ mul_m4_v3(ob_eval->object_to_world, nLoc);
vec[0] = gridf * floorf(0.5f + nLoc[0] / gridf);
vec[1] = gridf * floorf(0.5f + nLoc[1] / gridf);
vec[2] = gridf * floorf(0.5f + nLoc[2] / gridf);
/* Back in object space... */
- mul_m4_v3(ob_eval->imat, vec);
+ mul_m4_v3(ob_eval->world_to_object, vec);
/* Get location of grid point in pose space. */
BKE_armature_loc_pose_to_bone(pchan_eval, vec, vec);
@@ -214,9 +214,12 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
for (int ob_index = 0; ob_index < objects_eval_len; ob_index++) {
Object *ob_eval = objects_eval[ob_index];
Object *ob = DEG_get_original_object(ob_eval);
- vec[0] = -ob_eval->obmat[3][0] + gridf * floorf(0.5f + ob_eval->obmat[3][0] / gridf);
- vec[1] = -ob_eval->obmat[3][1] + gridf * floorf(0.5f + ob_eval->obmat[3][1] / gridf);
- vec[2] = -ob_eval->obmat[3][2] + gridf * floorf(0.5f + ob_eval->obmat[3][2] / gridf);
+ vec[0] = -ob_eval->object_to_world[3][0] +
+ gridf * floorf(0.5f + ob_eval->object_to_world[3][0] / gridf);
+ vec[1] = -ob_eval->object_to_world[3][1] +
+ gridf * floorf(0.5f + ob_eval->object_to_world[3][1] / gridf);
+ vec[2] = -ob_eval->object_to_world[3][2] +
+ gridf * floorf(0.5f + ob_eval->object_to_world[3][2] / gridf);
if (ob->parent) {
float originmat[3][3];
@@ -343,11 +346,11 @@ static bool snap_selected_to_location(bContext *C,
}
if (tvs.transverts_tot != 0) {
- copy_m3_m4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->object_to_world);
invert_m3_m3(imat, bmat);
/* get the cursor in object space */
- sub_v3_v3v3(snap_target_local, snap_target_global, obedit->obmat[3]);
+ sub_v3_v3v3(snap_target_local, snap_target_global, obedit->object_to_world[3]);
mul_m3_v3(imat, snap_target_local);
if (use_offset) {
@@ -384,8 +387,8 @@ static bool snap_selected_to_location(bContext *C,
bArmature *arm = ob->data;
float snap_target_local[3];
- invert_m4_m4(ob->imat, ob->obmat);
- mul_v3_m4v3(snap_target_local, ob->imat, snap_target_global);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_v3_m4v3(snap_target_local, ob->world_to_object, snap_target_global);
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((pchan->bone->flag & BONE_SELECTED) && PBONE_VISIBLE(arm, pchan->bone) &&
@@ -409,10 +412,10 @@ static bool snap_selected_to_location(bContext *C,
float cursor_pose[3];
if (use_offset) {
- mul_v3_m4v3(cursor_pose, ob->obmat, pchan->pose_mat[3]);
+ mul_v3_m4v3(cursor_pose, ob->object_to_world, pchan->pose_mat[3]);
add_v3_v3(cursor_pose, offset_global);
- mul_m4_v3(ob->imat, cursor_pose);
+ mul_m4_v3(ob->world_to_object, cursor_pose);
BKE_armature_loc_pose_to_bone(pchan, cursor_pose, cursor_pose);
}
else {
@@ -510,13 +513,13 @@ static bool snap_selected_to_location(bContext *C,
float cursor_parent[3]; /* parent-relative */
if (use_offset) {
- add_v3_v3v3(cursor_parent, ob->obmat[3], offset_global);
+ add_v3_v3v3(cursor_parent, ob->object_to_world[3], offset_global);
}
else {
copy_v3_v3(cursor_parent, snap_target_global);
}
- sub_v3_v3(cursor_parent, ob->obmat[3]);
+ sub_v3_v3(cursor_parent, ob->object_to_world[3]);
if (ob->parent) {
float originmat[3][3], parentmat[4][4];
@@ -730,7 +733,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float r_vec[3])
tracking = &clip->tracking;
- copy_m4_m4(cammat, ob->obmat);
+ copy_m4_m4(cammat, ob->object_to_world);
BKE_tracking_get_camera_object_matrix(ob, mat);
@@ -809,13 +812,13 @@ static bool snap_curs_to_sel_ex(bContext *C, const int pivot_point, float r_curs
count += tvs.transverts_tot;
if (tvs.transverts_tot != 0) {
Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
- copy_m3_m4(bmat, obedit_eval->obmat);
+ copy_m3_m4(bmat, obedit_eval->object_to_world);
tv = tvs.transverts;
for (int i = 0; i < tvs.transverts_tot; i++, tv++) {
copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
- add_v3_v3(vec, obedit_eval->obmat[3]);
+ add_v3_v3(vec, obedit_eval->object_to_world[3]);
add_v3_v3(centroid, vec);
minmax_v3v3_v3(min, max, vec);
}
@@ -835,7 +838,7 @@ static bool snap_curs_to_sel_ex(bContext *C, const int pivot_point, float r_curs
if (arm->layer & pchan->bone->layer) {
if (pchan->bone->flag & BONE_SELECTED) {
copy_v3_v3(vec, pchan->pose_head);
- mul_m4_v3(obact_eval->obmat, vec);
+ mul_m4_v3(obact_eval->object_to_world, vec);
add_v3_v3(centroid, vec);
minmax_v3v3_v3(min, max, vec);
count++;
@@ -845,7 +848,7 @@ static bool snap_curs_to_sel_ex(bContext *C, const int pivot_point, float r_curs
}
else {
FOREACH_SELECTED_OBJECT_BEGIN (view_layer_eval, v3d, ob_eval) {
- copy_v3_v3(vec, ob_eval->obmat[3]);
+ copy_v3_v3(vec, ob_eval->object_to_world[3]);
/* special case for camera -- snap to bundles */
if (ob_eval->type == OB_CAMERA) {
@@ -1008,7 +1011,7 @@ bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
float ob_min[3], ob_max[3];
bool changed;
- changed = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->obmat, SELECT);
+ changed = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->object_to_world, SELECT);
if (changed) {
minmax_v3v3_v3(r_min, r_max, ob_min);
minmax_v3v3_v3(r_min, r_max, ob_max);
@@ -1024,13 +1027,13 @@ bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
return false;
}
- copy_m3_m4(bmat, obedit->obmat);
+ copy_m3_m4(bmat, obedit->object_to_world);
tv = tvs.transverts;
for (int a = 0; a < tvs.transverts_tot; a++, tv++) {
copy_v3_v3(vec, (tv->flag & TX_VERT_USE_MAPLOC) ? tv->maploc : tv->loc);
mul_m3_v3(bmat, vec);
- add_v3_v3(vec, obedit->obmat[3]);
+ add_v3_v3(vec, obedit->object_to_world[3]);
add_v3_v3(centroid, vec);
minmax_v3v3_v3(r_min, r_max, vec);
}
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 1fc16939f3f..fc26e6b4a06 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -281,7 +281,7 @@ void ED_view3d_clipping_calc(
/* optionally transform to object space */
if (ob) {
float imat[4][4];
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, ob->object_to_world);
for (int val = 0; val < 8; val++) {
mul_m4_v3(imat, bb->vec[val]);
@@ -291,7 +291,7 @@ void ED_view3d_clipping_calc(
/* verify if we have negative scale. doing the transform before cross
* product flips the sign of the vector compared to doing cross product
* before transform then, so we correct for that. */
- int flip_sign = (ob) ? is_negative_m4(ob->obmat) : false;
+ int flip_sign = (ob) ? is_negative_m4(ob->object_to_world) : false;
ED_view3d_clipping_calc_from_boundbox(planes, bb, flip_sign);
}
@@ -466,7 +466,8 @@ void ED_view3d_persp_switch_from_camera(const Depsgraph *depsgraph,
if (v3d->camera) {
Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, v3d->camera);
- rv3d->dist = ED_view3d_offset_distance(ob_camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
+ rv3d->dist = ED_view3d_offset_distance(
+ ob_camera_eval->object_to_world, rv3d->ofs, VIEW3D_DIST_FALLBACK);
ED_view3d_from_object(ob_camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
@@ -558,7 +559,7 @@ void ED_view3d_camera_lock_init_ex(const Depsgraph *depsgraph,
if (calc_dist) {
/* using a fallback dist is OK here since ED_view3d_from_object() compensates for it */
rv3d->dist = ED_view3d_offset_distance(
- ob_camera_eval->obmat, rv3d->ofs, VIEW3D_DIST_FALLBACK);
+ ob_camera_eval->object_to_world, rv3d->ofs, VIEW3D_DIST_FALLBACK);
}
ED_view3d_from_object(ob_camera_eval, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
@@ -592,12 +593,12 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV
ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- normalize_m4_m4(tmat, ob_camera_eval->obmat);
+ normalize_m4_m4(tmat, ob_camera_eval->object_to_world);
invert_m4_m4(imat, tmat);
mul_m4_m4m4(diff_mat, view_mat, imat);
- mul_m4_m4m4(parent_mat, diff_mat, root_parent_eval->obmat);
+ mul_m4_m4m4(parent_mat, diff_mat, root_parent_eval->object_to_world);
BKE_object_tfm_protected_backup(root_parent, &obtfm);
BKE_object_apply_mat4(root_parent, parent_mat, true, false);
@@ -1508,7 +1509,7 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c
void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
{
- ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
+ ED_view3d_from_m4(ob->object_to_world, ofs, quat, dist);
if (lens) {
CameraParams params;
@@ -1555,7 +1556,7 @@ static bool view3d_camera_to_view_selected_impl(struct Main *bmain,
is_ortho_camera = true;
}
- copy_m4_m4(obmat_new, camera_ob_eval->obmat);
+ copy_m4_m4(obmat_new, camera_ob_eval->object_to_world);
copy_v3_v3(obmat_new[3], co);
/* only touch location */
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index d0db4de0c47..c630a1a5653 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -365,7 +365,7 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
rv3d->view = RV3D_VIEW_USER; /* don't show the grid */
- normalize_m4_m4(bmat, ob->obmat);
+ normalize_m4_m4(bmat, ob->object_to_world);
invert_m4_m4(rv3d->viewmat, bmat);
/* view quat calculation, needed for add object */
@@ -404,12 +404,12 @@ void view3d_viewmatrix_set(Depsgraph *depsgraph,
Object *ob_eval = DEG_get_evaluated_object(depsgraph, v3d->ob_center);
float vec[3];
- copy_v3_v3(vec, ob_eval->obmat[3]);
+ copy_v3_v3(vec, ob_eval->object_to_world[3]);
if (ob_eval->type == OB_ARMATURE && v3d->ob_center_bone[0]) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob_eval->pose, v3d->ob_center_bone);
if (pchan) {
copy_v3_v3(vec, pchan->pose_mat[3]);
- mul_m4_v3(ob_eval->obmat, vec);
+ mul_m4_v3(ob_eval->object_to_world, vec);
}
}
translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 5b194ae7237..ad6ab625438 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1725,7 +1725,7 @@ static void initSnapSpatial(TransInfo *t, float r_snap[3], float *r_snap_precisi
{
/* Default values. */
r_snap[0] = r_snap[1] = 1.0f;
- r_snap[1] = 0.0f;
+ r_snap[2] = 0.0f;
*r_snap_precision = 0.1f;
if (t->spacetype == SPACE_VIEW3D) {
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 90f2795184b..1e260ecd292 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -469,7 +469,8 @@ typedef struct TransDataContainer {
/**
* Store matrix, this avoids having to have duplicate check all over
- * Typically: 'obedit->obmat' or 'poseobj->obmat', but may be used elsewhere too.
+ * Typically: 'obedit->object_to_world' or 'poseobj->object_to_world', but may be used elsewhere
+ * too.
*/
bool use_local_mat;
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index 7a68ee1bfbf..a5b2442f11c 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -981,7 +981,7 @@ static void init_TransDataContainers(TransInfo *t,
if (tc->use_local_mat) {
BLI_assert((t->flag & T_2D_EDIT) == 0);
- copy_m4_m4(tc->mat, objects[i]->obmat);
+ copy_m4_m4(tc->mat, objects[i]->object_to_world);
copy_m3_m4(tc->mat3, tc->mat);
/* for non-invertible scale matrices, invert_m4_m4_fallback()
* can still provide a valid pivot */
@@ -1235,8 +1235,8 @@ void transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc)
if (mmd->mirror_ob) {
float obinv[4][4];
- invert_m4_m4(obinv, mmd->mirror_ob->obmat);
- mul_m4_m4m4(mtx, obinv, ob->obmat);
+ invert_m4_m4(obinv, mmd->mirror_ob->object_to_world);
+ mul_m4_m4m4(mtx, obinv, ob->object_to_world);
invert_m4_m4(imtx, mtx);
}
diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c
index 4b79625fa66..2e37f6b7c34 100644
--- a/source/blender/editors/transform/transform_convert_armature.c
+++ b/source/blender/editors/transform/transform_convert_armature.c
@@ -306,8 +306,9 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
* just make things obey standard rotation locks too */
if (data->rootbone == 0) {
for (bPoseChannel *pchan_iter = pchan; pchan_iter; pchan_iter = pchan_iter->parent) {
- /* here, we set ik-settings for bone from pchan->protectflag */
- /* XXX: careful with quats/axis-angle rotations where we're locking 4d components. */
+ /* Here, we set IK-settings for bone from `pchan->protectflag`. */
+ /* XXX: careful with quaternion/axis-angle rotations
+ * where we're locking 4d components. */
if (pchan_iter->protectflag & OB_LOCK_ROTX) {
pchan_iter->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
@@ -592,7 +593,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ext->rotOrder = pchan->rotmode;
/* proper way to get parent transform + own transform + constraints transform */
- copy_m3_m4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->object_to_world);
/* New code, using "generic" BKE_bone_parent_transform_calc_from_pchan(). */
{
@@ -954,7 +955,7 @@ static void createTransArmatureVerts(bContext *UNUSED(C), TransInfo *t)
bool mirror = ((arm->flag & ARM_MIRROR_EDIT) != 0);
BoneInitData *bid = tc->custom.type.data;
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
td = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransEditBone");
diff --git a/source/blender/editors/transform/transform_convert_curve.c b/source/blender/editors/transform/transform_convert_curve.c
index 404b1293208..13ba28ec3d0 100644
--- a/source/blender/editors/transform/transform_convert_curve.c
+++ b/source/blender/editors/transform/transform_convert_curve.c
@@ -174,7 +174,7 @@ static void createTransCurveVerts(bContext *UNUSED(C), TransInfo *t)
transform_mode_use_local_origins(t));
float mtx[3][3], smtx[3][3];
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
TransData *td = tc->data;
diff --git a/source/blender/editors/transform/transform_convert_lattice.c b/source/blender/editors/transform/transform_convert_lattice.c
index b77538dc249..e9b3401974b 100644
--- a/source/blender/editors/transform/transform_convert_lattice.c
+++ b/source/blender/editors/transform/transform_convert_lattice.c
@@ -66,7 +66,7 @@ static void createTransLatticeVerts(bContext *UNUSED(C), TransInfo *t)
}
tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Lattice EditMode)");
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
td = tc->data;
diff --git a/source/blender/editors/transform/transform_convert_mball.c b/source/blender/editors/transform/transform_convert_mball.c
index 7ae93524d0b..c90052e9e8c 100644
--- a/source/blender/editors/transform/transform_convert_mball.c
+++ b/source/blender/editors/transform/transform_convert_mball.c
@@ -61,7 +61,7 @@ static void createTransMBallVerts(bContext *UNUSED(C), TransInfo *t)
tx = tc->data_ext = MEM_callocN(tc->data_len * sizeof(TransDataExtension),
"MetaElement_TransExtension");
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
for (ml = mb->editelems->first; ml; ml = ml->next) {
diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c
index 7e237c9eb32..3192b1b6786 100644
--- a/source/blender/editors/transform/transform_convert_mesh.c
+++ b/source/blender/editors/transform/transform_convert_mesh.c
@@ -1527,7 +1527,7 @@ static void createTransEditVerts(bContext *UNUSED(C), TransInfo *t)
em, calc_single_islands, calc_island_center, calc_island_axismtx, &island_data);
}
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
/* we use a pseudo-inverse so that when one of the axes is scaled to 0,
* matrix inversion still works and we can still moving along the other */
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
diff --git a/source/blender/editors/transform/transform_convert_mesh_edge.c b/source/blender/editors/transform/transform_convert_mesh_edge.c
index 0ce4c592f53..fd62b199345 100644
--- a/source/blender/editors/transform/transform_convert_mesh_edge.c
+++ b/source/blender/editors/transform/transform_convert_mesh_edge.c
@@ -62,7 +62,7 @@ static void createTransEdge(bContext *UNUSED(C), TransInfo *t)
td = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransCrease");
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
/* create data we need */
diff --git a/source/blender/editors/transform/transform_convert_mesh_skin.c b/source/blender/editors/transform/transform_convert_mesh_skin.c
index 376e559181e..cb6108a4c45 100644
--- a/source/blender/editors/transform/transform_convert_mesh_skin.c
+++ b/source/blender/editors/transform/transform_convert_mesh_skin.c
@@ -130,7 +130,7 @@ static void createTransMeshSkin(bContext *UNUSED(C), TransInfo *t)
em, calc_single_islands, calc_island_center, calc_island_axismtx, &island_data);
}
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
/* we use a pseudo-inverse so that when one of the axes is scaled to 0,
* matrix inversion still works and we can still moving along the other */
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
diff --git a/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c b/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c
index 59836180166..d253261f458 100644
--- a/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c
+++ b/source/blender/editors/transform/transform_convert_mesh_vert_cdata.c
@@ -131,7 +131,7 @@ static void createTransMeshVertCData(bContext *UNUSED(C), TransInfo *t)
em, calc_single_islands, calc_island_center, calc_island_axismtx, &island_data);
}
- copy_m3_m4(mtx, tc->obedit->obmat);
+ copy_m3_m4(mtx, tc->obedit->object_to_world);
/* we use a pseudo-inverse so that when one of the axes is scaled to 0,
* matrix inversion still works and we can still moving along the other */
pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c
index af5a51cbff6..830094ebe83 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -60,9 +60,9 @@ typedef struct TransDataNla {
* \{ */
/**
- * \brief Applies a translation to the given NlaStrip.
- * \param strip_rna_ptr The RNA pointer of the NLA strip to modify.
- * \param transdata The transformation info structure.
+ * \brief Applies a translation to the given #NlaStrip.
+ * \param strip_rna_ptr: The RNA pointer of the NLA strip to modify.
+ * \param transdata: The transformation info structure.
*/
static void applyTransformNLA_translation(PointerRNA *strip_rna_ptr, const TransDataNla *transdata)
{
diff --git a/source/blender/editors/transform/transform_convert_object.c b/source/blender/editors/transform/transform_convert_object.c
index 0dcfd7206ad..55f7cd9b23d 100644
--- a/source/blender/editors/transform/transform_convert_object.c
+++ b/source/blender/editors/transform/transform_convert_object.c
@@ -158,14 +158,14 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
copy_qt_qt(td->ext->oquat, ob->quat);
}
/* update object's loc/rot to get current rigid body transform */
- mat4_to_loc_rot_size(ob->loc, rot, scale, ob->obmat);
+ mat4_to_loc_rot_size(ob->loc, rot, scale, ob->object_to_world);
sub_v3_v3(ob->loc, ob->dloc);
BKE_object_mat3_to_rot(ob, rot, false); /* drot is already corrected here */
}
}
/* axismtx has the real orientation */
- transform_orientations_create_from_axis(td->axismtx, UNPACK3(ob->obmat));
+ transform_orientations_create_from_axis(td->axismtx, UNPACK3(ob->object_to_world));
if (t->orient_type_mask & (1 << V3D_ORIENT_GIMBAL)) {
if (!gimbal_axis_object(ob, td->ext->axismtx_gimbal)) {
copy_m3_m3(td->ext->axismtx_gimbal, td->axismtx);
@@ -192,7 +192,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
* More proper solution would be to make a shallow copy of the object and
* evaluate that, and access matrix of that evaluated copy of the object.
* Might be more tricky than it sounds, if some logic later on accesses the
- * object matrix via td->ob->obmat. */
+ * object matrix via td->ob->object_to_world. */
Object *object_eval = DEG_get_evaluated_object(t->depsgraph, ob);
if (skip_invert == false && constinv == false) {
object_eval->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc checks this */
@@ -208,7 +208,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
/* Copy newly evaluated fields to the original object, similar to how
* active dependency graph will do it. */
- copy_m4_m4(ob->obmat, object_eval->obmat);
+ copy_m4_m4(ob->object_to_world, object_eval->object_to_world);
/* Only copy negative scale flag, this is the only flag which is modified by
* the BKE_object_where_is_calc(). The rest of the flags we need to keep,
* otherwise we might lose dupli flags (see T61787). */
@@ -258,9 +258,9 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
copy_v3_v3(td->ext->isize, ob->scale);
copy_v3_v3(td->ext->dscale, ob->dscale);
- copy_v3_v3(td->center, ob->obmat[3]);
+ copy_v3_v3(td->center, ob->object_to_world[3]);
- copy_m4_m4(td->ext->obmat, ob->obmat);
+ copy_m4_m4(td->ext->obmat, ob->object_to_world);
/* is there a need to set the global<->data space conversion matrices? */
if (ob->parent || constinv) {
@@ -271,7 +271,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
* done, as it doesn't work well.
*/
BKE_object_to_mat3(ob, obmtx);
- copy_m3_m4(totmat, ob->obmat);
+ copy_m3_m4(totmat, ob->object_to_world);
/* If the object scale is zero on any axis, this might result in a zero matrix.
* In this case, the transformation would not do anything, see: T50103. */
diff --git a/source/blender/editors/transform/transform_convert_object_texspace.c b/source/blender/editors/transform/transform_convert_object_texspace.c
index 839bf6b77b3..b4c1c134d49 100644
--- a/source/blender/editors/transform/transform_convert_object_texspace.c
+++ b/source/blender/editors/transform/transform_convert_object_texspace.c
@@ -67,8 +67,8 @@ static void createTransTexspace(bContext *UNUSED(C), TransInfo *t)
td->flag = TD_SELECTED;
td->ob = ob;
- copy_m3_m4(td->mtx, ob->obmat);
- copy_m3_m4(td->axismtx, ob->obmat);
+ copy_m3_m4(td->mtx, ob->object_to_world);
+ copy_m3_m4(td->axismtx, ob->object_to_world);
normalize_m3(td->axismtx);
pseudoinverse_m3_m3(td->smtx, td->mtx, PSEUDOINVERSE_EPSILON);
diff --git a/source/blender/editors/transform/transform_convert_particle.c b/source/blender/editors/transform/transform_convert_particle.c
index 3e056b6a048..e6ff730d4d1 100644
--- a/source/blender/editors/transform/transform_convert_particle.c
+++ b/source/blender/editors/transform/transform_convert_particle.c
@@ -95,7 +95,7 @@ static void createTransParticleVerts(bContext *UNUSED(C), TransInfo *t)
unit_m4(mat);
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
for (i = 0, point = edit->points; i < edit->totpoint; i++, point++) {
TransData *head, *tail;
diff --git a/source/blender/editors/transform/transform_convert_sculpt.c b/source/blender/editors/transform/transform_convert_sculpt.c
index f4f2e2a1c6e..cdbf497c584 100644
--- a/source/blender/editors/transform/transform_convert_sculpt.c
+++ b/source/blender/editors/transform/transform_convert_sculpt.c
@@ -49,7 +49,7 @@ static void createTransSculpt(bContext *C, TransInfo *t)
td->flag = TD_SELECTED;
copy_v3_v3(td->center, ss->pivot_pos);
- mul_m4_v3(ob->obmat, td->center);
+ mul_m4_v3(ob->object_to_world, td->center);
td->ob = ob;
td->loc = ss->pivot_pos;
@@ -60,16 +60,16 @@ static void createTransSculpt(bContext *C, TransInfo *t)
}
float obmat_inv[3][3];
- copy_m3_m4(obmat_inv, ob->obmat);
+ copy_m3_m4(obmat_inv, ob->object_to_world);
invert_m3(obmat_inv);
td->ext->rot = NULL;
td->ext->rotAxis = NULL;
td->ext->rotAngle = NULL;
td->ext->quat = ss->pivot_rot;
- copy_m4_m4(td->ext->obmat, ob->obmat);
+ copy_m4_m4(td->ext->obmat, ob->object_to_world);
copy_m3_m3(td->ext->l_smtx, obmat_inv);
- copy_m3_m4(td->ext->r_mtx, ob->obmat);
+ copy_m3_m4(td->ext->r_mtx, ob->object_to_world);
copy_m3_m3(td->ext->r_smtx, obmat_inv);
copy_qt_qt(td->ext->iquat, ss->pivot_rot);
@@ -83,8 +83,8 @@ static void createTransSculpt(bContext *C, TransInfo *t)
copy_v3_v3(td->ext->isize, ss->init_pivot_scale);
copy_m3_m3(td->smtx, obmat_inv);
- copy_m3_m4(td->mtx, ob->obmat);
- copy_m3_m4(td->axismtx, ob->obmat);
+ copy_m3_m4(td->mtx, ob->object_to_world);
+ copy_m3_m4(td->axismtx, ob->object_to_world);
BLI_assert(!(t->options & CTX_PAINT_CURVE));
ED_sculpt_init_transform(C, ob, t->mval, t->undo_name);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 301eac4536e..e1f93bf881b 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1063,7 +1063,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
}
if (tc->obedit) {
if (ED_object_calc_active_center_for_editmode(tc->obedit, select_only, r_center)) {
- mul_m4_v3(tc->obedit->obmat, r_center);
+ mul_m4_v3(tc->obedit->object_to_world, r_center);
return true;
}
}
@@ -1071,7 +1071,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
BKE_view_layer_synced_ensure(t->scene, t->view_layer);
Object *ob = BKE_view_layer_active_object_get(t->view_layer);
if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
- mul_m4_v3(ob->obmat, r_center);
+ mul_m4_v3(ob->object_to_world, r_center);
return true;
}
}
@@ -1088,7 +1088,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
BKE_view_layer_synced_ensure(t->scene, t->view_layer);
Base *base = BKE_view_layer_active_base_get(t->view_layer);
if (base && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) {
- copy_v3_v3(r_center, base->object->obmat[3]);
+ copy_v3_v3(r_center, base->object->object_to_world[3]);
return true;
}
}
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index f3d17559a63..71a449ad10c 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -581,12 +581,12 @@ bool gimbal_axis_pose(Object *ob, const bPoseChannel *pchan, float gmat[3][3])
mul_m3_m3m3(mat, parent_mat, tmat);
/* needed if object transformation isn't identity */
- copy_m3_m4(obmat, ob->obmat);
+ copy_m3_m4(obmat, ob->object_to_world);
mul_m3_m3m3(gmat, obmat, mat);
}
else {
/* needed if object transformation isn't identity */
- copy_m3_m4(obmat, ob->obmat);
+ copy_m3_m4(obmat, ob->object_to_world);
mul_m3_m3m3(gmat, obmat, tmat);
}
@@ -608,7 +608,7 @@ bool gimbal_axis_object(Object *ob, float gmat[3][3])
if (ob->parent) {
float parent_mat[3][3];
- copy_m3_m4(parent_mat, ob->parent->obmat);
+ copy_m3_m4(parent_mat, ob->parent->object_to_world);
normalize_m3(parent_mat);
mul_m3_m3m3(gmat, parent_mat, gmat);
}
@@ -675,14 +675,14 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
copy_m3_m4(tbounds->axis, rv3d->twmat);
if (params->use_local_axis && (ob && ob->mode & (OB_MODE_EDIT | OB_MODE_POSE))) {
float diff_mat[3][3];
- copy_m3_m4(diff_mat, ob->obmat);
+ copy_m3_m4(diff_mat, ob->object_to_world);
normalize_m3(diff_mat);
invert_m3(diff_mat);
mul_m3_m3m3(tbounds->axis, tbounds->axis, diff_mat);
normalize_m3(tbounds->axis);
tbounds->use_matrix_space = true;
- copy_m4_m4(tbounds->matrix_space, ob->obmat);
+ copy_m4_m4(tbounds->matrix_space, ob->object_to_world);
}
if (is_gp_edit) {
@@ -751,7 +751,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
#define FOREACH_EDIT_OBJECT_BEGIN(ob_iter, use_mat_local) \
{ \
- invert_m4_m4(obedit->imat, obedit->obmat); \
+ invert_m4_m4(obedit->world_to_object, obedit->object_to_world); \
uint objects_len = 0; \
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode( \
scene, view_layer, CTX_wm_view3d(C), &objects_len); \
@@ -780,7 +780,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, obedit->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, obedit->world_to_object, ob_iter->object_to_world);
}
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
@@ -800,7 +800,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, obedit->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, obedit->world_to_object, ob_iter->object_to_world);
}
LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) {
if (EBONE_VISIBLE(arm, ebo)) {
@@ -833,7 +833,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, obedit->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, obedit->world_to_object, ob_iter->object_to_world);
}
nu = nurbs->first;
@@ -893,7 +893,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, obedit->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, obedit->world_to_object, ob_iter->object_to_world);
}
LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) {
@@ -913,7 +913,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, obedit->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, obedit->world_to_object, ob_iter->object_to_world);
}
while (a--) {
@@ -933,13 +933,13 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
/* selection center */
if (totsel) {
mul_v3_fl(tbounds->center, 1.0f / (float)totsel); /* centroid! */
- mul_m4_v3(obedit->obmat, tbounds->center);
- mul_m4_v3(obedit->obmat, tbounds->min);
- mul_m4_v3(obedit->obmat, tbounds->max);
+ mul_m4_v3(obedit->object_to_world, tbounds->center);
+ mul_m4_v3(obedit->object_to_world, tbounds->min);
+ mul_m4_v3(obedit->object_to_world, tbounds->max);
}
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
uint objects_len = 0;
Object **objects = BKE_object_pose_array_get(scene, view_layer, v3d, &objects_len);
@@ -954,7 +954,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
float mat_local[4][4];
if (use_mat_local) {
- mul_m4_m4m4(mat_local, ob->imat, ob_iter->obmat);
+ mul_m4_m4m4(mat_local, ob->world_to_object, ob_iter->object_to_world);
}
/* Use channels to get stats. */
@@ -971,18 +971,18 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
if (totsel) {
mul_v3_fl(tbounds->center, 1.0f / (float)totsel); /* centroid! */
- mul_m4_v3(ob->obmat, tbounds->center);
- mul_m4_v3(ob->obmat, tbounds->min);
- mul_m4_v3(ob->obmat, tbounds->max);
+ mul_m4_v3(ob->object_to_world, tbounds->center);
+ mul_m4_v3(ob->object_to_world, tbounds->min);
+ mul_m4_v3(ob->object_to_world, tbounds->max);
}
}
else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
if (ob->mode & OB_MODE_SCULPT) {
totsel = 1;
- calc_tw_center_with_matrix(tbounds, ob->sculpt->pivot_pos, false, ob->obmat);
- mul_m4_v3(ob->obmat, tbounds->center);
- mul_m4_v3(ob->obmat, tbounds->min);
- mul_m4_v3(ob->obmat, tbounds->max);
+ calc_tw_center_with_matrix(tbounds, ob->sculpt->pivot_pos, false, ob->object_to_world);
+ mul_m4_v3(ob->object_to_world, tbounds->center);
+ mul_m4_v3(ob->object_to_world, tbounds->min);
+ mul_m4_v3(ob->object_to_world, tbounds->max);
}
}
else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
@@ -1037,12 +1037,12 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
}
if (params->use_only_center || (bb == NULL)) {
- calc_tw_center(tbounds, base->object->obmat[3]);
+ calc_tw_center(tbounds, base->object->object_to_world[3]);
}
else {
for (uint j = 0; j < 8; j++) {
float co[3];
- mul_v3_m4v3(co, base->object->obmat, bb->vec[j]);
+ mul_v3_m4v3(co, base->object->object_to_world, bb->vec[j]);
calc_tw_center(tbounds, co);
}
}
diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c
index 2eaeaf92c86..aeceedf0690 100644
--- a/source/blender/editors/transform/transform_mode.c
+++ b/source/blender/editors/transform/transform_mode.c
@@ -1041,7 +1041,7 @@ void ElementResize(const TransInfo *t,
if (t->options & CTX_POSE_BONE) {
/* Without this, the resulting location of scaled bones aren't correct,
* especially noticeable scaling root or disconnected bones around the cursor, see T92515. */
- mul_mat3_m4_v3(tc->poseobj->obmat, vec);
+ mul_mat3_m4_v3(tc->poseobj->object_to_world, vec);
}
mul_m3_v3(td->smtx, vec);
}
diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c
index 5baf06006d9..5cdb4d3bf61 100644
--- a/source/blender/editors/transform/transform_mode_edge_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_slide.c
@@ -1149,7 +1149,7 @@ void drawEdgeSlide(TransInfo *t)
GPU_blend(GPU_BLEND_ALPHA);
GPU_matrix_push();
- GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
+ GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->object_to_world);
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c
index d7c4d862b23..a54888fe515 100644
--- a/source/blender/editors/transform/transform_mode_vert_slide.c
+++ b/source/blender/editors/transform/transform_mode_vert_slide.c
@@ -167,7 +167,7 @@ static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2]
float dir_dot;
sub_v3_v3v3(tdir, sv->co_orig_3d, sv->co_link_orig_3d[j]);
- mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, tdir);
+ mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->object_to_world, tdir);
project_plane_v3_v3v3(tdir, tdir, t->viewinv[2]);
normalize_v3(tdir);
@@ -382,7 +382,7 @@ void drawVertSlide(TransInfo *t)
GPU_blend(GPU_BLEND_ALPHA);
GPU_matrix_push();
- GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
+ GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->object_to_world);
GPU_line_width(line_size);
@@ -437,15 +437,16 @@ void drawVertSlide(TransInfo *t)
xy_delta[0] = t->mval[0] - t->mouse.imval[0];
xy_delta[1] = t->mval[1] - t->mouse.imval[1];
- mul_v3_m4v3(
- co_orig_3d, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, curr_sv->co_orig_3d);
+ mul_v3_m4v3(co_orig_3d,
+ TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->object_to_world,
+ curr_sv->co_orig_3d);
zfac = ED_view3d_calc_zfac(t->region->regiondata, co_orig_3d);
ED_view3d_win_to_delta(t->region, xy_delta, zfac, co_dest_3d);
- invert_m4_m4(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat,
- TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
- mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat, co_dest_3d);
+ invert_m4_m4(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->world_to_object,
+ TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->object_to_world);
+ mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->world_to_object, co_dest_3d);
add_v3_v3(co_dest_3d, curr_sv->co_orig_3d);
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 212df5978e4..66fee01f864 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -126,7 +126,7 @@ static TransformOrientation *createObjectSpace(bContext *C,
ob = base->object;
- copy_m3_m4(mat, ob->obmat);
+ copy_m3_m4(mat, ob->object_to_world);
normalize_m3(mat);
/* use object name if no name is given */
@@ -532,7 +532,7 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene,
ED_getTransformOrientationMatrix(scene, view_layer, v3d, ob, obedit, pivot_point, r_mat);
}
else {
- transform_orientations_create_from_axis(r_mat, UNPACK3(ob->obmat));
+ transform_orientations_create_from_axis(r_mat, UNPACK3(ob->object_to_world));
}
break;
}
@@ -764,7 +764,7 @@ int getTransformOrientation_ex(const Scene *scene,
float imat[3][3], mat[3][3];
/* we need the transpose of the inverse for a normal... */
- copy_m3_m4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->object_to_world);
invert_m3_m3(mat, imat);
transpose_m3(mat);
@@ -1192,8 +1192,8 @@ int getTransformOrientation_ex(const Scene *scene,
if (result == ORIENTATION_EDGE) {
float tvec[3];
- mul_mat3_m4_v3(ob->obmat, normal);
- mul_mat3_m4_v3(ob->obmat, plane);
+ mul_mat3_m4_v3(ob->object_to_world, normal);
+ mul_mat3_m4_v3(ob->object_to_world, plane);
/* align normal to edge direction (so normal is perpendicular to the plane).
* 'ORIENTATION_EDGE' will do the other way around.
@@ -1235,7 +1235,7 @@ int getTransformOrientation_ex(const Scene *scene,
/* use for both active & all */
if (ok) {
/* we need the transpose of the inverse for a normal... */
- copy_m3_m4(imat, ob->obmat);
+ copy_m3_m4(imat, ob->object_to_world);
invert_m3_m3(mat, imat);
transpose_m3(mat);
@@ -1267,8 +1267,8 @@ int getTransformOrientation_ex(const Scene *scene,
}
if (ok) {
- copy_v3_v3(normal, ob->obmat[2]);
- copy_v3_v3(plane, ob->obmat[1]);
+ copy_v3_v3(normal, ob->object_to_world[2]);
+ copy_v3_v3(plane, ob->object_to_world[1]);
}
}
result = ORIENTATION_NORMAL;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 672d947936d..11cb57dc911 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -372,7 +372,7 @@ static bool applyFaceProject(TransInfo *t, TransDataContainer *tc, TransData *td
}
else if (t->options & CTX_OBJECT) {
BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
- copy_v3_v3(iloc, td->ob->obmat[3]);
+ copy_v3_v3(iloc, td->ob->object_to_world[3]);
}
if (ED_view3d_project_float_global(t->region, iloc, mval_fl, V3D_PROJ_TEST_NOP) !=
@@ -444,7 +444,7 @@ static void applyFaceNearest(TransInfo *t, TransDataContainer *tc, TransData *td
}
else if (t->options & CTX_OBJECT) {
BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
- copy_v3_v3(init_loc, td->ob->obmat[3]);
+ copy_v3_v3(init_loc, td->ob->object_to_world[3]);
}
eSnapMode hit = ED_transform_snap_object_project_view3d(
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index 7971e1ca9af..24d76a50117 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -565,7 +565,7 @@ static void iter_snap_objects(SnapObjectContext *sctx,
free_object_duplilist(lb);
}
- sob_callback(sctx, params, obj_eval, obj_eval->obmat, is_object_active, data);
+ sob_callback(sctx, params, obj_eval, obj_eval->object_to_world, is_object_active, data);
}
}
@@ -1145,7 +1145,7 @@ static void raycast_obj_fn(SnapObjectContext *sctx,
* \param r_index: Hit index or -1 when no valid index is found.
* (currently only set to the polygon index when using `snap_to == SCE_SNAP_MODE_FACE_RAYCAST`).
* \param r_ob: Hit object.
- * \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
+ * \param r_obmat: Object matrix (may not be #Object.object_to_world with dupli-instances).
* \param r_hit_list: List of #SnapObjectHitDepth (caller must free).
*/
static bool raycastObjects(SnapObjectContext *sctx,
@@ -1483,7 +1483,7 @@ static void nearest_world_object_fn(SnapObjectContext *sctx,
* \param r_no: Normal of nearest point on target surface.
* \param r_index: Index of nearest polygon on target surface.
* \param r_ob: Nearest target object.
- * \param r_obmat: Nearest target matrix (may not be #Object.obmat with dupli-instances).
+ * \param r_obmat: Nearest target matrix (may not be #Object.object_to_world with dupli-instances).
*/
static bool nearestWorldObjects(SnapObjectContext *sctx,
const struct SnapObjectParams *params,
@@ -3177,7 +3177,7 @@ static void snap_obj_fn(SnapObjectContext *sctx,
* \param r_index: Hit index or -1 when no valid index is found.
* (currently only set to the polygon index when using `snap_to == SCE_SNAP_MODE_FACE_RAYCAST`).
* \param r_ob: Hit object.
- * \param r_obmat: Object matrix (may not be #Object.obmat with dupli-instances).
+ * \param r_obmat: Object matrix (may not be #Object.object_to_world with dupli-instances).
*/
static eSnapMode snapObjectsRay(SnapObjectContext *sctx,
const SnapObjectParams *params,
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 7dd223a9252..777cc1d97e4 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -4705,7 +4705,7 @@ static int uv_select_similar_vert_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
BMFace *face;
BMIter iter;
@@ -4742,7 +4742,7 @@ static int uv_select_similar_vert_exec(bContext *C, wmOperator *op)
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
BMFace *face;
BMIter iter;
@@ -4818,7 +4818,7 @@ static int uv_select_similar_edge_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
BMFace *face;
BMIter iter;
@@ -4859,7 +4859,7 @@ static int uv_select_similar_edge_exec(bContext *C, wmOperator *op)
bool changed = false;
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
BMFace *face;
BMIter iter;
@@ -4927,7 +4927,7 @@ static int uv_select_similar_face_exec(bContext *C, wmOperator *op)
BMesh *bm = em->bm;
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
@@ -4963,7 +4963,7 @@ static int uv_select_similar_face_exec(bContext *C, wmOperator *op)
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
float ob_m3[3][3];
- copy_m3_m4(ob_m3, ob->obmat);
+ copy_m3_m4(ob_m3, ob->object_to_world);
BMFace *face;
BMIter iter;
@@ -5053,7 +5053,7 @@ static int uv_select_similar_island_exec(bContext *C, wmOperator *op)
}
float ob_m3[3][3];
- copy_m3_m4(ob_m3, obedit->obmat);
+ copy_m3_m4(ob_m3, obedit->object_to_world);
int index;
LISTBASE_FOREACH_INDEX (struct FaceIsland *, island, &island_list_ptr[ob_index], index) {
@@ -5082,7 +5082,7 @@ static int uv_select_similar_island_exec(bContext *C, wmOperator *op)
continue;
}
float ob_m3[3][3];
- copy_m3_m4(ob_m3, obedit->obmat);
+ copy_m3_m4(ob_m3, obedit->object_to_world);
bool changed = false;
int index;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index ecaba3234a7..071f1c44c6b 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1388,8 +1388,8 @@ static void uv_map_transform_center(const Scene *scene,
}
case V3D_AROUND_CURSOR: /* cursor center */
{
- invert_m4_m4(ob->imat, ob->obmat);
- mul_v3_m4v3(r_center, ob->imat, scene->cursor.location);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_v3_m4v3(r_center, ob->world_to_object, scene->cursor.location);
break;
}
case V3D_AROUND_ACTIVE: {
@@ -1439,7 +1439,7 @@ static void uv_map_rotation_matrix_ex(float result[4][4],
zero_v3(viewmatrix[3]);
/* get rotation of the current object matrix */
- copy_m4_m4(rotobj, ob->obmat);
+ copy_m4_m4(rotobj, ob->object_to_world);
zero_v3(rotobj[3]);
/* but shifting */
@@ -1774,8 +1774,8 @@ static void uv_map_clip_correct(const Scene *scene,
dy = 1.0f / dy;
}
- if (dx == 1.0f && dy == 1.0f) {
- /* Scaling by 1.0 has no effect. */
+ if (dx == 1.0f && dy == 1.0f && min[0] == 0.0f && min[1] == 0.0f) {
+ /* Scaling by 1.0, without translating, has no effect. */
return;
}
@@ -1948,7 +1948,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
continue;
}
- mat4_to_size(obsize, obedit->obmat);
+ mat4_to_size(obsize, obedit->object_to_world);
if (!(fabsf(obsize[0] - obsize[1]) < 1e-4f && fabsf(obsize[1] - obsize[2]) < 1e-4f)) {
if ((reported_errors & UNWRAP_ERROR_NONUNIFORM) == 0) {
BKE_report(op->reports,
@@ -1958,7 +1958,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
reported_errors |= UNWRAP_ERROR_NONUNIFORM;
}
}
- else if (is_negative_m4(obedit->obmat)) {
+ else if (is_negative_m4(obedit->object_to_world)) {
if ((reported_errors & UNWRAP_ERROR_NEGATIVE) == 0) {
BKE_report(
op->reports,
@@ -2538,7 +2538,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
float objects_pos_avg[4] = {0};
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- add_v4_v4(objects_pos_avg, objects[ob_index]->obmat[3]);
+ add_v4_v4(objects_pos_avg, objects[ob_index]->object_to_world[3]);
}
mul_v4_fl(objects_pos_avg, 1.0f / objects_len);
@@ -2576,7 +2576,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
const bool camera_bounds = RNA_boolean_get(op->ptr, "camera_bounds");
struct ProjCameraInfo *uci = BLI_uvproject_camera_info(
v3d->camera,
- obedit->obmat,
+ obedit->object_to_world,
camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f,
camera_bounds ? (scene->r.ysch * scene->r.yasp) : 1.0f);
@@ -2597,7 +2597,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
}
}
else {
- copy_m4_m4(rotmat, obedit->obmat);
+ copy_m4_m4(rotmat, obedit->object_to_world);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 0d41b5a773d..53c2b1d235b 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -431,7 +431,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
// Compute matrix including camera transform
float obmat[4][4], nmat[4][4];
- mul_m4_m4m4(obmat, viewmat, ob->obmat);
+ mul_m4_m4m4(obmat, viewmat, ob->object_to_world);
invert_m4_m4(nmat, obmat);
transpose_m4(nmat);
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 06365c3799f..af9ef7f352e 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -131,9 +131,9 @@ static void init_view(Render *re)
int ymax = re->disprect.ymax;
float thickness = 1.0f;
- switch (re->r.line_thickness_mode) {
+ switch (re->scene->r.line_thickness_mode) {
case R_LINE_THICKNESS_ABSOLUTE:
- thickness = re->r.unit_line_thickness * (re->r.size / 100.0f);
+ thickness = re->scene->r.unit_line_thickness * (re->r.size / 100.0f);
break;
case R_LINE_THICKNESS_RELATIVE:
thickness = height / 480.0f;
@@ -485,7 +485,7 @@ void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_r
return;
}
- rl = render_get_active_layer(freestyle_render, freestyle_render->result);
+ rl = render_get_single_layer(freestyle_render, freestyle_render->result);
if (!rl) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "No source render layer to composite" << endl;
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index ad9b7dfa5ed..0d47665c6d3 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -12,6 +12,8 @@
#include "FitCurve.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index c17fb92a58c..db6816bf045 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -25,6 +25,8 @@
#include "BKE_global.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
index f1e4297ab5e..b8beeed5880 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
@@ -7,6 +7,8 @@
#include "GeomUtils.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle::GeomUtils {
// This internal procedure is defined below.
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.cpp b/source/blender/freestyle/intern/geometry/HashGrid.cpp
index 51c87757645..46ce9184951 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/HashGrid.cpp
@@ -7,6 +7,8 @@
#include "HashGrid.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
void HashGrid::clear()
diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp
index 306913e6297..04e271f7a5b 100644
--- a/source/blender/freestyle/intern/geometry/Noise.cpp
+++ b/source/blender/freestyle/intern/geometry/Noise.cpp
@@ -12,6 +12,7 @@
#include "BLI_compiler_attrs.h"
#include "BLI_rand.h"
+#include "BLI_sys_types.h"
#include "Noise.h"
diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp
index 95afa4dda48..bc68d17a1f9 100644
--- a/source/blender/freestyle/intern/image/ImagePyramid.cpp
+++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp
@@ -11,6 +11,8 @@
#include "Image.h"
#include "ImagePyramid.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index 114fafea55b..d79c2f4d9b0 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -9,6 +9,8 @@
#include "../stroke/ContextFunctions.h"
+#include "BLI_sys_types.h"
+
using namespace Freestyle;
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
index 097fdb6a16b..684edb26a97 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
@@ -9,6 +9,8 @@
#include "../system/RandGen.h"
+#include "BLI_sys_types.h"
+
#include <sstream>
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index d88d3edecc0..711cf9c6bab 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -12,6 +12,8 @@
#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h"
#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp
index 1c5e90474ab..860573016f2 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp
@@ -16,6 +16,8 @@
#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h"
#include "UnaryFunction1D/BPy_UnaryFunction1DVoid.h"
+#include "BLI_sys_types.h"
+
#include <sstream>
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index 7fb647119e6..92867e36479 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -12,6 +12,8 @@
#include "Interface0D/BPy_SVertex.h"
#include "Interface1D/BPy_FEdge.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index 77c3c708103..130526ac309 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -11,6 +11,8 @@
#include "Interface0D/BPy_ViewVertex.h"
#include "Interface1D/BPy_ViewEdge.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index ad54787ad05..40df2033221 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -42,6 +42,8 @@
#include "UnaryFunction1D/BPy_UnaryFunction1DVec3f.h"
#include "UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h"
+#include "BLI_sys_types.h"
+
using namespace Freestyle;
// BinaryPredicate0D: __call__
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index cb84b7e82ba..55faebc509c 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -10,6 +10,8 @@
#include "../BPy_Id.h"
#include "../Interface1D/BPy_FEdge.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index e9dcedef34e..6f90406d74d 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -13,6 +13,8 @@
#include "../Interface0D/CurvePoint/BPy_StrokeVertex.h"
#include "../Iterator/BPy_StrokeVertexIterator.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index 0a4d1a5d32c..aae8d5514c9 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -9,6 +9,8 @@
#include "../../BPy_Convert.h"
#include "../../Interface0D/BPy_SVertex.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
index 51ae9334f37..6516ad8af9c 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
@@ -9,6 +9,8 @@
#include "../../BPy_Convert.h"
#include "../../Interface0D/BPy_SVertex.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
index 29e1a1d3525..8faefd085d6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
@@ -11,6 +11,8 @@
#include "UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index e0aa5af2adb..7f5b98da223 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -11,6 +11,8 @@
#include "UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
index 3a2c9868014..82362704119 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
@@ -8,6 +8,8 @@
#include "../../../stroke/AdvancedFunctions0D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
index 41bc3199271..800a5da1978 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
@@ -12,6 +12,8 @@
#include "UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index 242f4a141bc..fa15983f0d3 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -14,6 +14,8 @@
#include "UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h"
#include "UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
index b513686524e..d1479f27935 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
@@ -10,6 +10,8 @@
#include "../../BPy_Convert.h"
#include "../../BPy_IntegrationType.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
index ecf95e189d8..99c688985f5 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
@@ -6,6 +6,8 @@
#include "BPy_EqualToChainingTimeStampUP1D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
index b75e45cb132..48365507d1a 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
@@ -6,6 +6,8 @@
#include "BPy_EqualToTimeStampUP1D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
index ad8aba9eb29..b410ee14831 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
@@ -6,6 +6,8 @@
#include "BPy_ShapeUP1D.h"
+#include "BLI_sys_types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
index 3962ac0aa35..39dbf4b87a9 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
@@ -7,6 +7,8 @@
#include "IndexedFaceSet.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
IndexedFaceSet::IndexedFaceSet()
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
index 97fa07df4c9..0089f68ce2d 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
@@ -9,6 +9,7 @@
#include "NodeTransform.h"
#include "BLI_math.h"
+#include "BLI_sys_types.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
index a4ef70722d0..0ab83003514 100644
--- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
+++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp
@@ -6,6 +6,8 @@
#include "SceneHash.h"
+#include "BLI_sys_types.h"
+
#include <sstream>
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
index cc5d8ef6ed4..4a2b6979985 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
@@ -10,6 +10,8 @@
#include "IndexedFaceSet.h"
#include "ScenePrettyPrinter.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
#define VISIT(CLASS) \
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
index 79825b626d5..a221e0e8bbd 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
@@ -10,6 +10,8 @@
#include "../view_map/SteerableViewMap.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle::Functions1D {
int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter)
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
index c19ac31ae4a..e5009f2b4f8 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h
@@ -33,7 +33,7 @@ class DensityF1D : public UnaryFunction1D<double> {
public:
/** Builds the functor.
* \param sigma:
- * Thesigma used in DensityF0D and determining the window size used in each density query.
+ * The sigma used in DensityF0D and determining the window size used in each density query.
* \param iType:
* The integration method used to compute a single value from a set of values.
* \param sampling:
diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
index 4ff00dd0a08..6508c95f2b4 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
@@ -11,6 +11,8 @@
#include "../system/PseudoNoise.h"
#include "../system/RandGen.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
/////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index 4df0bd7b089..e77ba63f3d6 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -23,6 +23,8 @@
#include "BKE_global.h"
+#include "BLI_sys_types.h"
+
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp
index af79a8eb4eb..741fad592cf 100644
--- a/source/blender/freestyle/intern/stroke/Canvas.cpp
+++ b/source/blender/freestyle/intern/stroke/Canvas.cpp
@@ -22,6 +22,8 @@
#include "../view_map/SteerableViewMap.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
// soc #include <qimage.h>
diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
index 879ea49b43a..cd37a5f893d 100644
--- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
@@ -12,6 +12,8 @@
#include "../system/TimeStamp.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle::ContextFunctions {
uint GetTimeStampCF()
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index b45e3218a13..93524e6ebe5 100644
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -14,6 +14,8 @@
#include "Stroke.h"
#include "StrokeIterators.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
index 30dacb7f7df..095cb74d607 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
@@ -9,6 +9,8 @@
#include "../geometry/GeomUtils.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp
index 79b2cea0446..fbd85815da1 100644
--- a/source/blender/freestyle/intern/system/StringUtils.cpp
+++ b/source/blender/freestyle/intern/system/StringUtils.cpp
@@ -10,6 +10,8 @@
#include "StringUtils.h"
#include "FreestyleConfig.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle::StringUtils {
void getPathName(const string &path, const string &base, vector<string> &pathnames)
diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
index 7fa4f52506d..f4619e6e85f 100644
--- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
@@ -7,6 +7,8 @@
#include "ArbitraryGridDensityProvider.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
index 11ba5933ce0..b984d5dba29 100644
--- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
@@ -7,6 +7,8 @@
#include "AverageAreaGridDensityProvider.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
index 36afb0119a2..4464aab6419 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
@@ -10,6 +10,8 @@
#include "BoxGrid.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
using namespace std;
diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
index e2886370800..c1afb6de881 100644
--- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
@@ -9,6 +9,8 @@
#include "../geometry/GridHelpers.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index e455011f187..b7e805f8767 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -12,6 +12,8 @@
#include "../geometry/GeomUtils.h"
#include "../geometry/normal_cycle.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp
index 2157c533986..aaafc5c884a 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp
@@ -8,6 +8,8 @@
#include "Functions0D.h"
#include "ViewMap.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
using namespace std;
diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
index 7e4f673e2fb..40fa8387637 100644
--- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
+++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
@@ -7,6 +7,8 @@
#include "HeuristicGridDensityProviderFactory.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
HeuristicGridDensityProviderFactory::HeuristicGridDensityProviderFactory(real sizeFactor,
diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
index 54c30661de9..7ac5de9abbc 100644
--- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
@@ -9,6 +9,8 @@
#include "OccluderSource.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
index 43809f83dc4..af6924eea6e 100644
--- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
@@ -7,6 +7,8 @@
#include "Pow23GridDensityProvider.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
index 7d9d871f586..ce4c8fcd453 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
@@ -14,6 +14,8 @@
#include "../geometry/GeomUtils.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
using namespace std;
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
index 6d800d13b3b..bb4dbd17f70 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
@@ -10,6 +10,8 @@
#include "SphericalGrid.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
using namespace std;
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index ba37dc434f4..20472599835 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -16,8 +16,10 @@
#include "../image/Image.h"
#include "../image/ImagePyramid.h"
-#include "BKE_global.h"
#include "BLI_math.h"
+#include "BLI_sys_types.h"
+
+#include "BKE_global.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index 277334d13fd..fcb157a4e60 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -13,6 +13,8 @@
#include "../winged_edge/WXEdge.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp
index 0ba4850eed5..09432aa4ac7 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp
@@ -13,6 +13,8 @@
#include "../geometry/GeomUtils.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
/**********************************/
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 4ef06c0ac96..9c2919b0ca8 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -24,6 +24,8 @@
#include "../winged_edge/WFillGrid.h"
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
index 2da95d47912..c666e548884 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
@@ -89,7 +89,7 @@ class ViewMapTesselator {
#endif
};
-/** Class to tesselate the 2D projected silhouette */
+/** Class to tessellate the 2D projected silhouette */
class ViewMapTesselator2D : public ViewMapTesselator {
public:
inline ViewMapTesselator2D() : ViewMapTesselator()
@@ -110,7 +110,7 @@ class ViewMapTesselator2D : public ViewMapTesselator {
#endif
};
-/** Class to tesselate the 3D silhouette */
+/** Class to tessellate the 3D silhouette */
class ViewMapTesselator3D : public ViewMapTesselator {
public:
inline ViewMapTesselator3D() : ViewMapTesselator()
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 33f72cc0c9f..3082988bd36 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -9,6 +9,8 @@
#include "WEdge.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
/** Temporary structures */
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
index 2c107a01d13..6838060b44e 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
@@ -6,6 +6,9 @@
*/
#include "WXEdge.h"
+
+#include "BLI_sys_types.h"
+
#include "BKE_global.h"
namespace Freestyle {
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
index 929e9b7e4dd..e22de505472 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
@@ -9,6 +9,8 @@
#include "WXEdgeBuilder.h"
#include "WXEdge.h"
+#include "BLI_sys_types.h"
+
namespace Freestyle {
void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs)
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index e8095d89ee1..ce6054830f3 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -14,6 +14,8 @@
#include "../scene_graph/NodeShape.h"
+#include "BLI_sys_types.h"
+
using namespace std;
namespace Freestyle {
diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc
index c649bde06ca..2d9c23df348 100644
--- a/source/blender/geometry/intern/realize_instances.cc
+++ b/source/blender/geometry/intern/realize_instances.cc
@@ -433,7 +433,7 @@ static void foreach_geometry_in_reference(
int index = 0;
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (&collection, object) {
const GeometrySet object_geometry_set = object_get_evaluated_geometry_set(*object);
- const float4x4 matrix = base_transform * offset_matrix * object->obmat;
+ const float4x4 matrix = base_transform * offset_matrix * object->object_to_world;
const int sub_id = noise::hash(id, index);
fn(object_geometry_set, matrix, sub_id);
index++;
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 8bb61136cc2..e51fe8832f0 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -104,9 +104,9 @@ static void BKE_gpencil_instance_modifier_instance_tfm(Object *ob,
if (mmd->flag & GP_ARRAY_USE_OFFSET) {
add_v3_v3(mat_offset[3], mmd->offset);
}
- invert_m4_m4(obinv, ob->obmat);
+ invert_m4_m4(obinv, ob->object_to_world);
- mul_m4_series(r_offset, mat_offset, obinv, mmd->object->obmat);
+ mul_m4_series(r_offset, mat_offset, obinv, mmd->object->object_to_world);
copy_m4_m4(mat_offset, r_offset);
/* clear r_mat locations to avoid double transform */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index 3c971ec6af0..49ac3275c82 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -303,8 +303,8 @@ static void build_sequential(Object *ob,
/* Compute distance to control object if set, and build according to that order. */
if (mmd->object) {
float sv1[3], sv2[3];
- mul_v3_m4v3(sv1, ob->obmat, &gps->points[0].x);
- mul_v3_m4v3(sv2, ob->obmat, &gps->points[gps->totpoints - 1].x);
+ mul_v3_m4v3(sv1, ob->object_to_world, &gps->points[0].x);
+ mul_v3_m4v3(sv2, ob->object_to_world, &gps->points[gps->totpoints - 1].x);
float dist_l = len_v3v3(sv1, mmd->object->loc);
float dist_r = len_v3v3(sv2, mmd->object->loc);
if (dist_r < dist_l) {
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index 1a2bfebdc55..e3b4e1c5e02 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -234,14 +234,14 @@ static void deformStroke(GpencilModifierData *md,
/* get world-space matrix of target, corrected for the space the verts are in */
if (mmd->subtarget[0] && pchan) {
/* bone target if there's a matching pose-channel */
- mul_m4_m4m4(dmat, mmd->object->obmat, pchan->pose_mat);
+ mul_m4_m4m4(dmat, mmd->object->object_to_world, pchan->pose_mat);
}
else {
/* just object target */
- copy_m4_m4(dmat, mmd->object->obmat);
+ copy_m4_m4(dmat, mmd->object->object_to_world);
}
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_series(tData.mat, ob->imat, dmat, mmd->parentinv);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_series(tData.mat, ob->world_to_object, dmat, mmd->parentinv);
/* loop points and apply deform */
for (int i = 0; i < gps->totpoints; i++) {
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
index 326e86091c5..bc91094e80e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
@@ -81,8 +81,8 @@ static void update_mirror_object(Object *ob,
float tmp[4][4];
float itmp[4][4];
- invert_m4_m4(tmp, mmd->object->obmat);
- mul_m4_m4m4(tmp, tmp, ob->obmat);
+ invert_m4_m4(tmp, mmd->object->object_to_world);
+ mul_m4_m4m4(tmp, tmp, ob->object_to_world);
invert_m4_m4(itmp, tmp);
mul_m4_series(mtx, itmp, mtx, tmp);
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
index 1cf11a694ac..cb4a7893080 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
@@ -109,7 +109,7 @@ static void duplicateStroke(Object *ob,
float opacity_factor;
/* Apply object scale to offset distance. */
- offset *= mat4_to_scale(ob->obmat);
+ offset *= mat4_to_scale(ob->object_to_world);
BKE_gpencil_stroke_normal(gps, stroke_normal);
if (len_v3(stroke_normal) < FLT_EPSILON) {
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
index 387e3c2d5ce..455d8b0b528 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloutline.c
@@ -116,7 +116,7 @@ static void convert_stroke(GpencilModifierData *md,
/* Apply layer thickness change. */
gps_duplicate->thickness += gpl->line_change;
/* Apply object scale to thickness. */
- gps_duplicate->thickness *= mat4_to_scale(ob->obmat);
+ gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
/* Stroke. */
@@ -197,7 +197,7 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
}
Object *cam_ob = scene->camera;
float viewmat[4][4];
- invert_m4_m4(viewmat, cam_ob->obmat);
+ invert_m4_m4(viewmat, cam_ob->object_to_world);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
@@ -240,7 +240,7 @@ static void bakeModifier(Main *UNUSED(bmain),
BKE_scene_graph_update_for_newframe(depsgraph);
/* Ensure the camera is the right one. */
BKE_scene_camera_switch_update(scene);
- invert_m4_m4(viewmat, cam_ob->obmat);
+ invert_m4_m4(viewmat, cam_ob->object_to_world);
/* Prepare transform matrix. */
float diff_mat[4][4];
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
index 94d8cb98290..8331188fbd8 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
@@ -144,7 +144,7 @@ static void deformStroke(GpencilModifierData *md,
float coba_res[4];
float matrix[4][4];
if (is_gradient) {
- mul_m4_m4m4(matrix, mmd->object->imat, ob->obmat);
+ mul_m4_m4m4(matrix, mmd->object->world_to_object, ob->object_to_world);
}
/* loop points and apply color. */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_angle.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_angle.c
index 3ecff4bf447..e9761732614 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_angle.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_angle.c
@@ -97,7 +97,7 @@ static void deformStroke(GpencilModifierData *md,
/* Apply the rotation of the object. */
if (mmd->space == GP_SPACE_LOCAL) {
- mul_mat3_m4_v3(ob->obmat, vec_ref);
+ mul_mat3_m4_v3(ob->object_to_world, vec_ref);
}
/* Ensure there is a vertex group. */
@@ -122,8 +122,8 @@ static void deformStroke(GpencilModifierData *md,
bGPDspoint *pt1 = (i > 0) ? &gps->points[i] : &gps->points[i + 1];
bGPDspoint *pt2 = (i > 0) ? &gps->points[i - 1] : &gps->points[i];
float fpt1[3], fpt2[3];
- mul_v3_m4v3(fpt1, ob->obmat, &pt1->x);
- mul_v3_m4v3(fpt2, ob->obmat, &pt2->x);
+ mul_v3_m4v3(fpt1, ob->object_to_world, &pt1->x);
+ mul_v3_m4v3(fpt2, ob->object_to_world, &pt2->x);
float vec[3];
sub_v3_v3v3(vec, fpt1, fpt2);
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
index f64c83443d8..ddf852bcd11 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
@@ -64,8 +64,8 @@ static float calc_point_weight_by_distance(Object *ob,
{
float weight;
float gvert[3];
- mul_v3_m4v3(gvert, ob->obmat, &pt->x);
- float dist = len_v3v3(mmd->object->obmat[3], gvert);
+ mul_v3_m4v3(gvert, ob->object_to_world, &pt->x);
+ float dist = len_v3v3(mmd->object->object_to_world[3], gvert);
if (dist > dist_max) {
weight = 1.0f;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc
index 5e741ccbd55..85f158d42e6 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc
@@ -9,17 +9,15 @@
#include "MOD_lineart.h"
#include "lineart_intern.h"
-static bool cmp_adjacent_items(const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2)
-{
- int a = p1.v1 - p2.v1;
- int b = p1.v2 - p2.v2;
- /* parallel_sort() requires cmp() to return true when the first element needs to appear before
- * the second element in the sorted array, false otherwise (strict weak ordering), see
- * https://en.cppreference.com/w/cpp/named_req/Compare. */
- return a < 0 ? true : (a == 0 ? b < 0 : false);
-}
-
void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length)
{
- blender::parallel_sort(ai, ai + length, cmp_adjacent_items);
+ blender::parallel_sort(
+ ai, ai + length, [](const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2) {
+ int a = p1.v1 - p2.v1;
+ int b = p1.v2 - p2.v2;
+ /* parallel_sort() requires cmp() to return true when the first element needs to appear
+ * before the second element in the sorted array, false otherwise (strict weak ordering),
+ * see https://en.cppreference.com/w/cpp/named_req/Compare. */
+ return a < 0 ? true : (a == 0 ? b < 0 : false);
+ });
}
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index c1e71bde254..4b5c40c0e38 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2633,7 +2633,7 @@ void lineart_main_load_geometries(Depsgraph *depsgraph,
scene,
eval_ob,
eval_ob,
- eval_ob->obmat,
+ eval_ob->object_to_world,
is_render,
olti,
thread_count,
@@ -3589,11 +3589,11 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
clipping_offset = 0.0001;
}
- copy_v3db_v3fl(ld->conf.camera_pos, camera->obmat[3]);
+ copy_v3db_v3fl(ld->conf.camera_pos, camera->object_to_world[3]);
if (active_camera) {
- copy_v3db_v3fl(ld->conf.active_camera_pos, active_camera->obmat[3]);
+ copy_v3db_v3fl(ld->conf.active_camera_pos, active_camera->object_to_world[3]);
}
- copy_m4_m4(ld->conf.cam_obmat, camera->obmat);
+ copy_m4_m4(ld->conf.cam_obmat, camera->object_to_world);
ld->conf.cam_is_persp = (c->type == CAM_PERSP);
ld->conf.near_clip = c->clip_start + clipping_offset;
@@ -3620,8 +3620,8 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
if (lmd->light_contour_object) {
Object *light_obj = lmd->light_contour_object;
- copy_v3db_v3fl(ld->conf.camera_pos_secondary, light_obj->obmat[3]);
- copy_m4_m4(ld->conf.cam_obmat_secondary, light_obj->obmat);
+ copy_v3db_v3fl(ld->conf.camera_pos_secondary, light_obj->object_to_world[3]);
+ copy_m4_m4(ld->conf.cam_obmat_secondary, light_obj->object_to_world);
ld->conf.light_reference_available = true;
if (light_obj->type == OB_LAMP) {
ld->conf.cam_is_persp_secondary = ((Light *)light_obj->data)->type != LA_SUN;
@@ -5418,7 +5418,7 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
}
float gp_obmat_inverse[4][4];
- invert_m4_m4(gp_obmat_inverse, ob->obmat);
+ invert_m4_m4(gp_obmat_inverse, ob->object_to_world);
lineart_gpencil_generate(cache,
depsgraph,
ob,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
index 80517979f30..6f44cc68a19 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
@@ -154,7 +154,7 @@ static bool bake_strokes(Object *ob,
typedef struct LineartBakeJob {
wmWindowManager *wm;
void *owner;
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
/* C or ob must have one != NULL. */
@@ -218,8 +218,8 @@ static void lineart_gpencil_guard_modifiers(LineartBakeJob *bj)
}
static void lineart_gpencil_bake_startjob(void *customdata,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
LineartBakeJob *bj = (LineartBakeJob *)customdata;
@@ -337,7 +337,7 @@ static int lineart_gpencil_bake_common(bContext *C,
}
float pseduo_progress;
- short pseduo_do_update;
+ bool pseduo_do_update;
lineart_gpencil_bake_startjob(bj, NULL, &pseduo_do_update, &pseduo_progress);
BLI_linklist_free(bj->objects, NULL);
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
index e34e6fc43ea..edea052e728 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
@@ -1167,7 +1167,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
copy_v3_v3_db(ld->conf.camera_pos_secondary, ld->conf.camera_pos);
copy_m4_m4(ld->conf.cam_obmat_secondary, ld->conf.cam_obmat);
- copy_m4_m4(ld->conf.cam_obmat, lmd->light_contour_object->obmat);
+ copy_m4_m4(ld->conf.cam_obmat, lmd->light_contour_object->object_to_world);
copy_v3db_v3fl(ld->conf.camera_pos, ld->conf.cam_obmat[3]);
ld->conf.cam_is_persp_secondary = ld->conf.cam_is_persp;
ld->conf.cam_is_persp = is_persp;
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 58b1cd0a50b..8da17720339 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -12,6 +12,7 @@ endif()
set(INC
.
intern
+ vulkan
metal
opengl
../blenkernel
@@ -26,6 +27,7 @@ set(INC
../editors/include
# For *_info.hh includes.
+ ../compositor/realtime_compositor
../draw/engines/eevee_next
../draw/intern
@@ -184,6 +186,34 @@ set(OPENGL_SRC
opengl/gl_vertex_buffer.hh
)
+set(VULKAN_SRC
+ vulkan/vk_backend.cc
+ vulkan/vk_batch.cc
+ vulkan/vk_context.cc
+ vulkan/vk_drawlist.cc
+ vulkan/vk_framebuffer.cc
+ vulkan/vk_index_buffer.cc
+ vulkan/vk_query.cc
+ vulkan/vk_shader.cc
+ vulkan/vk_storage_buffer.cc
+ vulkan/vk_texture.cc
+ vulkan/vk_uniform_buffer.cc
+ vulkan/vk_vertex_buffer.cc
+
+ vulkan/vk_backend.hh
+ vulkan/vk_batch.hh
+ vulkan/vk_context.hh
+ vulkan/vk_drawlist.hh
+ vulkan/vk_framebuffer.hh
+ vulkan/vk_index_buffer.hh
+ vulkan/vk_query.hh
+ vulkan/vk_shader.hh
+ vulkan/vk_storage_buffer.hh
+ vulkan/vk_texture.hh
+ vulkan/vk_uniform_buffer.hh
+ vulkan/vk_vertex_buffer.hh
+)
+
set(METAL_SRC
metal/mtl_backend.mm
metal/mtl_batch.mm
@@ -235,6 +265,10 @@ if(WITH_OPENGL)
list(APPEND SRC ${OPENGL_SRC})
endif()
+if(WITH_VULKAN_BACKEND)
+ list(APPEND SRC ${VULKAN_SRC})
+endif()
+
if(WITH_METAL_BACKEND)
list(APPEND SRC ${METAL_SRC})
endif()
@@ -333,64 +367,6 @@ set(GLSL_SRC
shaders/common/gpu_shader_common_math_utils.glsl
shaders/common/gpu_shader_common_mix_rgb.glsl
- shaders/compositor/compositor_alpha_crop.glsl
- shaders/compositor/compositor_bilateral_blur.glsl
- shaders/compositor/compositor_blur.glsl
- shaders/compositor/compositor_blur_variable_size.glsl
- shaders/compositor/compositor_bokeh_image.glsl
- shaders/compositor/compositor_box_mask.glsl
- shaders/compositor/compositor_convert.glsl
- shaders/compositor/compositor_despeckle.glsl
- shaders/compositor/compositor_directional_blur.glsl
- shaders/compositor/compositor_edge_filter.glsl
- shaders/compositor/compositor_ellipse_mask.glsl
- shaders/compositor/compositor_filter.glsl
- shaders/compositor/compositor_flip.glsl
- shaders/compositor/compositor_image_crop.glsl
- shaders/compositor/compositor_morphological_distance.glsl
- shaders/compositor/compositor_morphological_distance_feather.glsl
- shaders/compositor/compositor_morphological_distance_threshold.glsl
- shaders/compositor/compositor_morphological_step.glsl
- shaders/compositor/compositor_normalize.glsl
- shaders/compositor/compositor_parallel_reduction.glsl
- shaders/compositor/compositor_projector_lens_distortion.glsl
- shaders/compositor/compositor_realize_on_domain.glsl
- shaders/compositor/compositor_screen_lens_distortion.glsl
- shaders/compositor/compositor_set_alpha.glsl
- shaders/compositor/compositor_split_viewer.glsl
- shaders/compositor/compositor_symmetric_blur.glsl
- shaders/compositor/compositor_symmetric_separable_blur.glsl
- shaders/compositor/compositor_tone_map_photoreceptor.glsl
- shaders/compositor/compositor_tone_map_simple.glsl
-
- shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
- shaders/compositor/library/gpu_shader_compositor_blur_common.glsl
- shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
- shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
- shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
- shaders/compositor/library/gpu_shader_compositor_color_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_color_spill.glsl
- shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
- shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_exposure.glsl
- shaders/compositor/library/gpu_shader_compositor_gamma.glsl
- shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
- shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
- shaders/compositor/library/gpu_shader_compositor_invert.glsl
- shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl
- shaders/compositor/library/gpu_shader_compositor_main.glsl
- shaders/compositor/library/gpu_shader_compositor_map_value.glsl
- shaders/compositor/library/gpu_shader_compositor_normal.glsl
- shaders/compositor/library/gpu_shader_compositor_posterize.glsl
- shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl
- shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl
- shaders/compositor/library/gpu_shader_compositor_store_output.glsl
- shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
- shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl
-
shaders/material/gpu_shader_material_add_shader.glsl
shaders/material/gpu_shader_material_ambient_occlusion.glsl
shaders/material/gpu_shader_material_anisotropic.glsl
@@ -618,36 +594,6 @@ set(SRC_SHADER_CREATE_INFOS
shaders/infos/gpu_shader_simple_lighting_info.hh
shaders/infos/gpu_shader_text_info.hh
shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
-
- shaders/compositor/infos/compositor_alpha_crop_info.hh
- shaders/compositor/infos/compositor_bilateral_blur_info.hh
- shaders/compositor/infos/compositor_blur_info.hh
- shaders/compositor/infos/compositor_blur_variable_size_info.hh
- shaders/compositor/infos/compositor_bokeh_image_info.hh
- shaders/compositor/infos/compositor_box_mask_info.hh
- shaders/compositor/infos/compositor_convert_info.hh
- shaders/compositor/infos/compositor_despeckle_info.hh
- shaders/compositor/infos/compositor_directional_blur_info.hh
- shaders/compositor/infos/compositor_edge_filter_info.hh
- shaders/compositor/infos/compositor_ellipse_mask_info.hh
- shaders/compositor/infos/compositor_filter_info.hh
- shaders/compositor/infos/compositor_flip_info.hh
- shaders/compositor/infos/compositor_image_crop_info.hh
- shaders/compositor/infos/compositor_morphological_distance_feather_info.hh
- shaders/compositor/infos/compositor_morphological_distance_info.hh
- shaders/compositor/infos/compositor_morphological_distance_threshold_info.hh
- shaders/compositor/infos/compositor_morphological_step_info.hh
- shaders/compositor/infos/compositor_normalize_info.hh
- shaders/compositor/infos/compositor_parallel_reduction_info.hh
- shaders/compositor/infos/compositor_projector_lens_distortion_info.hh
- shaders/compositor/infos/compositor_realize_on_domain_info.hh
- shaders/compositor/infos/compositor_screen_lens_distortion_info.hh
- shaders/compositor/infos/compositor_set_alpha_info.hh
- shaders/compositor/infos/compositor_split_viewer_info.hh
- shaders/compositor/infos/compositor_symmetric_blur_info.hh
- shaders/compositor/infos/compositor_symmetric_separable_blur_info.hh
- shaders/compositor/infos/compositor_tone_map_photoreceptor_info.hh
- shaders/compositor/infos/compositor_tone_map_simple_info.hh
)
set(SRC_SHADER_CREATE_INFOS_MTL
@@ -682,6 +628,7 @@ endif()
blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
target_link_libraries(bf_gpu PUBLIC
+ bf_compositor_shaders
bf_draw_shaders
bf_gpu_shaders
)
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index bdb384c16f1..917407eece3 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -47,6 +47,9 @@ typedef struct GPUOffScreen GPUOffScreen;
GPUFrameBuffer *GPU_framebuffer_create(const char *name);
void GPU_framebuffer_free(GPUFrameBuffer *fb);
void GPU_framebuffer_bind(GPUFrameBuffer *fb);
+
+const char *GPU_framebuffer_get_name(GPUFrameBuffer *fb);
+
/**
* Workaround for binding a SRGB frame-buffer without doing the SRGB transform.
*/
diff --git a/source/blender/gpu/GPU_platform.h b/source/blender/gpu/GPU_platform.h
index b63fe4c0580..657b45df1a5 100644
--- a/source/blender/gpu/GPU_platform.h
+++ b/source/blender/gpu/GPU_platform.h
@@ -16,6 +16,7 @@ typedef enum eGPUBackendType {
GPU_BACKEND_NONE = 0,
GPU_BACKEND_OPENGL = 1 << 0,
GPU_BACKEND_METAL = 1 << 1,
+ GPU_BACKEND_VULKAN = 1 << 3,
GPU_BACKEND_ANY = 0xFFFFFFFFu
} eGPUBackendType;
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index f6b88c4231c..7e94538892a 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -33,6 +33,9 @@
# include "gl_backend.hh"
# include "gl_context.hh"
#endif
+#ifdef WITH_VULKAN_BACKEND
+# include "vk_backend.hh"
+#endif
#ifdef WITH_METAL_BACKEND
# include "mtl_backend.hh"
#endif
@@ -245,6 +248,12 @@ bool GPU_backend_supported(void)
#else
return false;
#endif
+ case GPU_BACKEND_VULKAN:
+#ifdef WITH_VULKAN_BACKEND
+ return true;
+#else
+ return false;
+#endif
case GPU_BACKEND_METAL:
#ifdef WITH_METAL_BACKEND
return MTLBackend::metal_is_supported();
@@ -268,6 +277,11 @@ static void gpu_backend_create()
g_backend = new GLBackend;
break;
#endif
+#ifdef WITH_VULKAN_BACKEND
+ case GPU_BACKEND_VULKAN:
+ g_backend = new VKBackend;
+ break;
+#endif
#ifdef WITH_METAL_BACKEND
case GPU_BACKEND_METAL:
g_backend = new MTLBackend;
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 6528f39d4ec..5b50fd66196 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -238,6 +238,11 @@ void GPU_framebuffer_free(GPUFrameBuffer *gpu_fb)
delete unwrap(gpu_fb);
}
+const char *GPU_framebuffer_get_name(GPUFrameBuffer *gpu_fb)
+{
+ return unwrap(gpu_fb)->name_get();
+}
+
/* ---------- Binding ----------- */
void GPU_framebuffer_bind(GPUFrameBuffer *gpu_fb)
diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh
index 5afcc102e44..cb7fd62445c 100644
--- a/source/blender/gpu/intern/gpu_framebuffer_private.hh
+++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh
@@ -204,6 +204,11 @@ class FrameBuffer {
{
return attachments_[GPU_FB_COLOR_ATTACHMENT0 + slot].tex;
};
+
+ inline const char *const name_get() const
+ {
+ return name_;
+ };
};
/* Syntactic sugar. */
diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc
index ff7aa65f03f..ebbddccbe47 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.cc
+++ b/source/blender/gpu/intern/gpu_shader_create_info.cc
@@ -284,6 +284,7 @@ void gpu_shader_create_info_init()
_info
/* Declare, register and construct the infos. */
+#include "compositor_shader_create_info_list.hh"
#include "gpu_shader_create_info_list.hh"
/* Baked shader data appended to create infos. */
diff --git a/source/blender/gpu/intern/gpu_shader_dependency.cc b/source/blender/gpu/intern/gpu_shader_dependency.cc
index be53ee5d945..7d5b8c891b9 100644
--- a/source/blender/gpu/intern/gpu_shader_dependency.cc
+++ b/source/blender/gpu/intern/gpu_shader_dependency.cc
@@ -24,6 +24,7 @@
extern "C" {
#define SHADER_SOURCE(datatoc, filename, filepath) extern char datatoc[];
+#include "glsl_compositor_source_list.h"
#include "glsl_draw_source_list.h"
#include "glsl_gpu_source_list.h"
#ifdef WITH_OCIO
@@ -845,6 +846,7 @@ void gpu_shader_dependency_init()
#define SHADER_SOURCE(datatoc, filename, filepath) \
g_sources->add_new(filename, new GPUSource(filepath, filename, datatoc, g_functions));
+#include "glsl_compositor_source_list.h"
#include "glsl_draw_source_list.h"
#include "glsl_gpu_source_list.h"
#ifdef WITH_OCIO
diff --git a/source/blender/gpu/metal/mtl_shader_generator.hh b/source/blender/gpu/metal/mtl_shader_generator.hh
index 43890ca0170..63e2e6d5924 100644
--- a/source/blender/gpu/metal/mtl_shader_generator.hh
+++ b/source/blender/gpu/metal/mtl_shader_generator.hh
@@ -497,7 +497,7 @@ inline std::string get_stage_class_name(ShaderStage stage)
inline bool is_builtin_type(std::string type)
{
/* Add Types as needed. */
- /* TODO(Metal): Consider replacing this with a switch and constexpr hash and switch.
+ /* TODO(Metal): Consider replacing this with a switch and `constexpr` hash and switch.
* Though most efficient and maintainable approach to be determined. */
static std::map<std::string, eMTLDataType> glsl_builtin_types = {
{"float", MTL_DATATYPE_FLOAT},
diff --git a/source/blender/gpu/metal/mtl_texture_util.mm b/source/blender/gpu/metal/mtl_texture_util.mm
index 5ed7659f260..33a62e2e3ef 100644
--- a/source/blender/gpu/metal/mtl_texture_util.mm
+++ b/source/blender/gpu/metal/mtl_texture_util.mm
@@ -34,7 +34,7 @@ MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format)
{
switch (tex_format) {
- /* Formats texture & renderbuffer. */
+ /* Formats texture & render-buffer. */
case GPU_RGBA8UI:
return MTLPixelFormatRGBA8Uint;
case GPU_RGBA8I:
diff --git a/source/blender/gpu/vulkan/vk_backend.cc b/source/blender/gpu/vulkan/vk_backend.cc
new file mode 100644
index 00000000000..00bc43333d6
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -0,0 +1,107 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_backend.hh"
+
+#include "vk_batch.hh"
+#include "vk_context.hh"
+#include "vk_drawlist.hh"
+#include "vk_framebuffer.hh"
+#include "vk_index_buffer.hh"
+#include "vk_query.hh"
+#include "vk_shader.hh"
+#include "vk_storage_buffer.hh"
+#include "vk_texture.hh"
+#include "vk_uniform_buffer.hh"
+#include "vk_vertex_buffer.hh"
+
+namespace blender::gpu {
+
+void VKBackend::delete_resources()
+{
+}
+
+void VKBackend::samplers_update()
+{
+}
+
+void VKBackend::compute_dispatch(int /*groups_x_len*/, int /*groups_y_len*/, int /*groups_z_len*/)
+{
+}
+
+void VKBackend::compute_dispatch_indirect(StorageBuf * /*indirect_buf*/)
+{
+}
+
+Context *VKBackend::context_alloc(void * /*ghost_window*/, void * /*ghost_context*/)
+{
+ return new VKContext();
+}
+
+Batch *VKBackend::batch_alloc()
+{
+ return new VKBatch();
+}
+
+DrawList *VKBackend::drawlist_alloc(int /*list_length*/)
+{
+ return new VKDrawList();
+}
+
+FrameBuffer *VKBackend::framebuffer_alloc(const char *name)
+{
+ return new VKFrameBuffer(name);
+}
+
+IndexBuf *VKBackend::indexbuf_alloc()
+{
+ return new VKIndexBuffer();
+}
+
+QueryPool *VKBackend::querypool_alloc()
+{
+ return new VKQueryPool();
+}
+
+Shader *VKBackend::shader_alloc(const char *name)
+{
+ return new VKShader(name);
+}
+
+Texture *VKBackend::texture_alloc(const char *name)
+{
+ return new VKTexture(name);
+}
+
+UniformBuf *VKBackend::uniformbuf_alloc(int size, const char *name)
+{
+ return new VKUniformBuffer(size, name);
+}
+
+StorageBuf *VKBackend::storagebuf_alloc(int size, GPUUsageType /*usage*/, const char *name)
+{
+ return new VKStorageBuffer(size, name);
+}
+
+VertBuf *VKBackend::vertbuf_alloc()
+{
+ return new VKVertexBuffer();
+}
+
+void VKBackend::render_begin()
+{
+}
+
+void VKBackend::render_end()
+{
+}
+
+void VKBackend::render_step()
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_backend.hh b/source/blender/gpu/vulkan/vk_backend.hh
new file mode 100644
index 00000000000..549478586e8
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_backend.hh
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_backend.hh"
+
+namespace blender::gpu {
+
+class VKBackend : public GPUBackend {
+ public:
+ void delete_resources() override;
+
+ void samplers_update() override;
+ void compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len) override;
+ void compute_dispatch_indirect(StorageBuf *indirect_buf) override;
+
+ Context *context_alloc(void *ghost_window, void *ghost_context) override;
+
+ Batch *batch_alloc() override;
+ DrawList *drawlist_alloc(int list_length) override;
+ FrameBuffer *framebuffer_alloc(const char *name) override;
+ IndexBuf *indexbuf_alloc() override;
+ QueryPool *querypool_alloc() override;
+ Shader *shader_alloc(const char *name) override;
+ Texture *texture_alloc(const char *name) override;
+ UniformBuf *uniformbuf_alloc(int size, const char *name) override;
+ StorageBuf *storagebuf_alloc(int size, GPUUsageType usage, const char *name) override;
+ VertBuf *vertbuf_alloc() override;
+
+ /* Render Frame Coordination --
+ * Used for performing per-frame actions globally */
+ void render_begin() override;
+ void render_end() override;
+ void render_step() override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_batch.cc b/source/blender/gpu/vulkan/vk_batch.cc
new file mode 100644
index 00000000000..a25f98a2e24
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_batch.cc
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_batch.hh"
+
+namespace blender::gpu {
+
+void VKBatch::draw(int /*v_first*/, int /*v_count*/, int /*i_first*/, int /*i_count*/)
+{
+}
+
+void VKBatch::draw_indirect(GPUStorageBuf * /*indirect_buf*/, intptr_t /*offset*/)
+{
+}
+
+void VKBatch::multi_draw_indirect(GPUStorageBuf * /*indirect_buf*/,
+ int /*count*/,
+ intptr_t /*offset*/,
+ intptr_t /*stride*/)
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_batch.hh b/source/blender/gpu/vulkan/vk_batch.hh
new file mode 100644
index 00000000000..0f6df41606d
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_batch.hh
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_batch_private.hh"
+
+namespace blender::gpu {
+
+class VKBatch : public Batch {
+ public:
+ void draw(int v_first, int v_count, int i_first, int i_count) override;
+ void draw_indirect(GPUStorageBuf *indirect_buf, intptr_t offset) override;
+ void multi_draw_indirect(GPUStorageBuf *indirect_buf,
+ int count,
+ intptr_t offset,
+ intptr_t stride) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc
new file mode 100644
index 00000000000..55b29ea4e2f
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_context.cc
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_context.hh"
+
+namespace blender::gpu {
+
+void VKContext::activate()
+{
+}
+
+void VKContext::deactivate()
+{
+}
+
+void VKContext::begin_frame()
+{
+}
+
+void VKContext::end_frame()
+{
+}
+
+void VKContext::flush()
+{
+}
+
+void VKContext::finish()
+{
+}
+
+void VKContext::memory_statistics_get(int * /*total_mem*/, int * /*free_mem*/)
+{
+}
+
+void VKContext::debug_group_begin(const char *, int)
+{
+}
+
+void VKContext::debug_group_end()
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_context.hh b/source/blender/gpu/vulkan/vk_context.hh
new file mode 100644
index 00000000000..17292b891b6
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_context.hh
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_context_private.hh"
+
+namespace blender::gpu {
+
+class VKContext : public Context {
+ public:
+ VKContext()
+ {
+ }
+
+ void activate() override;
+ void deactivate() override;
+ void begin_frame() override;
+ void end_frame() override;
+
+ void flush() override;
+ void finish() override;
+
+ void memory_statistics_get(int *total_mem, int *free_mem) override;
+
+ void debug_group_begin(const char *, int) override;
+ void debug_group_end() override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_drawlist.cc b/source/blender/gpu/vulkan/vk_drawlist.cc
new file mode 100644
index 00000000000..c8f3c736bb8
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_drawlist.cc
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_drawlist.hh"
+
+namespace blender::gpu {
+
+void VKDrawList::append(GPUBatch * /*batch*/, int /*i_first*/, int /*i_count*/)
+{
+}
+
+void VKDrawList::submit()
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_drawlist.hh b/source/blender/gpu/vulkan/vk_drawlist.hh
new file mode 100644
index 00000000000..4707bf4bb26
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_drawlist.hh
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_drawlist_private.hh"
+
+namespace blender::gpu {
+
+class VKDrawList : public DrawList {
+ public:
+ void append(GPUBatch *batch, int i_first, int i_count) override;
+ void submit() override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc
new file mode 100644
index 00000000000..48b0685bf38
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_framebuffer.cc
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_framebuffer.hh"
+
+namespace blender::gpu {
+
+void VKFrameBuffer::bind(bool /*enabled_srgb*/)
+{
+}
+
+bool VKFrameBuffer::check(char /*err_out*/[256])
+{
+ return false;
+}
+
+void VKFrameBuffer::clear(eGPUFrameBufferBits /*buffers*/,
+ const float /*clear_col*/[4],
+ float /*clear_depth*/,
+ uint /*clear_stencil*/)
+{
+}
+
+void VKFrameBuffer::clear_multi(const float (*/*clear_col*/)[4])
+{
+}
+
+void VKFrameBuffer::clear_attachment(GPUAttachmentType /*type*/,
+ eGPUDataFormat /*data_format*/,
+ const void * /*clear_value*/)
+{
+}
+
+void VKFrameBuffer::attachment_set_loadstore_op(GPUAttachmentType /*type*/,
+ eGPULoadOp /*load_action*/,
+ eGPUStoreOp /*store_action*/)
+{
+}
+
+void VKFrameBuffer::read(eGPUFrameBufferBits /*planes*/,
+ eGPUDataFormat /*format*/,
+ const int /*area*/[4],
+ int /*channel_len*/,
+ int /*slot*/,
+ void * /*r_data*/)
+{
+}
+
+void VKFrameBuffer::blit_to(eGPUFrameBufferBits /*planes*/,
+ int /*src_slot*/,
+ FrameBuffer * /*dst*/,
+ int /*dst_slot*/,
+ int /*dst_offset_x*/,
+ int /*dst_offset_y*/)
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_framebuffer.hh b/source/blender/gpu/vulkan/vk_framebuffer.hh
new file mode 100644
index 00000000000..632d45ce709
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_framebuffer.hh
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_framebuffer_private.hh"
+
+namespace blender::gpu {
+
+class VKFrameBuffer : public FrameBuffer {
+ public:
+ VKFrameBuffer(const char *name) : FrameBuffer(name)
+ {
+ }
+
+ void bind(bool enabled_srgb) override;
+ bool check(char err_out[256]) override;
+ void clear(eGPUFrameBufferBits buffers,
+ const float clear_col[4],
+ float clear_depth,
+ uint clear_stencil) override;
+ void clear_multi(const float (*clear_col)[4]) override;
+ void clear_attachment(GPUAttachmentType type,
+ eGPUDataFormat data_format,
+ const void *clear_value) override;
+
+ void attachment_set_loadstore_op(GPUAttachmentType type,
+ eGPULoadOp load_action,
+ eGPUStoreOp store_action) override;
+
+ void read(eGPUFrameBufferBits planes,
+ eGPUDataFormat format,
+ const int area[4],
+ int channel_len,
+ int slot,
+ void *r_data) override;
+
+ void blit_to(eGPUFrameBufferBits planes,
+ int src_slot,
+ FrameBuffer *dst,
+ int dst_slot,
+ int dst_offset_x,
+ int dst_offset_y) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_index_buffer.cc b/source/blender/gpu/vulkan/vk_index_buffer.cc
new file mode 100644
index 00000000000..119a617a159
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_index_buffer.cc
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_index_buffer.hh"
+
+namespace blender::gpu {
+
+void VKIndexBuffer::upload_data()
+{
+}
+
+void VKIndexBuffer::bind_as_ssbo(uint /*binding*/)
+{
+}
+
+const uint32_t *VKIndexBuffer::read() const
+{
+ return 0;
+}
+
+void VKIndexBuffer::update_sub(uint /*start*/, uint /*len*/, const void * /*data*/)
+{
+}
+
+void VKIndexBuffer::strip_restart_indices()
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_index_buffer.hh b/source/blender/gpu/vulkan/vk_index_buffer.hh
new file mode 100644
index 00000000000..f002d5581c7
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_index_buffer.hh
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_index_buffer_private.hh"
+
+namespace blender::gpu {
+
+class VKIndexBuffer : public IndexBuf {
+ public:
+ void upload_data() override;
+
+ void bind_as_ssbo(uint binding) override;
+
+ const uint32_t *read() const override;
+
+ void update_sub(uint start, uint len, const void *data) override;
+
+ private:
+ void strip_restart_indices() override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_query.cc b/source/blender/gpu/vulkan/vk_query.cc
new file mode 100644
index 00000000000..e24fe54e5d0
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_query.cc
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_query.hh"
+
+namespace blender::gpu {
+
+void VKQueryPool::init(GPUQueryType /*type*/)
+{
+}
+
+void VKQueryPool::begin_query()
+{
+}
+
+void VKQueryPool::end_query()
+{
+}
+
+void VKQueryPool::get_occlusion_result(MutableSpan<uint32_t> /*r_values*/)
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_query.hh b/source/blender/gpu/vulkan/vk_query.hh
new file mode 100644
index 00000000000..36558ef9549
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_query.hh
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_query.hh"
+
+namespace blender::gpu {
+
+class VKQueryPool : public QueryPool {
+ public:
+ void init(GPUQueryType type) override;
+ void begin_query() override;
+ void end_query() override;
+ void get_occlusion_result(MutableSpan<uint32_t> r_values) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_shader.cc b/source/blender/gpu/vulkan/vk_shader.cc
new file mode 100644
index 00000000000..d628f3eb851
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -0,0 +1,102 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_shader.hh"
+
+namespace blender::gpu {
+void VKShader::vertex_shader_from_glsl(MutableSpan<const char *> /*sources*/)
+{
+}
+
+void VKShader::geometry_shader_from_glsl(MutableSpan<const char *> /*sources*/)
+{
+}
+
+void VKShader::fragment_shader_from_glsl(MutableSpan<const char *> /*sources*/)
+{
+}
+
+void VKShader::compute_shader_from_glsl(MutableSpan<const char *> /*sources*/)
+{
+}
+
+bool VKShader::finalize(const shader::ShaderCreateInfo * /*info*/)
+{
+ return false;
+}
+
+void VKShader::transform_feedback_names_set(Span<const char *> /*name_list*/,
+ eGPUShaderTFBType /*geom_type*/)
+{
+}
+
+bool VKShader::transform_feedback_enable(GPUVertBuf *)
+{
+ return false;
+}
+
+void VKShader::transform_feedback_disable()
+{
+}
+
+void VKShader::bind()
+{
+}
+
+void VKShader::unbind()
+{
+}
+
+void VKShader::uniform_float(int /*location*/,
+ int /*comp_len*/,
+ int /*array_size*/,
+ const float * /*data*/)
+{
+}
+void VKShader::uniform_int(int /*location*/,
+ int /*comp_len*/,
+ int /*array_size*/,
+ const int * /*data*/)
+{
+}
+
+std::string VKShader::resources_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+std::string VKShader::vertex_interface_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+std::string VKShader::fragment_interface_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+std::string VKShader::geometry_interface_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+std::string VKShader::geometry_layout_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+std::string VKShader::compute_layout_declare(const shader::ShaderCreateInfo & /*info*/) const
+{
+ return std::string();
+}
+
+int VKShader::program_handle_get() const
+{
+ return -1;
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_shader.hh b/source/blender/gpu/vulkan/vk_shader.hh
new file mode 100644
index 00000000000..9ab0aca67eb
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_shader.hh
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_shader_private.hh"
+
+namespace blender::gpu {
+
+class VKShader : public Shader {
+ public:
+ VKShader(const char *name) : Shader(name)
+ {
+ }
+
+ void vertex_shader_from_glsl(MutableSpan<const char *> sources) override;
+ void geometry_shader_from_glsl(MutableSpan<const char *> sources) override;
+ void fragment_shader_from_glsl(MutableSpan<const char *> sources) override;
+ void compute_shader_from_glsl(MutableSpan<const char *> sources) override;
+ bool finalize(const shader::ShaderCreateInfo *info = nullptr) override;
+
+ void transform_feedback_names_set(Span<const char *> name_list,
+ eGPUShaderTFBType geom_type) override;
+ bool transform_feedback_enable(GPUVertBuf *) override;
+ void transform_feedback_disable() override;
+
+ void bind() override;
+ void unbind() override;
+
+ void uniform_float(int location, int comp_len, int array_size, const float *data) override;
+ void uniform_int(int location, int comp_len, int array_size, const int *data) override;
+
+ std::string resources_declare(const shader::ShaderCreateInfo &info) const override;
+ std::string vertex_interface_declare(const shader::ShaderCreateInfo &info) const override;
+ std::string fragment_interface_declare(const shader::ShaderCreateInfo &info) const override;
+ std::string geometry_interface_declare(const shader::ShaderCreateInfo &info) const override;
+ std::string geometry_layout_declare(const shader::ShaderCreateInfo &info) const override;
+ std::string compute_layout_declare(const shader::ShaderCreateInfo &info) const override;
+
+ /* DEPRECATED: Kept only because of BGL API. */
+ int program_handle_get() const override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_storage_buffer.cc b/source/blender/gpu/vulkan/vk_storage_buffer.cc
new file mode 100644
index 00000000000..2b6fda0547d
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_storage_buffer.cc
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_vertex_buffer.hh"
+
+#include "vk_storage_buffer.hh"
+
+namespace blender::gpu {
+
+void VKStorageBuffer::update(const void * /*data*/)
+{
+}
+
+void VKStorageBuffer::bind(int /*slot*/)
+{
+}
+
+void VKStorageBuffer::unbind()
+{
+}
+
+void VKStorageBuffer::clear(eGPUTextureFormat /* internal_format*/,
+ eGPUDataFormat /*data_format*/,
+ void * /*data*/)
+{
+}
+void VKStorageBuffer::copy_sub(VertBuf * /*src*/,
+ uint /*dst_offset*/,
+ uint /*src_offset*/,
+ uint /*copy_size*/)
+{
+}
+
+void VKStorageBuffer::read(void * /*data*/)
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_storage_buffer.hh b/source/blender/gpu/vulkan/vk_storage_buffer.hh
new file mode 100644
index 00000000000..a51f89f627a
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_storage_buffer.hh
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "GPU_texture.h"
+
+#include "gpu_storage_buffer_private.hh"
+
+namespace blender::gpu {
+
+class VKStorageBuffer : public StorageBuf {
+ public:
+ VKStorageBuffer(int size, const char *name) : StorageBuf(size, name)
+ {
+ }
+
+ void update(const void *data) override;
+ void bind(int slot) override;
+ void unbind() override;
+ void clear(eGPUTextureFormat internal_format, eGPUDataFormat data_format, void *data) override;
+ void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
+ void read(void *data) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_texture.cc b/source/blender/gpu/vulkan/vk_texture.cc
new file mode 100644
index 00000000000..ea5379e6572
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_texture.cc
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_texture.hh"
+
+namespace blender::gpu {
+
+void VKTexture::generate_mipmap()
+{
+}
+
+void VKTexture::copy_to(Texture * /*tex*/)
+{
+}
+
+void VKTexture::clear(eGPUDataFormat /*format*/, const void * /*data*/)
+{
+}
+
+void VKTexture::swizzle_set(const char /*swizzle_mask*/[4])
+{
+}
+
+void VKTexture::stencil_texture_mode_set(bool /*use_stencil*/)
+{
+}
+
+void VKTexture::mip_range_set(int /*min*/, int /*max*/)
+{
+}
+
+void *VKTexture::read(int /*mip*/, eGPUDataFormat /*format*/)
+{
+ return nullptr;
+}
+
+void VKTexture::update_sub(int /*mip*/,
+ int /*offset*/[3],
+ int /*extent*/[3],
+ eGPUDataFormat /*format*/,
+ const void * /*data*/)
+{
+}
+
+/* TODO(fclem): Legacy. Should be removed at some point. */
+uint VKTexture::gl_bindcode_get() const
+{
+ return 0;
+}
+
+bool VKTexture::init_internal()
+{
+ return false;
+}
+
+bool VKTexture::init_internal(GPUVertBuf * /*vbo*/)
+{
+ return false;
+}
+
+bool VKTexture::init_internal(const GPUTexture * /*src*/, int /*mip_offset*/, int /*layer_offset*/)
+{
+ return false;
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_texture.hh b/source/blender/gpu/vulkan/vk_texture.hh
new file mode 100644
index 00000000000..93094b7e540
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_texture.hh
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_texture_private.hh"
+
+namespace blender::gpu {
+
+class VKTexture : public Texture {
+ public:
+ VKTexture(const char *name) : Texture(name)
+ {
+ }
+
+ void generate_mipmap() override;
+ void copy_to(Texture *tex) override;
+ void clear(eGPUDataFormat format, const void *data) override;
+ void swizzle_set(const char swizzle_mask[4]) override;
+ void stencil_texture_mode_set(bool use_stencil) override;
+ void mip_range_set(int min, int max) override;
+ void *read(int mip, eGPUDataFormat format) override;
+ void update_sub(
+ int mip, int offset[3], int extent[3], eGPUDataFormat format, const void *data) override;
+
+ /* TODO(fclem): Legacy. Should be removed at some point. */
+ uint gl_bindcode_get() const override;
+
+ protected:
+ bool init_internal() override;
+ bool init_internal(GPUVertBuf *vbo) override;
+ bool init_internal(const GPUTexture *src, int mip_offset, int layer_offset) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_uniform_buffer.cc b/source/blender/gpu/vulkan/vk_uniform_buffer.cc
new file mode 100644
index 00000000000..8ef5b19273a
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_uniform_buffer.cc
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_uniform_buffer.hh"
+
+namespace blender::gpu {
+
+void VKUniformBuffer::update(const void * /*data*/)
+{
+}
+
+void VKUniformBuffer::bind(int /*slot*/)
+{
+}
+
+void VKUniformBuffer::unbind()
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_uniform_buffer.hh b/source/blender/gpu/vulkan/vk_uniform_buffer.hh
new file mode 100644
index 00000000000..f086a7aa391
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_uniform_buffer.hh
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_uniform_buffer_private.hh"
+
+namespace blender::gpu {
+
+class VKUniformBuffer : public UniformBuf {
+ public:
+ VKUniformBuffer(int size, const char *name) : UniformBuf(size, name)
+ {
+ }
+
+ void update(const void *data) override;
+ void bind(int slot) override;
+ void unbind() override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_vertex_buffer.cc b/source/blender/gpu/vulkan/vk_vertex_buffer.cc
new file mode 100644
index 00000000000..5791e20fb30
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_vertex_buffer.cc
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_vertex_buffer.hh"
+
+namespace blender::gpu {
+
+void VKVertexBuffer::bind_as_ssbo(uint /*binding*/)
+{
+}
+
+void VKVertexBuffer::bind_as_texture(uint /*binding*/)
+{
+}
+
+void VKVertexBuffer::wrap_handle(uint64_t /*handle*/)
+{
+}
+
+void VKVertexBuffer::update_sub(uint /*start*/, uint /*len*/, const void * /*data*/)
+{
+}
+
+const void *VKVertexBuffer::read() const
+{
+ return nullptr;
+}
+
+void *VKVertexBuffer::unmap(const void * /*mapped_data*/) const
+{
+ return nullptr;
+}
+
+void VKVertexBuffer::acquire_data()
+{
+}
+
+void VKVertexBuffer::resize_data()
+{
+}
+
+void VKVertexBuffer::release_data()
+{
+}
+
+void VKVertexBuffer::upload_data()
+{
+}
+
+void VKVertexBuffer::duplicate_data(VertBuf * /*dst*/)
+{
+}
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_vertex_buffer.hh b/source/blender/gpu/vulkan/vk_vertex_buffer.hh
new file mode 100644
index 00000000000..84ccc65bcdf
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_vertex_buffer.hh
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_vertex_buffer_private.hh"
+
+namespace blender::gpu {
+
+class VKVertexBuffer : public VertBuf {
+ public:
+ void bind_as_ssbo(uint binding) override;
+ void bind_as_texture(uint binding) override;
+ void wrap_handle(uint64_t handle) override;
+
+ void update_sub(uint start, uint len, const void *data) override;
+ const void *read() const override;
+ void *unmap(const void *mapped_data) const override;
+
+ protected:
+ void acquire_data() override;
+ void resize_data() override;
+ void release_data() override;
+ void upload_data() override;
+ void duplicate_data(VertBuf *dst) override;
+};
+
+} // namespace blender::gpu \ No newline at end of file
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 6d99fde9df6..c467e48d21e 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -406,7 +406,7 @@ static void execute_posetree(struct Depsgraph *depsgraph,
}
copy_v3_v3(rootmat[3], pchan->pose_head);
- mul_m4_m4m4(imat, ob->obmat, rootmat);
+ mul_m4_m4m4(imat, ob->object_to_world, rootmat);
invert_m4_m4(goalinv, imat);
for (target = tree->targets.first; target; target = target->next) {
@@ -465,7 +465,7 @@ static void execute_posetree(struct Depsgraph *depsgraph,
/* end effector in world space */
copy_m4_m4(end_pose, pchan->pose_mat);
copy_v3_v3(end_pose[3], pchan->pose_tail);
- mul_m4_series(world_pose, goalinv, ob->obmat, end_pose);
+ mul_m4_series(world_pose, goalinv, ob->object_to_world, end_pose);
/* blend position */
goalpos[0] = fac * goalpos[0] + mfac * world_pose[3][0];
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 9317f14b7f1..2878bbb6da7 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -586,10 +586,10 @@ static bool target_callback(const iTaSC::Timestamp &timestamp,
float chanmat[4][4];
copy_m4_m4(chanmat, pchan->pose_mat);
copy_v3_v3(chanmat[3], pchan->pose_tail);
- mul_m4_series(restmat, target->owner->obmat, chanmat, target->eeRest);
+ mul_m4_series(restmat, target->owner->object_to_world, chanmat, target->eeRest);
}
else {
- mul_m4_m4m4(restmat, target->owner->obmat, target->eeRest);
+ mul_m4_m4m4(restmat, target->owner->object_to_world, target->eeRest);
}
/* blend the target */
blend_m4_m4m4(tarmat, restmat, tarmat, constraint->enforce);
@@ -620,10 +620,10 @@ static bool base_callback(const iTaSC::Timestamp &timestamp,
ikscene->baseFrame.setValue(&chanmat[0][0]);
/* iTaSC armature is scaled to object scale, scale the base frame too */
ikscene->baseFrame.p *= ikscene->blScale;
- mul_m4_m4m4(rootmat, ikscene->blArmature->obmat, chanmat);
+ mul_m4_m4m4(rootmat, ikscene->blArmature->object_to_world, chanmat);
}
else {
- copy_m4_m4(rootmat, ikscene->blArmature->obmat);
+ copy_m4_m4(rootmat, ikscene->blArmature->object_to_world);
ikscene->baseFrame = iTaSC::F_identity;
}
next.setValue(&rootmat[0][0]);
@@ -1065,7 +1065,7 @@ static void convert_pose(IK_Scene *ikscene)
int a, joint;
/* assume uniform scaling and take Y scale as general scale for the armature */
- scale = len_v3(ikscene->blArmature->obmat[1]);
+ scale = len_v3(ikscene->blArmature->object_to_world[1]);
rot = ikscene->jointArray(0);
for (joint = a = 0, ikchan = ikscene->channels;
a < ikscene->numchan && joint < ikscene->numjoint;
@@ -1105,7 +1105,7 @@ static void BKE_pose_rest(IK_Scene *ikscene)
int a, joint;
/* assume uniform scaling and take Y scale as general scale for the armature */
- scale = len_v3(ikscene->blArmature->obmat[1]);
+ scale = len_v3(ikscene->blArmature->object_to_world[1]);
/* rest pose is 0 */
SetToZero(ikscene->jointArray);
/* except for transY joints */
@@ -1183,7 +1183,7 @@ static IK_Scene *convert_tree(
}
ikscene->blArmature = ob;
/* assume uniform scaling and take Y scale as general scale for the armature */
- ikscene->blScale = len_v3(ob->obmat[1]);
+ ikscene->blScale = len_v3(ob->object_to_world[1]);
ikscene->blInvScale = (ikscene->blScale < KDL::epsilon) ? 0.0f : 1.0f / ikscene->blScale;
std::string joint;
@@ -1667,7 +1667,7 @@ static void create_scene(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
static int init_scene(Object *ob)
{
/* check also if scaling has changed */
- float scale = len_v3(ob->obmat[1]);
+ float scale = len_v3(ob->object_to_world[1]);
IK_Scene *scene;
if (ob->pose->ikdata) {
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 5c76dfe52df..a05bc51fcea 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -358,14 +358,14 @@ struct IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
* Will rebuild all used indices and proxies at once.
*/
void IMB_anim_index_rebuild(struct IndexBuildContext *context,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
/**
* Finish rebuilding proxies/time-codes and free temporary contexts used.
*/
-void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, short stop);
+void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, bool stop);
/**
* Return the length (in frames) of the given \a anim.
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index eaa72441fb6..d824b87f493 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -377,9 +377,9 @@ static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_l
{
if (!anim->index_dir[0]) {
char filename[FILE_MAXFILE];
- BLI_split_dirfile(anim->name, index_dir, filename, index_dir_len, sizeof(filename));
- BLI_path_append(index_dir, index_dir_len, "BL_proxy");
- BLI_path_append(index_dir, index_dir_len, filename);
+ char dirname[FILE_MAXDIR];
+ BLI_split_dirfile(anim->name, dirname, filename, index_dir_len, sizeof(filename));
+ BLI_path_join(index_dir, index_dir_len, dirname, "BL_proxy", filename);
}
else {
BLI_strncpy(index_dir, anim->index_dir, index_dir_len);
@@ -931,7 +931,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim,
return (IndexBuildContext *)context;
}
-static void index_rebuild_ffmpeg_finish(FFmpegIndexBuilderContext *context, int stop)
+static void index_rebuild_ffmpeg_finish(FFmpegIndexBuilderContext *context, const bool stop)
{
int i;
@@ -1012,8 +1012,8 @@ static void index_rebuild_ffmpeg_proc_decoded_frame(FFmpegIndexBuilderContext *c
}
static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
- const short *stop,
- short *do_update,
+ const bool *stop,
+ bool *do_update,
float *progress)
{
AVFrame *in_frame = av_frame_alloc();
@@ -1303,7 +1303,7 @@ static IndexBuildContext *index_fallback_create_context(struct anim *anim,
return (IndexBuildContext *)context;
}
-static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, int stop)
+static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, const bool stop)
{
struct anim *anim = context->anim;
char filepath[FILE_MAX];
@@ -1330,8 +1330,8 @@ static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context,
}
static void index_rebuild_fallback(FallbackIndexBuilderContext *context,
- const short *stop,
- short *do_update,
+ const bool *stop,
+ bool *do_update,
float *progress)
{
int count = IMB_anim_get_duration(context->anim, IMB_TC_NONE);
@@ -1470,9 +1470,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
void IMB_anim_index_rebuild(struct IndexBuildContext *context,
/* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
+ bool *stop,
/* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *do_update,
+ bool *do_update,
/* NOLINTNEXTLINE: readability-non-const-parameter. */
float *progress)
{
@@ -1494,7 +1494,7 @@ void IMB_anim_index_rebuild(struct IndexBuildContext *context,
UNUSED_VARS(stop, do_update, progress);
}
-void IMB_anim_index_rebuild_finish(IndexBuildContext *context, short stop)
+void IMB_anim_index_rebuild_finish(IndexBuildContext *context, const bool stop)
{
switch (context->anim_type) {
#ifdef WITH_FFMPEG
diff --git a/source/blender/imbuf/intern/webp.c b/source/blender/imbuf/intern/webp.c
index 27c26fb19c1..3031b8c3e33 100644
--- a/source/blender/imbuf/intern/webp.c
+++ b/source/blender/imbuf/intern/webp.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
- * \ingroup imbuf
+ * \ingroup imbuf
*/
#ifdef _WIN32
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc
index 546bc9d49cc..1ac4eacc997 100644
--- a/source/blender/io/alembic/exporter/abc_export_capi.cc
+++ b/source/blender/io/alembic/exporter/abc_export_capi.cc
@@ -72,8 +72,8 @@ static void report_job_duration(const ExportJobData *data)
static void export_startjob(void *customdata,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
@@ -230,7 +230,7 @@ bool ABC_export(Scene *scene,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while exporting. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
blender::io::alembic::export_startjob(job, &stop, &do_update, &progress);
diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc
index f872943ad5c..13136372c56 100644
--- a/source/blender/io/alembic/exporter/abc_writer_hair.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc
@@ -118,7 +118,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
{
/* Get untransformed vertices, there's a xform under the hair. */
float inv_mat[4][4];
- invert_m4_m4_safe(inv_mat, context.object->obmat);
+ invert_m4_m4_safe(inv_mat, context.object->object_to_world);
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
@@ -241,7 +241,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context,
{
/* Get untransformed vertices, there's a xform under the hair. */
float inv_mat[4][4];
- invert_m4_m4_safe(inv_mat, context.object->obmat);
+ invert_m4_m4_safe(inv_mat, context.object->object_to_world);
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
diff --git a/source/blender/io/alembic/exporter/abc_writer_points.cc b/source/blender/io/alembic/exporter/abc_writer_points.cc
index 29370978b54..6ec6f736818 100644
--- a/source/blender/io/alembic/exporter/abc_writer_points.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_points.cc
@@ -101,7 +101,7 @@ void ABCPointsWriter::do_write(HierarchyContext &context)
}
/* location */
- mul_v3_m4v3(pos, context.object->imat, state.co);
+ mul_v3_m4v3(pos, context.object->world_to_object, state.co);
/* velocity */
sub_v3_v3v3(vel, state.co, psys->particles[p].prev_state.co);
diff --git a/source/blender/io/alembic/intern/abc_axis_conversion.cc b/source/blender/io/alembic/intern/abc_axis_conversion.cc
index 00e5890e9d3..c7d2a3e1bf4 100644
--- a/source/blender/io/alembic/intern/abc_axis_conversion.cc
+++ b/source/blender/io/alembic/intern/abc_axis_conversion.cc
@@ -134,15 +134,15 @@ void create_transform_matrix(Object *obj,
if (mode == ABC_MATRIX_LOCAL && obj->parent) {
/* Note that this produces another matrix than the local matrix, due to
* constraints and modifiers as well as the obj->parentinv matrix. */
- invert_m4_m4(obj->parent->imat, obj->parent->obmat);
- mul_m4_m4m4(zup_mat, obj->parent->imat, obj->obmat);
+ invert_m4_m4(obj->parent->world_to_object, obj->parent->object_to_world);
+ mul_m4_m4m4(zup_mat, obj->parent->world_to_object, obj->object_to_world);
}
else {
- copy_m4_m4(zup_mat, obj->obmat);
+ copy_m4_m4(zup_mat, obj->object_to_world);
}
if (proxy_from) {
- mul_m4_m4m4(zup_mat, proxy_from->obmat, zup_mat);
+ mul_m4_m4m4(zup_mat, proxy_from->object_to_world, zup_mat);
}
copy_m44_axis_swap(r_yup_mat, zup_mat, ABC_YUP_FROM_ZUP);
diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc
index af26565f8d6..f3a07eaad3f 100644
--- a/source/blender/io/alembic/intern/abc_reader_object.cc
+++ b/source/blender/io/alembic/intern/abc_reader_object.cc
@@ -165,7 +165,7 @@ void AbcObjectReader::setupObjectTransform(const chrono_t time)
/* Apply the matrix to the object. */
BKE_object_apply_mat4(m_object, transform_from_alembic, true, false);
- BKE_object_to_mat4(m_object, m_object->obmat);
+ BKE_object_to_mat4(m_object, m_object->object_to_world);
if (!is_constant || m_settings->always_add_cache_reader) {
bConstraint *con = BKE_constraint_add_for_object(
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index b92ce5b4cfb..f6c11f6a684 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -427,8 +427,8 @@ struct ImportJobData {
ArchiveReader *archive;
std::vector<AbcObjectReader *> readers;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
char error_code;
@@ -446,7 +446,7 @@ static void report_job_duration(const ImportJobData *data)
std::cout << '\n';
}
-static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
+static void import_startjob(void *user_data, bool *stop, bool *do_update, float *progress)
{
SCOPE_TIMER("Alembic import, objects reading and creation");
@@ -715,7 +715,7 @@ bool ABC_import(bContext *C,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while importing. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
import_startjob(job, &stop, &do_update, &progress);
diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp
index 2d872377bbf..826d7864067 100644
--- a/source/blender/io/collada/AnimationImporter.cpp
+++ b/source/blender/io/collada/AnimationImporter.cpp
@@ -332,8 +332,8 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob)
float mat[4][4];
TransformReader::get_node_mat(mat, node, &uid_animated_map, ob);
if (ob) {
- copy_m4_m4(ob->obmat, mat);
- BKE_object_apply_mat4(ob, ob->obmat, false, false);
+ copy_m4_m4(ob->object_to_world, mat);
+ BKE_object_apply_mat4(ob, ob->object_to_world, false, false);
}
}
@@ -2097,7 +2097,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root,
if (par_job) {
float temp[4][4], ipar[4][4];
- invert_m4_m4(ipar, par_job->obmat);
+ invert_m4_m4(ipar, par_job->object_to_world);
copy_m4_m4(temp, mat);
mul_m4_m4m4(mat, ipar, temp);
}
diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp
index 1310337f501..7de08f89b7d 100644
--- a/source/blender/io/collada/ArmatureImporter.cpp
+++ b/source/blender/io/collada/ArmatureImporter.cpp
@@ -114,7 +114,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin,
Object *ob_arm = skin->BKE_armature_from_object();
if (ob_arm) {
float invmat[4][4];
- invert_m4_m4(invmat, ob_arm->obmat);
+ invert_m4_m4(invmat, ob_arm->object_to_world);
mul_m4_m4m4(mat, invmat, mat);
}
@@ -708,7 +708,7 @@ void ArmatureImporter::set_pose(Object *ob_arm,
copy_m4_m4(mat, obmat);
float invObmat[4][4];
- invert_m4_m4(invObmat, ob_arm->obmat);
+ invert_m4_m4(invObmat, ob_arm->object_to_world);
mul_m4_m4m4(pchan->pose_mat, invObmat, mat);
}
diff --git a/source/blender/io/collada/ControllerExporter.cpp b/source/blender/io/collada/ControllerExporter.cpp
index 6bf8d904a41..62bcdc5bf4c 100644
--- a/source/blender/io/collada/ControllerExporter.cpp
+++ b/source/blender/io/collada/ControllerExporter.cpp
@@ -406,7 +406,7 @@ void ControllerExporter::add_bind_shape_mat(Object *ob)
bc_add_global_transform(f_obmat, export_settings.get_global_transform());
}
- // UnitConverter::mat4_to_dae_double(bind_mat, ob->obmat);
+ // UnitConverter::mat4_to_dae_double(bind_mat, ob->object_to_world);
UnitConverter::mat4_to_dae_double(bind_mat, f_obmat);
if (this->export_settings.get_limit_precision()) {
BCMatrix::sanitize(bind_mat, LIMITTED_PRECISION);
@@ -523,7 +523,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm,
}
/* make world-space matrix (bind_mat is armature-space) */
- mul_m4_m4m4(world, ob_arm->obmat, bind_mat);
+ mul_m4_m4m4(world, ob_arm->object_to_world, bind_mat);
if (!has_bindmat) {
if (export_settings.get_apply_global_orientation()) {
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp
index 5e432682564..dae1c4ba894 100644
--- a/source/blender/io/collada/DocumentImporter.cpp
+++ b/source/blender/io/collada/DocumentImporter.cpp
@@ -412,8 +412,8 @@ Object *DocumentImporter::create_instance_node(Object *source_ob,
}
}
/* calc new matrix and apply */
- mul_m4_m4m4(obn->obmat, obn->obmat, mat);
- BKE_object_apply_mat4(obn, obn->obmat, false, false);
+ mul_m4_m4m4(obn->object_to_world, obn->object_to_world, mat);
+ BKE_object_apply_mat4(obn, obn->object_to_world, false, false);
}
}
else {
diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp
index 6d7593afb8b..1a28adf50a5 100644
--- a/source/blender/io/collada/MeshImporter.cpp
+++ b/source/blender/io/collada/MeshImporter.cpp
@@ -564,7 +564,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
/* set default flags */
medge = &edges[mesh->totedge];
for (int i = 0; i < len; i++, medge++) {
- medge->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ medge->flag = ME_EDGEDRAW;
}
mesh->totedge = totedge;
diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp
index 0654bae3730..b4615635318 100644
--- a/source/blender/io/collada/SkinInfo.cpp
+++ b/source/blender/io/collada/SkinInfo.cpp
@@ -214,12 +214,12 @@ void SkinInfo::link_armature(bContext *C,
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(scene, ob, &workob);
- invert_m4_m4(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.object_to_world);
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
#endif
- copy_m4_m4(ob->obmat, bind_shape_matrix);
- BKE_object_apply_mat4(ob, ob->obmat, false, false);
+ copy_m4_m4(ob->object_to_world, bind_shape_matrix);
+ BKE_object_apply_mat4(ob, ob->object_to_world, false, false);
amd->deformflag = ARM_DEF_VGROUP;
diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp
index 22a73cd7db2..96ff78a715a 100644
--- a/source/blender/io/collada/collada_utils.cpp
+++ b/source/blender/io/collada/collada_utils.cpp
@@ -129,7 +129,7 @@ bool bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
const bool keep_transform = false;
if (par && is_parent_space) {
- mul_m4_m4m4(ob->obmat, par->obmat, ob->obmat);
+ mul_m4_m4m4(ob->object_to_world, par->object_to_world, ob->object_to_world);
}
bool ok = ED_object_parent_set(
@@ -348,10 +348,10 @@ std::string bc_replace_string(std::string data,
void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene)
{
if (scale_to_scene) {
- mul_m4_m4m4(ob->obmat, bc_unit.get_scale(), ob->obmat);
+ mul_m4_m4m4(ob->object_to_world, bc_unit.get_scale(), ob->object_to_world);
}
- mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat);
- BKE_object_apply_mat4(ob, ob->obmat, false, false);
+ mul_m4_m4m4(ob->object_to_world, bc_unit.get_rotation(), ob->object_to_world);
+ BKE_object_apply_mat4(ob, ob->object_to_world, false, false);
}
void bc_match_scale(std::vector<Object *> *objects_done,
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index cf9ce787e98..3871be08e8b 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -443,7 +443,7 @@ void AbstractHierarchyIterator::visit_object(Object *object,
context->original_export_path = "";
context->higher_up_export_path = "";
- copy_m4_m4(context->matrix_world, object->obmat);
+ copy_m4_m4(context->matrix_world, object->object_to_world);
ExportGraph::key_type graph_index = determine_graph_index_object(context);
context_update_for_graph_index(context, graph_index);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc
index b9d7b6719b1..6cc977bfced 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_base.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc
@@ -79,7 +79,7 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara
BKE_camera_params_compute_matrix(&params);
float viewmat[4][4];
- invert_m4_m4(viewmat, cam_ob->obmat);
+ invert_m4_m4(viewmat, cam_ob->object_to_world);
mul_m4_m4m4(persmat_, params.winmat, viewmat);
}
@@ -152,7 +152,7 @@ void GpencilIO::create_object_list()
/* Save z-depth from view to sort from back to front. */
if (is_camera_) {
- float camera_z = dot_v3v3(camera_z_axis, object->obmat[3]);
+ float camera_z = dot_v3v3(camera_z_axis, object->object_to_world[3]);
ObjectZ obz = {camera_z, object};
ob_list_.append(obz);
}
@@ -160,10 +160,10 @@ void GpencilIO::create_object_list()
float zdepth = 0;
if (rv3d_) {
if (rv3d_->is_persp) {
- zdepth = ED_view3d_calc_zfac(rv3d_, object->obmat[3]);
+ zdepth = ED_view3d_calc_zfac(rv3d_, object->object_to_world[3]);
}
else {
- zdepth = -dot_v3v3(rv3d_->viewinv[2], object->obmat[3]);
+ zdepth = -dot_v3v3(rv3d_->viewinv[2], object->object_to_world[3]);
}
ObjectZ obz = {zdepth * -1.0f, object};
ob_list_.append(obz);
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
index ddd72f816b0..c042ca597c8 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
@@ -177,7 +177,7 @@ void GpencilExporterPDF::export_gpencil_layers()
/* Apply layer thickness change. */
gps_duplicate->thickness += gpl->line_change;
/* Apply object scale to thickness. */
- gps_duplicate->thickness *= mat4_to_scale(ob->obmat);
+ gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
/* Fill. */
if ((is_fill) && (params_.flag & GP_EXPORT_FILL)) {
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
index 58f12e9b8b1..8acb87f8e58 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
@@ -197,7 +197,7 @@ void GpencilExporterSVG::export_gpencil_layers()
/* Apply layer thickness change. */
gps_duplicate->thickness += gpl->line_change;
/* Apply object scale to thickness. */
- gps_duplicate->thickness *= mat4_to_scale(ob->obmat);
+ gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
CLAMP_MIN(gps_duplicate->thickness, 1.0f);
const bool is_normalized = ((params_.flag & GP_EXPORT_NORM_THICKNESS) != 0) ||
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt
index 6973c181981..1cbec8c471f 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -178,7 +178,8 @@ if(WIN32)
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:MinSizeRel>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
endif()
-# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
+# Source:
+# https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
if(WIN32)
target_link_libraries(bf_usd INTERFACE ${USD_LIBRARIES})
target_compile_options(bf_usd PRIVATE /w34101)
@@ -210,6 +211,6 @@ if(WITH_GTESTS)
blender_add_test_lib(bf_io_usd_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()
-# In cmake version 3.21 and up, we can instead use the NO_CACHE option for
-# find_file so we don't need to clear it from the cache here.
+# In CMAKE version 3.21 and up, we can instead use the `NO_CACHE` option for
+# `find_file` so we don't need to clear it from the cache here.
unset(USD_IMAGING_HEADERS CACHE)
diff --git a/source/blender/io/usd/intern/usd_capi_export.cc b/source/blender/io/usd/intern/usd_capi_export.cc
index 8df13fd0dcd..72c20f28b62 100644
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@ -62,8 +62,8 @@ struct ExportJobData {
bool is_usdz_export;
USDExportParams params;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
bool was_canceled;
@@ -223,7 +223,7 @@ static void process_usdz_textures(const ExportJobData *data, const char *path) {
char texture_path[4096];
BLI_strcpy_rlen(texture_path, path);
BLI_path_append(texture_path, 4096, "textures");
- BLI_path_slash_ensure(texture_path);
+ BLI_path_slash_ensure(texture_path, 4096);
struct direntry *entries;
unsigned int num_files = BLI_filelist_dir_contents(texture_path, &entries);
@@ -324,8 +324,8 @@ static bool perform_usdz_conversion(const ExportJobData *data)
static void export_startjob(void *customdata,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
@@ -619,7 +619,7 @@ bool USD_export(bContext *C,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while exporting. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
blender::io::usd::export_startjob(job, &stop, &do_update, &progress);
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc
index c7c3ac51844..ca518249c91 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -276,8 +276,8 @@ struct ImportJobData {
USDStageReader *archive;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
char error_code;
@@ -338,8 +338,7 @@ static void report_job_duration(const ImportJobData *data)
std::cout << '\n';
}
-
-static void import_startjob(void *customdata, short *stop, short *do_update, float *progress)
+static void import_startjob(void *customdata, bool *stop, bool *do_update, float *progress)
{
ImportJobData *data = static_cast<ImportJobData *>(customdata);
@@ -703,7 +702,7 @@ bool USD_import(struct bContext *C,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while importing. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
import_startjob(job, &stop, &do_update, &progress);
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 9c0c76a50c1..75d9330392f 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -34,6 +34,7 @@
#include <pxr/base/vt/value.h>
#include <pxr/usd/sdf/types.h>
#include <pxr/usd/usdGeom/mesh.h>
+#include <pxr/usd/usdGeom/primvarsAPI.h>
#include <pxr/usd/usdGeom/subset.h>
#include <pxr/usd/usdShade/materialBindingAPI.h>
#include <pxr/usd/usdSkel/bindingAPI.h>
@@ -297,12 +298,13 @@ bool USDMeshReader::topology_changed(const Mesh *existing_mesh, const double mot
mesh_prim_.GetFaceVertexCountsAttr().Get(&face_counts_, motionSampleTime);
mesh_prim_.GetPointsAttr().Get(&positions_, motionSampleTime);
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(mesh_prim_);
/* TODO(makowalski): Reading normals probably doesn't belong in this function,
* as this is not required to determine if the topology has changed. */
/* If 'normals' and 'primvars:normals' are both specified, the latter has precedence. */
- pxr::UsdGeomPrimvar primvar = mesh_prim_.GetPrimvar(usdtokens::normalsPrimvar);
+ pxr::UsdGeomPrimvar primvar = primvarsAPI.GetPrimvar(usdtokens::normalsPrimvar);
if (primvar.HasValue()) {
primvar.ComputeFlattened(&normals_, motionSampleTime);
normal_interpolation_ = primvar.GetInterpolation();
@@ -386,6 +388,8 @@ void USDMeshReader::read_uvs(Mesh *mesh, const double motionSampleTime, const bo
std::vector<UVSample> uv_primvars(ldata->totlayer);
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(mesh_prim_);
+
if (has_uvs_) {
for (int layer_idx = 0; layer_idx < ldata->totlayer; layer_idx++) {
const CustomDataLayer *layer = &ldata->layers[layer_idx];
@@ -416,11 +420,11 @@ void USDMeshReader::read_uvs(Mesh *mesh, const double motionSampleTime, const bo
}
/* Early out if mesh doesn't have primvar. */
- if (!mesh_prim_.HasPrimvar(uv_token)) {
+ if (!primvarsAPI.HasPrimvar(uv_token)) {
continue;
}
- if (pxr::UsdGeomPrimvar uv_primvar = mesh_prim_.GetPrimvar(uv_token)) {
+ if (pxr::UsdGeomPrimvar uv_primvar = primvarsAPI.GetPrimvar(uv_token)) {
uv_primvar.ComputeFlattened(&uv_primvars[layer_idx].uvs, motionSampleTime);
uv_primvars[layer_idx].interpolation = uv_primvar.GetInterpolation();
}
@@ -492,7 +496,9 @@ void USDMeshReader::read_colors(Mesh *mesh, const double motionSampleTime)
return;
}
- std::vector<pxr::UsdGeomPrimvar> primvars = mesh_prim_.GetPrimvars();
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(mesh_prim_.GetPrim());
+
+ std::vector<pxr::UsdGeomPrimvar> primvars = primvarsAPI.GetPrimvars();
/* Convert all color primvars to custom layer data. */
for (pxr::UsdGeomPrimvar pv : primvars) {
@@ -894,12 +900,14 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
is_left_handed_ = true;
}
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(mesh_prim_);
+
std::vector<pxr::TfToken> uv_tokens;
/* Currently we only handle UV primvars. */
if (read_flag & MOD_MESHSEQ_READ_UV) {
- std::vector<pxr::UsdGeomPrimvar> primvars = mesh_prim_.GetPrimvars();
+ std::vector<pxr::UsdGeomPrimvar> primvars = primvarsAPI.GetPrimvars();
for (pxr::UsdGeomPrimvar p : primvars) {
diff --git a/source/blender/io/usd/intern/usd_writer_hair.cc b/source/blender/io/usd/intern/usd_writer_hair.cc
index ae0e68ee8b1..7fbe68f9d25 100644
--- a/source/blender/io/usd/intern/usd_writer_hair.cc
+++ b/source/blender/io/usd/intern/usd_writer_hair.cc
@@ -41,7 +41,7 @@ void USDHairWriter::do_write(HierarchyContext &context)
{
/* Get untransformed vertices, there's a xform under the hair. */
float inv_mat[4][4];
- invert_m4_m4_safe(inv_mat, context.object->obmat);
+ invert_m4_m4_safe(inv_mat, context.object->object_to_world);
ParticleSystem *psys = context.particle_system;
ParticleCacheKey **cache = psys->pathcache;
diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc
index 3d2aacb2d42..ac0501588cf 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/io/usd/intern/usd_writer_mesh.cc
@@ -270,7 +270,8 @@ void USDGenericMeshWriter::write_uv_maps(const Mesh *mesh,
.Set(std::string(layer->name), pxr::UsdTimeCode::Default());
}
- pxr::UsdGeomPrimvar uv_coords_primvar = usd_mesh.CreatePrimvar(
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(usd_mesh.GetPrim());
+ pxr::UsdGeomPrimvar uv_coords_primvar = primvarsAPI.CreatePrimvar(
primvar_name, pxr::SdfValueTypeNames->TexCoord2fArray, pxr::UsdGeomTokens->faceVarying);
MLoopUV *mloopuv = static_cast<MLoopUV *>(layer->data);
@@ -343,6 +344,8 @@ void USDGenericMeshWriter::write_vertex_groups(const Object *ob,
std::vector<pxr::UsdGeomPrimvar> pv_groups;
std::vector<pxr::VtArray<float>> pv_data;
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(usd_mesh.GetPrim());
+
// Create vertex groups primvars
for (def = (bDeformGroup *)ob->defbase.first, i = 0, j = 0; def; def = def->next, i++) {
if (!def)
@@ -350,7 +353,7 @@ void USDGenericMeshWriter::write_vertex_groups(const Object *ob,
pxr::TfToken primvar_name(pxr::TfMakeValidIdentifier(def->name));
pxr::TfToken primvar_interpolation = (as_point_groups) ? pxr::UsdGeomTokens->vertex :
pxr::UsdGeomTokens->faceVarying;
- pv_groups.push_back(usd_mesh.CreatePrimvar(
+ pv_groups.push_back(primvarsAPI.CreatePrimvar(
primvar_name, pxr::SdfValueTypeNames->FloatArray, primvar_interpolation));
size_t primvar_size = 0;
@@ -451,12 +454,14 @@ void USDGenericMeshWriter::write_face_maps(const Object *ob,
int i;
size_t mpoly_len = mesh->totpoly;
+ pxr::UsdGeomPrimvarsAPI primvarsAPI(usd_mesh.GetPrim());
+
for (bFaceMap *fmap = (bFaceMap *)ob->fmaps.first; fmap; fmap = fmap->next) {
if (!fmap)
continue;
pxr::TfToken primvar_name(pxr::TfMakeValidIdentifier(fmap->name));
pxr::TfToken primvar_interpolation = pxr::UsdGeomTokens->uniform;
- pv_groups.push_back(usd_mesh.CreatePrimvar(
+ pv_groups.push_back(primvarsAPI.CreatePrimvar(
primvar_name, pxr::SdfValueTypeNames->FloatArray, primvar_interpolation));
pv_data.push_back(pxr::VtArray<float>(mpoly_len));
diff --git a/source/blender/io/usd/tests/usd_imaging_test.cc b/source/blender/io/usd/tests/usd_imaging_test.cc
index 5cd3c042e59..80c232ad099 100644
--- a/source/blender/io/usd/tests/usd_imaging_test.cc
+++ b/source/blender/io/usd/tests/usd_imaging_test.cc
@@ -42,8 +42,8 @@ TEST_F(USDImagingTest, CapsuleAdapterTest)
}
pxr::UsdImagingCapsuleAdapter capsule_adapter;
- pxr::VtValue points_value = pxr::UsdImagingCapsuleAdapter::GetMeshPoints(
- capsule.GetPrim(), pxr::UsdTimeCode::Default());
+ pxr::VtValue points_value = capsule_adapter.GetPoints(capsule.GetPrim(),
+ pxr::UsdTimeCode::Default());
if (!points_value.IsHolding<pxr::VtArray<pxr::GfVec3f>>()) {
FAIL() << "Mesh points value holding unexpected type.";
return;
@@ -52,7 +52,8 @@ TEST_F(USDImagingTest, CapsuleAdapterTest)
pxr::VtArray<pxr::GfVec3f> points = points_value.Get<pxr::VtArray<pxr::GfVec3f>>();
EXPECT_FALSE(points.empty());
- pxr::VtValue topology_value = pxr::UsdImagingCapsuleAdapter::GetMeshTopology();
+ pxr::VtValue topology_value = capsule_adapter.GetTopology(
+ capsule.GetPrim(), pxr::SdfPath(), pxr::UsdTimeCode::Default());
if (!topology_value.IsHolding<pxr::HdMeshTopology>()) {
FAIL() << "Mesh topology value holding unexpected type.";
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index 5c81cf7abca..5289a8c750a 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@ -7,8 +7,9 @@
#include <algorithm>
#include <cstdio>
+#include "BKE_attribute.hh"
#include "BKE_blender_version.h"
-#include "BKE_geometry_set.hh"
+#include "BKE_mesh.h"
#include "BLI_color.hh"
#include "BLI_enumerable_thread_specific.hh"
@@ -416,15 +417,12 @@ void OBJWriter::write_edges_indices(FormatHandler &fh,
const OBJMesh &obj_mesh_data) const
{
/* NOTE: ensure_mesh_edges should be called before. */
- const int tot_edges = obj_mesh_data.tot_edges();
- for (int edge_index = 0; edge_index < tot_edges; edge_index++) {
- const std::optional<std::array<int, 2>> vertex_indices =
- obj_mesh_data.calc_loose_edge_vert_indices(edge_index);
- if (!vertex_indices) {
- continue;
+ const Span<MEdge> edges = obj_mesh_data.get_mesh()->edges();
+ for (const int i : edges.index_range()) {
+ const MEdge &edge = edges[i];
+ if (edge.flag & ME_LOOSEEDGE) {
+ fh.write_obj_edge(edge.v1 + offsets.vertex_offset + 1, edge.v2 + offsets.vertex_offset + 1);
}
- fh.write_obj_edge((*vertex_indices)[0] + offsets.vertex_offset + 1,
- (*vertex_indices)[1] + offsets.vertex_offset + 1);
}
}
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index d00c09b9013..a95f917869b 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -124,10 +124,11 @@ void OBJMesh::set_world_axes_transform(const eIOAxis forward, const eIOAxis up)
unit_m3(axes_transform);
/* +Y-forward and +Z-up are the default Blender axis settings. */
mat3_from_axis_conversion(forward, up, IO_AXIS_Y, IO_AXIS_Z, axes_transform);
- mul_m4_m3m4(world_and_axes_transform_, axes_transform, export_object_eval_.obmat);
+ mul_m4_m3m4(world_and_axes_transform_, axes_transform, export_object_eval_.object_to_world);
/* mul_m4_m3m4 does not transform last row of obmat, i.e. location data. */
- mul_v3_m3v3(world_and_axes_transform_[3], axes_transform, export_object_eval_.obmat[3]);
- world_and_axes_transform_[3][3] = export_object_eval_.obmat[3][3];
+ mul_v3_m3v3(
+ world_and_axes_transform_[3], axes_transform, export_object_eval_.object_to_world[3]);
+ world_and_axes_transform_[3][3] = export_object_eval_.object_to_world[3][3];
/* Normals need inverse transpose of the regular matrix to handle non-uniform scale. */
float normal_matrix[3][3];
@@ -182,7 +183,6 @@ void OBJMesh::ensure_mesh_normals() const
void OBJMesh::ensure_mesh_edges() const
{
- BKE_mesh_calc_edges(export_mesh_eval_, true, false);
BKE_mesh_calc_edges_loose(export_mesh_eval_);
}
@@ -506,13 +506,4 @@ const char *OBJMesh::get_poly_deform_group_name(const int16_t def_group_index) c
return vertex_group.name;
}
-std::optional<std::array<int, 2>> OBJMesh::calc_loose_edge_vert_indices(const int edge_index) const
-{
- const Span<MEdge> edges = export_mesh_eval_->edges();
- const MEdge &edge = edges[edge_index];
- if (edge.flag & ME_LOOSEEDGE) {
- return std::array<int, 2>{int(edge.v1), int(edge.v2)};
- }
- return std::nullopt;
-}
} // namespace blender::io::obj
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
index ec98468e2de..89ee6f4dea2 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
@@ -216,11 +216,6 @@ class OBJMesh : NonCopyable {
const char *get_poly_deform_group_name(int16_t def_group_index) const;
/**
- * Calculate vertex indices of an edge's corners if it is a loose edge.
- */
- std::optional<std::array<int, 2>> calc_loose_edge_vert_indices(int edge_index) const;
-
- /**
* Calculate the order in which the polygons should be written into the file (sorted by material
* index).
*/
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc
index 812c3e7b5d4..1b1ee5f8386 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc
@@ -31,10 +31,10 @@ void OBJCurve::set_world_axes_transform(const eIOAxis forward, const eIOAxis up)
unit_m3(axes_transform);
/* +Y-forward and +Z-up are the Blender's default axis settings. */
mat3_from_axis_conversion(forward, up, IO_AXIS_Y, IO_AXIS_Z, axes_transform);
- mul_m4_m3m4(world_axes_transform_, axes_transform, export_object_eval_->obmat);
- /* #mul_m4_m3m4 does not transform last row of #Object.obmat, i.e. location data. */
- mul_v3_m3v3(world_axes_transform_[3], axes_transform, export_object_eval_->obmat[3]);
- world_axes_transform_[3][3] = export_object_eval_->obmat[3][3];
+ mul_m4_m3m4(world_axes_transform_, axes_transform, export_object_eval_->object_to_world);
+ /* #mul_m4_m3m4 does not transform last row of #Object.object_to_world, i.e. location data. */
+ mul_v3_m3v3(world_axes_transform_[3], axes_transform, export_object_eval_->object_to_world[3]);
+ world_axes_transform_[3][3] = export_object_eval_->object_to_world[3][3];
}
const char *OBJCurve::get_curve_name() const
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
index 33ece88d3d4..56ad7fd4563 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
@@ -254,7 +254,6 @@ void MeshFromGeometry::create_edges(Mesh *mesh)
dst_edge.v1 = mesh_geometry_.global_to_local_vertices_.lookup_default(src_edge.v1, 0);
dst_edge.v2 = mesh_geometry_.global_to_local_vertices_.lookup_default(src_edge.v2, 0);
BLI_assert(dst_edge.v1 < total_verts && dst_edge.v2 < total_verts);
- dst_edge.flag = ME_LOOSEEDGE;
}
/* Set argument `update` to true so that existing, explicitly imported edges can be merged
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 287a9e2f3b9..0355ed3febe 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -116,7 +116,7 @@ typedef enum eCustomDataType {
CD_PROP_BYTE_COLOR = 17,
CD_TANGENT = 18,
CD_MDISPS = 19,
- CD_PREVIEW_MCOL = 20, /* for displaying weightpaint colors */
+ CD_PREVIEW_MCOL = 20, /* For displaying weight-paint colors. */
/* CD_ID_MCOL = 21, */
/* CD_TEXTURE_MLOOPCOL = 22, */ /* UNUSED */
CD_CLOTH_ORCO = 23,
@@ -209,7 +209,7 @@ typedef enum eCustomDataType {
#define CD_MASK_HAIRLENGTH (1ULL << CD_HAIRLENGTH)
-/** Multires loop data. */
+/** Multi-resolution loop data. */
#define CD_MASK_MULTIRES_GRIDS (CD_MASK_MDISPS | CD_GRID_PAINT_MASK)
/* All data layers. */
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 827e07725a1..6ea35dfb770 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -134,13 +134,13 @@ typedef struct ViewLayerAOV {
typedef struct ViewLayerLightgroup {
struct ViewLayerLightgroup *next, *prev;
- /* Name of the Lightgroup */
+ /* Name of the Light-group. */
char name[64];
} ViewLayerLightgroup;
-/* Lightgroup membership information. */
+/* Light-group membership information. */
typedef struct LightgroupMembership {
- /* Name of the Lightgroup */
+ /* Name of the Light-group. */
char name[64];
} LightgroupMembership;
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index a1781265278..f1c2dcaae68 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -73,7 +73,6 @@ enum {
ME_SEAM = (1 << 2),
/** Deprecated hide status. Now stored in ".hide_edge" attribute. */
/* ME_HIDE = (1 << 4), */
- ME_EDGERENDER = (1 << 5),
ME_LOOSEEDGE = (1 << 7),
ME_SHARP = (1 << 9), /* only reason this flag remains a 'short' */
};
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index d0c09a0d6ab..b4a66a46efe 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -42,7 +42,7 @@ typedef struct MetaElem {
float rad2;
/** Stiffness, how much of the element to fill. */
float s;
- /** Old, only used for backwards compat. use dimensions now. */
+ /** Old, only used for backwards compatibility. use dimensions now. */
float len;
/** Matrix and inverted matrix. */
@@ -63,7 +63,7 @@ typedef struct MetaBall {
/* material of the mother ball will define the material used of all others */
struct Material **mat;
- /** Flag is enum for updates, flag2 is bitflags for settings. */
+ /** Flag is enum for updates, flag2 is bit-flags for settings. */
char flag, flag2;
short totcol;
/** Used to store MB_AUTOSPACE. */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 7625f04fefa..c4180071352 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -195,7 +195,7 @@ typedef struct LatticeModifierData {
ModifierData modifier;
struct Object *object;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char name[64];
float strength;
short flag;
@@ -212,7 +212,7 @@ typedef struct CurveModifierData {
ModifierData modifier;
struct Object *object;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char name[64];
/** Axis along which curve deforms. */
short defaxis;
@@ -262,7 +262,7 @@ typedef struct MaskModifierData {
/** Armature to use to in place of hardcoded vgroup. */
struct Object *ob_arm;
- /** Name of vertex group to use to mask, MAX_VGROUP_NAME. */
+ /** Name of vertex group to use to mask, #MAX_VGROUP_NAME. */
char vgroup[64];
/** Using armature or hardcoded vgroup. */
@@ -447,7 +447,7 @@ typedef struct BevelModifierData {
float bevel_angle;
float spread;
/** if the MOD_BEVEL_VWEIGHT option is set,
- * this will be the name of the vert group, MAX_VGROUP_NAME */
+ * this will be the name of the vert group, #MAX_VGROUP_NAME */
char defgrp_name[64];
char _pad1[4];
@@ -565,7 +565,7 @@ typedef struct DisplaceModifierData {
float strength;
int direction;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
float midlevel;
int space;
@@ -635,7 +635,7 @@ typedef struct DecimateModifierData {
/** (mode == MOD_DECIM_MODE_DISSOLVE). */
float angle;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
float defgrp_factor;
short flag, mode;
@@ -663,7 +663,7 @@ enum {
typedef struct SmoothModifierData {
ModifierData modifier;
float fac;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
short flag, repeat;
@@ -684,7 +684,7 @@ typedef struct CastModifierData {
float fac;
float radius;
float size;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
short flag;
/** Cast modifier projection type. */
@@ -725,7 +725,7 @@ typedef struct WaveModifierData {
/* End MappingInfoModifierData. */
struct Object *objectcenter;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
short flag;
@@ -760,7 +760,7 @@ typedef struct ArmatureModifierData {
struct Object *object;
/** Stored input of previous modifier, for vertex-group blending. */
float (*vert_coords_prev)[3];
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
} ArmatureModifierData;
@@ -803,11 +803,11 @@ typedef struct HookModifierData {
struct CurveMapping *curfalloff;
- /** If NULL, it's using vertexgroup. */
+ /** If NULL, it's using vertex-group. */
int *indexar;
int indexar_num;
float force;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char name[64];
void *_pad1;
} HookModifierData;
@@ -946,7 +946,7 @@ typedef struct MeshDeformModifierData {
/** Mesh object. */
struct Object *object;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char defgrp_name[64];
short gridsize, flag;
@@ -1124,7 +1124,7 @@ typedef struct ShrinkwrapModifierData {
struct Object *target;
/** Additional shrink target. */
struct Object *auxTarget;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char vgroup_name[64];
/** Distance offset to keep from mesh/projection point. */
float keepDist;
@@ -1171,9 +1171,9 @@ enum {
/** #ShrinkwrapModifierData.shrinkOpts */
enum {
- /** allow shrinkwrap to move the vertex in the positive direction of axis */
+ /** Allow shrink-wrap to move the vertex in the positive direction of axis. */
MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR = (1 << 0),
- /** allow shrinkwrap to move the vertex in the negative direction of axis */
+ /** Allow shrink-wrap to move the vertex in the negative direction of axis. */
MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR = (1 << 1),
/** ignore vertex moves if a vertex ends projected on a front face of the target */
@@ -1207,7 +1207,7 @@ typedef struct SimpleDeformModifierData {
/** Object to control the origin of modifier space coordinates. */
struct Object *origin;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char vgroup_name[64];
/** Factors to control simple deforms. */
float factor;
@@ -1250,7 +1250,7 @@ typedef struct ShapeKeyModifierData {
typedef struct SolidifyModifierData {
ModifierData modifier;
- /** Name of vertex group to use, MAX_VGROUP_NAME. */
+ /** Name of vertex group to use, #MAX_VGROUP_NAME. */
char defgrp_name[64];
char shell_defgrp_name[64];
char rim_defgrp_name[64];
@@ -1451,7 +1451,7 @@ typedef struct WarpModifierData {
char bone_to[64];
struct CurveMapping *curfalloff;
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char defgrp_name[64];
float strength;
float falloff_radius;
@@ -1484,7 +1484,7 @@ typedef enum {
typedef struct WeightVGEditModifierData {
ModifierData modifier;
- /** Name of vertex group to edit. MAX_VGROUP_NAME. */
+ /** Name of vertex group to edit. #MAX_VGROUP_NAME. */
char defgrp_name[64];
/** Using MOD_WVG_EDIT_* flags. */
@@ -1504,7 +1504,7 @@ typedef struct WeightVGEditModifierData {
/* Masking options. */
/** The global "influence", if no vgroup nor tex is used as mask. */
float mask_constant;
- /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ /** Name of mask vertex group from which to get weight factors. #MAX_VGROUP_NAME. */
char mask_defgrp_name[64];
/* Texture masking. */
@@ -1540,9 +1540,9 @@ enum {
typedef struct WeightVGMixModifierData {
ModifierData modifier;
- /** Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
+ /** Name of vertex group to modify/weight. #MAX_VGROUP_NAME. */
char defgrp_name_a[64];
- /** Name of other vertex group to mix in. MAX_VGROUP_NAME. */
+ /** Name of other vertex group to mix in. #MAX_VGROUP_NAME. */
char defgrp_name_b[64];
/** Default weight value for first vgroup. */
float default_weight_a;
@@ -1558,7 +1558,7 @@ typedef struct WeightVGMixModifierData {
/* Masking options. */
/** The global "influence", if no vgroup nor tex is used as mask. */
float mask_constant;
- /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ /** Name of mask vertex group from which to get weight factors. #MAX_VGROUP_NAME. */
char mask_defgrp_name[64];
/* Texture masking. */
@@ -1628,7 +1628,7 @@ enum {
typedef struct WeightVGProximityModifierData {
ModifierData modifier;
- /** Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
+ /** Name of vertex group to modify/weight. #MAX_VGROUP_NAME. */
char defgrp_name[64];
/* Mapping stuff. */
@@ -1646,7 +1646,7 @@ typedef struct WeightVGProximityModifierData {
/* Masking options. */
/** The global "influence", if no vgroup nor tex is used as mask. */
float mask_constant;
- /** Name of mask vertex group from which to get weight factors. MAX_VGROUP_NAME. */
+ /** Name of mask vertex group from which to get weight factors. #MAX_VGROUP_NAME. */
char mask_defgrp_name[64];
/* Texture masking. */
@@ -1840,7 +1840,7 @@ typedef struct LaplacianSmoothModifierData {
float lambda, lambda_border;
char _pad1[4];
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
short flag, repeat;
} LaplacianSmoothModifierData;
@@ -1887,7 +1887,7 @@ typedef struct CorrectiveSmoothModifierData {
char smooth_type, rest_source;
char _pad[6];
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
/* runtime-only cache */
@@ -1932,7 +1932,7 @@ typedef struct UVWarpModifierData {
/** Optional name of bone target, MAX_ID_NAME-2. */
char bone_dst[64];
- /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ /** Optional vertex-group name, #MAX_VGROUP_NAME. */
char vgroup_name[64];
/** MAX_CUSTOMDATA_LAYER_NAME. */
char uvlayer_name[64];
@@ -2013,7 +2013,7 @@ enum {
typedef struct LaplacianDeformModifierData {
ModifierData modifier;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char anchor_grp_name[64];
int verts_num, repeat;
float *vertexco;
@@ -2035,7 +2035,7 @@ enum {
*/
typedef struct WireframeModifierData {
ModifierData modifier;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
float offset;
float offset_fac;
@@ -2059,7 +2059,7 @@ typedef struct WeldModifierData {
/* The limit below which to merge vertices. */
float merge_dist;
- /* Name of vertex group to use to mask, MAX_VGROUP_NAME. */
+ /** Name of vertex group to use to mask, #MAX_VGROUP_NAME. */
char defgrp_name[64];
char mode;
@@ -2107,7 +2107,7 @@ typedef struct DataTransferModifierData {
/** See CDT_MIX_ enum in BKE_customdata.h. */
int mix_mode;
float mix_factor;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
int flags;
@@ -2130,7 +2130,7 @@ enum {
/** Set Split Normals modifier. */
typedef struct NormalEditModifierData {
ModifierData modifier;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
/** Source of normals, or center of ellipsoid. */
struct Object *target;
@@ -2253,7 +2253,7 @@ enum {
typedef struct WeightedNormalModifierData {
ModifierData modifier;
- /** MAX_VGROUP_NAME. */
+ /** #MAX_VGROUP_NAME. */
char defgrp_name[64];
char mode, flag;
short weight;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index c7962db8198..3161238dc2e 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -613,7 +613,7 @@ typedef struct bNodeTree {
void (*progress)(void *, float progress);
/** \warning may be called by different threads */
void (*stats_draw)(void *, const char *str);
- int (*test_break)(void *);
+ bool (*test_break)(void *);
void (*update_draw)(void *);
void *tbh, *prh, *sdh, *udh;
@@ -931,7 +931,7 @@ typedef struct NodeImageMultiFileSocket {
char path[1024];
ImageFormatData format;
- /* multilayer output */
+ /* Multi-layer output. */
/** EXR_TOT_MAXNAME-2 ('.' and channel char are appended). */
char layer[30];
char _pad2[2];
@@ -1273,7 +1273,7 @@ typedef struct CryptomatteLayer {
typedef struct NodeCryptomatte_Runtime {
/* Contains `CryptomatteLayer`. */
ListBase layers;
- /* Temp storage for the cryptomatte picker. */
+ /* Temp storage for the crypto-matte picker. */
float add[3];
float remove[3];
} NodeCryptomatte_Runtime;
@@ -1497,6 +1497,10 @@ typedef struct NodeGeometryCurveToPoints {
typedef struct NodeGeometryCurveSample {
/* GeometryNodeCurveSampleMode. */
uint8_t mode;
+ int8_t use_all_curves;
+ /* eCustomDataType. */
+ int8_t data_type;
+ char _pad[1];
} NodeGeometryCurveSample;
typedef struct NodeGeometryTransferAttribute {
diff --git a/source/blender/makesdna/DNA_object_defaults.h b/source/blender/makesdna/DNA_object_defaults.h
index 14683869bc4..2a5796d2aea 100644
--- a/source/blender/makesdna/DNA_object_defaults.h
+++ b/source/blender/makesdna/DNA_object_defaults.h
@@ -23,7 +23,7 @@
\
.constinv = _DNA_DEFAULT_UNIT_M4, \
.parentinv = _DNA_DEFAULT_UNIT_M4, \
- .obmat = _DNA_DEFAULT_UNIT_M4, \
+ .object_to_world = _DNA_DEFAULT_UNIT_M4, \
\
.scale = {1, 1, 1}, \
.dscale = {1, 1, 1}, \
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 8296855ec29..494295f7bb9 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -322,20 +322,14 @@ typedef struct Object {
float rotAxis[3], drotAxis[3];
/** Axis angle rotation - angle part. */
float rotAngle, drotAngle;
- /** Final world-space matrix with constraints & animsys applied. */
- float obmat[4][4];
+ /** Final transformation matrices with constraints & animsys applied. */
+ float object_to_world[4][4];
+ float world_to_object[4][4];
/** Inverse result of parent, so that object doesn't 'stick' to parent. */
float parentinv[4][4];
/** Inverse result of constraints.
* doesn't include effect of parent or object local transform. */
float constinv[4][4];
- /**
- * Inverse matrix of 'obmat' for any other use than rendering!
- *
- * \note this isn't assured to be valid as with 'obmat',
- * before using this value you should do: `invert_m4_m4(ob->imat, ob->obmat)`
- */
- float imat[4][4];
/** Copy of Base's layer in the scene. */
unsigned int lay DNA_DEPRECATED;
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 44f1d3479b1..c4f11905e10 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -465,7 +465,7 @@ enum {
#define PART_REACT_MULTIPLE 2
//#define PART_LOOP 4 /* not used anymore */
-/* for dopesheet */
+/* For dope-sheet. */
#define PART_DS_EXPAND 8
#define PART_HAIR_REGROW 16 /* regrow hair for each frame */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index d2d20bcde78..4bb92e6fcc5 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -667,7 +667,7 @@ typedef struct SpaceSeq {
struct SequencerPreviewOverlay preview_overlay;
struct SequencerTimelineOverlay timeline_overlay;
- /** Multiview current eye - for internal use. */
+ /** Multi-view current eye - for internal use. */
char multiview_eye;
char _pad2[7];
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 9b235fac049..7231a995f10 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -89,13 +89,13 @@ typedef struct Report {
} Report;
/**
- * \note Saved in the wm, don't remove.
+ * \note Saved in the #wmWindowManager, don't remove.
*/
typedef struct ReportList {
ListBase list;
- /** eReportType. */
+ /** #eReportType. */
int printlevel;
- /** eReportType. */
+ /** #eReportType. */
int storelevel;
int flag;
char _pad[4];
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index e99f317f057..0cd1144b30d 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -199,8 +199,10 @@ typedef struct WorkSpaceInstanceHook {
WorkSpace *active;
struct WorkSpaceLayout *act_layout;
- /** Needed because we can't change workspaces/layouts in running handler loop,
- * it would break context. */
+ /**
+ * Needed because we can't change work-spaces/layouts in running handler loop,
+ * it would break context.
+ */
WorkSpace *temp_workspace_store;
struct WorkSpaceLayout *temp_layout_store;
} WorkSpaceInstanceHook;
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
index ec624bcb64e..afc907b7780 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -96,6 +96,8 @@ DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
DNA_STRUCT_RENAME_ELEM(Object, restrictflag, visibility_flag)
DNA_STRUCT_RENAME_ELEM(Object, size, scale)
+DNA_STRUCT_RENAME_ELEM(Object, obmat, object_to_world)
+DNA_STRUCT_RENAME_ELEM(Object, imat, world_to_object)
DNA_STRUCT_RENAME_ELEM(Object_Runtime, crazyspace_num_verts, crazyspace_verts_num)
DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h
index 53241c4a809..1604bd97ed4 100644
--- a/source/blender/makesrna/RNA_enum_items.h
+++ b/source/blender/makesrna/RNA_enum_items.h
@@ -19,6 +19,7 @@ DEF_ENUM(rna_enum_object_empty_drawtype_items)
DEF_ENUM(rna_enum_object_gpencil_type_items)
DEF_ENUM(rna_enum_metaelem_type_items)
+DEF_ENUM(rna_enum_color_space_convert_default_items)
DEF_ENUM(rna_enum_proportional_falloff_items)
DEF_ENUM(rna_enum_proportional_falloff_curve_only_items)
DEF_ENUM(rna_enum_snap_source_items)
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index f028b199098..5c2bdc214d1 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -406,8 +406,9 @@ if(WIN32 AND NOT UNIX)
target_link_libraries(makesrna ${PTHREADS_LIBRARIES})
endif()
-# Output rna_*_gen.c
-# note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes
+# Output `rna_*_gen.c`.
+# NOTE: (Linux only): with crashes try add this after COMMAND:
+# `valgrind --leak-check=full --track-origins=yes`
add_custom_command(
OUTPUT ${GENSRC}
COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_CURRENT_BINARY_DIR}/../
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index e6b1ea1321c..a2386205013 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -1129,7 +1129,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_define_lib_overridable(false);
}
-/* err... bones should not be directly edited (only editbones should be...) */
+/* Err... bones should not be directly edited (only edit-bones should be...). */
static void rna_def_bone(BlenderRNA *brna)
{
StructRNA *srna;
diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c
index f919cfbeffd..3c7eb3d208f 100644
--- a/source/blender/makesrna/intern/rna_asset.c
+++ b/source/blender/makesrna/intern/rna_asset.c
@@ -472,6 +472,12 @@ static void rna_def_asset_handle(BlenderRNA *brna)
rna_def_asset_handle_api(srna);
}
+static void rna_def_asset_catalog_path(BlenderRNA *brna)
+{
+ StructRNA *srna = RNA_def_struct(brna, "AssetCatalogPath", NULL);
+ RNA_def_struct_ui_text(srna, "Catalog Path", "");
+}
+
static void rna_def_asset_library_reference(BlenderRNA *brna)
{
StructRNA *srna = RNA_def_struct(brna, "AssetLibraryReference", NULL);
@@ -498,6 +504,7 @@ void RNA_def_asset(BlenderRNA *brna)
rna_def_asset_data(brna);
rna_def_asset_library_reference(brna);
rna_def_asset_handle(brna);
+ rna_def_asset_catalog_path(brna);
RNA_define_animate_sdna(true);
}
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 137020ce3f8..5ba31070e1d 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -3663,13 +3663,13 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mask Texture Overlay Alpha", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
+ prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "add_col");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
+ prop = RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "sub_col");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index b68d87587e7..061ddc034b0 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -15,11 +15,22 @@
#include "BKE_node_tree_update.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "WM_api.h"
#include "WM_types.h"
+const EnumPropertyItem rna_enum_color_space_convert_default_items[] = {
+ {0,
+ "NONE",
+ 0,
+ "None",
+ "Do not perform any color transform on load, treat colors as in scene linear space "
+ "already"},
+ {0, NULL, 0, NULL, NULL},
+};
+
#ifdef RNA_RUNTIME
# include "RNA_access.h"
@@ -566,8 +577,11 @@ static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA
}
static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
+ if (C == NULL) {
+ return rna_enum_color_space_convert_default_items;
+ }
EnumPropertyItem *items = NULL;
int totitem = 0;
@@ -1190,16 +1204,6 @@ static void rna_def_colormanage(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
- static const EnumPropertyItem color_space_items[] = {
- {0,
- "NONE",
- 0,
- "None",
- "Do not perform any color transform on load, treat colors as in scene linear space "
- "already"},
- {0, NULL, 0, NULL, NULL},
- };
-
/* ** Display Settings ** */
srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path");
@@ -1279,7 +1283,7 @@ static void rna_def_colormanage(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_items(prop, rna_enum_color_space_convert_default_items);
RNA_def_property_enum_funcs(prop,
"rna_ColorManagedColorspaceSettings_colorspace_get",
"rna_ColorManagedColorspaceSettings_colorspace_set",
@@ -1309,7 +1313,7 @@ static void rna_def_colormanage(BlenderRNA *brna)
prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_items(prop, rna_enum_color_space_convert_default_items);
RNA_def_property_enum_funcs(prop,
"rna_ColorManagedColorspaceSettings_colorspace_get",
"rna_ColorManagedColorspaceSettings_colorspace_set",
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index db5b3c33c59..9af76de2a2b 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -168,7 +168,7 @@ static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float
/* We can return actual object's matrix here, no reason to return identity matrix
* when this is not actually an instance... */
Object *ob = (Object *)di->iter.current;
- copy_m4_m4((float(*)[4])mat, ob->obmat);
+ copy_m4_m4((float(*)[4])mat, ob->object_to_world);
}
}
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 727d329781d..9fe7dda0e20 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -2416,7 +2416,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
RNA_def_property_update(prop, NC_ANIMATION, NULL);
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index cf0ff546d41..a55a1b0ffcd 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -334,13 +334,13 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr, const char **
static void set_parent(bGPDlayer *gpl, Object *par, const int type, const char *substr)
{
if (type == PAROBJECT) {
- invert_m4_m4(gpl->inverse, par->obmat);
+ invert_m4_m4(gpl->inverse, par->object_to_world);
gpl->parent = par;
gpl->partype |= PAROBJECT;
gpl->parsubstr[0] = 0;
}
else if (type == PARSKEL) {
- invert_m4_m4(gpl->inverse, par->obmat);
+ invert_m4_m4(gpl->inverse, par->object_to_world);
gpl->parent = par;
gpl->partype |= PARSKEL;
gpl->parsubstr[0] = 0;
@@ -349,7 +349,7 @@ static void set_parent(bGPDlayer *gpl, Object *par, const int type, const char *
bPoseChannel *pchan = BKE_pose_channel_find_name(par->pose, substr);
if (pchan) {
float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, par->obmat, pchan->pose_mat);
+ mul_m4_m4m4(tmp_mat, par->object_to_world, pchan->pose_mat);
invert_m4_m4(gpl->inverse, tmp_mat);
gpl->parent = par;
@@ -357,7 +357,7 @@ static void set_parent(bGPDlayer *gpl, Object *par, const int type, const char *
BLI_strncpy(gpl->parsubstr, substr, sizeof(gpl->parsubstr));
}
else {
- invert_m4_m4(gpl->inverse, par->obmat);
+ invert_m4_m4(gpl->inverse, par->object_to_world);
gpl->parent = par;
gpl->partype |= PAROBJECT;
gpl->parsubstr[0] = 0;
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index bad099815a4..f13132b5b7c 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -4024,6 +4024,7 @@ static void rna_def_mesh(BlenderRNA *brna)
"Size of the voxel in object space used for volume evaluation. Lower "
"values preserve finer details");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "remesh_voxel_adaptivity", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "remesh_voxel_adaptivity");
@@ -4035,11 +4036,13 @@ static void rna_def_mesh(BlenderRNA *brna)
"Reduces the final face count by simplifying geometry where detail is not needed, "
"generating triangles. A value greater than 0 disables Fix Poles");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "use_remesh_fix_poles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_FIX_POLES);
RNA_def_property_ui_text(prop, "Fix Poles", "Produces less poles and a better topology flow");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "use_remesh_preserve_volume", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_REPROJECT_VOLUME);
@@ -4048,29 +4051,34 @@ static void rna_def_mesh(BlenderRNA *brna)
"Preserve Volume",
"Projects the mesh to preserve the volume and details of the original mesh");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "use_remesh_preserve_paint_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_REPROJECT_PAINT_MASK);
RNA_def_property_ui_text(prop, "Preserve Paint Mask", "Keep the current mask on the new mesh");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "use_remesh_preserve_sculpt_face_sets", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_REPROJECT_SCULPT_FACE_SETS);
RNA_def_property_ui_text(
prop, "Preserve Face Sets", "Keep the current Face Sets on the new mesh");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "use_remesh_preserve_vertex_colors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_REPROJECT_VERTEX_COLORS);
RNA_def_property_ui_text(
prop, "Preserve Vertex Colors", "Keep the current vertex colors on the new mesh");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
prop = RNA_def_property(srna, "remesh_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "remesh_mode");
RNA_def_property_enum_items(prop, rna_enum_mesh_remesh_mode_items);
RNA_def_property_ui_text(prop, "Remesh Mode", "");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
/* End remesh */
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 524e3134f9c..de033408170 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -822,6 +822,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
/* these limits have currently be chosen arbitrarily, but could be extended
* (minimum should still be > 0 though) if needed... */
+ RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_range(prop, 0.1f, 1000.0f);
RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
RNA_def_property_update(
@@ -832,6 +833,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
/* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
* due to numeric errors */
+ RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_range(prop, 0.0001f, 1000.0f);
RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
RNA_def_property_update(
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 865399df9ef..4460a8c8830 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4500,8 +4500,11 @@ static void rna_NodeConvertColorSpace_to_color_space_set(struct PointerRNA *ptr,
}
static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
+ if (C == NULL) {
+ return rna_enum_color_space_convert_default_items;
+ }
EnumPropertyItem *items = NULL;
int totitem = 0;
@@ -7323,19 +7326,9 @@ static void def_cmp_convert_color_space(StructRNA *srna)
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "NodeConvertColorSpace", "storage");
- static const EnumPropertyItem color_space_items[] = {
- {0,
- "NONE",
- 0,
- "None",
- "Do not perform any color transform on load, treat colors as in scene linear space "
- "already"},
- {0, NULL, 0, NULL, NULL},
- };
-
prop = RNA_def_property(srna, "from_color_space", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_items(prop, rna_enum_color_space_convert_default_items);
RNA_def_property_enum_funcs(prop,
"rna_NodeConvertColorSpace_from_color_space_get",
"rna_NodeConvertColorSpace_from_color_space_set",
@@ -7345,7 +7338,7 @@ static void def_cmp_convert_color_space(StructRNA *srna)
prop = RNA_def_property(srna, "to_color_space", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_items(prop, rna_enum_color_space_convert_default_items);
RNA_def_property_enum_funcs(prop,
"rna_NodeConvertColorSpace_to_color_space_get",
"rna_NodeConvertColorSpace_to_color_space_set",
@@ -9442,10 +9435,26 @@ static void def_geo_curve_sample(StructRNA *srna)
RNA_def_struct_sdna_from(srna, "NodeGeometryCurveSample", "storage");
- PropertyRNA *prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ PropertyRNA *prop;
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, mode_items);
RNA_def_property_ui_text(prop, "Mode", "Method for sampling input");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+ prop = RNA_def_property(srna, "use_all_curves", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop,
+ "All Curves",
+ "Sample lengths based on the total lengh of all curves, rather than "
+ "using a length inside each selected curve");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
+
+ prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_GeometryNodeAttributeType_type_with_socket_itemf");
+ RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
+ RNA_def_property_ui_text(prop, "Data Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_triangulate(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 46a89d3a6e0..1d6b3d5d69e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -356,7 +356,8 @@ static void rna_Object_internal_update_draw(Main *UNUSED(bmain),
static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
/* don't use compat so we get predictable rotation */
- BKE_object_apply_mat4((Object *)ptr->owner_id, ((Object *)ptr->owner_id)->obmat, false, true);
+ BKE_object_apply_mat4(
+ (Object *)ptr->owner_id, ((Object *)ptr->owner_id)->object_to_world, false, true);
rna_Object_internal_update(bmain, scene, ptr);
}
@@ -407,7 +408,7 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
Object *ob = (Object *)ptr->owner_id;
float local_mat[4][4];
- /* Localspace matrix is truly relative to the parent,
+ /* Local-space matrix is truly relative to the parent,
* but parameters stored in object are relative to parentinv matrix.
* Undo the parent inverse part before applying it as local matrix. */
if (ob->parent) {
@@ -3390,7 +3391,7 @@ static void rna_def_object(BlenderRNA *brna)
/* matrix */
prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "obmat");
+ RNA_def_property_float_sdna(prop, NULL, "object_to_world");
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 07702f3b4b6..02105c7b425 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -471,7 +471,7 @@ static void rna_ParticleSystem_co_hair(
if (step >= 0 && step <= max_k) {
copy_v3_v3(n_co, (cache + step)->co);
mul_m4_v3(particlesystem->imat, n_co);
- mul_m4_v3(object->obmat, n_co);
+ mul_m4_v3(object->object_to_world, n_co);
}
}
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index c4a11d4e9e0..44df0db9ade 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -1640,7 +1640,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
/* color */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index fc68e8421d7..eac29ac5e61 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -1785,6 +1785,10 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "template_node_asset_menu_items", "uiTemplateNodeAssetMenuItems");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "catalog_path", NULL, 0, "", "");
+
func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e22ae205b0a..58189ab2478 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -574,7 +574,7 @@ static void rna_Userdef_disk_cache_dir_update(Main *UNUSED(bmain),
{
if (U.sequencer_disk_cache_dir[0] != '\0') {
BLI_path_abs(U.sequencer_disk_cache_dir, BKE_main_blendfile_path_from_global());
- BLI_path_slash_ensure(U.sequencer_disk_cache_dir);
+ BLI_path_slash_ensure(U.sequencer_disk_cache_dir, sizeof(U.sequencer_disk_cache_dir));
BLI_path_make_safe(U.sequencer_disk_cache_dir);
}
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index bf534b0d586..2d725af7fe4 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -456,13 +456,13 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
float result_mat[4][4];
if (ctx->object) {
- invert_m4_m4(obinv, ctx->object->obmat);
+ invert_m4_m4(obinv, ctx->object->object_to_world);
}
else {
unit_m4(obinv);
}
- mul_m4_series(result_mat, offset, obinv, amd->offset_ob->obmat);
+ mul_m4_series(result_mat, offset, obinv, amd->offset_ob->object_to_world);
copy_m4_m4(offset, result_mat);
}
@@ -474,7 +474,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
Object *curve_ob = amd->curve_ob;
CurveCache *curve_cache = curve_ob->runtime.curve_cache;
if (curve_cache != NULL && curve_cache->anim_path_accum_length != NULL) {
- float scale_fac = mat4_to_scale(curve_ob->obmat);
+ float scale_fac = mat4_to_scale(curve_ob->object_to_world);
length = scale_fac * BKE_anim_path_get_length(curve_cache);
}
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.cc b/source/blender/modifiers/intern/MOD_boolean.cc
index 7ad49f43e1b..21f05158e8b 100644
--- a/source/blender/modifiers/intern/MOD_boolean.cc
+++ b/source/blender/modifiers/intern/MOD_boolean.cc
@@ -139,8 +139,8 @@ static Mesh *get_quick_mesh(
float imat[4][4];
float omat[4][4];
- invert_m4_m4(imat, ob_self->obmat);
- mul_m4_m4m4(omat, imat, ob_operand_ob->obmat);
+ invert_m4_m4(imat, ob_self->object_to_world);
+ mul_m4_m4m4(omat, imat, ob_operand_ob->object_to_world);
MutableSpan<MVert> verts = result->verts_for_write();
for (const int i : verts.index_range()) {
@@ -227,7 +227,8 @@ static BMesh *BMD_mesh_bm_create(
SCOPED_TIMER(__func__);
#endif
- *r_is_flip = (is_negative_m4(object->obmat) != is_negative_m4(operand_ob->obmat));
+ *r_is_flip = (is_negative_m4(object->object_to_world) !=
+ is_negative_m4(operand_ob->object_to_world));
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(mesh, mesh_operand_ob);
@@ -294,8 +295,8 @@ static void BMD_mesh_intersection(BMesh *bm,
float imat[4][4];
float omat[4][4];
- invert_m4_m4(imat, object->obmat);
- mul_m4_m4m4(omat, imat, operand_ob->obmat);
+ invert_m4_m4(imat, object->object_to_world);
+ mul_m4_m4m4(omat, imat, operand_ob->object_to_world);
BMVert *eve;
i = 0;
@@ -414,7 +415,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
}
meshes.append(mesh);
- obmats.append((float4x4 *)&ctx->object->obmat);
+ obmats.append((float4x4 *)&ctx->object->object_to_world);
material_remaps.append({});
if (mesh->totcol == 0) {
/* Necessary for faces using the default material when there are no material slots. */
@@ -431,7 +432,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
}
BKE_mesh_wrapper_ensure_mdata(mesh_operand);
meshes.append(mesh_operand);
- obmats.append((float4x4 *)&bmd->object->obmat);
+ obmats.append((float4x4 *)&bmd->object->object_to_world);
material_remaps.append(get_material_remap(*bmd->object, *mesh_operand, materials));
}
else if (bmd->flag & eBooleanModifierFlag_Collection) {
@@ -446,7 +447,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
}
BKE_mesh_wrapper_ensure_mdata(collection_mesh);
meshes.append(collection_mesh);
- obmats.append((float4x4 *)&ob->obmat);
+ obmats.append((float4x4 *)&ob->object_to_world);
material_remaps.append(get_material_remap(*ob, *collection_mesh, materials));
}
}
@@ -456,14 +457,15 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
const bool use_self = (bmd->flag & eBooleanModifierFlag_Self) != 0;
const bool hole_tolerant = (bmd->flag & eBooleanModifierFlag_HoleTolerant) != 0;
- Mesh *result = blender::meshintersect::direct_mesh_boolean(meshes,
- obmats,
- *(float4x4 *)&ctx->object->obmat,
- material_remaps,
- use_self,
- hole_tolerant,
- bmd->operation,
- nullptr);
+ Mesh *result = blender::meshintersect::direct_mesh_boolean(
+ meshes,
+ obmats,
+ *(float4x4 *)&ctx->object->object_to_world,
+ material_remaps,
+ use_self,
+ hole_tolerant,
+ bmd->operation,
+ nullptr);
MEM_SAFE_FREE(result->mat);
result->mat = (Material **)MEM_malloc_arrayN(materials.size(), sizeof(Material *), __func__);
result->totcol = materials.size();
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 30be1d33653..b6e1b5e88c1 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -126,13 +126,13 @@ static void sphere_do(CastModifierData *cmd,
* we use its location, transformed to ob's local space */
if (ctrl_ob) {
if (flag & MOD_CAST_USE_OB_TRANSFORM) {
- invert_m4_m4(imat, ctrl_ob->obmat);
- mul_m4_m4m4(mat, imat, ob->obmat);
+ invert_m4_m4(imat, ctrl_ob->object_to_world);
+ mul_m4_m4m4(mat, imat, ob->object_to_world);
invert_m4_m4(imat, mat);
}
- invert_m4_m4(ob->imat, ob->obmat);
- mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_v3_m4v3(center, ob->world_to_object, ctrl_ob->object_to_world[3]);
}
/* now we check which options the user wants */
@@ -275,13 +275,13 @@ static void cuboid_do(CastModifierData *cmd,
if (ctrl_ob) {
if (flag & MOD_CAST_USE_OB_TRANSFORM) {
- invert_m4_m4(imat, ctrl_ob->obmat);
- mul_m4_m4m4(mat, imat, ob->obmat);
+ invert_m4_m4(imat, ctrl_ob->object_to_world);
+ mul_m4_m4m4(mat, imat, ob->object_to_world);
invert_m4_m4(imat, mat);
}
- invert_m4_m4(ob->imat, ob->obmat);
- mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_v3_m4v3(center, ob->world_to_object, ctrl_ob->object_to_world[3]);
}
if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index e38bf96500e..82faf08b349 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -149,7 +149,7 @@ static void deformVerts(ModifierData *md,
for (uint i = 0; i < mvert_num; i++) {
/* we save global positions */
- mul_m4_v3(ob->obmat, collmd->x[i].co);
+ mul_m4_v3(ob->object_to_world, collmd->x[i].co);
}
collmd->xnew = MEM_dupallocN(collmd->x); /* Frame end position. */
@@ -188,7 +188,7 @@ static void deformVerts(ModifierData *md,
for (uint i = 0; i < mvert_num; i++) {
/* we save global positions */
- mul_m4_v3(ob->obmat, collmd->xnew[i].co);
+ mul_m4_v3(ob->object_to_world, collmd->xnew[i].co);
/* detect motion */
is_static = is_static && equals_v3v3(collmd->x[i].co, collmd->xnew[i].co);
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index ad5be57ad68..fc12a9c2aad 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -322,7 +322,7 @@ static void displaceModifier_do(DisplaceModifierData *dmd,
}
else if (ELEM(direction, MOD_DISP_DIR_X, MOD_DISP_DIR_Y, MOD_DISP_DIR_Z, MOD_DISP_DIR_RGB_XYZ) &&
use_global_direction) {
- copy_m4_m4(local_mat, ob->obmat);
+ copy_m4_m4(local_mat, ob->object_to_world);
}
DisplaceUserdata data = {NULL};
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index af167bf9b32..96bf836fa4a 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -985,7 +985,7 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
MTFace *mtface = CustomData_get_layer_named(&explode->fdata, CD_MTFACE, emd->uvname);
/* getting back to object space */
- invert_m4_m4(imat, ctx->object->obmat);
+ invert_m4_m4(imat, ctx->object->object_to_world);
psmd->psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
@@ -1020,7 +1020,7 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
psys_get_particle_state(&sim, ed_v2, &state, 1);
vertco = explode_verts[v].co;
- mul_m4_v3(ctx->object->obmat, vertco);
+ mul_m4_v3(ctx->object->object_to_world, vertco);
sub_v3_v3(vertco, birth.co);
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 11bc9ee9574..231c65998e0 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -338,14 +338,14 @@ static void deformVerts_do(HookModifierData *hmd,
/* get world-space matrix of target, corrected for the space the verts are in */
if (hmd->subtarget[0] && pchan) {
/* bone target if there's a matching pose-channel */
- mul_m4_m4m4(dmat, ob_target->obmat, pchan->pose_mat);
+ mul_m4_m4m4(dmat, ob_target->object_to_world, pchan->pose_mat);
}
else {
/* just object target */
- copy_m4_m4(dmat, ob_target->obmat);
+ copy_m4_m4(dmat, ob_target->object_to_world);
}
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_series(hd.mat, ob->imat, dmat, hmd->parentinv);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_series(hd.mat, ob->world_to_object, dmat, hmd->parentinv);
/* --- done with 'hd' init --- */
/* Regarding index range checking below.
diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc
index 7fabd5c65fa..659a1625079 100644
--- a/source/blender/modifiers/intern/MOD_mask.cc
+++ b/source/blender/modifiers/intern/MOD_mask.cc
@@ -607,7 +607,7 @@ static void add_interpolated_polys_to_new_mesh(const Mesh &src_mesh,
cut_edge.v1 = dst_loops[mp_dst.loopstart].v;
cut_edge.v2 = cut_dst_loop.v;
BLI_assert(cut_edge.v1 != cut_edge.v2);
- cut_edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ cut_edge.flag = ME_EDGEDRAW;
edge_index++;
/* Only handle one of the cuts per iteration. */
diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
index cad9fdfe30d..fa7f0690675 100644
--- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
+++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
@@ -134,8 +134,8 @@ static Volume *mesh_to_volume(ModifierData *md,
}
BKE_mesh_wrapper_ensure_mdata(mesh);
- const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->imat) *
- float4x4(object_to_convert->obmat);
+ const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->world_to_object) *
+ float4x4(object_to_convert->object_to_world);
geometry::MeshToVolumeResolution resolution;
resolution.mode = (MeshToVolumeModifierResolutionMode)mvmd->resolution_mode;
if (resolution.mode == MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT) {
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index d7ed346a61f..2aaaee2ccc7 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -358,8 +358,8 @@ static void meshdeformModifier_do(ModifierData *md,
}
/* compute matrices to go in and out of cage object space */
- invert_m4_m4(imat, ob_target->obmat);
- mul_m4_m4m4(cagemat, imat, ob->obmat);
+ invert_m4_m4(imat, ob_target->object_to_world);
+ mul_m4_m4m4(cagemat, imat, ob->object_to_world);
mul_m4_m4m4(cmat, mmd->bindmat, cagemat);
invert_m4_m4(iobmat, cmat);
copy_m3_m4(icagemat, iobmat);
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.cc b/source/blender/modifiers/intern/MOD_normal_edit.cc
index 43ded18fcc4..7d422826cf8 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.cc
+++ b/source/blender/modifiers/intern/MOD_normal_edit.cc
@@ -94,8 +94,8 @@ static void generate_vert_coordinates(Mesh *mesh,
/* Translate our coordinates so that center of ob_center is at (0, 0, 0). */
/* Get ob_center (world) coordinates in ob local coordinates.
* No need to take into account ob_center's space here, see T44027. */
- invert_m4_m4(inv_obmat, ob->obmat);
- mul_v3_m4v3(diff, inv_obmat, ob_center->obmat[3]);
+ invert_m4_m4(inv_obmat, ob->object_to_world);
+ mul_v3_m4v3(diff, inv_obmat, ob_center->object_to_world[3]);
negate_v3(diff);
do_diff = true;
@@ -383,8 +383,8 @@ static void normalEditModifier_do_directional(NormalEditModifierData *enmd,
/* Get target's center coordinates in ob local coordinates. */
float mat[4][4];
- invert_m4_m4(mat, ob->obmat);
- mul_m4_m4m4(mat, mat, ob_target->obmat);
+ invert_m4_m4(mat, ob->object_to_world);
+ mul_m4_m4m4(mat, mat, ob_target->object_to_world);
copy_v3_v3(target_co, mat[3]);
if (use_parallel_normals) {
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index aab48101351..f65f8bc4fb3 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -273,7 +273,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
break;
case eParticleInstanceSpace_Local:
/* get particle states in the particle object's local space */
- invert_m4_m4(spacemat, pimd->ob->obmat);
+ invert_m4_m4(spacemat, pimd->ob->object_to_world);
break;
default:
/* should not happen */
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 91f8947bbc3..4ba274dbd8a 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -274,8 +274,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
if (ob_axis != NULL) {
/* Calculate the matrix relative to the axis object. */
- invert_m4_m4(mtx_tmp_a, ctx->object->obmat);
- copy_m4_m4(mtx_tx_inv, ob_axis->obmat);
+ invert_m4_m4(mtx_tmp_a, ctx->object->object_to_world);
+ copy_m4_m4(mtx_tx_inv, ob_axis->object_to_world);
mul_m4_m4m4(mtx_tx, mtx_tmp_a, mtx_tx_inv);
/* Calculate the axis vector. */
@@ -814,7 +814,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
/* add the new edge */
med_new->v1 = varray_stride + j;
med_new->v2 = med_new->v1 - totvert;
- med_new->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med_new->flag = ME_EDGEDRAW;
if (!BLI_BITMAP_TEST(vert_tag, j)) {
med_new->flag |= ME_LOOSEEDGE;
}
@@ -835,7 +835,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
for (i = 0; i < totvert; i++) {
med_new->v1 = i;
med_new->v2 = varray_stride + i;
- med_new->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med_new->flag = ME_EDGEDRAW;
if (!BLI_BITMAP_TEST(vert_tag, i)) {
med_new->flag |= ME_LOOSEEDGE;
}
diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c
index a662d729f52..08e9569bd95 100644
--- a/source/blender/modifiers/intern/MOD_solidify_extrude.c
+++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c
@@ -1045,7 +1045,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
for (i = 0; i < rimVerts; i++, ed++) {
ed->v1 = new_vert_arr[i];
ed->v2 = (do_shell ? new_vert_arr[i] : i) + verts_num;
- ed->flag |= ME_EDGEDRAW | ME_EDGERENDER;
+ ed->flag |= ME_EDGEDRAW;
if (orig_ed) {
*orig_ed = ORIGINDEX_NONE;
diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
index 5948fefa8b3..9d0b5c30b5e 100644
--- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
+++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c
@@ -2042,7 +2042,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
BLI_assert(v2 != MOD_SOLIDIFY_EMPTY_TAG);
medge[insert].v1 = v1;
medge[insert].v2 = v2;
- medge[insert].flag = orig_medge[(*l)->old_edge].flag | ME_EDGEDRAW | ME_EDGERENDER;
+ medge[insert].flag = orig_medge[(*l)->old_edge].flag | ME_EDGEDRAW;
if (result_edge_crease) {
result_edge_crease[insert] = orig_edge_crease ? orig_edge_crease[(*l)->old_edge] :
0.0f;
@@ -2206,8 +2206,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
}
medge[edge_index].v1 = last_g->new_vert;
medge[edge_index].v2 = g->new_vert;
- medge[edge_index].flag = ME_EDGEDRAW | ME_EDGERENDER |
- ((last_flag | flag) & (ME_SEAM | ME_SHARP));
+ medge[edge_index].flag = ME_EDGEDRAW | ((last_flag | flag) & (ME_SEAM | ME_SHARP));
if (result_edge_crease) {
result_edge_crease[edge_index] = max_ff(mv_crease,
min_ff(last_max_crease, max_crease));
@@ -2240,7 +2239,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
last_g->open_face_edge = edge_index;
medge[edge_index].v1 = last_g->new_vert;
medge[edge_index].v2 = first_g->new_vert;
- medge[edge_index].flag = ME_EDGEDRAW | ME_EDGERENDER |
+ medge[edge_index].flag = ME_EDGEDRAW |
((last_flag | first_flag) & (ME_SEAM | ME_SHARP));
if (result_edge_crease) {
result_edge_crease[edge_index] = max_ff(mv_crease,
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index c5e117635b5..a34d66f394b 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -154,7 +154,7 @@ static void deformVerts(ModifierData *md,
MVert *verts = BKE_mesh_verts_for_write(surmd->mesh);
for (i = 0, x = surmd->x, v = surmd->v; i < mesh_verts_num; i++, x++, v++) {
float *vec = verts[i].co;
- mul_m4_v3(ctx->object->obmat, vec);
+ mul_m4_v3(ctx->object->object_to_world, vec);
if (init) {
v->co[0] = v->co[1] = v->co[2] = 0.0f;
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 53bfdc35b31..6a9321a78a2 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -1466,8 +1466,8 @@ static void surfacedeformModifier_do(ModifierData *md,
ob, md);
float tmp_mat[4][4];
- invert_m4_m4(tmp_mat, ob->obmat);
- mul_m4_m4m4(smd_orig->mat, tmp_mat, ob_target->obmat);
+ invert_m4_m4(tmp_mat, ob->object_to_world);
+ mul_m4_m4m4(smd_orig->mat, tmp_mat, ob_target->object_to_world);
/* Avoid converting edit-mesh data, binding is an exception. */
BKE_mesh_wrapper_ensure_mdata(target);
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index e8280bc9c97..5bae6090758 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -86,7 +86,7 @@ static Mesh *triangulate_mesh(Mesh *mesh,
/* force drawing of all edges (seems to be omitted in CDDM_from_bmesh) */
for (i = 0; i < edges_num; i++, me++) {
- me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
+ me->flag |= ME_EDGEDRAW;
}
return result;
diff --git a/source/blender/modifiers/intern/MOD_util.cc b/source/blender/modifiers/intern/MOD_util.cc
index 589a3d28ad9..a94fc6732a0 100644
--- a/source/blender/modifiers/intern/MOD_util.cc
+++ b/source/blender/modifiers/intern/MOD_util.cc
@@ -75,15 +75,15 @@ void MOD_get_texture_coords(MappingInfoModifierData *dmd,
bPoseChannel *pchan = BKE_pose_channel_find_name(map_object->pose, dmd->map_bone);
if (pchan) {
float mat_bone_world[4][4];
- mul_m4_m4m4(mat_bone_world, map_object->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat_bone_world, map_object->object_to_world, pchan->pose_mat);
invert_m4_m4(mapref_imat, mat_bone_world);
}
else {
- invert_m4_m4(mapref_imat, map_object->obmat);
+ invert_m4_m4(mapref_imat, map_object->object_to_world);
}
}
else {
- invert_m4_m4(mapref_imat, map_object->obmat);
+ invert_m4_m4(mapref_imat, map_object->object_to_world);
}
}
else { /* if there is no map object, default to local */
@@ -138,10 +138,10 @@ void MOD_get_texture_coords(MappingInfoModifierData *dmd,
copy_v3_v3(*r_texco, cos != nullptr ? *cos : mv->co);
break;
case MOD_DISP_MAP_GLOBAL:
- mul_v3_m4v3(*r_texco, ob->obmat, cos != nullptr ? *cos : mv->co);
+ mul_v3_m4v3(*r_texco, ob->object_to_world, cos != nullptr ? *cos : mv->co);
break;
case MOD_DISP_MAP_OBJECT:
- mul_v3_m4v3(*r_texco, ob->obmat, cos != nullptr ? *cos : mv->co);
+ mul_v3_m4v3(*r_texco, ob->object_to_world, cos != nullptr ? *cos : mv->co);
mul_m4_v3(mapref_imat, *r_texco);
break;
}
diff --git a/source/blender/modifiers/intern/MOD_uvproject.cc b/source/blender/modifiers/intern/MOD_uvproject.cc
index c07b2059b5b..895572d9477 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.cc
+++ b/source/blender/modifiers/intern/MOD_uvproject.cc
@@ -132,7 +132,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
float offsetmat[4][4];
Camera *cam = nullptr;
/* calculate projection matrix */
- invert_m4_m4(projectors[i].projmat, projectors[i].ob->obmat);
+ invert_m4_m4(projectors[i].projmat, projectors[i].ob->object_to_world);
projectors[i].uci = nullptr;
@@ -178,7 +178,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
projectors[i].normal[0] = 0;
projectors[i].normal[1] = 0;
projectors[i].normal[2] = 1;
- mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
+ mul_mat3_m4_v3(projectors[i].ob->object_to_world, projectors[i].normal);
}
polys_num = mesh->totpoly;
@@ -192,7 +192,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
/* Convert coords to world-space. */
for (i = 0, co = coords; i < verts_num; i++, co++) {
- mul_m4_v3(ob->obmat, *co);
+ mul_m4_v3(ob->object_to_world, *co);
}
/* if only one projector, project coords to UVs */
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.cc b/source/blender/modifiers/intern/MOD_uvwarp.cc
index 4ec273bcbc6..a96b28b4e2e 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.cc
+++ b/source/blender/modifiers/intern/MOD_uvwarp.cc
@@ -72,10 +72,10 @@ static void matrix_from_obj_pchan(float mat[4][4], Object *ob, const char *bonen
{
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename);
if (pchan) {
- mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat, ob->object_to_world, pchan->pose_mat);
}
else {
- copy_m4_m4(mat, ob->obmat);
+ copy_m4_m4(mat, ob->object_to_world);
}
}
diff --git a/source/blender/modifiers/intern/MOD_volume_displace.cc b/source/blender/modifiers/intern/MOD_volume_displace.cc
index e66793d7cce..2d6f8c100e7 100644
--- a/source/blender/modifiers/intern/MOD_volume_displace.cc
+++ b/source/blender/modifiers/intern/MOD_volume_displace.cc
@@ -254,15 +254,16 @@ struct DisplaceGridOp {
return index_to_object;
}
case MOD_VOLUME_DISPLACE_MAP_GLOBAL: {
- const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat);
+ const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world);
return index_to_object * object_to_world;
}
case MOD_VOLUME_DISPLACE_MAP_OBJECT: {
if (vdmd.texture_map_object == nullptr) {
return index_to_object;
}
- const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat);
- const openvdb::Mat4s world_to_texture = matrix_to_openvdb(vdmd.texture_map_object->imat);
+ const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world);
+ const openvdb::Mat4s world_to_texture = matrix_to_openvdb(
+ vdmd.texture_map_object->world_to_object);
return index_to_object * object_to_world * world_to_texture;
}
}
diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
index 35fd5a4af42..2a8883dc2eb 100644
--- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
+++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
@@ -157,8 +157,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
volume_grid);
openvdb::math::Transform::Ptr transform = local_grid->transform().copy();
- transform->postMult(openvdb::Mat4d((float *)vmmd->object->obmat));
- openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx->object->imat);
+ transform->postMult(openvdb::Mat4d((float *)vmmd->object->object_to_world));
+ openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx->object->world_to_object);
/* `imat` had floating point issues and wasn't affine. */
imat.setCol(3, openvdb::Vec4d(0, 0, 0, 1));
transform->postMult(imat);
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 3fafbd97fee..791eed28a71 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -93,11 +93,11 @@ static void matrix_from_obj_pchan(float mat[4][4],
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename);
if (pchan) {
float mat_bone_world[4][4];
- mul_m4_m4m4(mat_bone_world, ob->obmat, pchan->pose_mat);
+ mul_m4_m4m4(mat_bone_world, ob->object_to_world, pchan->pose_mat);
mul_m4_m4m4(mat, obinv, mat_bone_world);
}
else {
- mul_m4_m4m4(mat, obinv, ob->obmat);
+ mul_m4_m4m4(mat, obinv, ob->object_to_world);
}
}
@@ -215,7 +215,7 @@ static void warpModifier_do(WarpModifierData *wmd,
BKE_curvemapping_init(wmd->curfalloff);
}
- invert_m4_m4(obinv, ob->obmat);
+ invert_m4_m4(obinv, ob->object_to_world);
/* Checks that the objects/bones are available. */
matrix_from_obj_pchan(mat_from, obinv, wmd->object_from, wmd->bone_from);
diff --git a/source/blender/modifiers/intern/MOD_wave.cc b/source/blender/modifiers/intern/MOD_wave.cc
index 647e0324707..dce006bda92 100644
--- a/source/blender/modifiers/intern/MOD_wave.cc
+++ b/source/blender/modifiers/intern/MOD_wave.cc
@@ -152,8 +152,8 @@ static void waveModifier_do(WaveModifierData *md,
if (wmd->objectcenter != nullptr) {
float mat[4][4];
/* get the control object's location in local coordinates */
- invert_m4_m4(ob->imat, ob->obmat);
- mul_m4_m4m4(mat, ob->imat, wmd->objectcenter->obmat);
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
+ mul_m4_m4m4(mat, ob->world_to_object, wmd->objectcenter->object_to_world);
wmd->startx = mat[3][0];
wmd->starty = mat[3][1];
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.cc b/source/blender/modifiers/intern/MOD_weightvgproximity.cc
index 93052f4215d..e4e03a2cbc9 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.cc
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.cc
@@ -223,9 +223,9 @@ static void get_vert2ob_distance(
while (i-- > 0) {
/* Get world-coordinates of the vertex (constraints and anim included). */
- mul_v3_m4v3(v_wco, ob->obmat, v_cos[i]);
+ mul_v3_m4v3(v_wco, ob->object_to_world, v_cos[i]);
/* Return distance between both coordinates. */
- dist[i] = len_v3v3(v_wco, obr->obmat[3]);
+ dist[i] = len_v3v3(v_wco, obr->object_to_world[3]);
}
}
@@ -235,7 +235,7 @@ static void get_vert2ob_distance(
*/
static float get_ob2ob_distance(const Object *ob, const Object *obr)
{
- return len_v3v3(ob->obmat[3], obr->obmat[3]);
+ return len_v3v3(ob->object_to_world[3], obr->object_to_world[3]);
}
/**
diff --git a/source/blender/nodes/composite/CMakeLists.txt b/source/blender/nodes/composite/CMakeLists.txt
index 4255a2dde21..8bcc2a393d3 100644
--- a/source/blender/nodes/composite/CMakeLists.txt
+++ b/source/blender/nodes/composite/CMakeLists.txt
@@ -19,6 +19,7 @@ set(INC
../../windowmanager
../../compositor/realtime_compositor
../../compositor/realtime_compositor/algorithms
+ ../../compositor/realtime_compositor/cached_resources
../../../../intern/guardedalloc
# dna_type_offsets.h
diff --git a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc
index e2f4e80270e..dffdc4a9408 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc
@@ -108,7 +108,7 @@ void register_node_type_cmp_alphaover()
cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_alphaover_declare;
ntype.draw_buttons = file_ns::node_composit_buts_alphaover;
- node_type_init(&ntype, file_ns::node_alphaover_init);
+ ntype.initfunc = file_ns::node_alphaover_init;
node_type_storage(
&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
index 25fefd33199..8c77df08211 100644
--- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
@@ -74,7 +74,7 @@ void register_node_type_cmp_antialiasing()
ntype.draw_buttons = file_ns::node_composit_buts_antialiasing;
ntype.flag |= NODE_PREVIEW;
node_type_size(&ntype, 170, 140, 200);
- node_type_init(&ntype, file_ns::node_composit_init_antialiasing);
+ ntype.initfunc = file_ns::node_composit_init_antialiasing;
node_type_storage(
&ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc
index af7581d845f..65990677ae3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc
@@ -119,7 +119,7 @@ void register_node_type_cmp_bilateralblur()
cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_bilateralblur_declare;
ntype.draw_buttons = file_ns::node_composit_buts_bilateralblur;
- node_type_init(&ntype, file_ns::node_composit_init_bilateralblur);
+ ntype.initfunc = file_ns::node_composit_init_bilateralblur;
node_type_storage(
&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc
index a9372bdcfb7..6eacc685c7e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc
@@ -5,11 +5,7 @@
* \ingroup cmpnodes
*/
-#include <cstdint>
-
-#include "BLI_array.hh"
#include "BLI_assert.h"
-#include "BLI_index_range.hh"
#include "BLI_math_base.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_math_vector.hh"
@@ -19,12 +15,13 @@
#include "UI_interface.h"
#include "UI_resources.h"
-#include "RE_pipeline.h"
-
+#include "GPU_shader.h"
#include "GPU_state.h"
#include "GPU_texture.h"
#include "COM_node_operation.hh"
+#include "COM_symmetric_blur_weights.hh"
+#include "COM_symmetric_separable_blur_weights.hh"
#include "COM_utilities.hh"
#include "node_composite_util.hh"
@@ -92,192 +89,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext * /*C*/, PointerR
using namespace blender::realtime_compositor;
-/* A helper class that computes and caches a 1D GPU texture containing the weights of the separable
- * filter of the given type and radius. The filter is assumed to be symmetric, because the filter
- * functions are all even functions. Consequently, only the positive half of the filter is computed
- * and the shader takes that into consideration. */
-class SymmetricSeparableBlurWeights {
- private:
- float radius_ = 1.0f;
- int type_ = R_FILTER_GAUSS;
- GPUTexture *texture_ = nullptr;
-
- public:
- ~SymmetricSeparableBlurWeights()
- {
- if (texture_) {
- GPU_texture_free(texture_);
- }
- }
-
- /* Check if a texture containing the weights was already computed for the given filter type and
- * radius. If such texture exists, do nothing, otherwise, free the already computed texture and
- * recompute it with the given filter type and radius. */
- void update(float radius, int type)
- {
- if (texture_ && type == type_ && radius == radius_) {
- return;
- }
-
- if (texture_) {
- GPU_texture_free(texture_);
- }
-
- /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only
- * compute half of it and no doubling happens. We add 1 to make sure the filter size is always
- * odd and there is a center weight. */
- const int size = math::ceil(radius) + 1;
- Array<float> weights(size);
-
- float sum = 0.0f;
-
- /* First, compute the center weight. */
- const float center_weight = RE_filter_value(type, 0.0f);
- weights[0] = center_weight;
- sum += center_weight;
-
- /* Second, compute the other weights in the positive direction, making sure to add double the
- * weight to the sum of weights because the filter is symmetric and we only loop over half of
- * it. Skip the center weight already computed by dropping the front index. */
- const float scale = radius > 0.0f ? 1.0f / radius : 0.0f;
- for (const int i : weights.index_range().drop_front(1)) {
- const float weight = RE_filter_value(type, i * scale);
- weights[i] = weight;
- sum += weight * 2.0f;
- }
-
- /* Finally, normalize the weights. */
- for (const int i : weights.index_range()) {
- weights[i] /= sum;
- }
-
- texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data());
-
- type_ = type;
- radius_ = radius;
- }
-
- void bind_as_texture(GPUShader *shader, const char *texture_name)
- {
- const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
- GPU_texture_bind(texture_, texture_image_unit);
- }
-
- void unbind_as_texture()
- {
- GPU_texture_unbind(texture_);
- }
-};
-
-/* A helper class that computes and caches a 2D GPU texture containing the weights of the filter of
- * the given type and radius. The filter is assumed to be symmetric, because the filter functions
- * are evaluated on the normalized distance to the center. Consequently, only the upper right
- * quadrant are computed and the shader takes that into consideration. */
-class SymmetricBlurWeights {
- private:
- int type_ = R_FILTER_GAUSS;
- float2 radius_ = float2(1.0f);
- GPUTexture *texture_ = nullptr;
-
- public:
- ~SymmetricBlurWeights()
- {
- if (texture_) {
- GPU_texture_free(texture_);
- }
- }
-
- /* Check if a texture containing the weights was already computed for the given filter type and
- * radius. If such texture exists, do nothing, otherwise, free the already computed texture and
- * recompute it with the given filter type and radius. */
- void update(float2 radius, int type)
- {
- if (texture_ && type == type_ && radius == radius_) {
- return;
- }
-
- if (texture_) {
- GPU_texture_free(texture_);
- }
-
- /* The full size of filter is double the radius plus 1, but since the filter is symmetric, we
- * only compute a single quadrant of it and so no doubling happens. We add 1 to make sure the
- * filter size is always odd and there is a center weight. */
- const float2 scale = math::safe_divide(float2(1.0f), radius);
- const int2 size = int2(math::ceil(radius)) + int2(1);
- Array<float> weights(size.x * size.y);
-
- float sum = 0.0f;
-
- /* First, compute the center weight. */
- const float center_weight = RE_filter_value(type, 0.0f);
- weights[0] = center_weight;
- sum += center_weight;
-
- /* Then, compute the weights along the positive x axis, making sure to add double the weight to
- * the sum of weights because the filter is symmetric and we only loop over the positive half
- * of the x axis. Skip the center weight already computed by dropping the front index. */
- for (const int x : IndexRange(size.x).drop_front(1)) {
- const float weight = RE_filter_value(type, x * scale.x);
- weights[x] = weight;
- sum += weight * 2.0f;
- }
-
- /* Then, compute the weights along the positive y axis, making sure to add double the weight to
- * the sum of weights because the filter is symmetric and we only loop over the positive half
- * of the y axis. Skip the center weight already computed by dropping the front index. */
- for (const int y : IndexRange(size.y).drop_front(1)) {
- const float weight = RE_filter_value(type, y * scale.y);
- weights[size.x * y] = weight;
- sum += weight * 2.0f;
- }
-
- /* Then, compute the other weights in the upper right quadrant, making sure to add quadruple
- * the weight to the sum of weights because the filter is symmetric and we only loop over one
- * quadrant of it. Skip the weights along the y and x axis already computed by dropping the
- * front index. */
- for (const int y : IndexRange(size.y).drop_front(1)) {
- for (const int x : IndexRange(size.x).drop_front(1)) {
- const float weight = RE_filter_value(type, math::length(float2(x, y) * scale));
- weights[size.x * y + x] = weight;
- sum += weight * 4.0f;
- }
- }
-
- /* Finally, normalize the weights. */
- for (const int y : IndexRange(size.y)) {
- for (const int x : IndexRange(size.x)) {
- weights[size.x * y + x] /= sum;
- }
- }
-
- texture_ = GPU_texture_create_2d("Weights", size.x, size.y, 1, GPU_R16F, weights.data());
-
- type_ = type;
- radius_ = radius;
- }
-
- void bind_as_texture(GPUShader *shader, const char *texture_name)
- {
- const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
- GPU_texture_bind(texture_, texture_image_unit);
- }
-
- void unbind_as_texture()
- {
- GPU_texture_unbind(texture_);
- }
-};
-
class BlurOperation : public NodeOperation {
- private:
- /* Cached symmetric blur weights. */
- SymmetricBlurWeights blur_weights_;
- /* Cached symmetric blur weights for the separable horizontal pass. */
- SymmetricSeparableBlurWeights blur_horizontal_weights_;
- /* Cached symmetric blur weights for the separable vertical pass. */
- SymmetricSeparableBlurWeights blur_vertical_weights_;
-
public:
using NodeOperation::NodeOperation;
@@ -308,13 +120,16 @@ class BlurOperation : public NodeOperation {
const Result &input_image = get_input("Image");
input_image.bind_as_texture(shader, "input_tx");
- blur_weights_.update(compute_blur_radius(), node_storage(bnode()).filtertype);
- blur_weights_.bind_as_texture(shader, "weights_tx");
+ const float2 blur_radius = compute_blur_radius();
+
+ const SymmetricBlurWeights &weights = context().cache_manager().get_symmetric_blur_weights(
+ node_storage(bnode()).filtertype, blur_radius);
+ weights.bind_as_texture(shader, "weights_tx");
Domain domain = compute_domain();
if (get_extend_bounds()) {
/* Add a radius amount of pixels in both sides of the image, hence the multiply by 2. */
- domain.size += int2(math::ceil(compute_blur_radius())) * 2;
+ domain.size += int2(math::ceil(blur_radius)) * 2;
}
Result &output_image = get_result("Image");
@@ -326,7 +141,7 @@ class BlurOperation : public NodeOperation {
GPU_shader_unbind();
output_image.unbind_as_image();
input_image.unbind_as_texture();
- blur_weights_.unbind_as_texture();
+ weights.unbind_as_texture();
}
GPUTexture *execute_separable_blur_horizontal_pass()
@@ -341,12 +156,16 @@ class BlurOperation : public NodeOperation {
const Result &input_image = get_input("Image");
input_image.bind_as_texture(shader, "input_tx");
- blur_horizontal_weights_.update(compute_blur_radius().x, node_storage(bnode()).filtertype);
- blur_horizontal_weights_.bind_as_texture(shader, "weights_tx");
+ const float2 blur_radius = compute_blur_radius();
+
+ const SymmetricSeparableBlurWeights &weights =
+ context().cache_manager().get_symmetric_separable_blur_weights(
+ node_storage(bnode()).filtertype, blur_radius.x);
+ weights.bind_as_texture(shader, "weights_tx");
Domain domain = compute_domain();
if (get_extend_bounds()) {
- domain.size.x += int(math::ceil(compute_blur_radius().x)) * 2;
+ domain.size.x += int(math::ceil(blur_radius.x)) * 2;
}
/* We allocate an output image of a transposed size, that is, with a height equivalent to the
@@ -367,7 +186,7 @@ class BlurOperation : public NodeOperation {
GPU_shader_unbind();
input_image.unbind_as_texture();
- blur_horizontal_weights_.unbind_as_texture();
+ weights.unbind_as_texture();
GPU_texture_image_unbind(horizontal_pass_result);
return horizontal_pass_result;
@@ -386,8 +205,12 @@ class BlurOperation : public NodeOperation {
const int texture_image_unit = GPU_shader_get_texture_binding(shader, "input_tx");
GPU_texture_bind(horizontal_pass_result, texture_image_unit);
- blur_vertical_weights_.update(compute_blur_radius().y, node_storage(bnode()).filtertype);
- blur_vertical_weights_.bind_as_texture(shader, "weights_tx");
+ const float2 blur_radius = compute_blur_radius();
+
+ const SymmetricSeparableBlurWeights &weights =
+ context().cache_manager().get_symmetric_separable_blur_weights(
+ node_storage(bnode()).filtertype, blur_radius.y);
+ weights.bind_as_texture(shader, "weights_tx");
Domain domain = compute_domain();
if (get_extend_bounds()) {
@@ -405,7 +228,7 @@ class BlurOperation : public NodeOperation {
GPU_shader_unbind();
output_image.unbind_as_image();
- blur_vertical_weights_.unbind_as_texture();
+ weights.unbind_as_texture();
GPU_texture_unbind(horizontal_pass_result);
}
@@ -501,7 +324,7 @@ void register_node_type_cmp_blur()
ntype.declare = file_ns::cmp_node_blur_declare;
ntype.draw_buttons = file_ns::node_composit_buts_blur;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_blur);
+ ntype.initfunc = file_ns::node_composit_init_blur;
node_type_storage(
&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
index a581d87a463..f09bf1f5afd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
@@ -215,7 +215,7 @@ void register_node_type_cmp_bokehblur()
cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_bokehblur_declare;
ntype.draw_buttons = file_ns::node_composit_buts_bokehblur;
- node_type_init(&ntype, file_ns::node_composit_init_bokehblur);
+ ntype.initfunc = file_ns::node_composit_init_bokehblur;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
index eb35b933d1b..8b817d3a677 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
@@ -122,7 +122,7 @@ void register_node_type_cmp_bokehimage()
ntype.declare = file_ns::cmp_node_bokehimage_declare;
ntype.draw_buttons = file_ns::node_composit_buts_bokehimage;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_bokehimage);
+ ntype.initfunc = file_ns::node_composit_init_bokehimage;
node_type_storage(
&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc
index 668dc9d92de..17b5d64de91 100644
--- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc
@@ -157,7 +157,7 @@ void register_node_type_cmp_boxmask()
cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE);
ntype.declare = file_ns::cmp_node_boxmask_declare;
ntype.draw_buttons = file_ns::node_composit_buts_boxmask;
- node_type_init(&ntype, file_ns::node_composit_init_boxmask);
+ ntype.initfunc = file_ns::node_composit_init_boxmask;
node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc
index 6b9fef75524..08794914e91 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc
@@ -81,7 +81,7 @@ void register_node_type_cmp_brightcontrast()
cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_brightcontrast_declare;
ntype.draw_buttons = file_ns::node_composit_buts_brightcontrast;
- node_type_init(&ntype, file_ns::node_composit_init_brightcontrast);
+ ntype.initfunc = file_ns::node_composit_init_brightcontrast;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc b/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc
index 2fd2d6c8f71..be02f1ecd00 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc
@@ -182,7 +182,7 @@ void register_node_type_cmp_channel_matte()
ntype.declare = file_ns::cmp_node_channel_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_channel_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_channel_matte);
+ ntype.initfunc = file_ns::node_composit_init_channel_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
index e2ef96ea95e..4e035fcf5e0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
@@ -121,7 +121,7 @@ void register_node_type_cmp_chroma_matte()
ntype.declare = file_ns::cmp_node_chroma_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_chroma_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_chroma_matte);
+ ntype.initfunc = file_ns::node_composit_init_chroma_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_color_matte.cc b/source/blender/nodes/composite/nodes/node_composite_color_matte.cc
index 2a20a4d995f..9233f61205d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_color_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_color_matte.cc
@@ -119,7 +119,7 @@ void register_node_type_cmp_color_matte()
ntype.declare = file_ns::cmp_node_color_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_color_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_color_matte);
+ ntype.initfunc = file_ns::node_composit_init_color_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_color_spill.cc b/source/blender/nodes/composite/nodes/node_composite_color_spill.cc
index ba829da83ed..cd129d53d6b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_color_spill.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_color_spill.cc
@@ -196,7 +196,7 @@ void register_node_type_cmp_color_spill()
cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE);
ntype.declare = file_ns::cmp_node_color_spill_declare;
ntype.draw_buttons = file_ns::node_composit_buts_color_spill;
- node_type_init(&ntype, file_ns::node_composit_init_color_spill);
+ ntype.initfunc = file_ns::node_composit_init_color_spill;
node_type_storage(
&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
index 3300896bfdf..aade1b639ab 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
@@ -210,7 +210,7 @@ void register_node_type_cmp_colorbalance()
ntype.draw_buttons = file_ns::node_composit_buts_colorbalance;
ntype.draw_buttons_ex = file_ns::node_composit_buts_colorbalance_ex;
node_type_size(&ntype, 400, 200, 400);
- node_type_init(&ntype, file_ns::node_composit_init_colorbalance);
+ ntype.initfunc = file_ns::node_composit_init_colorbalance;
node_type_storage(
&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
index c6051a42df6..5ff190ac2e4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
@@ -353,7 +353,7 @@ void register_node_type_cmp_colorcorrection()
ntype.draw_buttons = file_ns::node_composit_buts_colorcorrection;
ntype.draw_buttons_ex = file_ns::node_composit_buts_colorcorrection_ex;
node_type_size(&ntype, 400, 200, 600);
- node_type_init(&ntype, file_ns::node_composit_init_colorcorrection);
+ ntype.initfunc = file_ns::node_composit_init_colorcorrection;
node_type_storage(
&ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc
index 8dd88d098c4..cd119684a79 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_common.cc
@@ -32,7 +32,7 @@ void register_node_type_cmp_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- node_type_group_update(&ntype, node_group_update);
+ ntype.group_update_func = node_group_update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc
index 3e521144b8d..24928acedd9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc
@@ -78,7 +78,7 @@ void register_node_type_cmp_convert_color_space(void)
ntype.declare = file_ns::CMP_NODE_CONVERT_COLOR_SPACE_declare;
ntype.draw_buttons = file_ns::node_composit_buts_convert_colorspace;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_composit_init_convert_colorspace);
+ ntype.initfunc = file_ns::node_composit_init_convert_colorspace;
node_type_storage(
&ntype, "NodeConvertColorSpace", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc
index 96a5443921b..4539d2af92d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc
@@ -230,7 +230,7 @@ void register_node_type_cmp_crop()
cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT);
ntype.declare = file_ns::cmp_node_crop_declare;
ntype.draw_buttons = file_ns::node_composit_buts_crop;
- node_type_init(&ntype, file_ns::node_composit_init_crop);
+ ntype.initfunc = file_ns::node_composit_init_crop;
node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
index fa3b14ae015..e95a306976c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
@@ -331,7 +331,7 @@ void register_node_type_cmp_cryptomatte()
node_type_socket_templates(
&ntype, file_ns::cmp_node_cryptomatte_in, file_ns::cmp_node_cryptomatte_out);
node_type_size(&ntype, 240, 100, 700);
- node_type_init(&ntype, file_ns::node_init_cryptomatte);
+ ntype.initfunc = file_ns::node_init_cryptomatte;
ntype.initfunc_api = file_ns::node_init_api_cryptomatte;
ntype.poll = file_ns::node_poll_cryptomatte;
node_type_storage(
@@ -418,7 +418,7 @@ void register_node_type_cmp_cryptomatte_legacy()
cmp_node_type_base(
&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte (Legacy)", NODE_CLASS_MATTE);
node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out);
- node_type_init(&ntype, legacy_file_ns::node_init_cryptomatte_legacy);
+ ntype.initfunc = legacy_file_ns::node_init_cryptomatte_legacy;
node_type_storage(
&ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte);
ntype.gather_link_search_ops = nullptr;
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc
index b631f75e879..5799c6c1a09 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc
@@ -100,7 +100,7 @@ void register_node_type_cmp_curve_time()
cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time Curve", NODE_CLASS_INPUT);
ntype.declare = file_ns::cmp_node_time_declare;
node_type_size(&ntype, 200, 140, 320);
- node_type_init(&ntype, file_ns::node_composit_init_curves_time);
+ ntype.initfunc = file_ns::node_composit_init_curves_time;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
@@ -195,7 +195,7 @@ void register_node_type_cmp_curve_vec()
ntype.declare = file_ns::cmp_node_curve_vec_declare;
ntype.draw_buttons = file_ns::node_buts_curvevec;
node_type_size(&ntype, 200, 140, 320);
- node_type_init(&ntype, file_ns::node_composit_init_curve_vec);
+ ntype.initfunc = file_ns::node_composit_init_curve_vec;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
@@ -332,7 +332,7 @@ void register_node_type_cmp_curve_rgb()
cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_rgbcurves_declare;
node_type_size(&ntype, 200, 140, 320);
- node_type_init(&ntype, file_ns::node_composit_init_curve_rgb);
+ ntype.initfunc = file_ns::node_composit_init_curve_rgb;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc
index 197e02bebad..584cca87740 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc
@@ -111,7 +111,7 @@ void register_node_type_cmp_defocus()
cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_defocus_declare;
ntype.draw_buttons = file_ns::node_composit_buts_defocus;
- node_type_init(&ntype, file_ns::node_composit_init_defocus);
+ ntype.initfunc = file_ns::node_composit_init_defocus;
node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc
index 821b3c23a7b..9ae02dab505 100644
--- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc
@@ -82,7 +82,7 @@ void register_node_type_cmp_denoise()
cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_denoise_declare;
ntype.draw_buttons = file_ns::node_composit_buts_denoise;
- node_type_init(&ntype, file_ns::node_composit_init_denonise);
+ ntype.initfunc = file_ns::node_composit_init_denonise;
node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc
index 1e15f9709fe..28ef022459b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc
@@ -115,7 +115,7 @@ void register_node_type_cmp_despeckle()
ntype.declare = file_ns::cmp_node_despeckle_declare;
ntype.draw_buttons = file_ns::node_composit_buts_despeckle;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_despeckle);
+ ntype.initfunc = file_ns::node_composit_init_despeckle;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc b/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc
index cde537f7d4c..c3fb0885c4d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc
@@ -101,7 +101,7 @@ void register_node_type_cmp_diff_matte()
ntype.declare = file_ns::cmp_node_diff_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_diff_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_diff_matte);
+ ntype.initfunc = file_ns::node_composit_init_diff_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc
index d659c46721d..cc4e09d4d0d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc
@@ -5,25 +5,20 @@
* \ingroup cmpnodes
*/
-#include <cmath>
-
-#include "BLI_array.hh"
#include "BLI_assert.h"
#include "BLI_math_base.hh"
-
-#include "DNA_scene_types.h"
+#include "BLI_math_vec_types.hh"
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_resources.h"
-#include "RE_pipeline.h"
-
#include "GPU_shader.h"
#include "GPU_state.h"
#include "GPU_texture.h"
+#include "COM_morphological_distance_feather_weights.hh"
#include "COM_node_operation.hh"
#include "COM_utilities.hh"
@@ -64,161 +59,7 @@ static void node_composit_buts_dilateerode(uiLayout *layout, bContext * /*C*/, P
using namespace blender::realtime_compositor;
-/* Computes a falloff that is equal to 1 at an input of zero and decrease to zero at an input of 1,
- * with the rate of decrease depending on the falloff type. */
-static float compute_distance_falloff(float x, int falloff_type)
-{
- x = 1.0f - x;
-
- switch (falloff_type) {
- case PROP_SMOOTH:
- return 3.0f * x * x - 2.0f * x * x * x;
- case PROP_SPHERE:
- return std::sqrt(2.0f * x - x * x);
- case PROP_ROOT:
- return std::sqrt(x);
- case PROP_SHARP:
- return x * x;
- case PROP_INVSQUARE:
- return x * (2.0f - x);
- case PROP_LIN:
- return x;
- default:
- BLI_assert_unreachable();
- return x;
- }
-}
-
-/* A helper class that computes and caches 1D GPU textures containing the weights of the separable
- * Gaussian filter of the given radius as well as an inverse distance falloff of the given type and
- * radius. The weights and falloffs are symmetric, because the Gaussian and falloff functions are
- * all even functions. Consequently, only the positive half of the filter is computed and the
- * shader takes that into consideration. */
-class SymmetricSeparableMorphologicalDistanceFeatherWeights {
- private:
- int radius_ = 1;
- int falloff_type_ = PROP_SMOOTH;
- GPUTexture *weights_texture_ = nullptr;
- GPUTexture *distance_falloffs_texture_ = nullptr;
-
- public:
- ~SymmetricSeparableMorphologicalDistanceFeatherWeights()
- {
- if (weights_texture_) {
- GPU_texture_free(weights_texture_);
- }
-
- if (distance_falloffs_texture_) {
- GPU_texture_free(distance_falloffs_texture_);
- }
- }
-
- /* Check if textures containing the weights and distance falloffs were already computed for the
- * given distance falloff type and radius. If such textures exists, do nothing, otherwise, free
- * the already computed textures and recompute it with the given distance falloff type and
- * radius. */
- void update(int radius, int falloff_type)
- {
- if (weights_texture_ && distance_falloffs_texture_ && falloff_type == falloff_type_ &&
- radius == radius_) {
- return;
- }
-
- radius_ = radius;
- falloff_type_ = falloff_type;
-
- compute_weights();
- compute_distance_falloffs();
- }
-
- void compute_weights()
- {
- if (weights_texture_) {
- GPU_texture_free(weights_texture_);
- }
-
- /* The size of filter is double the radius plus 1, but since the filter is symmetric, we only
- * compute half of it and no doubling happens. We add 1 to make sure the filter size is always
- * odd and there is a center weight. */
- const int size = radius_ + 1;
- Array<float> weights(size);
-
- float sum = 0.0f;
-
- /* First, compute the center weight. */
- const float center_weight = RE_filter_value(R_FILTER_GAUSS, 0.0f);
- weights[0] = center_weight;
- sum += center_weight;
-
- /* Second, compute the other weights in the positive direction, making sure to add double the
- * weight to the sum of weights because the filter is symmetric and we only loop over half of
- * it. Skip the center weight already computed by dropping the front index. */
- const float scale = radius_ > 0.0f ? 1.0f / radius_ : 0.0f;
- for (const int i : weights.index_range().drop_front(1)) {
- const float weight = RE_filter_value(R_FILTER_GAUSS, i * scale);
- weights[i] = weight;
- sum += weight * 2.0f;
- }
-
- /* Finally, normalize the weights. */
- for (const int i : weights.index_range()) {
- weights[i] /= sum;
- }
-
- weights_texture_ = GPU_texture_create_1d("Weights", size, 1, GPU_R16F, weights.data());
- }
-
- void compute_distance_falloffs()
- {
- if (distance_falloffs_texture_) {
- GPU_texture_free(distance_falloffs_texture_);
- }
-
- /* The size of the distance falloffs is double the radius plus 1, but since the falloffs are
- * symmetric, we only compute half of them and no doubling happens. We add 1 to make sure the
- * falloffs size is always odd and there is a center falloff. */
- const int size = radius_ + 1;
- Array<float> falloffs(size);
-
- /* Compute the distance falloffs in the positive direction only, because the falloffs are
- * symmetric. */
- const float scale = radius_ > 0.0f ? 1.0f / radius_ : 0.0f;
- for (const int i : falloffs.index_range()) {
- falloffs[i] = compute_distance_falloff(i * scale, falloff_type_);
- }
-
- distance_falloffs_texture_ = GPU_texture_create_1d(
- "Distance Factors", size, 1, GPU_R16F, falloffs.data());
- }
-
- void bind_weights_as_texture(GPUShader *shader, const char *texture_name)
- {
- const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
- GPU_texture_bind(weights_texture_, texture_image_unit);
- }
-
- void unbind_weights_as_texture()
- {
- GPU_texture_unbind(weights_texture_);
- }
-
- void bind_distance_falloffs_as_texture(GPUShader *shader, const char *texture_name)
- {
- const int texture_image_unit = GPU_shader_get_texture_binding(shader, texture_name);
- GPU_texture_bind(distance_falloffs_texture_, texture_image_unit);
- }
-
- void unbind_distance_falloffs_as_texture()
- {
- GPU_texture_unbind(distance_falloffs_texture_);
- }
-};
-
class DilateErodeOperation : public NodeOperation {
- private:
- /* Cached symmetric blur weights and distance falloffs for the distance feature method. */
- SymmetricSeparableMorphologicalDistanceFeatherWeights distance_feather_weights_;
-
public:
using NodeOperation::NodeOperation;
@@ -414,9 +255,11 @@ class DilateErodeOperation : public NodeOperation {
const Result &input_image = get_input("Mask");
input_image.bind_as_texture(shader, "input_tx");
- distance_feather_weights_.update(math::abs(get_distance()), node_storage(bnode()).falloff);
- distance_feather_weights_.bind_weights_as_texture(shader, "weights_tx");
- distance_feather_weights_.bind_distance_falloffs_as_texture(shader, "falloffs_tx");
+ const MorphologicalDistanceFeatherWeights &weights =
+ context().cache_manager().get_morphological_distance_feather_weights(
+ node_storage(bnode()).falloff, math::abs(get_distance()));
+ weights.bind_weights_as_texture(shader, "weights_tx");
+ weights.bind_distance_falloffs_as_texture(shader, "falloffs_tx");
/* We allocate an output image of a transposed size, that is, with a height equivalent to the
* width of the input and vice versa. This is done as a performance optimization. The shader
@@ -437,8 +280,8 @@ class DilateErodeOperation : public NodeOperation {
GPU_shader_unbind();
input_image.unbind_as_texture();
- distance_feather_weights_.unbind_weights_as_texture();
- distance_feather_weights_.unbind_distance_falloffs_as_texture();
+ weights.unbind_weights_as_texture();
+ weights.unbind_distance_falloffs_as_texture();
GPU_texture_image_unbind(horizontal_pass_result);
return horizontal_pass_result;
@@ -453,9 +296,11 @@ class DilateErodeOperation : public NodeOperation {
const int texture_image_unit = GPU_shader_get_texture_binding(shader, "input_tx");
GPU_texture_bind(horizontal_pass_result, texture_image_unit);
- distance_feather_weights_.update(math::abs(get_distance()), node_storage(bnode()).falloff);
- distance_feather_weights_.bind_weights_as_texture(shader, "weights_tx");
- distance_feather_weights_.bind_distance_falloffs_as_texture(shader, "falloffs_tx");
+ const MorphologicalDistanceFeatherWeights &weights =
+ context().cache_manager().get_morphological_distance_feather_weights(
+ node_storage(bnode()).falloff, math::abs(get_distance()));
+ weights.bind_weights_as_texture(shader, "weights_tx");
+ weights.bind_distance_falloffs_as_texture(shader, "falloffs_tx");
const Domain domain = compute_domain();
Result &output_image = get_result("Mask");
@@ -468,8 +313,8 @@ class DilateErodeOperation : public NodeOperation {
GPU_shader_unbind();
output_image.unbind_as_image();
- distance_feather_weights_.unbind_weights_as_texture();
- distance_feather_weights_.unbind_distance_falloffs_as_texture();
+ weights.unbind_weights_as_texture();
+ weights.unbind_distance_falloffs_as_texture();
GPU_texture_unbind(horizontal_pass_result);
}
@@ -535,7 +380,7 @@ void register_node_type_cmp_dilateerode()
cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER);
ntype.draw_buttons = file_ns::node_composit_buts_dilateerode;
ntype.declare = file_ns::cmp_node_dilate_declare;
- node_type_init(&ntype, file_ns::node_composit_init_dilateerode);
+ ntype.initfunc = file_ns::node_composit_init_dilateerode;
node_type_storage(
&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc
index a5a253c2cca..452c83ef1b5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc
@@ -199,7 +199,7 @@ void register_node_type_cmp_dblur()
cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_directional_blur_declare;
ntype.draw_buttons = file_ns::node_composit_buts_dblur;
- node_type_init(&ntype, file_ns::node_composit_init_dblur);
+ ntype.initfunc = file_ns::node_composit_init_dblur;
node_type_storage(
&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc b/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc
index 87b66810fe3..16f79f4e730 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc
@@ -123,7 +123,7 @@ void register_node_type_cmp_distance_matte()
ntype.declare = file_ns::cmp_node_distance_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_distance_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_distance_matte);
+ ntype.initfunc = file_ns::node_composit_init_distance_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc
index 120b4d0d976..f06b64f10b5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc
@@ -156,7 +156,7 @@ void register_node_type_cmp_ellipsemask()
ntype.declare = file_ns::cmp_node_ellipsemask_declare;
ntype.draw_buttons = file_ns::node_composit_buts_ellipsemask;
node_type_size(&ntype, 260, 110, 320);
- node_type_init(&ntype, file_ns::node_composit_init_ellipsemask);
+ ntype.initfunc = file_ns::node_composit_init_ellipsemask;
node_type_storage(
&ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc
index 60d149a32b9..4352f519e4c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc
@@ -105,7 +105,7 @@ void register_node_type_cmp_glare()
cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_glare_declare;
ntype.draw_buttons = file_ns::node_composit_buts_glare;
- node_type_init(&ntype, file_ns::node_composit_init_glare);
+ ntype.initfunc = file_ns::node_composit_init_glare;
node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
index a365929138c..2e09e44eddc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
@@ -106,7 +106,7 @@ void register_node_type_cmp_huecorrect()
cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_huecorrect_declare;
node_type_size(&ntype, 320, 140, 500);
- node_type_init(&ntype, file_ns::node_composit_init_huecorrect);
+ ntype.initfunc = file_ns::node_composit_init_huecorrect;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc
index 9efedf744ec..322f1eecf91 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_image.cc
@@ -660,10 +660,10 @@ void register_node_type_cmp_image()
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT);
- node_type_init(&ntype, file_ns::node_composit_init_image);
+ ntype.initfunc = file_ns::node_composit_init_image;
node_type_storage(
&ntype, "ImageUser", file_ns::node_composit_free_image, file_ns::node_composit_copy_image);
- node_type_update(&ntype, file_ns::cmp_node_image_update);
+ ntype.updatefunc = file_ns::cmp_node_image_update;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
ntype.labelfunc = node_image_label;
ntype.flag |= NODE_PREVIEW;
@@ -879,8 +879,8 @@ void register_node_type_cmp_rlayers()
ntype.flag |= NODE_PREVIEW;
node_type_storage(
&ntype, nullptr, file_ns::node_composit_free_rlayers, file_ns::node_composit_copy_rlayers);
- node_type_update(&ntype, file_ns::cmp_node_rlayers_update);
- node_type_init(&ntype, node_cmp_rlayers_outputs);
+ ntype.updatefunc = file_ns::cmp_node_rlayers_update;
+ ntype.initfunc = node_cmp_rlayers_outputs;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc
index bbb2808c4ea..c8787ebb01b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc
@@ -96,7 +96,7 @@ void register_node_type_cmp_invert()
cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_invert_declare;
ntype.draw_buttons = file_ns::node_composit_buts_invert;
- node_type_init(&ntype, file_ns::node_composit_init_invert);
+ ntype.initfunc = file_ns::node_composit_init_invert;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc
index 4b61e06a232..b2add06c541 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc
@@ -95,7 +95,7 @@ void register_node_type_cmp_keying()
cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE);
ntype.declare = file_ns::cmp_node_keying_declare;
ntype.draw_buttons = file_ns::node_composit_buts_keying;
- node_type_init(&ntype, file_ns::node_composit_init_keying);
+ ntype.initfunc = file_ns::node_composit_init_keying;
node_type_storage(
&ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc
index 1cf482ff6ff..e11ed0fbfb6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc
@@ -250,7 +250,7 @@ void register_node_type_cmp_lensdist()
cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT);
ntype.declare = file_ns::cmp_node_lensdist_declare;
ntype.draw_buttons = file_ns::node_composit_buts_lensdist;
- node_type_init(&ntype, file_ns::node_composit_init_lensdist);
+ ntype.initfunc = file_ns::node_composit_init_lensdist;
node_type_storage(
&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc
index 4c901372b9f..29212c7a76f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc
@@ -201,7 +201,7 @@ void register_node_type_cmp_view_levels()
ntype.declare = file_ns::cmp_node_levels_declare;
ntype.draw_buttons = file_ns::node_composit_buts_view_levels;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_view_levels);
+ ntype.initfunc = file_ns::node_composit_init_view_levels;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc
index 8426efb0f1f..325f5dbd870 100644
--- a/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc
@@ -104,7 +104,7 @@ void register_node_type_cmp_luma_matte()
ntype.declare = file_ns::cmp_node_luma_matte_declare;
ntype.draw_buttons = file_ns::node_composit_buts_luma_matte;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_luma_matte);
+ ntype.initfunc = file_ns::node_composit_init_luma_matte;
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_map_value.cc b/source/blender/nodes/composite/nodes/node_composite_map_value.cc
index eacc003378a..ea80e7b03a8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_map_value.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_map_value.cc
@@ -116,7 +116,7 @@ void register_node_type_cmp_map_value()
cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::cmp_node_map_value_declare;
ntype.draw_buttons = file_ns::node_composit_buts_map_value;
- node_type_init(&ntype, file_ns::node_composit_init_map_value);
+ ntype.initfunc = file_ns::node_composit_init_map_value;
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc
index 5dfcc9a9ecf..895ef62a82d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc
@@ -104,7 +104,7 @@ void register_node_type_cmp_mask()
cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT);
ntype.declare = file_ns::cmp_node_mask_declare;
ntype.draw_buttons = file_ns::node_composit_buts_mask;
- node_type_init(&ntype, file_ns::node_composit_init_mask);
+ ntype.initfunc = file_ns::node_composit_init_mask;
ntype.labelfunc = file_ns::node_mask_label;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc
index 4baf057913e..e1dda06a41e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_math.cc
@@ -96,7 +96,7 @@ void register_node_type_cmp_math()
cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_math_declare;
ntype.labelfunc = node_math_label;
- node_type_update(&ntype, node_math_update);
+ ntype.updatefunc = node_math_update;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_output_file.cc b/source/blender/nodes/composite/nodes/node_composite_output_file.cc
index f27dec91b1c..f64e448842d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_output_file.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_output_file.cc
@@ -470,7 +470,7 @@ void register_node_type_cmp_output_file()
ntype.flag |= NODE_PREVIEW;
node_type_storage(
&ntype, "NodeImageMultiFile", file_ns::free_output_file, file_ns::copy_output_file);
- node_type_update(&ntype, file_ns::update_output_file);
+ ntype.updatefunc = file_ns::update_output_file;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc
index 5f3df3abd35..4cc1166b373 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc
@@ -95,7 +95,7 @@ void register_node_type_cmp_rotate()
cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT);
ntype.declare = file_ns::cmp_node_rotate_declare;
ntype.draw_buttons = file_ns::node_composit_buts_rotate;
- node_type_init(&ntype, file_ns::node_composit_init_rotate);
+ ntype.initfunc = file_ns::node_composit_init_rotate;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc
index c524d7b8da9..a4e28326d9d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc
@@ -221,7 +221,7 @@ void register_node_type_cmp_scale()
cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT);
ntype.declare = file_ns::cmp_node_scale_declare;
ntype.draw_buttons = file_ns::node_composit_buts_scale;
- node_type_update(&ntype, file_ns::node_composite_update_scale);
+ ntype.updatefunc = file_ns::node_composite_update_scale;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc
index d3f8530ae8b..118ab6ccdf8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc
@@ -137,10 +137,10 @@ void register_node_type_cmp_separate_color()
cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_separate_color_declare;
- node_type_init(&ntype, node_cmp_combsep_color_init);
+ ntype.initfunc = node_cmp_combsep_color_init;
node_type_storage(
&ntype, "NodeCMPCombSepColor", node_free_standard_storage, node_copy_standard_storage);
- node_type_update(&ntype, file_ns::cmp_node_separate_color_update);
+ ntype.updatefunc = file_ns::cmp_node_separate_color_update;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
nodeRegisterType(&ntype);
@@ -243,10 +243,10 @@ void register_node_type_cmp_combine_color()
cmp_node_type_base(&ntype, CMP_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_combine_color_declare;
- node_type_init(&ntype, node_cmp_combsep_color_init);
+ ntype.initfunc = node_cmp_combsep_color_init;
node_type_storage(
&ntype, "NodeCMPCombSepColor", node_free_standard_storage, node_copy_standard_storage);
- node_type_update(&ntype, file_ns::cmp_node_combine_color_update);
+ ntype.updatefunc = file_ns::cmp_node_combine_color_update;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
index 82fc37a18f6..7c1461b4f6e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
@@ -84,7 +84,7 @@ void register_node_type_cmp_sepycca()
cmp_node_type_base(
&ntype, CMP_NODE_SEPYCCA_LEGACY, "Separate YCbCrA (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_sepycca_declare;
- node_type_init(&ntype, file_ns::node_composit_init_mode_sepycca);
+ ntype.initfunc = file_ns::node_composit_init_mode_sepycca;
ntype.gather_link_search_ops = nullptr;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
@@ -172,7 +172,7 @@ void register_node_type_cmp_combycca()
cmp_node_type_base(
&ntype, CMP_NODE_COMBYCCA_LEGACY, "Combine YCbCrA (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_combycca_declare;
- node_type_init(&ntype, file_ns::node_composit_init_mode_combycca);
+ ntype.initfunc = file_ns::node_composit_init_mode_combycca;
ntype.gather_link_search_ops = nullptr;
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc
index 725ae6e3fcb..99c4dae4a92 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc
@@ -81,7 +81,7 @@ void register_node_type_cmp_setalpha()
cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_setalpha_declare;
ntype.draw_buttons = file_ns::node_composit_buts_set_alpha;
- node_type_init(&ntype, file_ns::node_composit_init_setalpha);
+ ntype.initfunc = file_ns::node_composit_init_setalpha;
node_type_storage(
&ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc
index f25d33033a2..b4e698f5096 100644
--- a/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_split_viewer.cc
@@ -125,7 +125,7 @@ void register_node_type_cmp_splitviewer()
ntype.declare = file_ns::cmp_node_split_viewer_declare;
ntype.draw_buttons = file_ns::node_composit_buts_splitviewer;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_splitviewer);
+ ntype.initfunc = file_ns::node_composit_init_splitviewer;
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc
index d2ee9f567f2..798e60e9482 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc
@@ -68,7 +68,7 @@ void register_node_type_cmp_sunbeams()
cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_sunbeams_declare;
ntype.draw_buttons = file_ns::node_composit_buts_sunbeams;
- node_type_init(&ntype, file_ns::init);
+ ntype.initfunc = file_ns::init;
node_type_storage(
&ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc
index 9b21ecab335..9974e55cc1a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switchview.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc
@@ -173,7 +173,7 @@ void register_node_type_cmp_switch_view()
node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_switch_view_out);
ntype.draw_buttons_ex = file_ns::node_composit_buts_switch_view_ex;
ntype.initfunc_api = file_ns::init_switch_view;
- node_type_update(&ntype, file_ns::cmp_node_switch_view_update);
+ ntype.updatefunc = file_ns::cmp_node_switch_view_update;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc
index d26a01bb3c9..febbb9ddec5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc
@@ -332,7 +332,7 @@ void register_node_type_cmp_tonemap()
cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::cmp_node_tonemap_declare;
ntype.draw_buttons = file_ns::node_composit_buts_tonemap;
- node_type_init(&ntype, file_ns::node_composit_init_tonemap);
+ ntype.initfunc = file_ns::node_composit_init_tonemap;
node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc
index c8f9f8ee666..154be2d428a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc
@@ -110,7 +110,7 @@ void register_node_type_cmp_translate()
cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT);
ntype.declare = file_ns::cmp_node_translate_declare;
ntype.draw_buttons = file_ns::node_composit_buts_translate;
- node_type_init(&ntype, file_ns::node_composit_init_translate);
+ ntype.initfunc = file_ns::node_composit_init_translate;
node_type_storage(
&ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
index 2870b07f207..d083051e9d2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
@@ -134,7 +134,7 @@ void register_node_type_cmp_valtorgb()
cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::cmp_node_valtorgb_declare;
node_type_size(&ntype, 240, 200, 320);
- node_type_init(&ntype, file_ns::node_composit_init_valtorgb);
+ ntype.initfunc = file_ns::node_composit_init_valtorgb;
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
diff --git a/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc b/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc
index 6d43647020f..6a44fcb1650 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc
@@ -81,7 +81,7 @@ void register_node_type_cmp_vecblur()
cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER);
ntype.declare = file_ns::cmp_node_vec_blur_declare;
ntype.draw_buttons = file_ns::node_composit_buts_vecblur;
- node_type_init(&ntype, file_ns::node_composit_init_vecblur);
+ ntype.initfunc = file_ns::node_composit_init_vecblur;
node_type_storage(
&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc
index c83674fa9c1..682b0626ccd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc
@@ -196,7 +196,7 @@ void register_node_type_cmp_viewer()
ntype.draw_buttons = file_ns::node_composit_buts_viewer;
ntype.draw_buttons_ex = file_ns::node_composit_buts_viewer_ex;
ntype.flag |= NODE_PREVIEW;
- node_type_init(&ntype, file_ns::node_composit_init_viewer);
+ ntype.initfunc = file_ns::node_composit_init_viewer;
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
diff --git a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
index 7fc7829186a..3027a81807b 100644
--- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
+++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
@@ -131,7 +131,7 @@ void register_node_type_fn_boolean_math()
fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_boolean_math_declare;
ntype.labelfunc = file_ns::node_boolean_math_label;
- node_type_update(&ntype, file_ns::node_boolean_math_update);
+ ntype.updatefunc = file_ns::node_boolean_math_update;
ntype.build_multi_function = file_ns::fn_node_boolean_math_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_boolean_math_layout;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
diff --git a/source/blender/nodes/function/nodes/node_fn_combine_color.cc b/source/blender/nodes/function/nodes/node_fn_combine_color.cc
index fddf606dfc9..c5dd5dfff1a 100644
--- a/source/blender/nodes/function/nodes/node_fn_combine_color.cc
+++ b/source/blender/nodes/function/nodes/node_fn_combine_color.cc
@@ -97,8 +97,8 @@ void register_node_type_fn_combine_color(void)
fn_node_type_base(&ntype, FN_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER);
ntype.declare = blender::nodes::fn_node_combine_color_declare;
- node_type_update(&ntype, blender::nodes::fn_node_combine_color_update);
- node_type_init(&ntype, blender::nodes::fn_node_combine_color_init);
+ ntype.updatefunc = blender::nodes::fn_node_combine_color_update;
+ ntype.initfunc = blender::nodes::fn_node_combine_color_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = blender::nodes::fn_node_combine_color_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc
index 4dd8d0c6ba4..c0eb3e9ffd5 100644
--- a/source/blender/nodes/function/nodes/node_fn_compare.cc
+++ b/source/blender/nodes/function/nodes/node_fn_compare.cc
@@ -582,8 +582,8 @@ void register_node_type_fn_compare()
fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_compare_declare;
ntype.labelfunc = file_ns::node_compare_label;
- node_type_update(&ntype, file_ns::node_compare_update);
- node_type_init(&ntype, file_ns::node_compare_init);
+ ntype.updatefunc = file_ns::node_compare_update;
+ ntype.initfunc = file_ns::node_compare_init;
node_type_storage(
&ntype, "NodeFunctionCompare", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_compare_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_input_bool.cc b/source/blender/nodes/function/nodes/node_fn_input_bool.cc
index c68de06a91b..62e0358b0ae 100644
--- a/source/blender/nodes/function/nodes/node_fn_input_bool.cc
+++ b/source/blender/nodes/function/nodes/node_fn_input_bool.cc
@@ -43,7 +43,7 @@ void register_node_type_fn_input_bool()
fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, "Boolean", 0);
ntype.declare = file_ns::fn_node_input_bool_declare;
- node_type_init(&ntype, file_ns::fn_node_input_bool_init);
+ ntype.initfunc = file_ns::fn_node_input_bool_init;
node_type_storage(
&ntype, "NodeInputBool", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_bool_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_input_color.cc b/source/blender/nodes/function/nodes/node_fn_input_color.cc
index 9a66066189a..af4c340efe7 100644
--- a/source/blender/nodes/function/nodes/node_fn_input_color.cc
+++ b/source/blender/nodes/function/nodes/node_fn_input_color.cc
@@ -46,7 +46,7 @@ void register_node_type_fn_input_color()
fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, "Color", NODE_CLASS_INPUT);
ntype.declare = file_ns::fn_node_input_color_declare;
- node_type_init(&ntype, file_ns::fn_node_input_color_init);
+ ntype.initfunc = file_ns::fn_node_input_color_init;
node_type_storage(
&ntype, "NodeInputColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_color_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_input_int.cc b/source/blender/nodes/function/nodes/node_fn_input_int.cc
index 5285c242d88..c339d2a348e 100644
--- a/source/blender/nodes/function/nodes/node_fn_input_int.cc
+++ b/source/blender/nodes/function/nodes/node_fn_input_int.cc
@@ -43,7 +43,7 @@ void register_node_type_fn_input_int()
fn_node_type_base(&ntype, FN_NODE_INPUT_INT, "Integer", 0);
ntype.declare = file_ns::fn_node_input_int_declare;
- node_type_init(&ntype, file_ns::fn_node_input_int_init);
+ ntype.initfunc = file_ns::fn_node_input_int_init;
node_type_storage(
&ntype, "NodeInputInt", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_int_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_input_string.cc b/source/blender/nodes/function/nodes/node_fn_input_string.cc
index a7172d9fcf9..9da17ef9a67 100644
--- a/source/blender/nodes/function/nodes/node_fn_input_string.cc
+++ b/source/blender/nodes/function/nodes/node_fn_input_string.cc
@@ -65,7 +65,7 @@ void register_node_type_fn_input_string()
fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, "String", NODE_CLASS_INPUT);
ntype.declare = file_ns::fn_node_input_string_declare;
- node_type_init(&ntype, file_ns::fn_node_input_string_init);
+ ntype.initfunc = file_ns::fn_node_input_string_init;
node_type_storage(
&ntype, "NodeInputString", file_ns::fn_node_input_string_free, file_ns::fn_node_string_copy);
ntype.build_multi_function = file_ns::fn_node_input_string_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_input_vector.cc b/source/blender/nodes/function/nodes/node_fn_input_vector.cc
index 49c8a6284e0..f6feda4cad0 100644
--- a/source/blender/nodes/function/nodes/node_fn_input_vector.cc
+++ b/source/blender/nodes/function/nodes/node_fn_input_vector.cc
@@ -44,7 +44,7 @@ void register_node_type_fn_input_vector()
fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, "Vector", 0);
ntype.declare = file_ns::fn_node_input_vector_declare;
- node_type_init(&ntype, file_ns::fn_node_input_vector_init);
+ ntype.initfunc = file_ns::fn_node_input_vector_init;
node_type_storage(
&ntype, "NodeInputVector", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_vector_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_random_value.cc b/source/blender/nodes/function/nodes/node_fn_random_value.cc
index 9f842e81071..c923e6e7d16 100644
--- a/source/blender/nodes/function/nodes/node_fn_random_value.cc
+++ b/source/blender/nodes/function/nodes/node_fn_random_value.cc
@@ -218,8 +218,8 @@ void register_node_type_fn_random_value()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, "Random Value", NODE_CLASS_CONVERTER);
- node_type_init(&ntype, file_ns::fn_node_random_value_init);
- node_type_update(&ntype, file_ns::fn_node_random_value_update);
+ ntype.initfunc = file_ns::fn_node_random_value_init;
+ ntype.updatefunc = file_ns::fn_node_random_value_update;
ntype.draw_buttons = file_ns::fn_node_random_value_layout;
ntype.declare = file_ns::fn_node_random_value_declare;
ntype.build_multi_function = file_ns::fn_node_random_value_build_multi_function;
diff --git a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
index 813d0a265f7..19afadb7a33 100644
--- a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
+++ b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
@@ -132,7 +132,7 @@ void register_node_type_fn_rotate_euler()
fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, "Rotate Euler", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_rotate_euler_declare;
ntype.draw_buttons = file_ns::fn_node_rotate_euler_layout;
- node_type_update(&ntype, file_ns::fn_node_rotate_euler_update);
+ ntype.updatefunc = file_ns::fn_node_rotate_euler_update;
ntype.build_multi_function = file_ns::fn_node_rotate_euler_build_multi_function;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/function/nodes/node_fn_separate_color.cc b/source/blender/nodes/function/nodes/node_fn_separate_color.cc
index 19753f93b5c..e3efb76d155 100644
--- a/source/blender/nodes/function/nodes/node_fn_separate_color.cc
+++ b/source/blender/nodes/function/nodes/node_fn_separate_color.cc
@@ -213,8 +213,8 @@ void register_node_type_fn_separate_color(void)
fn_node_type_base(&ntype, FN_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER);
ntype.declare = blender::nodes::fn_node_separate_color_declare;
- node_type_update(&ntype, blender::nodes::fn_node_separate_color_update);
- node_type_init(&ntype, blender::nodes::fn_node_separate_color_init);
+ ntype.updatefunc = blender::nodes::fn_node_separate_color_update;
+ ntype.initfunc = blender::nodes::fn_node_separate_color_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = blender::nodes::fn_node_separate_color_build_multi_function;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
index 9af445090e9..33a58cada1b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
@@ -425,8 +425,8 @@ void register_node_type_geo_accumulate_field()
geo_node_type_base(&ntype, GEO_NODE_ACCUMULATE_FIELD, "Accumulate Field", NODE_CLASS_CONVERTER);
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.draw_buttons = file_ns::node_layout;
ntype.declare = file_ns::node_declare;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
index 1aea129bd53..1a0cb14f451 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
@@ -241,8 +241,8 @@ void register_node_type_geo_attribute_capture()
"NodeGeometryAttributeCapture",
node_free_standard_storage,
node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc
index af55ef3f7ed..d31366f9c93 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc
@@ -132,7 +132,7 @@ void register_node_type_geo_attribute_domain_size()
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.updatefunc = file_ns::node_update;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc
index 3023c7bd751..e381133af30 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc
@@ -396,8 +396,8 @@ void register_node_type_geo_attribute_statistic()
&ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
index 094aab65653..61780ee25bb 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
@@ -191,7 +191,7 @@ void register_node_type_geo_boolean()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.updatefunc = file_ns::node_update;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
index df677e1c399..6c41dbbe34c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -93,7 +93,7 @@ static void node_geo_exec(GeoNodeExecParams params)
if (!reset_children) {
add_v3_v3(transform.values[3], child_collection->instance_offset);
if (use_relative_transform) {
- mul_m4_m4_pre(transform.values, self_object->imat);
+ mul_m4_m4_pre(transform.values, self_object->world_to_object);
}
else {
sub_v3_v3(transform.values[3], collection->instance_offset);
@@ -107,12 +107,12 @@ static void node_geo_exec(GeoNodeExecParams params)
float4x4 transform = float4x4::identity();
if (!reset_children) {
if (use_relative_transform) {
- transform = self_object->imat;
+ transform = self_object->world_to_object;
}
else {
sub_v3_v3(transform.values[3], collection->instance_offset);
}
- mul_m4_m4_post(transform.values, child_object->obmat);
+ mul_m4_m4_post(transform.values, child_object->object_to_world);
}
entries.append({handle, &(child_object->id.name[2]), transform});
}
@@ -130,7 +130,7 @@ static void node_geo_exec(GeoNodeExecParams params)
float4x4 transform = float4x4::identity();
if (use_relative_transform) {
copy_v3_v3(transform.values[3], collection->instance_offset);
- mul_m4_m4_pre(transform.values, self_object->imat);
+ mul_m4_m4_pre(transform.values, self_object->world_to_object);
}
const int handle = instances->add_reference(*collection);
@@ -150,7 +150,7 @@ void register_node_type_geo_collection_info()
geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, "Collection Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_node_init);
+ ntype.initfunc = file_ns::node_node_init;
node_type_storage(&ntype,
"NodeGeometryCollectionInfo",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 531d37c3a89..90fb7e10570 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -23,7 +23,7 @@ void register_node_type_geo_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- node_type_group_update(&ntype, node_group_update);
+ ntype.group_update_func = node_group_update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
index 038309785fb..278d7c4bd24 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
@@ -87,7 +87,7 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
MEdge &edge = edges[edge_index];
edge.v1 = v_from;
edge.v2 = v_to;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
/* Write edge index into both loops that have it. */
int reverse_index = plConvexHullGetReversedLoopIndex(hull, i);
@@ -101,7 +101,7 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
MEdge &edge = edges[0];
edge.v1 = 0;
edge.v2 = 1;
- edge.flag |= ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
+ edge.flag |= ME_EDGEDRAW | ME_LOOSEEDGE;
edge_index++;
}
BLI_assert(edge_index == edges_num);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc
index 6eaa40bff03..a14661b4a50 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc
@@ -90,7 +90,7 @@ static Mesh *cdt_to_mesh(const meshintersect::CDT_result<double> &result)
for (const int i : IndexRange(result.edge.size())) {
edges[i].v1 = result.edge[i].first;
edges[i].v2 = result.edge[i].second;
- edges[i].flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edges[i].flag = ME_EDGEDRAW;
}
int i_loop = 0;
for (const int i : IndexRange(result.face.size())) {
@@ -155,7 +155,7 @@ void register_node_type_geo_curve_fill()
geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, "Fill Curve", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeGeometryCurveFill", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc
index 2b24b6cbf42..7a6fa799013 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc
@@ -121,8 +121,8 @@ void register_node_type_geo_curve_fillet()
node_type_storage(
&ntype, "NodeGeometryCurveFillet", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
index 252f66c308f..9f0d40bb0d7 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
@@ -138,7 +138,7 @@ void register_node_type_geo_curve_handle_type_selection()
&ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, "Handle Type Selection", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryCurveSelectHandles",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
index cc32c8f5efc..e0148730710 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
@@ -359,8 +359,8 @@ void register_node_type_geo_curve_primitive_arc()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_ARC, "Arc", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveArc",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
index b407ac47dc9..59c17365261 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
@@ -119,7 +119,7 @@ void register_node_type_geo_curve_primitive_bezier_segment()
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bezier Segment", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveBezierSegment",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
index 35fdd6754cc..75f2116b237 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
@@ -217,8 +217,8 @@ void register_node_type_geo_curve_primitive_circle()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, "Curve Circle", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveCircle",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc
index 6b402a67450..d4ce1923178 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc
@@ -119,8 +119,8 @@ void register_node_type_geo_curve_primitive_line()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, "Curve Line", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveLine",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
index 44c2a078cb6..d4e37a98372 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
@@ -274,8 +274,8 @@ void register_node_type_geo_curve_primitive_quadrilateral()
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
- node_type_update(&ntype, file_ns::node_update);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.updatefunc = file_ns::node_update;
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveQuad",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index 8b6a7064362..23a71af448d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -123,8 +123,8 @@ void register_node_type_geo_curve_resample()
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeGeometryCurveResample", node_free_standard_storage, node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
index 27e111822bf..ba7985f26bc 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_devirtualize_parameters.hh"
+#include "BLI_generic_array.hh"
#include "BLI_length_parameterize.hh"
#include "BKE_curves.hh"
@@ -8,6 +9,8 @@
#include "UI_interface.h"
#include "UI_resources.h"
+#include "NOD_socket_search_link.hh"
+
#include "node_geometry_util.hh"
namespace blender::nodes::node_geo_curve_sample_cc {
@@ -16,9 +19,16 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveSample)
static void node_declare(NodeDeclarationBuilder &b)
{
- b.add_input<decl::Geometry>(N_("Curve"))
+ b.add_input<decl::Geometry>(N_("Curves"))
.only_realized_data()
.supported_type(GEO_COMPONENT_TYPE_CURVE);
+
+ b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
+ b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
+ b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
+ b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
+ b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
+
b.add_input<decl::Float>(N_("Factor"))
.min(0.0f)
.max(1.0f)
@@ -30,6 +40,16 @@ static void node_declare(NodeDeclarationBuilder &b)
.subtype(PROP_DISTANCE)
.supports_field()
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; });
+ b.add_input<decl::Int>(N_("Curve Index")).supports_field().make_available([](bNode &node) {
+ node_storage(node).use_all_curves = false;
+ });
+
+ b.add_output<decl::Float>(N_("Value"), "Value_Float").dependent_field();
+ b.add_output<decl::Int>(N_("Value"), "Value_Int").dependent_field();
+ b.add_output<decl::Vector>(N_("Value"), "Value_Vector").dependent_field();
+ b.add_output<decl::Color>(N_("Value"), "Value_Color").dependent_field();
+ b.add_output<decl::Bool>(N_("Value"), "Value_Bool").dependent_field();
+
b.add_output<decl::Vector>(N_("Position")).dependent_field();
b.add_output<decl::Vector>(N_("Tangent")).dependent_field();
b.add_output<decl::Vector>(N_("Normal")).dependent_field();
@@ -37,13 +57,17 @@ static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
+ uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "use_all_curves", 0, nullptr, ICON_NONE);
}
-static void node_type_init(bNodeTree * /*tree*/, bNode *node)
+static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeGeometryCurveSample *data = MEM_cnew<NodeGeometryCurveSample>(__func__);
- data->mode = GEO_NODE_CURVE_SAMPLE_LENGTH;
+ data->mode = GEO_NODE_CURVE_SAMPLE_FACTOR;
+ data->use_all_curves = false;
+ data->data_type = CD_PROP_FLOAT;
node->storage = data;
}
@@ -51,16 +75,62 @@ static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeGeometryCurveSample &storage = node_storage(*node);
const GeometryNodeCurveSampleMode mode = (GeometryNodeCurveSampleMode)storage.mode;
+ const eCustomDataType data_type = eCustomDataType(storage.data_type);
+
+ bNodeSocket *in_socket_float = static_cast<bNodeSocket *>(node->inputs.first)->next;
+ bNodeSocket *in_socket_int32 = in_socket_float->next;
+ bNodeSocket *in_socket_vector = in_socket_int32->next;
+ bNodeSocket *in_socket_color4f = in_socket_vector->next;
+ bNodeSocket *in_socket_bool = in_socket_color4f->next;
- bNodeSocket *factor = static_cast<bNodeSocket *>(node->inputs.first)->next;
+ bNodeSocket *factor = in_socket_bool->next;
bNodeSocket *length = factor->next;
+ bNodeSocket *curve_index = length->next;
nodeSetSocketAvailability(ntree, factor, mode == GEO_NODE_CURVE_SAMPLE_FACTOR);
nodeSetSocketAvailability(ntree, length, mode == GEO_NODE_CURVE_SAMPLE_LENGTH);
+ nodeSetSocketAvailability(ntree, curve_index, !storage.use_all_curves);
+
+ nodeSetSocketAvailability(ntree, in_socket_vector, data_type == CD_PROP_FLOAT3);
+ nodeSetSocketAvailability(ntree, in_socket_float, data_type == CD_PROP_FLOAT);
+ nodeSetSocketAvailability(ntree, in_socket_color4f, data_type == CD_PROP_COLOR);
+ nodeSetSocketAvailability(ntree, in_socket_bool, data_type == CD_PROP_BOOL);
+ nodeSetSocketAvailability(ntree, in_socket_int32, data_type == CD_PROP_INT32);
+
+ bNodeSocket *out_socket_float = static_cast<bNodeSocket *>(node->outputs.first);
+ bNodeSocket *out_socket_int32 = out_socket_float->next;
+ bNodeSocket *out_socket_vector = out_socket_int32->next;
+ bNodeSocket *out_socket_color4f = out_socket_vector->next;
+ bNodeSocket *out_socket_bool = out_socket_color4f->next;
+
+ nodeSetSocketAvailability(ntree, out_socket_vector, data_type == CD_PROP_FLOAT3);
+ nodeSetSocketAvailability(ntree, out_socket_float, data_type == CD_PROP_FLOAT);
+ nodeSetSocketAvailability(ntree, out_socket_color4f, data_type == CD_PROP_COLOR);
+ nodeSetSocketAvailability(ntree, out_socket_bool, data_type == CD_PROP_BOOL);
+ nodeSetSocketAvailability(ntree, out_socket_int32, data_type == CD_PROP_INT32);
+}
+
+static void node_gather_link_searches(GatherLinkSearchOpParams &params)
+{
+ const NodeDeclaration &declaration = *params.node_type().fixed_declaration;
+ search_link_ops_for_declarations(params, declaration.inputs().take_front(4));
+ search_link_ops_for_declarations(params, declaration.outputs().take_front(3));
+
+ const std::optional<eCustomDataType> type = node_data_type_to_custom_data_type(
+ eNodeSocketDatatype(params.other_socket().type));
+ if (type && *type != CD_PROP_STRING) {
+ /* The input and output sockets have the same name. */
+ params.add_item(IFACE_("Value"), [type](LinkSearchOpParams &params) {
+ bNode &node = params.add_node("GeometryNodeSampleCurve");
+ node_storage(node).data_type = *type;
+ params.update_and_connect_available_socket(node, "Value");
+ });
+ }
}
static void sample_indices_and_lengths(const Span<float> accumulated_lengths,
const Span<float> sample_lengths,
+ const GeometryNodeCurveSampleMode length_mode,
const IndexMask mask,
MutableSpan<int> r_segment_indices,
MutableSpan<float> r_length_in_segment)
@@ -70,10 +140,13 @@ static void sample_indices_and_lengths(const Span<float> accumulated_lengths,
mask.to_best_mask_type([&](const auto mask) {
for (const int64_t i : mask) {
+ const float sample_length = length_mode == GEO_NODE_CURVE_SAMPLE_FACTOR ?
+ sample_lengths[i] * total_length :
+ sample_lengths[i];
int segment_i;
float factor_in_segment;
length_parameterize::sample_at_length(accumulated_lengths,
- std::clamp(sample_lengths[i], 0.0f, total_length),
+ std::clamp(sample_length, 0.0f, total_length),
segment_i,
factor_in_segment,
&hint);
@@ -89,6 +162,7 @@ static void sample_indices_and_lengths(const Span<float> accumulated_lengths,
static void sample_indices_and_factors_to_compressed(const Span<float> accumulated_lengths,
const Span<float> sample_lengths,
+ const GeometryNodeCurveSampleMode length_mode,
const IndexMask mask,
MutableSpan<int> r_segment_indices,
MutableSpan<float> r_factor_in_segment)
@@ -96,16 +170,32 @@ static void sample_indices_and_factors_to_compressed(const Span<float> accumulat
const float total_length = accumulated_lengths.last();
length_parameterize::SampleSegmentHint hint;
- mask.to_best_mask_type([&](const auto mask) {
- for (const int64_t i : IndexRange(mask.size())) {
- const float length = sample_lengths[mask[i]];
- length_parameterize::sample_at_length(accumulated_lengths,
- std::clamp(length, 0.0f, total_length),
- r_segment_indices[i],
- r_factor_in_segment[i],
- &hint);
- }
- });
+ switch (length_mode) {
+ case GEO_NODE_CURVE_SAMPLE_FACTOR:
+ mask.to_best_mask_type([&](const auto mask) {
+ for (const int64_t i : IndexRange(mask.size())) {
+ const float length = sample_lengths[mask[i]] * total_length;
+ length_parameterize::sample_at_length(accumulated_lengths,
+ std::clamp(length, 0.0f, total_length),
+ r_segment_indices[i],
+ r_factor_in_segment[i],
+ &hint);
+ }
+ });
+ break;
+ case GEO_NODE_CURVE_SAMPLE_LENGTH:
+ mask.to_best_mask_type([&](const auto mask) {
+ for (const int64_t i : IndexRange(mask.size())) {
+ const float length = sample_lengths[mask[i]];
+ length_parameterize::sample_at_length(accumulated_lengths,
+ std::clamp(length, 0.0f, total_length),
+ r_segment_indices[i],
+ r_factor_in_segment[i],
+ &hint);
+ }
+ });
+ break;
+ }
}
/**
@@ -115,10 +205,12 @@ static void sample_indices_and_factors_to_compressed(const Span<float> accumulat
class SampleFloatSegmentsFunction : public fn::MultiFunction {
private:
Array<float> accumulated_lengths_;
+ GeometryNodeCurveSampleMode length_mode_;
public:
- SampleFloatSegmentsFunction(Array<float> accumulated_lengths)
- : accumulated_lengths_(std::move(accumulated_lengths))
+ SampleFloatSegmentsFunction(Array<float> accumulated_lengths,
+ const GeometryNodeCurveSampleMode length_mode)
+ : accumulated_lengths_(std::move(accumulated_lengths)), length_mode_(length_mode)
{
static fn::MFSignature signature = create_signature();
this->set_signature(&signature);
@@ -141,7 +233,8 @@ class SampleFloatSegmentsFunction : public fn::MultiFunction {
MutableSpan<float> lengths_in_segments = params.uninitialized_single_output<float>(
2, "Length in Curve");
- sample_indices_and_lengths(accumulated_lengths_, lengths, mask, indices, lengths_in_segments);
+ sample_indices_and_lengths(
+ accumulated_lengths_, lengths, length_mode_, mask, indices, lengths_in_segments);
}
};
@@ -153,15 +246,27 @@ class SampleCurveFunction : public fn::MultiFunction {
* that the curve is not freed before the function can execute.
*/
GeometrySet geometry_set_;
+ GField src_field_;
+ GeometryNodeCurveSampleMode length_mode_;
+
+ fn::MFSignature signature_;
+
+ std::optional<bke::CurvesFieldContext> source_context_;
+ std::unique_ptr<FieldEvaluator> source_evaluator_;
+ const GVArray *source_data_;
public:
- SampleCurveFunction(GeometrySet geometry_set) : geometry_set_(std::move(geometry_set))
+ SampleCurveFunction(GeometrySet geometry_set,
+ const GeometryNodeCurveSampleMode length_mode,
+ const GField &src_field)
+ : geometry_set_(std::move(geometry_set)), src_field_(src_field), length_mode_(length_mode)
{
- static fn::MFSignature signature = create_signature();
- this->set_signature(&signature);
+ signature_ = create_signature();
+ this->set_signature(&signature_);
+ this->evaluate_source();
}
- static fn::MFSignature create_signature()
+ fn::MFSignature create_signature()
{
blender::fn::MFSignatureBuilder signature{"Sample Curve"};
signature.single_input<int>("Curve Index");
@@ -169,6 +274,7 @@ class SampleCurveFunction : public fn::MultiFunction {
signature.single_output<float3>("Position");
signature.single_output<float3>("Tangent");
signature.single_output<float3>("Normal");
+ signature.single_output("Value", src_field_.cpp_type());
return signature.build();
}
@@ -180,6 +286,7 @@ class SampleCurveFunction : public fn::MultiFunction {
3, "Tangent");
MutableSpan<float3> sampled_normals = params.uninitialized_single_output_if_required<float3>(
4, "Normal");
+ GMutableSpan sampled_values = params.uninitialized_single_output_if_required(5, "Value");
auto return_default = [&]() {
if (!sampled_positions.is_empty()) {
@@ -218,18 +325,40 @@ class SampleCurveFunction : public fn::MultiFunction {
Array<int> indices;
Array<float> factors;
+ GArray<> src_original_values(source_data_->type());
+ GArray<> src_evaluated_values(source_data_->type());
+
+ auto fill_invalid = [&](const IndexMask mask) {
+ if (!sampled_positions.is_empty()) {
+ sampled_positions.fill_indices(mask, float3(0));
+ }
+ if (!sampled_tangents.is_empty()) {
+ sampled_tangents.fill_indices(mask, float3(0));
+ }
+ if (!sampled_normals.is_empty()) {
+ sampled_normals.fill_indices(mask, float3(0));
+ }
+ if (!sampled_values.is_empty()) {
+ attribute_math::convert_to_static_type(source_data_->type(), [&](auto dummy) {
+ using T = decltype(dummy);
+ sampled_values.typed<T>().fill_indices(mask, {});
+ });
+ }
+ };
auto sample_curve = [&](const int curve_i, const IndexMask mask) {
+ const Span<float> accumulated_lengths = curves.evaluated_lengths_for_curve(curve_i,
+ cyclic[curve_i]);
+ if (accumulated_lengths.is_empty()) {
+ fill_invalid(mask);
+ return;
+ }
/* Store the sampled indices and factors in arrays the size of the mask.
* Then, during interpolation, move the results back to the masked indices. */
indices.reinitialize(mask.size());
factors.reinitialize(mask.size());
sample_indices_and_factors_to_compressed(
- curves.evaluated_lengths_for_curve(curve_i, cyclic[curve_i]),
- lengths,
- mask,
- indices,
- factors);
+ accumulated_lengths, lengths, length_mode_, mask, indices, factors);
const IndexRange evaluated_points = curves.evaluated_points_for_curve(curve_i);
if (!sampled_positions.is_empty()) {
@@ -254,54 +383,67 @@ class SampleCurveFunction : public fn::MultiFunction {
sampled_normals[i] = math::normalize(sampled_normals[i]);
}
}
+ if (!sampled_values.is_empty()) {
+ const IndexRange points = curves.points_for_curve(curve_i);
+ src_original_values.reinitialize(points.size());
+ source_data_->materialize_compressed_to_uninitialized(points, src_original_values.data());
+ src_evaluated_values.reinitialize(curves.evaluated_points_for_curve(curve_i).size());
+ curves.interpolate_to_evaluated(curve_i, src_original_values, src_evaluated_values);
+ attribute_math::convert_to_static_type(source_data_->type(), [&](auto dummy) {
+ using T = decltype(dummy);
+ const Span<T> src_evaluated_values_typed = src_evaluated_values.as_span().typed<T>();
+ MutableSpan<T> sampled_values_typed = sampled_values.typed<T>();
+ length_parameterize::interpolate_to_masked<T>(
+ src_evaluated_values_typed, indices, factors, mask, sampled_values_typed);
+ });
+ }
};
- if (curve_indices.is_single()) {
- sample_curve(curve_indices.get_internal_single(), mask);
+ if (const std::optional<int> curve_i = curve_indices.get_if_single()) {
+ if (curves.curves_range().contains(*curve_i)) {
+ sample_curve(*curve_i, mask);
+ }
+ else {
+ fill_invalid(mask);
+ }
}
else {
+ Vector<int64_t> invalid_indices;
MultiValueMap<int, int64_t> indices_per_curve;
devirtualize_varray(curve_indices, [&](const auto curve_indices) {
for (const int64_t i : mask) {
- indices_per_curve.add(curve_indices[i], i);
+ const int curve_i = curve_indices[i];
+ if (curves.curves_range().contains(curve_i)) {
+ indices_per_curve.add(curve_i, i);
+ }
+ else {
+ invalid_indices.append(i);
+ }
}
});
for (const int curve_i : indices_per_curve.keys()) {
sample_curve(curve_i, IndexMask(indices_per_curve.lookup(curve_i)));
}
+ fill_invalid(IndexMask(invalid_indices));
}
}
-};
-/**
- * Pre-process the lengths or factors used for the sampling, turning factors into lengths, and
- * clamping between zero and the total length of the curves. Do this as a separate operation in the
- * field tree to make the sampling simpler, and to let the evaluator optimize better.
- *
- * \todo Use a mutable single input instead when they are supported.
- */
-static Field<float> get_length_input_field(GeoNodeExecParams params,
- const GeometryNodeCurveSampleMode mode,
- const float curves_total_length)
-{
- if (mode == GEO_NODE_CURVE_SAMPLE_LENGTH) {
- return params.extract_input<Field<float>>("Length");
+ private:
+ void evaluate_source()
+ {
+ const Curves &curves_id = *geometry_set_.get_curves_for_read();
+ const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
+ source_context_.emplace(bke::CurvesFieldContext{curves, ATTR_DOMAIN_POINT});
+ source_evaluator_ = std::make_unique<FieldEvaluator>(*source_context_, curves.points_num());
+ source_evaluator_->add(src_field_);
+ source_evaluator_->evaluate();
+ source_data_ = &source_evaluator_->get_evaluated(0);
}
-
- /* Convert the factor to a length. */
- Field<float> factor_field = params.get_input<Field<float>>("Factor");
- auto clamp_fn = std::make_unique<fn::CustomMF_SI_SO<float, float>>(
- __func__,
- [curves_total_length](float factor) { return factor * curves_total_length; },
- fn::CustomMF_presets::AllSpanOrSingle());
-
- return Field<float>(FieldOperation::Create(std::move(clamp_fn), {std::move(factor_field)}), 0);
-}
+};
static Array<float> curve_accumulated_lengths(const bke::CurvesGeometry &curves)
{
- curves.ensure_evaluated_lengths();
Array<float> curve_lengths(curves.curves_num());
const VArray<bool> cyclic = curves.cyclic();
@@ -313,9 +455,56 @@ static Array<float> curve_accumulated_lengths(const bke::CurvesGeometry &curves)
return curve_lengths;
}
+static GField get_input_attribute_field(GeoNodeExecParams &params, const eCustomDataType data_type)
+{
+ switch (data_type) {
+ case CD_PROP_FLOAT:
+ return params.extract_input<Field<float>>("Value_Float");
+ case CD_PROP_FLOAT3:
+ return params.extract_input<Field<float3>>("Value_Vector");
+ case CD_PROP_COLOR:
+ return params.extract_input<Field<ColorGeometry4f>>("Value_Color");
+ case CD_PROP_BOOL:
+ return params.extract_input<Field<bool>>("Value_Bool");
+ case CD_PROP_INT32:
+ return params.extract_input<Field<int>>("Value_Int");
+ default:
+ BLI_assert_unreachable();
+ }
+ return {};
+}
+
+static void output_attribute_field(GeoNodeExecParams &params, GField field)
+{
+ switch (bke::cpp_type_to_custom_data_type(field.cpp_type())) {
+ case CD_PROP_FLOAT: {
+ params.set_output("Value_Float", Field<float>(field));
+ break;
+ }
+ case CD_PROP_FLOAT3: {
+ params.set_output("Value_Vector", Field<float3>(field));
+ break;
+ }
+ case CD_PROP_COLOR: {
+ params.set_output("Value_Color", Field<ColorGeometry4f>(field));
+ break;
+ }
+ case CD_PROP_BOOL: {
+ params.set_output("Value_Bool", Field<bool>(field));
+ break;
+ }
+ case CD_PROP_INT32: {
+ params.set_output("Value_Int", Field<int>(field));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
static void node_geo_exec(GeoNodeExecParams params)
{
- GeometrySet geometry_set = params.extract_input<GeometrySet>("Curve");
+ GeometrySet geometry_set = params.extract_input<GeometrySet>("Curves");
if (!geometry_set.has_curves()) {
params.set_default_remaining_outputs();
return;
@@ -328,18 +517,18 @@ static void node_geo_exec(GeoNodeExecParams params)
return;
}
- Array<float> curve_lengths = curve_accumulated_lengths(curves);
- const float total_length = curve_lengths.last();
- if (total_length == 0.0f) {
- params.set_default_remaining_outputs();
- return;
- }
+ curves.ensure_evaluated_lengths();
const NodeGeometryCurveSample &storage = node_storage(params.node());
const GeometryNodeCurveSampleMode mode = (GeometryNodeCurveSampleMode)storage.mode;
- Field<float> length_field = get_length_input_field(params, mode, total_length);
+ const eCustomDataType data_type = eCustomDataType(storage.data_type);
- auto sample_fn = std::make_unique<SampleCurveFunction>(std::move(geometry_set));
+ Field<float> length_field = params.extract_input<Field<float>>(
+ mode == GEO_NODE_CURVE_SAMPLE_FACTOR ? "Factor" : "Length");
+ GField src_values_field = get_input_attribute_field(params, data_type);
+
+ auto sample_fn = std::make_unique<SampleCurveFunction>(
+ std::move(geometry_set), mode, std::move(src_values_field));
std::shared_ptr<FieldOperation> sample_op;
if (curves.curves_num() == 1) {
@@ -347,15 +536,26 @@ static void node_geo_exec(GeoNodeExecParams params)
{fn::make_constant_field<int>(0), std::move(length_field)});
}
else {
- auto index_fn = std::make_unique<SampleFloatSegmentsFunction>(std::move(curve_lengths));
- auto index_op = FieldOperation::Create(std::move(index_fn), {std::move(length_field)});
- sample_op = FieldOperation::Create(std::move(sample_fn),
- {Field<int>(index_op, 0), Field<float>(index_op, 1)});
+ Field<int> curve_index;
+ Field<float> length_in_curve;
+ if (storage.use_all_curves) {
+ auto index_fn = std::make_unique<SampleFloatSegmentsFunction>(
+ curve_accumulated_lengths(curves), mode);
+ auto index_op = FieldOperation::Create(std::move(index_fn), {std::move(length_field)});
+ curve_index = Field<int>(index_op, 0);
+ length_in_curve = Field<float>(index_op, 1);
+ }
+ else {
+ curve_index = params.extract_input<Field<int>>("Curve Index");
+ length_in_curve = std::move(length_field);
+ }
+ sample_op = FieldOperation::Create(std::move(sample_fn), {curve_index, length_in_curve});
}
params.set_output("Position", Field<float3>(sample_op, 0));
params.set_output("Tangent", Field<float3>(sample_op, 1));
params.set_output("Normal", Field<float3>(sample_op, 2));
+ output_attribute_field(params, GField(sample_op, 3));
}
} // namespace blender::nodes::node_geo_curve_sample_cc
@@ -369,11 +569,11 @@ void register_node_type_geo_curve_sample()
geo_node_type_base(&ntype, GEO_NODE_SAMPLE_CURVE, "Sample Curve", NODE_CLASS_GEOMETRY);
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_type_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeGeometryCurveSample", node_free_standard_storage, node_copy_standard_storage);
ntype.draw_buttons = file_ns::node_layout;
-
+ ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_set_handle_type.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_set_handle_type.cc
index d37af6e5fe8..46377329fb4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_set_handle_type.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_set_handle_type.cc
@@ -120,7 +120,7 @@ void register_node_type_geo_curve_set_handle_type()
&ntype, GEO_NODE_CURVE_SET_HANDLE_TYPE, "Set Handle Type", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryCurveSetHandles",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
index 9ac6516ee7b..4b8251aadd3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
@@ -87,7 +87,7 @@ void register_node_type_geo_curve_spline_type()
geo_node_type_base(&ntype, GEO_NODE_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryCurveSplineType",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index e9eaa00b02d..268c927f782 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -216,7 +216,7 @@ void register_node_type_geo_curve_to_points()
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeGeometryCurveToPoints", node_free_standard_storage, node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
index 15c89d78276..3ec71877b7c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
@@ -202,8 +202,8 @@ void register_node_type_geo_curve_trim()
ntype.declare = file_ns::node_declare;
node_type_storage(
&ntype, "NodeGeometryCurveTrim", node_free_standard_storage, node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
index 0932624bdc3..dabd2a1a9f2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
@@ -310,7 +310,8 @@ static void node_geo_exec(GeoNodeExecParams params)
ATTR_DOMAIN_CORNER);
const VArraySpan<float3> rest_positions = mesh_attributes_eval.lookup<float3>(rest_position_name,
ATTR_DOMAIN_POINT);
- const Span<float2> surface_uv_coords = curves.surface_uv_coords();
+ const VArraySpan<float2> surface_uv_coords = curves.attributes().lookup_or_default(
+ "surface_uv_coordinate", ATTR_DOMAIN_CURVE, float2(0));
const Span<MLoopTri> looptris_orig = surface_mesh_orig->looptris();
const Span<MLoopTri> looptris_eval = surface_mesh_eval->looptris();
@@ -379,7 +380,8 @@ static void node_geo_exec(GeoNodeExecParams params)
invalid_uv_count);
/* Then also deform edit curve information for use in sculpt mode. */
const CurvesGeometry &curves_orig = CurvesGeometry::wrap(edit_hints->curves_id_orig.geometry);
- const Span<float2> surface_uv_coords_orig = curves_orig.surface_uv_coords();
+ const VArraySpan<float2> surface_uv_coords_orig = curves_orig.attributes().lookup_or_default(
+ "surface_uv_coordinate", ATTR_DOMAIN_CURVE, float2(0));
if (!surface_uv_coords_orig.is_empty()) {
deform_curves(curves_orig,
*surface_mesh_orig,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
index 3e48a9fd923..8ed97f2019f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
@@ -1202,7 +1202,7 @@ void register_node_type_geo_delete_geometry()
node_free_standard_storage,
node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
index 95173bd23a5..f2e66e03d26 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
@@ -278,8 +278,8 @@ void register_node_type_geo_distribute_points_in_volume()
"NodeGeometryDistributePointsInVolume",
node_free_standard_storage,
node_copy_standard_storage);
- node_type_init(&ntype, blender::nodes::node_distribute_points_in_volume_init);
- node_type_update(&ntype, blender::nodes::node_distribute_points_in_volume_update);
+ ntype.initfunc = blender::nodes::node_distribute_points_in_volume_init;
+ ntype.updatefunc = blender::nodes::node_distribute_points_in_volume_update;
node_type_size(&ntype, 170, 100, 320);
ntype.declare = blender::nodes::geo_node_distribute_points_in_volume_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_distribute_points_in_volume_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
index c2cc70296ed..7c9501608a3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
@@ -563,7 +563,7 @@ void register_node_type_geo_distribute_points_on_faces()
GEO_NODE_DISTRIBUTE_POINTS_ON_FACES,
"Distribute Points on Faces",
NODE_CLASS_GEOMETRY);
- node_type_update(&ntype, file_ns::node_point_distribute_points_on_faces_update);
+ ntype.updatefunc = file_ns::node_point_distribute_points_on_faces_update;
node_type_size(&ntype, 170, 100, 320);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
index 486f900aca5..f048ec11f77 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
@@ -1149,7 +1149,7 @@ void register_node_type_geo_duplicate_elements()
node_free_standard_storage,
node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.draw_buttons = file_ns::node_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 151ba3e59cc..0062abba909 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -154,7 +154,7 @@ static MEdge new_edge(const int v1, const int v2)
MEdge edge;
edge.v1 = v1;
edge.v2 = v2;
- edge.flag = (ME_EDGEDRAW | ME_EDGERENDER);
+ edge.flag = ME_EDGEDRAW;
return edge;
}
@@ -1380,8 +1380,8 @@ void register_node_type_geo_extrude_mesh()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_EXTRUDE_MESH, "Extrude Mesh", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_storage(
&ntype, "NodeGeometryExtrudeMesh", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
index f39337d3fc3..0d339620047 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
@@ -402,7 +402,7 @@ void register_node_type_geo_image_texture()
geo_node_type_base(&ntype, GEO_NODE_IMAGE_TEXTURE, "Image Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeGeometryImageTexture", node_free_standard_storage, node_copy_standard_storage);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc
index 1063a022e9d..9d1f90ba0f3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_named_attribute.cc
@@ -126,7 +126,7 @@ void register_node_type_geo_input_named_attribute()
ntype.draw_buttons = file_ns::node_layout;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
ntype.updatefunc = file_ns::node_update;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryInputNamedAttribute",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc b/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc
index ce8b078f195..8ab8c4afaa9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc
@@ -132,7 +132,7 @@ void register_node_type_geo_merge_by_distance()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MERGE_BY_DISTANCE, "Merge by Distance", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometryMergeByDistance",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc
index 31a3e967905..14f38efbd42 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc
@@ -127,7 +127,7 @@ static Mesh *create_circle_mesh(const float radius,
/* Create outer edges. */
const short edge_flag = (fill_type == GEO_NODE_MESH_CIRCLE_FILL_NONE) ?
ME_LOOSEEDGE :
- (ME_EDGEDRAW | ME_EDGERENDER); /* NGON or TRIANGLE_FAN */
+ ME_EDGEDRAW; /* NGON or TRIANGLE_FAN */
for (const int i : IndexRange(verts_num)) {
MEdge &edge = edges[i];
edge.v1 = i;
@@ -141,7 +141,7 @@ static Mesh *create_circle_mesh(const float radius,
MEdge &edge = edges[verts_num + i];
edge.v1 = verts_num;
edge.v2 = i;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
@@ -205,7 +205,7 @@ void register_node_type_geo_mesh_primitive_circle()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CIRCLE, "Mesh Circle", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeGeometryMeshCircle", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
index 4a9264b8464..dca91d2dc61 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
@@ -329,7 +329,7 @@ static void calculate_cone_edges(const MutableSpan<MEdge> &edges, const ConeConf
MEdge &edge = edges[edge_index++];
edge.v1 = config.first_vert;
edge.v2 = config.first_ring_verts_start + i;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
@@ -342,7 +342,7 @@ static void calculate_cone_edges(const MutableSpan<MEdge> &edges, const ConeConf
MEdge &edge = edges[edge_index++];
edge.v1 = this_ring_vert_start + j;
edge.v2 = this_ring_vert_start + ((j + 1) % config.circle_segments);
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
if (i == config.tot_edge_rings - 1) {
/* There is one fewer ring of connecting edges. */
@@ -353,7 +353,7 @@ static void calculate_cone_edges(const MutableSpan<MEdge> &edges, const ConeConf
MEdge &edge = edges[edge_index++];
edge.v1 = this_ring_vert_start + j;
edge.v2 = next_ring_vert_start + j;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
@@ -363,7 +363,7 @@ static void calculate_cone_edges(const MutableSpan<MEdge> &edges, const ConeConf
MEdge &edge = edges[edge_index++];
edge.v1 = config.last_ring_verts_start + i;
edge.v2 = config.last_vert;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
}
@@ -854,8 +854,8 @@ void register_node_type_geo_mesh_primitive_cone()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CONE, "Cone", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeGeometryMeshCone", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
index f192b385b1b..b02b1fbae27 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
@@ -154,8 +154,8 @@ void register_node_type_geo_mesh_primitive_cylinder()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Cylinder", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeGeometryMeshCylinder", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
index 6f0b8283b72..e8ee057ee5c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
@@ -76,8 +76,7 @@ Mesh *create_grid_mesh(const int verts_x,
const int y_edges_start = 0;
const int x_edges_start = verts_x * edges_y;
- const short edge_flag = (edges_x == 0 || edges_y == 0) ? ME_LOOSEEDGE :
- ME_EDGEDRAW | ME_EDGERENDER;
+ const short edge_flag = (edges_x == 0 || edges_y == 0) ? ME_LOOSEEDGE : ME_EDGEDRAW;
/* Build the horizontal edges in the X direction. */
threading::parallel_for(IndexRange(verts_x), 512, [&](IndexRange x_range) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
index 7faa7e23274..51a4f36507e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
@@ -214,8 +214,8 @@ void register_node_type_geo_mesh_primitive_line()
geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_LINE, "Mesh Line", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeGeometryMeshLine", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
index 4b43693f0f6..cfa1c477b28 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
@@ -116,7 +116,7 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
MEdge &edge = edges[edge_index++];
edge.v1 = 0;
edge.v2 = first_vert_ring_index_start + segment;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
int ring_vert_index_start = 1;
@@ -128,7 +128,7 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
MEdge &edge = edges[edge_index++];
edge.v1 = ring_vert_index_start + segment;
edge.v2 = ring_vert_index_start + ((segment + 1) % segments);
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
/* Add the edges connecting to the next ring. */
@@ -137,7 +137,7 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
MEdge &edge = edges[edge_index++];
edge.v1 = ring_vert_index_start + segment;
edge.v2 = next_ring_vert_index_start + segment;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
ring_vert_index_start += segments;
@@ -150,7 +150,7 @@ BLI_NOINLINE static void calculate_sphere_edge_indices(MutableSpan<MEdge> edges,
MEdge &edge = edges[edge_index++];
edge.v1 = last_vert_index;
edge.v2 = last_vert_ring_start + segment;
- edge.flag = ME_EDGEDRAW | ME_EDGERENDER;
+ edge.flag = ME_EDGEDRAW;
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
index d97a0e72060..d47e0c0f101 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
@@ -163,7 +163,7 @@ void register_node_type_geo_mesh_to_points()
geo_node_type_base(&ntype, GEO_NODE_MESH_TO_POINTS, "Mesh to Points", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeGeometryMeshToPoints", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
index 8885903f828..cf4d058cd31 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
@@ -174,8 +174,8 @@ void register_node_type_geo_mesh_to_volume()
geo_node_type_base(&ntype, GEO_NODE_MESH_TO_VOLUME, "Mesh to Volume", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
node_type_size(&ntype, 200, 120, 700);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index bf064c6fcbe..f1a9987e721 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -45,8 +45,8 @@ static void node_geo_exec(GeoNodeExecParams params)
return;
}
- const float4x4 &object_matrix = object->obmat;
- const float4x4 transform = float4x4(self_object->imat) * object_matrix;
+ const float4x4 &object_matrix = object->object_to_world;
+ const float4x4 transform = float4x4(self_object->world_to_object) * object_matrix;
if (transform_space_relative) {
params.set_output("Location", transform.translation());
@@ -106,7 +106,7 @@ void register_node_type_geo_object_info()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT);
- node_type_init(&ntype, file_ns::node_node_init);
+ ntype.initfunc = file_ns::node_node_init;
node_type_storage(
&ntype, "NodeGeometryObjectInfo", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index 45f6820f2e5..d0b7f6a455f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -258,8 +258,8 @@ void register_node_type_geo_points_to_volume()
node_free_standard_storage,
node_copy_standard_storage);
node_type_size(&ntype, 170, 120, 700);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc
index 21f4449baee..92a409f9db6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc
@@ -228,7 +228,7 @@ void register_node_type_geo_proximity()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_PROXIMITY, "Geometry Proximity", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::geo_proximity_init);
+ ntype.initfunc = file_ns::geo_proximity_init;
node_type_storage(
&ntype, "NodeGeometryProximity", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
index d248bc539b1..b3dbc9ee866 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
@@ -435,8 +435,8 @@ void register_node_type_geo_raycast()
geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(
&ntype, "NodeGeometryRaycast", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
index 4d2db059798..22c18504985 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
@@ -325,8 +325,8 @@ void register_node_type_geo_sample_index()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_SAMPLE_INDEX, "Sample Index", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
node_type_storage(
&ntype, "NodeGeometrySampleIndex", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
index 8c5dad3a1c5..7028b013dc6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
@@ -334,7 +334,7 @@ void register_node_type_geo_sample_nearest()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_SAMPLE_NEAREST, "Sample Nearest", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc
index 95bf7199d63..503f6264191 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc
@@ -267,8 +267,8 @@ void register_node_type_geo_sample_nearest_surface()
geo_node_type_base(
&ntype, GEO_NODE_SAMPLE_NEAREST_SURFACE, "Sample Nearest Surface", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc
index 2e8446ba559..0a6dd569395 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc
@@ -284,8 +284,8 @@ void register_node_type_geo_sample_uv_surface()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_SAMPLE_UV_SURFACE, "Sample UV Surface", NODE_CLASS_GEOMETRY);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc
index 44d12466d9e..d4da5dda647 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc
@@ -87,7 +87,7 @@ void register_node_type_geo_separate_geometry()
node_free_standard_storage,
node_copy_standard_storage);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc
index c143203337a..48be899bec9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc
@@ -174,7 +174,7 @@ void register_node_type_geo_set_curve_handles()
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
ntype.minwidth = 100.0f;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(&ntype,
"NodeGeometrySetCurveHandlePositions",
node_free_standard_storage,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_normal.cc
index e2169966f5a..287c5920134 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_normal.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_normal.cc
@@ -66,7 +66,7 @@ void register_node_type_geo_set_curve_normal()
geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_NORMAL, "Set Curve Normal", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
index 3c85fd459e1..b71dba98daa 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
@@ -192,7 +192,7 @@ void register_node_type_geo_store_named_attribute()
node_free_standard_storage,
node_copy_standard_storage);
node_type_size(&ntype, 140, 100, 700);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
ntype.updatefunc = file_ns::node_update;
ntype.declare = file_ns::node_declare;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index 769a63f58cf..405c2761711 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -405,8 +405,8 @@ void register_node_type_geo_string_to_curves()
geo_node_type_base(&ntype, GEO_NODE_STRING_TO_CURVES, "String to Curves", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_size(&ntype, 190, 120, 700);
node_type_storage(&ntype,
"NodeGeometryStringToCurves",
diff --git a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
index 2e6ad02bfd5..7b4608d32a5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
@@ -191,7 +191,7 @@ void register_node_type_geo_subdivision_surface()
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_storage(&ntype,
"NodeGeometrySubdivisionSurface",
diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc
index 36be68f1a22..bd3ac271817 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc
@@ -290,8 +290,8 @@ void register_node_type_geo_switch()
geo_node_type_base(&ntype, GEO_NODE_SWITCH, "Switch", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
node_type_storage(&ntype, "NodeSwitch", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.geometry_node_execute_supports_laziness = true;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
index cedc1ef845b..5cb78b3abe8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
@@ -100,7 +100,7 @@ void register_node_type_geo_triangulate()
geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::geo_triangulate_init);
+ ntype.initfunc = file_ns::geo_triangulate_init;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc b/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
index e45ce6b42b4..eff3b969250 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
@@ -189,7 +189,7 @@ void register_node_type_geo_uv_unwrap()
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_UV_UNWRAP, "UV Unwrap", NODE_CLASS_CONVERTER);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeGeometryUVUnwrap", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = file_ns::node_declare;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
index e9050f9e6a1..53a8cd79f52 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc
@@ -135,8 +135,8 @@ void register_node_type_geo_viewer()
geo_node_type_base(&ntype, GEO_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT);
node_type_storage(
&ntype, "NodeGeometryViewer", node_free_standard_storage, node_copy_standard_storage);
- node_type_update(&ntype, file_ns::node_update);
- node_type_init(&ntype, file_ns::node_init);
+ ntype.updatefunc = file_ns::node_update;
+ ntype.initfunc = file_ns::node_init;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.draw_buttons_ex = file_ns::node_layout_ex;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
index 88e7718ed3c..c076a6c08f3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
@@ -215,8 +215,8 @@ void register_node_type_geo_volume_to_mesh()
node_type_storage(
&ntype, "NodeGeometryVolumeToMesh", node_free_standard_storage, node_copy_standard_storage);
node_type_size(&ntype, 170, 120, 700);
- node_type_init(&ntype, file_ns::node_init);
- node_type_update(&ntype, file_ns::node_update);
+ ntype.initfunc = file_ns::node_init;
+ ntype.updatefunc = file_ns::node_update;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc
index d7cc0b6065a..d01faeac401 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -255,7 +255,7 @@ void register_node_type_frame()
ntype->free_self = (void (*)(bNodeType *))MEM_freeN;
node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT);
- node_type_init(ntype, node_frame_init);
+ ntype->initfunc = node_frame_init;
node_type_storage(ntype, "NodeFrame", node_free_standard_storage, node_copy_standard_storage);
node_type_size(ntype, 150, 100, 0);
ntype->flag |= NODE_BACKGROUND;
@@ -285,7 +285,7 @@ void register_node_type_reroute()
ntype->free_self = (void (*)(bNodeType *))MEM_freeN;
node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT);
- node_type_init(ntype, node_reroute_init);
+ ntype->initfunc = node_reroute_init;
nodeRegisterType(ntype);
}
@@ -527,8 +527,8 @@ void register_node_type_group_input()
node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE);
node_type_size(ntype, 140, 80, 400);
- node_type_init(ntype, node_group_input_init);
- node_type_update(ntype, node_group_input_update);
+ ntype->initfunc = node_group_input_init;
+ ntype->updatefunc = node_group_input_update;
nodeRegisterType(ntype);
}
@@ -617,8 +617,8 @@ void register_node_type_group_output()
node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE);
node_type_size(ntype, 140, 80, 400);
- node_type_init(ntype, node_group_output_init);
- node_type_update(ntype, node_group_output_update);
+ ntype->initfunc = node_group_output_init;
+ ntype->updatefunc = node_group_output_update;
ntype->no_muting = true;
diff --git a/source/blender/nodes/intern/node_exec.cc b/source/blender/nodes/intern/node_exec.cc
index 724d6f1a1e1..af783ca391f 100644
--- a/source/blender/nodes/intern/node_exec.cc
+++ b/source/blender/nodes/intern/node_exec.cc
@@ -162,7 +162,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context,
/* XXX could let callbacks do this for specialized data */
exec = MEM_cnew<bNodeTreeExec>("node tree execution data");
- /* backpointer to node tree */
+ /* Back-pointer to node tree. */
exec->nodetree = ntree;
/* set stack indices */
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
index dc07f52e23f..55bf409444e 100644
--- a/source/blender/nodes/intern/node_exec.h
+++ b/source/blender/nodes/intern/node_exec.h
@@ -27,7 +27,7 @@ struct bNodeTree;
/* Node execution data */
typedef struct bNodeExec {
- /** Backpointer to node. */
+ /** Back-pointer to node. */
struct bNode *node;
bNodeExecData data;
@@ -37,7 +37,7 @@ typedef struct bNodeExec {
/* Execution Data for each instance of node tree execution */
typedef struct bNodeTreeExec {
- struct bNodeTree *nodetree; /* backpointer to node tree */
+ struct bNodeTree *nodetree; /* Back-pointer to node tree. */
int totnodes; /* total node count */
struct bNodeExec *nodeexec; /* per-node execution data */
diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc
index 52edf68b3ff..f177fc95ef8 100644
--- a/source/blender/nodes/shader/node_shader_tree.cc
+++ b/source/blender/nodes/shader/node_shader_tree.cc
@@ -1126,7 +1126,8 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec)
bNodeTree *ntree = exec->nodetree;
ntreeShaderEndExecTree_internal(exec);
- /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ /* XXX: clear node-tree back-pointer to exec data,
+ * same problem as noted in #ntreeBeginExecTree. */
ntree->execdata = nullptr;
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc
index f7b25225e30..8bdc5b91887 100644
--- a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc
@@ -32,7 +32,7 @@ void register_node_type_sh_add_shader()
sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_add_shader);
+ ntype.gpu_fn = file_ns::node_shader_gpu_add_shader;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
index 5f30fe0dd30..85c49b47b81 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc
@@ -66,8 +66,8 @@ void register_node_type_sh_ambient_occlusion()
sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
- node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_ambient_occlusion);
+ ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
+ ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
index 4694599f064..44f5282b688 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc
@@ -86,10 +86,10 @@ void register_node_type_sh_attribute()
sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_attribute;
- node_type_init(&ntype, file_ns::node_shader_init_attribute);
+ ntype.initfunc = file_ns::node_shader_init_attribute;
node_type_storage(
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_attribute);
+ ntype.gpu_fn = file_ns::node_shader_gpu_attribute;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc
index 1e41b66189a..a1e90757157 100644
--- a/source/blender/nodes/shader/nodes/node_shader_background.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_background.cc
@@ -33,7 +33,7 @@ void register_node_type_sh_background()
sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_background);
+ ntype.gpu_fn = file_ns::node_shader_gpu_background;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc
index 14356a46125..53ce3876772 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc
@@ -50,8 +50,8 @@ void register_node_type_sh_bevel()
sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_bevel;
- node_type_init(&ntype, file_ns::node_shader_init_bevel);
- node_type_gpu(&ntype, file_ns::gpu_shader_bevel);
+ ntype.initfunc = file_ns::node_shader_init_bevel;
+ ntype.gpu_fn = file_ns::gpu_shader_bevel;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc
index 23e9a601045..a31653de4b2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc
@@ -42,7 +42,7 @@ void register_node_type_sh_blackbody()
sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_blackbody);
+ ntype.gpu_fn = file_ns::node_shader_gpu_blackbody;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc
index 09f0e21208c..0b1930b0434 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc
@@ -32,7 +32,7 @@ void register_node_type_sh_brightcontrast()
sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast);
+ ntype.gpu_fn = file_ns::gpu_shader_brightcontrast;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
index 2071b78fa64..48a7c248ea9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc
@@ -69,8 +69,8 @@ void register_node_type_sh_bsdf_anisotropic()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_anisotropic;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_anisotropic);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_anisotropic);
+ ntype.initfunc = file_ns::node_shader_init_anisotropic;
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_anisotropic;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
index a4f0e04576f..ba222a1a2c2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc
@@ -45,7 +45,7 @@ void register_node_type_sh_bsdf_diffuse()
sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_diffuse);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_diffuse;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
index b3c047c3a47..00d2ba4a119 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc
@@ -57,8 +57,8 @@ void register_node_type_sh_bsdf_glass()
sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_glass);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glass);
+ ntype.initfunc = file_ns::node_shader_init_glass;
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glass;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
index 7beecc0ecd4..edccd7314d2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc
@@ -56,8 +56,8 @@ void register_node_type_sh_bsdf_glossy()
sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_glossy);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glossy);
+ ntype.initfunc = file_ns::node_shader_init_glossy;
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glossy;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
index f8a17e146f4..0498dcd0be5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc
@@ -58,7 +58,7 @@ void register_node_type_sh_bsdf_hair()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_hair;
node_type_size(&ntype, 150, 60, 200);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_hair);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_hair;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
index b1022a95783..fd127cfb8ae 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc
@@ -129,9 +129,9 @@ void register_node_type_sh_bsdf_hair_principled()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_principled_hair;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, file_ns::node_shader_init_hair_principled);
- node_type_update(&ntype, file_ns::node_shader_update_hair_principled);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_principled);
+ ntype.initfunc = file_ns::node_shader_init_hair_principled;
+ ntype.updatefunc = file_ns::node_shader_update_hair_principled;
+ ntype.gpu_fn = file_ns::node_shader_gpu_hair_principled;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
index adf2a9e8a19..82bf852455c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc
@@ -245,9 +245,9 @@ void register_node_type_sh_bsdf_principled()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_principled;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, file_ns::node_shader_init_principled);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_principled);
- node_type_update(&ntype, file_ns::node_shader_update_principled);
+ ntype.initfunc = file_ns::node_shader_init_principled;
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_principled;
+ ntype.updatefunc = file_ns::node_shader_update_principled;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
index a7111fd398f..d6ef63015f8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc
@@ -55,8 +55,8 @@ void register_node_type_sh_bsdf_refraction()
sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_refraction);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_refraction);
+ ntype.initfunc = file_ns::node_shader_init_refraction;
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_refraction;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
index d0f70eb1c92..ba8e48ce410 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc
@@ -59,7 +59,7 @@ void register_node_type_sh_bsdf_toon()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_toon;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_toon);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_toon;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
index b8a2bf8043e..fcb3bcdd00a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc
@@ -39,7 +39,7 @@ void register_node_type_sh_bsdf_translucent()
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_translucent);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_translucent;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
index 8824c744fd3..4eba043ff2b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_bsdf_transparent()
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_transparent);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_transparent;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
index c4aaf371e46..67351dd7e19 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc
@@ -44,7 +44,7 @@ void register_node_type_sh_bsdf_velvet()
sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet);
+ ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_velvet;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc
index 5447198107b..9439f95d62b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bump.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc
@@ -78,7 +78,7 @@ void register_node_type_sh_bump()
sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_bump;
- node_type_gpu(&ntype, file_ns::gpu_shader_bump);
+ ntype.gpu_fn = file_ns::gpu_shader_bump;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.cc b/source/blender/nodes/shader/nodes/node_shader_camera.cc
index 4d99d5ad17f..2752cd31c56 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_camera()
sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_camera);
+ ntype.gpu_fn = file_ns::gpu_shader_camera;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
index 7680c6f99c4..5b7c216c4c3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
@@ -76,8 +76,8 @@ void register_node_type_sh_clamp()
sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_clamp_declare;
ntype.draw_buttons = file_ns::node_shader_buts_clamp;
- node_type_init(&ntype, file_ns::node_shader_init_clamp);
- node_type_gpu(&ntype, file_ns::gpu_shader_clamp);
+ ntype.initfunc = file_ns::node_shader_init_clamp;
+ ntype.gpu_fn = file_ns::gpu_shader_clamp;
ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
index 096884591ab..f5d405c7678 100644
--- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
@@ -140,10 +140,10 @@ void register_node_type_sh_valtorgb()
sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_valtorgb_declare;
- node_type_init(&ntype, file_ns::node_shader_init_valtorgb);
+ ntype.initfunc = file_ns::node_shader_init_valtorgb;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::gpu_shader_valtorgb);
+ ntype.gpu_fn = file_ns::gpu_shader_valtorgb;
ntype.build_multi_function = file_ns::sh_node_valtorgb_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc b/source/blender/nodes/shader/nodes/node_shader_common.cc
index 20d0d11ba86..9d1d788da9d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_common.cc
@@ -93,8 +93,8 @@ void register_node_type_sh_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- node_type_group_update(&ntype, node_group_update);
- node_type_gpu(&ntype, gpu_group_execute);
+ ntype.group_update_func = node_group_update;
+ ntype.gpu_fn = gpu_group_execute;
nodeRegisterType(&ntype);
}
@@ -109,5 +109,5 @@ void register_node_type_sh_custom_group(bNodeType *ntype)
ntype->insert_link = node_insert_link_default;
}
- node_type_gpu(ntype, gpu_group_execute);
+ ntype->gpu_fn = gpu_group_execute;
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc
index c4dbc3ce6f1..0945c39ee50 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc
@@ -116,10 +116,10 @@ void register_node_type_sh_curve_vec()
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::sh_node_curve_vec_declare;
- node_type_init(&ntype, file_ns::node_shader_init_curve_vec);
+ ntype.initfunc = file_ns::node_shader_init_curve_vec;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_gpu(&ntype, file_ns::gpu_shader_curve_vec);
+ ntype.gpu_fn = file_ns::gpu_shader_curve_vec;
ntype.build_multi_function = file_ns::sh_node_curve_vec_build_multi_function;
nodeRegisterType(&ntype);
@@ -263,10 +263,10 @@ void register_node_type_sh_curve_rgb()
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::sh_node_curve_rgb_declare;
- node_type_init(&ntype, file_ns::node_shader_init_curve_rgb);
+ ntype.initfunc = file_ns::node_shader_init_curve_rgb;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_gpu(&ntype, file_ns::gpu_shader_curve_rgb);
+ ntype.gpu_fn = file_ns::gpu_shader_curve_rgb;
ntype.build_multi_function = file_ns::sh_node_curve_rgb_build_multi_function;
nodeRegisterType(&ntype);
@@ -383,10 +383,10 @@ void register_node_type_sh_curve_float()
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_curve_float_declare;
- node_type_init(&ntype, file_ns::node_shader_init_curve_float);
+ ntype.initfunc = file_ns::node_shader_init_curve_float;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_gpu(&ntype, file_ns::gpu_shader_curve_float);
+ ntype.gpu_fn = file_ns::gpu_shader_curve_float;
ntype.build_multi_function = file_ns::sh_node_curve_float_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_displacement.cc
index fd5a6107447..e71e2168701 100644
--- a/source/blender/nodes/shader/nodes/node_shader_displacement.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_displacement.cc
@@ -54,8 +54,8 @@ void register_node_type_sh_displacement()
sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_shader_init_displacement);
- node_type_gpu(&ntype, file_ns::gpu_shader_displacement);
+ ntype.initfunc = file_ns::node_shader_init_displacement;
+ ntype.gpu_fn = file_ns::gpu_shader_displacement;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
index 5a058eec690..c13300bdac4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc
@@ -80,7 +80,7 @@ void register_node_type_sh_eevee_specular()
sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_eevee_specular);
+ ntype.gpu_fn = file_ns::node_shader_gpu_eevee_specular;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc
index 69c6094e92e..df6283f92dc 100644
--- a/source/blender/nodes/shader/nodes/node_shader_emission.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc
@@ -34,7 +34,7 @@ void register_node_type_sh_emission()
sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_emission);
+ ntype.gpu_fn = file_ns::node_shader_gpu_emission;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
index abbfc5ad1d5..1e35942476a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc
@@ -36,7 +36,7 @@ void register_node_type_sh_fresnel()
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel);
+ ntype.gpu_fn = file_ns::node_shader_gpu_fresnel;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.cc b/source/blender/nodes/shader/nodes/node_shader_gamma.cc
index 80419ed732c..327d9b134cd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_gamma()
sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_gamma);
+ ntype.gpu_fn = file_ns::node_shader_gpu_gamma;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.cc b/source/blender/nodes/shader/nodes/node_shader_geometry.cc
index e27b5290513..d7d5f4aa91f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geometry.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_geometry.cc
@@ -68,7 +68,7 @@ void register_node_type_sh_geometry()
sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_geometry);
+ ntype.gpu_fn = file_ns::node_shader_gpu_geometry;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
index 2ae87f7bc51..4511c8a9ae6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
@@ -39,7 +39,7 @@ void register_node_type_sh_hair_info()
sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Curves Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info);
+ ntype.gpu_fn = file_ns::node_shader_gpu_hair_info;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.cc b/source/blender/nodes/shader/nodes/node_shader_holdout.cc
index ee754a7afa8..f3f8cef5a2d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_holdout.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_holdout.cc
@@ -31,7 +31,7 @@ void register_node_type_sh_holdout()
sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_rgb);
+ ntype.gpu_fn = file_ns::gpu_shader_rgb;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
index 3e057d3d230..7eb02a3bce2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc
@@ -39,7 +39,7 @@ void register_node_type_sh_hue_sat()
sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat);
+ ntype.gpu_fn = file_ns::gpu_shader_hue_sat;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
index 65655ba2781..dee69eaf391 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc
@@ -50,7 +50,7 @@ void register_node_type_sh_tex_ies()
sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_ies;
- node_type_init(&ntype, file_ns::node_shader_init_tex_ies);
+ ntype.initfunc = file_ns::node_shader_init_tex_ies;
node_type_storage(
&ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc
index adcb0508093..ba2774e3b8f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_invert()
sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_invert);
+ ntype.gpu_fn = file_ns::gpu_shader_invert;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
index 5a56ee8bc75..f589f85fc89 100644
--- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc
@@ -37,7 +37,7 @@ void register_node_type_sh_layer_weight()
sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight);
+ ntype.gpu_fn = file_ns::node_shader_gpu_layer_weight;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
index 1ee096c052f..fcaf1b31e77 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_light_falloff()
sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_light_falloff);
+ ntype.gpu_fn = file_ns::node_shader_gpu_light_falloff;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc
index 268a80af0ab..b04b2a2f022 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc
@@ -42,7 +42,7 @@ void register_node_type_sh_light_path()
sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path);
+ ntype.gpu_fn = file_ns::node_shader_gpu_light_path;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
index e0c1778f764..a906ee40b42 100644
--- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
@@ -502,11 +502,11 @@ void register_node_type_sh_map_range()
ntype.declare = file_ns::sh_node_map_range_declare;
ntype.draw_buttons = file_ns::node_shader_buts_map_range;
ntype.ui_class = file_ns::node_shader_map_range_ui_class;
- node_type_init(&ntype, file_ns::node_shader_init_map_range);
+ ntype.initfunc = file_ns::node_shader_init_map_range;
node_type_storage(
&ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage);
- node_type_update(&ntype, file_ns::node_shader_update_map_range);
- node_type_gpu(&ntype, file_ns::gpu_shader_map_range);
+ ntype.updatefunc = file_ns::node_shader_update_map_range;
+ ntype.gpu_fn = file_ns::gpu_shader_map_range;
ntype.build_multi_function = file_ns::sh_node_map_range_build_multi_function;
ntype.gather_link_search_ops = file_ns::node_map_range_gather_link_searches;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc
index 89cd5af045b..f9cac93544f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc
@@ -87,8 +87,8 @@ void register_node_type_sh_mapping()
sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_mapping;
- node_type_gpu(&ntype, file_ns::gpu_shader_mapping);
- node_type_update(&ntype, file_ns::node_shader_update_mapping);
+ ntype.gpu_fn = file_ns::gpu_shader_mapping;
+ ntype.updatefunc = file_ns::node_shader_update_mapping;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index 3f25da4652d..5fe1bb48cc2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -190,8 +190,8 @@ void register_node_type_sh_math()
sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_math_declare;
ntype.labelfunc = node_math_label;
- node_type_gpu(&ntype, file_ns::gpu_shader_math);
- node_type_update(&ntype, node_math_update);
+ ntype.gpu_fn = file_ns::gpu_shader_math;
+ ntype.updatefunc = node_math_update;
ntype.build_multi_function = file_ns::sh_node_math_build_multi_function;
ntype.gather_link_search_ops = file_ns::sh_node_math_gather_link_searches;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix.cc b/source/blender/nodes/shader/nodes/node_shader_mix.cc
index 878648105d1..bc928ddb49a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix.cc
@@ -456,9 +456,9 @@ void register_node_type_sh_mix()
sh_fn_node_type_base(&ntype, SH_NODE_MIX, "Mix", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_mix_declare;
ntype.ui_class = file_ns::sh_node_mix_ui_class;
- node_type_gpu(&ntype, file_ns::gpu_shader_mix);
- node_type_update(&ntype, file_ns::sh_node_mix_update);
- node_type_init(&ntype, file_ns::node_mix_init);
+ ntype.gpu_fn = file_ns::gpu_shader_mix;
+ ntype.updatefunc = file_ns::sh_node_mix_update;
+ ntype.initfunc = file_ns::node_mix_init;
node_type_storage(
&ntype, "NodeShaderMix", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::sh_node_mix_build_multi_function;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
index d1578b48c79..98771098f81 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
@@ -153,7 +153,7 @@ void register_node_type_sh_mix_rgb()
sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB_LEGACY, "Mix (Legacy)", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::sh_node_mix_rgb_declare;
ntype.labelfunc = node_blend_label;
- node_type_gpu(&ntype, file_ns::gpu_shader_mix_rgb);
+ ntype.gpu_fn = file_ns::gpu_shader_mix_rgb;
ntype.build_multi_function = file_ns::sh_node_mix_rgb_build_multi_function;
ntype.gather_link_search_ops = nullptr;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
index 27e41406b48..135e3582483 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc
@@ -33,7 +33,7 @@ void register_node_type_sh_mix_shader()
sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_mix_shader);
+ ntype.gpu_fn = file_ns::node_shader_gpu_mix_shader;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc
index 49c075ac27e..c36744524f4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc
@@ -44,7 +44,7 @@ void register_node_type_sh_normal()
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_normal);
+ ntype.gpu_fn = file_ns::gpu_shader_normal;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
index 99cb5f6f525..4338cfd9457 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc
@@ -118,10 +118,10 @@ void register_node_type_sh_normal_map()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_normal_map;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_normal_map);
+ ntype.initfunc = file_ns::node_shader_init_normal_map;
node_type_storage(
&ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::gpu_shader_normal_map);
+ ntype.gpu_fn = file_ns::gpu_shader_normal_map;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.cc b/source/blender/nodes/shader/nodes/node_shader_object_info.cc
index 210f855b9e0..daa40d8dc63 100644
--- a/source/blender/nodes/shader/nodes/node_shader_object_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_object_info.cc
@@ -37,7 +37,7 @@ void register_node_type_sh_object_info()
sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_object_info);
+ ntype.gpu_fn = file_ns::node_shader_gpu_object_info;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
index cc95db9d333..b668b5313ba 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc
@@ -60,10 +60,10 @@ void register_node_type_sh_output_aov()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_output_aov;
- node_type_init(&ntype, file_ns::node_shader_init_output_aov);
+ ntype.initfunc = file_ns::node_shader_init_output_aov;
node_type_storage(
&ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_output_aov);
+ ntype.gpu_fn = file_ns::node_shader_gpu_output_aov;
ntype.no_muting = true;
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
index 6e4483dbbe9..848e6c92e17 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
@@ -37,7 +37,7 @@ void register_node_type_sh_output_light()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_output_light);
+ ntype.gpu_fn = file_ns::node_shader_gpu_output_light;
ntype.no_muting = true;
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc
index 857c5eb68df..ff2628a891b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc
@@ -53,7 +53,7 @@ void register_node_type_sh_output_material()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_output_material);
+ ntype.gpu_fn = file_ns::node_shader_gpu_output_material;
ntype.no_muting = true;
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.cc b/source/blender/nodes/shader/nodes/node_shader_output_world.cc
index f450e667cd9..2d75faa9e80 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc
@@ -40,7 +40,7 @@ void register_node_type_sh_output_world()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_output_world);
+ ntype.gpu_fn = file_ns::node_shader_gpu_output_world;
ntype.no_muting = true;
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
index 76a91ab60aa..c86bb5866dd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
@@ -44,7 +44,7 @@ void register_node_type_sh_particle_info()
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_particle_info);
+ ntype.gpu_fn = file_ns::gpu_shader_particle_info;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_point_info.cc b/source/blender/nodes/shader/nodes/node_shader_point_info.cc
index 05b649490e4..fffa3abad03 100644
--- a/source/blender/nodes/shader/nodes/node_shader_point_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_point_info.cc
@@ -32,7 +32,7 @@ void register_node_type_sh_point_info()
sh_node_type_base(&ntype, SH_NODE_POINT_INFO, "Point Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_point_info);
+ ntype.gpu_fn = file_ns::node_shader_gpu_point_info;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_rgb.cc
index 1adbbbc48bc..d70df4a8e25 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb.cc
@@ -35,7 +35,7 @@ void register_node_type_sh_rgb()
sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_rgb);
+ ntype.gpu_fn = file_ns::gpu_shader_rgb;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
index 1db3342733b..1e663d1b86f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
@@ -36,7 +36,7 @@ void register_node_type_sh_rgbtobw()
sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_rgbtobw_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_rgbtobw);
+ ntype.gpu_fn = file_ns::gpu_shader_rgbtobw;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc
index 8534ce129b4..213de85cb15 100644
--- a/source/blender/nodes/shader/nodes/node_shader_script.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_script.cc
@@ -86,7 +86,7 @@ void register_node_type_sh_script()
sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT);
ntype.draw_buttons = file_ns::node_shader_buts_script;
ntype.draw_buttons_ex = file_ns::node_shader_buts_script_ex;
- node_type_init(&ntype, file_ns::init);
+ ntype.initfunc = file_ns::init;
node_type_storage(
&ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script);
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc
index 77ce6f5e4e4..94e5f19b840 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc
@@ -76,11 +76,11 @@ void register_node_type_sh_sepcolor()
sh_node_type_base(&ntype, SH_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_sepcolor_declare;
- node_type_update(&ntype, file_ns::node_sepcolor_update);
- node_type_init(&ntype, node_combsep_color_init);
+ ntype.updatefunc = file_ns::node_sepcolor_update;
+ ntype.initfunc = node_combsep_color_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::gpu_shader_sepcolor);
+ ntype.gpu_fn = file_ns::gpu_shader_sepcolor;
nodeRegisterType(&ntype);
}
@@ -152,11 +152,11 @@ void register_node_type_sh_combcolor()
sh_node_type_base(&ntype, SH_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_combcolor_declare;
- node_type_update(&ntype, file_ns::node_combcolor_update);
- node_type_init(&ntype, node_combsep_color_init);
+ ntype.updatefunc = file_ns::node_combcolor_update;
+ ntype.initfunc = node_combsep_color_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::gpu_shader_combcolor);
+ ntype.gpu_fn = file_ns::gpu_shader_combcolor;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
index b297ead1847..66ff5f82944 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
@@ -38,7 +38,7 @@ void register_node_type_sh_sephsv()
sh_node_type_base(&ntype, SH_NODE_SEPHSV_LEGACY, "Separate HSV (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare_sephsv;
- node_type_gpu(&ntype, file_ns::gpu_shader_sephsv);
+ ntype.gpu_fn = file_ns::gpu_shader_sephsv;
ntype.gather_link_search_ops = nullptr;
nodeRegisterType(&ntype);
@@ -75,7 +75,7 @@ void register_node_type_sh_combhsv()
sh_node_type_base(&ntype, SH_NODE_COMBHSV_LEGACY, "Combine HSV (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare_combhsv;
- node_type_gpu(&ntype, file_ns::gpu_shader_combhsv);
+ ntype.gpu_fn = file_ns::gpu_shader_combhsv;
ntype.gather_link_search_ops = nullptr;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
index c298998cad5..28c4eef823f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
@@ -79,7 +79,7 @@ void register_node_type_sh_seprgb()
sh_fn_node_type_base(
&ntype, SH_NODE_SEPRGB_LEGACY, "Separate RGB (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_seprgb_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_seprgb);
+ ntype.gpu_fn = file_ns::gpu_shader_seprgb;
ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function;
ntype.gather_link_search_ops = nullptr;
@@ -124,7 +124,7 @@ void register_node_type_sh_combrgb()
sh_fn_node_type_base(
&ntype, SH_NODE_COMBRGB_LEGACY, "Combine RGB (Legacy)", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_combrgb_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_combrgb);
+ ntype.gpu_fn = file_ns::gpu_shader_combrgb;
ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function;
ntype.gather_link_search_ops = nullptr;
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
index 8849824ec0b..131ae16ef1b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
@@ -97,7 +97,7 @@ void register_node_type_sh_sepxyz()
sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_sepxyz_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_sepxyz);
+ ntype.gpu_fn = file_ns::gpu_shader_sepxyz;
ntype.build_multi_function = file_ns::sh_node_sepxyz_build_multi_function;
nodeRegisterType(&ntype);
@@ -142,7 +142,7 @@ void register_node_type_sh_combxyz()
sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_combxyz_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_combxyz);
+ ntype.gpu_fn = file_ns::gpu_shader_combxyz;
ntype.build_multi_function = file_ns::sh_node_combxyz_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
index 7345e374937..38ae1f979a8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc
@@ -34,7 +34,7 @@ void register_node_type_sh_shadertorgb()
sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_shadertorgb);
+ ntype.gpu_fn = file_ns::node_shader_gpu_shadertorgb;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
index 62e21088791..31965c5e13e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc
@@ -36,7 +36,7 @@ void register_node_type_sh_squeeze()
sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_squeeze);
+ ntype.gpu_fn = file_ns::gpu_shader_squeeze;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
index 29d42b20a80..bcf859251e3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
@@ -87,9 +87,9 @@ void register_node_type_sh_subsurface_scattering()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_subsurface;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering);
- node_type_update(&ntype, file_ns::node_shader_update_subsurface_scattering);
+ ntype.initfunc = file_ns::node_shader_init_subsurface_scattering;
+ ntype.gpu_fn = file_ns::node_shader_gpu_subsurface_scattering;
+ ntype.updatefunc = file_ns::node_shader_update_subsurface_scattering;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc
index c2116c9c0ff..9b09eb09bba 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc
@@ -89,8 +89,8 @@ void register_node_type_sh_tangent()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tangent;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_tangent);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tangent);
+ ntype.initfunc = file_ns::node_shader_init_tangent;
+ ntype.gpu_fn = file_ns::node_shader_gpu_tangent;
node_type_storage(
&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
index f6bcedbd19e..aaae1369d79 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
@@ -283,10 +283,10 @@ void register_node_type_sh_tex_brick()
ntype.declare = file_ns::sh_node_tex_brick_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_brick;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_tex_brick);
+ ntype.initfunc = file_ns::node_shader_init_tex_brick;
node_type_storage(
&ntype, "NodeTexBrick", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_brick);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_brick;
ntype.build_multi_function = file_ns::sh_node_brick_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
index c48f79698bb..bef3eb990eb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
@@ -111,10 +111,10 @@ void register_node_type_sh_tex_checker()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_checker_declare;
- node_type_init(&ntype, file_ns::node_shader_init_tex_checker);
+ ntype.initfunc = file_ns::node_shader_init_tex_checker;
node_type_storage(
&ntype, "NodeTexChecker", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_checker);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_checker;
ntype.build_multi_function = file_ns::sh_node_tex_checker_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
index e2a40b79d53..a295bda9d07 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
@@ -38,7 +38,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
/* Use special matrix to let the shader branch to using the render object's matrix. */
float dummy_matrix[4][4];
dummy_matrix[3][3] = 0.0f;
- GPUNodeLink *inv_obmat = (ob != nullptr) ? GPU_uniform(&ob->imat[0][0]) :
+ GPUNodeLink *inv_obmat = (ob != nullptr) ? GPU_uniform(&ob->world_to_object[0][0]) :
GPU_uniform(&dummy_matrix[0][0]);
/* Optimization: don't request orco if not needed. */
@@ -82,7 +82,7 @@ void register_node_type_sh_tex_coord()
sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_coord;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_coord;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
index a145bce3f6f..60059a8f1c5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc
@@ -125,10 +125,10 @@ void register_node_type_sh_tex_environment()
sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_shader_init_tex_environment);
+ ntype.initfunc = file_ns::node_shader_init_tex_environment;
node_type_storage(
&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_environment);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_environment;
ntype.labelfunc = node_image_label;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
index 75c469fe665..f7bff442420 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
@@ -157,10 +157,10 @@ void register_node_type_sh_tex_gradient()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_gradient_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_gradient;
- node_type_init(&ntype, file_ns::node_shader_init_tex_gradient);
+ ntype.initfunc = file_ns::node_shader_init_tex_gradient;
node_type_storage(
&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_gradient);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_gradient;
ntype.build_multi_function = file_ns::sh_node_gradient_tex_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
index 80398871625..9f4f885fee1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
@@ -163,10 +163,10 @@ void register_node_type_sh_tex_image()
sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_image_declare;
- node_type_init(&ntype, file_ns::node_shader_init_tex_image);
+ ntype.initfunc = file_ns::node_shader_init_tex_image;
node_type_storage(
&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_image);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_image;
ntype.labelfunc = node_image_label;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
index b2ba0e52f02..f68f1747b21 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
@@ -177,10 +177,10 @@ void register_node_type_sh_tex_magic()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_magic_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_magic;
- node_type_init(&ntype, file_ns::node_shader_init_tex_magic);
+ ntype.initfunc = file_ns::node_shader_init_tex_magic;
node_type_storage(
&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_magic);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_magic;
ntype.build_multi_function = file_ns::sh_node_magic_tex_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
index 9a7573fc870..e79b12b78b9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
@@ -535,11 +535,11 @@ void register_node_type_sh_tex_musgrave()
ntype.declare = file_ns::sh_node_tex_musgrave_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_musgrave;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave);
+ ntype.initfunc = file_ns::node_shader_init_tex_musgrave;
node_type_storage(
&ntype, "NodeTexMusgrave", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_musgrave);
- node_type_update(&ntype, file_ns::node_shader_update_tex_musgrave);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_musgrave;
+ ntype.updatefunc = file_ns::node_shader_update_tex_musgrave;
ntype.build_multi_function = file_ns::sh_node_musgrave_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
index 684c122f7fe..d72e9c3c451 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
@@ -249,11 +249,11 @@ void register_node_type_sh_tex_noise()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_noise_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_noise;
- node_type_init(&ntype, file_ns::node_shader_init_tex_noise);
+ ntype.initfunc = file_ns::node_shader_init_tex_noise;
node_type_storage(
&ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_noise);
- node_type_update(&ntype, file_ns::node_shader_update_tex_noise);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_noise;
+ ntype.updatefunc = file_ns::node_shader_update_tex_noise;
ntype.build_multi_function = file_ns::sh_node_noise_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
index 0d10d5a5047..4005265e49a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc
@@ -103,7 +103,7 @@ void register_node_type_sh_tex_pointdensity()
sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_pointdensity;
- node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity);
+ ntype.initfunc = file_ns::node_shader_init_tex_pointdensity;
node_type_storage(&ntype,
"NodeShaderTexPointDensity",
file_ns::node_shader_free_tex_pointdensity,
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
index 44df6b2b1a1..faa0c0f0888 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc
@@ -308,11 +308,11 @@ void register_node_type_sh_tex_sky()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_sky;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_tex_sky);
+ ntype.initfunc = file_ns::node_shader_init_tex_sky;
node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_sky);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_sky;
/* Remove vector input for Nishita sky model. */
- node_type_update(&ntype, file_ns::node_shader_update_sky);
+ ntype.updatefunc = file_ns::node_shader_update_sky;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
index 0ef73f0c5ef..f07ef1b6c60 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
@@ -1347,11 +1347,11 @@ void register_node_type_sh_tex_voronoi()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_voronoi_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_voronoi;
- node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi);
+ ntype.initfunc = file_ns::node_shader_init_tex_voronoi;
node_type_storage(
&ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_voronoi);
- node_type_update(&ntype, file_ns::node_shader_update_tex_voronoi);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_voronoi;
+ ntype.updatefunc = file_ns::node_shader_update_tex_voronoi;
ntype.build_multi_function = file_ns::sh_node_voronoi_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
index 91dbc149f78..f4effe28815 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
@@ -224,9 +224,9 @@ void register_node_type_sh_tex_wave()
ntype.declare = file_ns::sh_node_tex_wave_declare;
ntype.draw_buttons = file_ns::node_shader_buts_tex_wave;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_tex_wave);
+ ntype.initfunc = file_ns::node_shader_init_tex_wave;
node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_wave);
+ ntype.gpu_fn = file_ns::node_shader_gpu_tex_wave;
ntype.build_multi_function = file_ns::sh_node_wave_tex_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
index 9a026567682..58787a9afa3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
@@ -194,9 +194,9 @@ void register_node_type_sh_tex_white_noise()
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE);
ntype.declare = file_ns::sh_node_tex_white_noise_declare;
ntype.draw_buttons = file_ns::node_shader_buts_white_noise;
- node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise);
- node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise);
- node_type_update(&ntype, file_ns::node_shader_update_tex_white_noise);
+ ntype.initfunc = file_ns::node_shader_init_tex_white_noise;
+ ntype.gpu_fn = file_ns::gpu_shader_tex_white_noise;
+ ntype.updatefunc = file_ns::node_shader_update_tex_white_noise;
ntype.build_multi_function = file_ns::sh_node_noise_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
index e9d2b32bfd7..483e06f1192 100644
--- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc
@@ -70,10 +70,10 @@ void register_node_type_sh_uvmap()
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_uvmap;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, file_ns::node_shader_init_uvmap);
+ ntype.initfunc = file_ns::node_shader_init_uvmap;
node_type_storage(
&ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_uvmap);
+ ntype.gpu_fn = file_ns::node_shader_gpu_uvmap;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc
index 0cd1a1f05f8..c190438c417 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_value.cc
@@ -42,7 +42,7 @@ void register_node_type_sh_value()
sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT);
ntype.declare = file_ns::sh_node_value_declare;
- node_type_gpu(&ntype, file_ns::gpu_shader_value);
+ ntype.gpu_fn = file_ns::gpu_shader_value;
ntype.build_multi_function = file_ns::sh_node_value_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc
index 64484f83320..c9e4f9c8e14 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc
@@ -52,8 +52,8 @@ void register_node_type_sh_vector_displacement()
sh_node_type_base(
&ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
- node_type_init(&ntype, file_ns::node_shader_init_vector_displacement);
- node_type_gpu(&ntype, file_ns::gpu_shader_vector_displacement);
+ ntype.initfunc = file_ns::node_shader_init_vector_displacement;
+ ntype.gpu_fn = file_ns::gpu_shader_vector_displacement;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
index 42b84617996..f7cf70aa8e1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
@@ -322,8 +322,8 @@ void register_node_type_sh_vect_math()
ntype.declare = file_ns::sh_node_vector_math_declare;
ntype.draw_buttons = file_ns::node_shader_buts_vect_math;
ntype.labelfunc = node_vector_math_label;
- node_type_gpu(&ntype, file_ns::gpu_shader_vector_math);
- node_type_update(&ntype, file_ns::node_shader_update_vector_math);
+ ntype.gpu_fn = file_ns::gpu_shader_vector_math;
+ ntype.updatefunc = file_ns::node_shader_update_vector_math;
ntype.build_multi_function = file_ns::sh_node_vector_math_build_multi_function;
ntype.gather_link_search_ops = file_ns::sh_node_vector_math_gather_link_searches;
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
index 218ed0e54c9..bdf7360873d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
@@ -212,8 +212,8 @@ void register_node_type_sh_vector_rotate()
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::sh_node_vector_rotate_declare;
ntype.draw_buttons = file_ns::node_shader_buts_vector_rotate;
- node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate);
- node_type_update(&ntype, file_ns::node_shader_update_vector_rotate);
+ ntype.gpu_fn = file_ns::gpu_shader_vector_rotate;
+ ntype.updatefunc = file_ns::node_shader_update_vector_rotate;
ntype.build_multi_function = file_ns::sh_node_vector_rotate_build_multi_function;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
index 9037c6208fb..03fb954f088 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc
@@ -144,10 +144,10 @@ void register_node_type_sh_vect_transform()
sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_vect_transform;
- node_type_init(&ntype, file_ns::node_shader_init_vect_transform);
+ ntype.initfunc = file_ns::node_shader_init_vect_transform;
node_type_storage(
&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform);
+ ntype.gpu_fn = file_ns::gpu_shader_vect_transform;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
index 6e2325bddf9..8f7e30b99df 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc
@@ -69,10 +69,10 @@ void register_node_type_sh_vertex_color()
sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Color Attribute", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_vertex_color;
- node_type_init(&ntype, file_ns::node_shader_init_vertex_color);
+ ntype.initfunc = file_ns::node_shader_init_vertex_color;
node_type_storage(
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_vertex_color);
+ ntype.gpu_fn = file_ns::node_shader_gpu_vertex_color;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
index d6a29f537ff..e50331585e3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc
@@ -33,7 +33,7 @@ void register_node_type_sh_volume_absorption()
sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption);
+ ntype.gpu_fn = file_ns::node_shader_gpu_volume_absorption;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc
index 9f1feedc336..6a1bc070f68 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc
@@ -49,7 +49,7 @@ void register_node_type_sh_volume_info()
sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_info);
+ ntype.gpu_fn = file_ns::node_shader_gpu_volume_info;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
index 2c5811045f0..4ff57042fe4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
@@ -142,8 +142,8 @@ void register_node_type_sh_volume_principled()
sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, file_ns::node_shader_init_volume_principled);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_principled);
+ ntype.initfunc = file_ns::node_shader_init_volume_principled;
+ ntype.gpu_fn = file_ns::node_shader_gpu_volume_principled;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc
index 1322a73ac37..b87792eef2e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc
@@ -38,7 +38,7 @@ void register_node_type_sh_volume_scatter()
sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER);
ntype.declare = file_ns::node_declare;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_scatter);
+ ntype.gpu_fn = file_ns::node_shader_gpu_volume_scatter;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc
index 43bb4798e3f..6fa495c3ead 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc
@@ -41,7 +41,7 @@ void register_node_type_sh_wavelength()
sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::node_declare;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_gpu(&ntype, file_ns::node_shader_gpu_wavelength);
+ ntype.gpu_fn = file_ns::node_shader_gpu_wavelength;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
index ddabebfeec2..b125e7221a6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc
@@ -47,7 +47,7 @@ void register_node_type_sh_wireframe()
sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
- node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe);
+ ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 81d0b0fbc84..99146f1a25c 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -308,7 +308,8 @@ void ntreeTexEndExecTree(bNodeTreeExec *exec)
bNodeTree *ntree = exec->nodetree;
ntreeTexEndExecTree_internal(exec);
- /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
+ /* XXX: clear node-tree back-pointer to exec data,
+ * same problem as noted in #ntreeBeginExecTree. */
ntree->execdata = NULL;
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_at.c b/source/blender/nodes/texture/nodes/node_texture_at.c
index 74f279d65c7..e2e635b7d92 100644
--- a/source/blender/nodes/texture/nodes/node_texture_at.c
+++ b/source/blender/nodes/texture/nodes/node_texture_at.c
@@ -45,7 +45,7 @@ void register_node_type_tex_at(void)
tex_node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 140, 100, 320);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index bfd43560c2d..b68bf4fcb8d 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -106,8 +106,8 @@ void register_node_type_tex_bricks(void)
tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, init);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.initfunc = init;
+ ntype.exec_fn = exec;
ntype.flag |= NODE_PREVIEW;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index 08f87cb7875..d66eb7e6953 100644
--- a/source/blender/nodes/texture/nodes/node_texture_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -56,7 +56,7 @@ void register_node_type_tex_checker(void)
tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
ntype.flag |= NODE_PREVIEW;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/texture/nodes/node_texture_combine_color.c b/source/blender/nodes/texture/nodes/node_texture_combine_color.c
index 459553bc950..e6a8080bb48 100644
--- a/source/blender/nodes/texture/nodes/node_texture_combine_color.c
+++ b/source/blender/nodes/texture/nodes/node_texture_combine_color.c
@@ -69,8 +69,8 @@ void register_node_type_tex_combine_color(void)
tex_node_type_base(&ntype, TEX_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
- node_type_update(&ntype, update);
+ ntype.exec_fn = exec;
+ ntype.updatefunc = update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index 96345b00a82..8ff4ad61387 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -155,8 +155,10 @@ void register_node_type_tex_group(void)
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- node_type_group_update(&ntype, node_group_update);
- node_type_exec(&ntype, group_initexec, group_freeexec, group_execute);
+ ntype.group_update_func = node_group_update;
+ ntype.init_exec_fn = group_initexec;
+ ntype.free_exec_fn = group_freeexec;
+ ntype.exec_fn = group_execute;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index e36bc248ed1..d41566be74c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -45,7 +45,7 @@ void register_node_type_tex_compose(void)
tex_node_type_base(
&ntype, TEX_NODE_COMPOSE_LEGACY, "Combine RGBA (Legacy)", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.c b/source/blender/nodes/texture/nodes/node_texture_coord.c
index e74dfd378d9..1babea310f4 100644
--- a/source/blender/nodes/texture/nodes/node_texture_coord.c
+++ b/source/blender/nodes/texture/nodes/node_texture_coord.c
@@ -35,7 +35,7 @@ void register_node_type_tex_coord(void)
tex_node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, NULL, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index dee4531746f..df75847dbe3 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -52,9 +52,10 @@ void register_node_type_tex_curve_time(void)
tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, NULL, time_outputs);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, time_init);
+ ntype.initfunc = time_init;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_exec(&ntype, node_initexec_curves, NULL, time_exec);
+ ntype.init_exec_fn = node_initexec_curves;
+ ntype.exec_fn = time_exec;
nodeRegisterType(&ntype);
}
@@ -101,9 +102,11 @@ void register_node_type_tex_curve_rgb(void)
tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, rgb_init);
+ ntype.initfunc = rgb_init;
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_exec(&ntype, node_initexec_curves, NULL, rgb_exec);
+ ntype.init_exec_fn = node_initexec_curves ;
+ ntype.exec_fn =rgb_exec ;
+
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index 2d42fa4602e..ae7e80a6aab 100644
--- a/source/blender/nodes/texture/nodes/node_texture_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -64,7 +64,7 @@ void register_node_type_tex_decompose(void)
tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE_LEGACY, "Separate RGBA", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.c b/source/blender/nodes/texture/nodes/node_texture_distance.c
index e236b6743a6..19918a9896e 100644
--- a/source/blender/nodes/texture/nodes/node_texture_distance.c
+++ b/source/blender/nodes/texture/nodes/node_texture_distance.c
@@ -46,7 +46,7 @@ void register_node_type_tex_distance(void)
tex_node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 989d94953f7..454b58f4665 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -94,7 +94,7 @@ void register_node_type_tex_hue_sat(void)
tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index e94c78b41ea..8b859421762 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -94,9 +94,9 @@ void register_node_type_tex_image(void)
tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, NULL, outputs);
- node_type_init(&ntype, init);
+ ntype.initfunc = init;
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
ntype.labelfunc = node_image_label;
ntype.flag |= NODE_PREVIEW;
diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c
index 6343f5f2caa..526d47bef9c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_invert.c
+++ b/source/blender/nodes/texture/nodes/node_texture_invert.c
@@ -49,7 +49,7 @@ void register_node_type_tex_invert(void)
tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 5867d6b91e1..505ba51b4d8 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -322,8 +322,8 @@ void register_node_type_tex_math(void)
tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, inputs, outputs);
ntype.labelfunc = node_math_label;
- node_type_exec(&ntype, NULL, NULL, exec);
- node_type_update(&ntype, node_math_update);
+ ntype.exec_fn = exec;
+ ntype.updatefunc = node_math_update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index cd6b54c4cf8..15ca2280fe1 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -56,7 +56,7 @@ void register_node_type_tex_mix_rgb(void)
tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
ntype.labelfunc = node_blend_label;
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index b300ba9ef77..37e39dae22c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -138,9 +138,9 @@ void register_node_type_tex_output(void)
tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT);
node_type_socket_templates(&ntype, inputs, NULL);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
- node_type_init(&ntype, init);
+ ntype.initfunc = init;
node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
ntype.flag |= NODE_PREVIEW;
ntype.no_muting = true;
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index d925c9f3554..f23c4f55820 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -254,9 +254,9 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node)
tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, Name, NODE_CLASS_TEXTURE); \
node_type_socket_templates(&ntype, name##_inputs, outputs); \
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); \
- node_type_init(&ntype, init); \
+ ntype.initfunc = init; \
node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \
- node_type_exec(&ntype, NULL, NULL, name##_exec); \
+ ntype.exec_fn = name##_exec; \
ntype.flag |= NODE_PREVIEW; \
\
nodeRegisterType(&ntype); \
diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.c b/source/blender/nodes/texture/nodes/node_texture_rotate.c
index 0bd2de76a9c..b31adefcbba 100644
--- a/source/blender/nodes/texture/nodes/node_texture_rotate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_rotate.c
@@ -81,7 +81,7 @@ void register_node_type_tex_rotate(void)
tex_node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.c b/source/blender/nodes/texture/nodes/node_texture_scale.c
index d565146cf09..93a4db7677c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_scale.c
+++ b/source/blender/nodes/texture/nodes/node_texture_scale.c
@@ -54,7 +54,7 @@ void register_node_type_tex_scale(void)
tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_separate_color.c b/source/blender/nodes/texture/nodes/node_texture_separate_color.c
index a482a3f3421..030f7d79043 100644
--- a/source/blender/nodes/texture/nodes/node_texture_separate_color.c
+++ b/source/blender/nodes/texture/nodes/node_texture_separate_color.c
@@ -95,8 +95,8 @@ void register_node_type_tex_separate_color(void)
tex_node_type_base(&ntype, TEX_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
- node_type_update(&ntype, update);
+ ntype.exec_fn = exec;
+ ntype.updatefunc = update;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 79cd8bbb1df..163a6516a58 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -78,7 +78,7 @@ void register_node_type_tex_texture(void)
tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
ntype.flag |= NODE_PREVIEW;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.c b/source/blender/nodes/texture/nodes/node_texture_translate.c
index 7ce7722938d..a8c12116097 100644
--- a/source/blender/nodes/texture/nodes/node_texture_translate.c
+++ b/source/blender/nodes/texture/nodes/node_texture_translate.c
@@ -50,7 +50,7 @@ void register_node_type_tex_translate(void)
tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.c b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
index 492aadf3281..d0fc5229e06 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToNor.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.c
@@ -66,7 +66,7 @@ void register_node_type_tex_valtonor(void)
tex_node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index e41e83555fc..b2acef407e2 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -50,9 +50,9 @@ void register_node_type_tex_valtorgb(void)
tex_node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
- node_type_init(&ntype, valtorgb_init);
+ ntype.initfunc = valtorgb_init;
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
- node_type_exec(&ntype, NULL, NULL, valtorgb_exec);
+ ntype.exec_fn = valtorgb_exec;
nodeRegisterType(&ntype);
}
@@ -91,7 +91,7 @@ void register_node_type_tex_rgbtobw(void)
tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out);
- node_type_exec(&ntype, NULL, NULL, rgbtobw_exec);
+ ntype.exec_fn = rgbtobw_exec;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index 72da751f8ef..1f31d62ed38 100644
--- a/source/blender/nodes/texture/nodes/node_texture_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -38,7 +38,7 @@ void register_node_type_tex_viewer(void)
tex_node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT);
node_type_socket_templates(&ntype, inputs, NULL);
- node_type_exec(&ntype, NULL, NULL, exec);
+ ntype.exec_fn = exec;
ntype.no_muting = true;
ntype.flag |= NODE_PREVIEW;
diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c
index 51366d199b0..c6e964405fa 100644
--- a/source/blender/python/gpu/gpu_py_platform.c
+++ b/source/blender/python/gpu/gpu_py_platform.c
@@ -89,11 +89,13 @@ PyDoc_STRVAR(pygpu_platform_backend_type_get_doc,
"\n"
" Get actuve GPU backend.\n"
"\n"
- " :return: Backend type ('OPENGL', 'METAL', 'NONE', 'UNKNOWN').\n"
+ " :return: Backend type ('OPENGL', 'VULKAN', 'METAL', 'NONE', 'UNKNOWN').\n"
" :rtype: str\n");
static PyObject *pygpu_platform_backend_type_get(PyObject *UNUSED(self))
{
switch (GPU_backend_get_type()) {
+ case GPU_BACKEND_VULKAN:
+ return PyUnicode_FromString("VULKAN");
case GPU_BACKEND_METAL:
return PyUnicode_FromString("METAL");
case GPU_BACKEND_NONE:
diff --git a/source/blender/python/intern/bpy_gizmo_wrap.h b/source/blender/python/intern/bpy_gizmo_wrap.h
index 6a876747e22..7d5edebed0f 100644
--- a/source/blender/python/intern/bpy_gizmo_wrap.h
+++ b/source/blender/python/intern/bpy_gizmo_wrap.h
@@ -13,7 +13,7 @@ struct wmGizmoType;
extern "C" {
#endif
-/* exposed to rna/wm api */
+/* Exposed to RNA/WM API. */
void BPY_RNA_gizmo_wrapper(struct wmGizmoType *gzt, void *userdata);
void BPY_RNA_gizmogroup_wrapper(struct wmGizmoGroupType *gzgt, void *userdata);
diff --git a/source/blender/python/intern/bpy_operator_wrap.h b/source/blender/python/intern/bpy_operator_wrap.h
index de3779332da..4b8ceba5f0c 100644
--- a/source/blender/python/intern/bpy_operator_wrap.h
+++ b/source/blender/python/intern/bpy_operator_wrap.h
@@ -12,10 +12,11 @@ struct wmOperatorType;
extern "C" {
#endif
-/* these are used for operator methods, used by bpy_operator.c */
+/** These are used for operator methods, used by `bpy_operator.c`. */
PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args);
-/* exposed to rna/wm api */
+/* Exposed to RNA/WM API. */
+
/**
* Generic function used by all Python defined operators
* it's passed as an argument to #WM_operatortype_append_ptr in for operator registration.
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 0eaa5d6b6c7..02f7e16e805 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -380,10 +380,10 @@ static short pyrna_rotation_euler_order_get(PointerRNA *ptr,
const short order_fallback,
PropertyRNA **r_prop_eul_order);
-/* bpyrna vector/euler/quat callbacks. */
+/* `bpyrna` vector/euler/quaternion callbacks. */
static uchar mathutils_rna_array_cb_index = -1; /* Index for our callbacks. */
-/* Subtype not used much yet. */
+/* Sub-type not used much yet. */
# define MATHUTILS_CB_SUBTYPE_EUL 0
# define MATHUTILS_CB_SUBTYPE_VEC 1
# define MATHUTILS_CB_SUBTYPE_QUAT 2
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 3a3297f27f7..3c564142160 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -40,7 +40,7 @@
*
* Any feedback is very welcome.
* http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
- * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space). */
+ * email: `m-mat @ math.sci.hiroshima-u.ac.jp` (remove space). */
/* Period parameters */
#define N 624
@@ -120,7 +120,7 @@ static void setRndSeed(int seed)
}
}
-/* float number in range [0, 1) using the mersenne twister rng */
+/* Float number in range [0, 1) using the mersenne twister random number generator. */
static float frand(void)
{
ulong y;
diff --git a/source/blender/render/RE_multires_bake.h b/source/blender/render/RE_multires_bake.h
index a478f124892..70ce46bc195 100644
--- a/source/blender/render/RE_multires_bake.h
+++ b/source/blender/render/RE_multires_bake.h
@@ -43,8 +43,8 @@ typedef struct MultiresBakeRender {
float user_scale; /* User scale used to scale displacement when baking derivative map. */
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
} MultiresBakeRender;
diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h
index e9a90096dab..d12162c0b9a 100644
--- a/source/blender/render/RE_pipeline.h
+++ b/source/blender/render/RE_pipeline.h
@@ -398,7 +398,7 @@ void RE_display_update_cb(struct Render *re,
void RE_stats_draw_cb(struct Render *re, void *handle, void (*f)(void *handle, RenderStats *rs));
void RE_progress_cb(struct Render *re, void *handle, void (*f)(void *handle, float));
void RE_draw_lock_cb(struct Render *re, void *handle, void (*f)(void *handle, bool lock));
-void RE_test_break_cb(struct Render *re, void *handle, int (*f)(void *handle));
+void RE_test_break_cb(struct Render *re, void *handle, bool (*f)(void *handle));
void RE_current_scene_update_cb(struct Render *re,
void *handle,
void (*f)(void *handle, struct Scene *scene));
diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c
index 8fd62f7ec34..9b56e18bb26 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -967,7 +967,7 @@ void RE_bake_normal_world_to_object(const BakePixel pixel_array[],
size_t i;
float iobmat[4][4];
- invert_m4_m4(iobmat, ob->obmat);
+ invert_m4_m4(iobmat, ob->object_to_world);
for (i = 0; i < pixels_num; i++) {
size_t offset;
diff --git a/source/blender/render/intern/engine.cc b/source/blender/render/intern/engine.cc
index b8757d33580..acca657f7dc 100644
--- a/source/blender/render/intern/engine.cc
+++ b/source/blender/render/intern/engine.cc
@@ -1036,12 +1036,6 @@ bool RE_engine_render(Render *re, bool do_all)
return true;
}
- /* update animation here so any render layer animation is applied before
- * creating the render result */
- if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_BUTS_PREVIEW)) == 0) {
- render_update_anim_renderdata(re, &re->scene->r, &re->scene->view_layers);
- }
-
/* Create engine. */
RenderEngine *engine = re->engine;
diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c
index f701d9a987a..cfb91e86ad9 100644
--- a/source/blender/render/intern/multires_bake.c
+++ b/source/blender/render/intern/multires_bake.c
@@ -89,7 +89,7 @@ typedef struct {
char *texels;
const MResolvePixelData *data;
MFlushPixel flush_pixel;
- short *do_update;
+ bool *do_update;
} MBakeRast;
typedef struct {
@@ -134,7 +134,7 @@ static void init_bake_rast(MBakeRast *bake_rast,
const ImBuf *ibuf,
const MResolvePixelData *data,
MFlushPixel flush_pixel,
- short *do_update)
+ bool *do_update)
{
BakeImBufuserData *userdata = (BakeImBufuserData *)ibuf->userdata;
diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc
index d2929a7f6ea..17cf3b7ff74 100644
--- a/source/blender/render/intern/pipeline.cc
+++ b/source/blender/render/intern/pipeline.cc
@@ -177,7 +177,7 @@ static void stats_nothing(void * /*arg*/, RenderStats * /*rs*/)
static void float_nothing(void * /*arg*/, float /*val*/)
{
}
-static int default_break(void * /*arg*/)
+static bool default_break(void * /*arg*/)
{
return G.is_break == true;
}
@@ -261,13 +261,10 @@ RenderResult *RE_MultilayerConvert(
return render_result_new_from_exr(exrhandle, colorspace, predivide, rectx, recty);
}
-RenderLayer *render_get_active_layer(Render *re, RenderResult *rr)
+RenderLayer *render_get_single_layer(Render *re, RenderResult *rr)
{
- ViewLayer *view_layer = static_cast<ViewLayer *>(
- BLI_findlink(&re->view_layers, re->active_view_layer));
-
- if (view_layer) {
- RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name);
+ if (re->single_view_layer[0]) {
+ RenderLayer *rl = RE_GetRenderLayer(rr, re->single_view_layer);
if (rl) {
return rl;
@@ -385,8 +382,8 @@ void RE_AcquireResultImageViews(Render *re, RenderResult *rr)
RenderView *rv = static_cast<RenderView *>(rr->views.first);
rr->have_combined = (rv->rectf != nullptr);
- /* active layer */
- RenderLayer *rl = render_get_active_layer(re, re->result);
+ /* single layer */
+ RenderLayer *rl = render_get_single_layer(re, re->result);
if (rl) {
if (rv->rectf == nullptr) {
@@ -443,7 +440,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr, const int view_id)
rr->rect32 = rv->rect32;
/* active layer */
- rl = render_get_active_layer(re, re->result);
+ rl = render_get_single_layer(re, re->result);
if (rl) {
if (rv->rectf == nullptr) {
@@ -583,9 +580,6 @@ void RE_FreeRender(Render *re)
BLI_mutex_end(&re->engine_draw_mutex);
BLI_mutex_end(&re->highlighted_tiles_mutex);
- BLI_freelistN(&re->view_layers);
- BLI_freelistN(&re->r.views);
-
BKE_curvemapping_free_data(&re->r.mblur_shutter_curve);
if (re->highlighted_tiles != nullptr) {
@@ -705,19 +699,18 @@ static void re_init_resolution(Render *re, Render *source, int winx, int winy, r
void render_copy_renderdata(RenderData *to, RenderData *from)
{
- BLI_freelistN(&to->views);
+ /* Mostly shallow copy referencing pointers in scene renderdata. */
BKE_curvemapping_free_data(&to->mblur_shutter_curve);
memcpy(to, from, sizeof(*to));
- BLI_duplicatelist(&to->views, &from->views);
BKE_curvemapping_copy_data(&to->mblur_shutter_curve, &from->mblur_shutter_curve);
}
void RE_InitState(Render *re,
Render *source,
RenderData *rd,
- ListBase *render_layers,
+ ListBase * /*render_layers*/,
ViewLayer *single_layer,
int winx,
int winy,
@@ -731,9 +724,7 @@ void RE_InitState(Render *re,
/* copy render data and render layers for thread safety */
render_copy_renderdata(&re->r, rd);
- BLI_freelistN(&re->view_layers);
- BLI_duplicatelist(&re->view_layers, render_layers);
- re->active_view_layer = 0;
+ re->single_view_layer[0] = '\0';
if (source) {
/* reuse border flags from source renderer */
@@ -757,16 +748,13 @@ void RE_InitState(Render *re,
if (re->rectx < 1 || re->recty < 1 ||
(BKE_imtype_is_movie(rd->im_format.imtype) && (re->rectx < 16 || re->recty < 16))) {
BKE_report(re->reports, RPT_ERROR, "Image too small");
- re->ok = 0;
+ re->ok = false;
return;
}
if (single_layer) {
- int index = BLI_findindex(render_layers, single_layer);
- if (index != -1) {
- re->active_view_layer = index;
- re->r.scemode |= R_SINGLE_LAYER;
- }
+ STRNCPY(re->single_view_layer, single_layer->name);
+ re->r.scemode |= R_SINGLE_LAYER;
}
/* if preview render, we try to keep old result */
@@ -779,13 +767,16 @@ void RE_InitState(Render *re,
re->result = nullptr;
}
else if (re->result) {
- ViewLayer *active_render_layer = static_cast<ViewLayer *>(
- BLI_findlink(&re->view_layers, re->active_view_layer));
bool have_layer = false;
- LISTBASE_FOREACH (RenderLayer *, rl, &re->result->layers) {
- if (STREQ(rl->name, active_render_layer->name)) {
- have_layer = true;
+ if (re->single_view_layer[0] == '\0' && re->result->layers.first) {
+ have_layer = true;
+ }
+ else {
+ LISTBASE_FOREACH (RenderLayer *, rl, &re->result->layers) {
+ if (STREQ(rl->name, re->single_view_layer)) {
+ have_layer = true;
+ }
}
}
@@ -817,27 +808,6 @@ void RE_InitState(Render *re,
RE_point_density_fix_linking();
}
-void render_update_anim_renderdata(Render *re, RenderData *rd, ListBase *render_layers)
-{
- /* filter */
- re->r.gauss = rd->gauss;
-
- /* motion blur */
- re->r.blurfac = rd->blurfac;
-
- /* freestyle */
- re->r.line_thickness_mode = rd->line_thickness_mode;
- re->r.unit_line_thickness = rd->unit_line_thickness;
-
- /* render layers */
- BLI_freelistN(&re->view_layers);
- BLI_duplicatelist(&re->view_layers, render_layers);
-
- /* render views */
- BLI_freelistN(&re->r.views);
- BLI_duplicatelist(&re->r.views, &rd->views);
-}
-
void RE_display_init_cb(Render *re, void *handle, void (*f)(void *handle, RenderResult *rr))
{
re->display_init = f;
@@ -877,7 +847,7 @@ void RE_draw_lock_cb(Render *re, void *handle, void (*f)(void *handle, bool lock
re->dlh = handle;
}
-void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
+void RE_test_break_cb(Render *re, void *handle, bool (*f)(void *handle))
{
re->test_break = f;
re->tbh = handle;
@@ -979,7 +949,7 @@ static void render_result_uncrop(Render *re)
re->result = rres;
/* Weak, the display callback wants an active render-layer pointer. */
- re->result->renlay = render_get_active_layer(re, re->result);
+ re->result->renlay = render_get_single_layer(re, re->result);
BLI_rw_mutex_unlock(&re->resultmutex);
@@ -1217,7 +1187,7 @@ static void do_render_compositor(Render *re)
/* Weak: the display callback wants an active render-layer pointer. */
if (re->result != nullptr) {
- re->result->renlay = render_get_active_layer(re, re->result);
+ re->result->renlay = render_get_single_layer(re, re->result);
re->display_update(re->duh, re->result, nullptr);
}
}
@@ -1635,15 +1605,15 @@ const char *RE_GetActiveRenderView(Render *re)
return re->viewname;
}
-/* evaluating scene options for general Blender render */
-static int render_init_from_main(Render *re,
- const RenderData *rd,
- Main *bmain,
- Scene *scene,
- ViewLayer *single_layer,
- Object *camera_override,
- int anim,
- int anim_init)
+/** Evaluating scene options for general Blender render. */
+static bool render_init_from_main(Render *re,
+ const RenderData *rd,
+ Main *bmain,
+ Scene *scene,
+ ViewLayer *single_layer,
+ Object *camera_override,
+ int anim,
+ int anim_init)
{
int winx, winy;
rcti disprect;
@@ -1676,9 +1646,8 @@ static int render_init_from_main(Render *re,
/* not too nice, but it survives anim-border render */
if (anim) {
- render_update_anim_renderdata(re, &scene->r, &scene->view_layers);
re->disprect = disprect;
- return 1;
+ return true;
}
/*
@@ -1700,7 +1669,7 @@ static int render_init_from_main(Render *re,
RE_InitState(re, nullptr, &scene->r, &scene->view_layers, single_layer, winx, winy, &disprect);
if (!re->ok) { /* if an error was printed, abort */
- return 0;
+ return false;
}
/* initstate makes new result, have to send changed tags around */
@@ -1709,7 +1678,7 @@ static int render_init_from_main(Render *re,
re->display_init(re->dih, re->result);
re->display_clear(re->dch, re->result);
- return 1;
+ return true;
}
void RE_SetReports(Render *re, ReportList *reports)
@@ -1862,7 +1831,7 @@ static bool use_eevee_for_freestyle_render(Render *re)
void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, int render)
{
- re->result_ok = 0;
+ re->result_ok = false;
if (render_init_from_main(re, &scene->r, bmain, scene, nullptr, nullptr, 0, 0)) {
if (render) {
char scene_engine[32];
@@ -1876,7 +1845,7 @@ void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, int render
change_renderdata_engine(re, scene_engine);
}
}
- re->result_ok = 1;
+ re->result_ok = true;
}
void RE_RenderFreestyleExternal(Render *re)
@@ -1890,12 +1859,10 @@ void RE_RenderFreestyleExternal(Render *re)
LISTBASE_FOREACH (RenderView *, rv, &re->result->views) {
RE_SetActiveRenderView(re, rv->name);
- ViewLayer *active_view_layer = static_cast<ViewLayer *>(
- BLI_findlink(&re->view_layers, re->active_view_layer));
FRS_begin_stroke_rendering(re);
- LISTBASE_FOREACH (ViewLayer *, view_layer, &re->view_layers) {
- if ((re->r.scemode & R_SINGLE_LAYER) && view_layer != active_view_layer) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &re->scene->view_layers) {
+ if ((re->r.scemode & R_SINGLE_LAYER) && !STREQ(view_layer->name, re->single_view_layer)) {
continue;
}
diff --git a/source/blender/render/intern/pipeline.h b/source/blender/render/intern/pipeline.h
index 689e4509da3..e5da3cb8830 100644
--- a/source/blender/render/intern/pipeline.h
+++ b/source/blender/render/intern/pipeline.h
@@ -17,14 +17,7 @@ struct RenderResult;
extern "C" {
#endif
-struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr);
-/**
- * Update some variables that can be animated, and otherwise wouldn't be due to
- * #RenderData getting copied once at the start of animation render.
- */
-void render_update_anim_renderdata(struct Render *re,
- struct RenderData *rd,
- struct ListBase *render_layers);
+struct RenderLayer *render_get_single_layer(struct Render *re, struct RenderResult *rr);
void render_copy_renderdata(struct RenderData *to, struct RenderData *from);
#ifdef __cplusplus
diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc
index f9524fdbf05..1cd95831ddf 100644
--- a/source/blender/render/intern/render_result.cc
+++ b/source/blender/render/intern/render_result.cc
@@ -262,7 +262,7 @@ RenderResult *render_result_new(Render *re,
render_result_views_new(rr, &re->r);
- /* check renderdata for amount of layers */
+ /* Check render-data for amount of layers. */
FOREACH_VIEW_LAYER_TO_RENDER_BEGIN (re, view_layer) {
if (layername && layername[0]) {
if (!STREQ(view_layer->name, layername)) {
@@ -321,7 +321,7 @@ RenderResult *render_result_new(Render *re,
rl->layflag = SCE_LAY_FLAG_DEFAULT;
rl->passflag = SCE_PASS_COMBINED;
- re->active_view_layer = 0;
+ re->single_view_layer[0] = '\0';
}
/* Border render; calculate offset for use in compositor. compo is centralized coords. */
@@ -768,8 +768,8 @@ void render_result_single_layer_end(Render *re)
/* reconstruct render result layers */
int nr = 0;
- LISTBASE_FOREACH (ViewLayer *, view_layer, &re->view_layers) {
- if (nr == re->active_view_layer) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &re->scene->view_layers) {
+ if (STREQ(view_layer->name, re->single_view_layer)) {
BLI_addtail(&re->result->layers, rl);
}
else {
diff --git a/source/blender/render/intern/render_result.h b/source/blender/render/intern/render_result.h
index 2e76efba8a3..6e971d45d31 100644
--- a/source/blender/render/intern/render_result.h
+++ b/source/blender/render/intern/render_result.h
@@ -136,10 +136,11 @@ void render_result_views_shallowdelete(struct RenderResult *rr);
{ \
int nr_; \
ViewLayer *iter_; \
- for (nr_ = 0, iter_ = static_cast<ViewLayer *>((re_)->view_layers.first); iter_ != NULL; \
+ for (nr_ = 0, iter_ = static_cast<ViewLayer *>((re_)->scene->view_layers.first); \
+ iter_ != NULL; \
iter_ = iter_->next, nr_++) { \
if (!G.background && (re_)->r.scemode & R_SINGLE_LAYER) { \
- if (nr_ != re->active_view_layer) { \
+ if (!STREQ(iter_->name, re->single_view_layer)) { \
continue; \
} \
} \
diff --git a/source/blender/render/intern/render_types.h b/source/blender/render/intern/render_types.h
index 29bac6e2766..418acbca3b1 100644
--- a/source/blender/render/intern/render_types.h
+++ b/source/blender/render/intern/render_types.h
@@ -39,7 +39,8 @@ struct Render {
int slot;
/* state settings */
- short flag, ok, result_ok;
+ short flag;
+ bool ok, result_ok;
/* result of rendering */
RenderResult *result;
@@ -76,8 +77,7 @@ struct Render {
struct Main *main;
Scene *scene;
RenderData r;
- ListBase view_layers;
- int active_view_layer;
+ char single_view_layer[MAX_NAME];
struct Object *camera_override;
ThreadMutex highlighted_tiles_mutex;
@@ -108,7 +108,7 @@ struct Render {
void (*draw_lock)(void *handle, bool lock);
void *dlh;
- int (*test_break)(void *handle);
+ bool (*test_break)(void *handle);
void *tbh;
RenderStats i;
diff --git a/source/blender/render/intern/texture_pointdensity.c b/source/blender/render/intern/texture_pointdensity.c
index 2a2b62be1f0..5c31192f62a 100644
--- a/source/blender/render/intern/texture_pointdensity.c
+++ b/source/blender/render/intern/texture_pointdensity.c
@@ -174,8 +174,8 @@ static void pointdensity_cache_psys(
sim.psys = psys;
sim.psmd = psys_get_modifier(ob, psys);
- /* in case ob->imat isn't up-to-date */
- invert_m4_m4(ob->imat, ob->obmat);
+ /* in case ob->world_to_object isn't up-to-date */
+ invert_m4_m4(ob->world_to_object, ob->object_to_world);
total_particles = psys->totpart + psys->totchild;
psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
@@ -235,7 +235,7 @@ static void pointdensity_cache_psys(
copy_v3_v3(partco, state.co);
if (pd->psys_cache_space == TEX_PD_OBJECTSPACE) {
- mul_m4_v3(ob->imat, partco);
+ mul_m4_v3(ob->world_to_object, partco);
}
else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
sub_v3_v3(partco, ob->loc);
@@ -399,12 +399,12 @@ static void pointdensity_cache_object(PointDensity *pd, Object *ob)
case TEX_PD_OBJECTSPACE:
break;
case TEX_PD_OBJECTLOC:
- mul_m4_v3(ob->obmat, co);
+ mul_m4_v3(ob->object_to_world, co);
sub_v3_v3(co, ob->loc);
break;
case TEX_PD_WORLDSPACE:
default:
- mul_m4_v3(ob->obmat, co);
+ mul_m4_v3(ob->object_to_world, co);
break;
}
@@ -778,7 +778,7 @@ static void particle_system_minmax(Depsgraph *depsgraph,
sim.psys = psys;
sim.psmd = psys_get_modifier(object, psys);
- invert_m4_m4(imat, object->obmat);
+ invert_m4_m4(imat, object->object_to_world);
total_particles = psys->totpart + psys->totchild;
psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
diff --git a/source/blender/sequencer/SEQ_proxy.h b/source/blender/sequencer/SEQ_proxy.h
index 00747f4b9cf..caf123afbcf 100644
--- a/source/blender/sequencer/SEQ_proxy.h
+++ b/source/blender/sequencer/SEQ_proxy.h
@@ -29,8 +29,8 @@ bool SEQ_proxy_rebuild_context(struct Main *bmain,
struct ListBase *queue,
bool build_only_on_bad_performance);
void SEQ_proxy_rebuild(struct SeqIndexBuildContext *context,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
void SEQ_proxy_rebuild_finish(struct SeqIndexBuildContext *context, bool stop);
void SEQ_proxy_set(struct Sequence *seq, bool value);
diff --git a/source/blender/sequencer/SEQ_render.h b/source/blender/sequencer/SEQ_render.h
index 9c163de4230..e2672eef8b9 100644
--- a/source/blender/sequencer/SEQ_render.h
+++ b/source/blender/sequencer/SEQ_render.h
@@ -66,8 +66,8 @@ void SEQ_render_thumbnails(const struct SeqRenderData *context,
struct Sequence *seq,
struct Sequence *seq_orig,
float frame_step,
- rctf *view_area,
- const short *stop);
+ const struct rctf *view_area,
+ const bool *stop);
/**
* Get cached thumbnails.
*/
@@ -82,7 +82,7 @@ struct ImBuf *SEQ_get_thumbnail(const struct SeqRenderData *context,
float SEQ_render_thumbnail_first_frame_get(const struct Scene *scene,
struct Sequence *seq,
float frame_step,
- struct rctf *view_area);
+ const struct rctf *view_area);
/**
* Get frame for first thumbnail.
*/
@@ -102,8 +102,8 @@ int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const struct Scene *scen
void SEQ_render_thumbnails_base_set(const struct SeqRenderData *context,
struct Sequence *seq,
struct Sequence *seq_orig,
- rctf *view_area,
- const short *stop);
+ const struct rctf *view_area,
+ const bool *stop);
void SEQ_render_init_colorspace(struct Sequence *seq);
void SEQ_render_new_render_data(struct Main *bmain,
diff --git a/source/blender/sequencer/intern/disk_cache.c b/source/blender/sequencer/intern/disk_cache.c
index 1f52d2ea41b..596a28201cc 100644
--- a/source/blender/sequencer/intern/disk_cache.c
+++ b/source/blender/sequencer/intern/disk_cache.c
@@ -182,7 +182,7 @@ static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, char *path)
if (is_dir && !FILENAME_IS_CURRPAR(file)) {
char subpath[FILE_MAX];
BLI_strncpy(subpath, fl->path, sizeof(subpath));
- BLI_path_slash_ensure(subpath);
+ BLI_path_slash_ensure(subpath, sizeof(sizeof(subpath)));
seq_disk_cache_get_files(disk_cache, subpath);
}
@@ -291,8 +291,8 @@ static void seq_disk_cache_get_project_dir(SeqDiskCache *disk_cache, char *path,
/* Use suffix, so that the cache directory name does not conflict with the bmain's blend file. */
const char *suffix = "_seq_cache";
strncat(cache_dir, suffix, sizeof(cache_dir) - strlen(cache_dir) - 1);
- BLI_strncpy(path, seq_disk_cache_base_dir(), path_len);
- BLI_path_append(path, path_len, cache_dir);
+
+ BLI_path_join(path, path_len, seq_disk_cache_base_dir(), cache_dir);
}
static void seq_disk_cache_get_dir(
@@ -307,9 +307,8 @@ static void seq_disk_cache_get_dir(
BLI_strncpy(seq_name, seq->name, sizeof(seq_name));
BLI_filename_make_safe(scene_name);
BLI_filename_make_safe(seq_name);
- BLI_strncpy(path, project_dir, path_len);
- BLI_path_append(path, path_len, scene_name);
- BLI_path_append(path, path_len, seq_name);
+
+ BLI_path_join(path, path_len, project_dir, scene_name, seq_name);
}
static void seq_disk_cache_get_file_path(SeqDiskCache *disk_cache,
@@ -350,8 +349,7 @@ static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache)
int version = 0;
seq_disk_cache_get_project_dir(disk_cache, filepath, sizeof(filepath));
- BLI_strncpy(path_version_file, filepath, sizeof(path_version_file));
- BLI_path_append(path_version_file, sizeof(path_version_file), "cache_version");
+ BLI_path_join(path_version_file, sizeof(path_version_file), filepath, "cache_version");
if (BLI_exists(filepath) && BLI_is_dir(filepath)) {
FILE *file = BLI_fopen(path_version_file, "r");
@@ -384,7 +382,7 @@ static void seq_disk_cache_delete_invalid_files(SeqDiskCache *disk_cache,
DiskCacheFile *next_file, *cache_file = disk_cache->files.first;
char cache_dir[FILE_MAX];
seq_disk_cache_get_dir(disk_cache, scene, seq, cache_dir, sizeof(cache_dir));
- BLI_path_slash_ensure(cache_dir);
+ BLI_path_slash_ensure(cache_dir, sizeof(cache_dir));
while (cache_file) {
next_file = cache_file->next;
diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c
index 87da2017296..21ce2cbdf9a 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -811,8 +811,11 @@ bool seq_cache_put_if_possible(
return false;
}
-void seq_cache_thumbnail_put(
- const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *i, rctf *view_area)
+void seq_cache_thumbnail_put(const SeqRenderData *context,
+ Sequence *seq,
+ float timeline_frame,
+ ImBuf *i,
+ const rctf *view_area)
{
Scene *scene = context->scene;
diff --git a/source/blender/sequencer/intern/image_cache.h b/source/blender/sequencer/intern/image_cache.h
index a7ae130dc41..7b7e020c926 100644
--- a/source/blender/sequencer/intern/image_cache.h
+++ b/source/blender/sequencer/intern/image_cache.h
@@ -48,7 +48,7 @@ void seq_cache_thumbnail_put(const struct SeqRenderData *context,
struct Sequence *seq,
float timeline_frame,
struct ImBuf *i,
- rctf *view_area);
+ const struct rctf *view_area);
bool seq_cache_put_if_possible(const struct SeqRenderData *context,
struct Sequence *seq,
float timeline_frame,
diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c
index 9f08db2aa45..eaea310f423 100644
--- a/source/blender/sequencer/intern/proxy.c
+++ b/source/blender/sequencer/intern/proxy.c
@@ -479,10 +479,7 @@ bool SEQ_proxy_rebuild_context(Main *bmain,
return true;
}
-void SEQ_proxy_rebuild(SeqIndexBuildContext *context,
- short *stop,
- short *do_update,
- float *progress)
+void SEQ_proxy_rebuild(SeqIndexBuildContext *context, bool *stop, bool *do_update, float *progress)
{
const bool overwrite = context->overwrite;
SeqRenderData render_context;
@@ -585,8 +582,7 @@ void seq_proxy_index_dir_set(struct anim *anim, const char *base_dir)
char fname[FILE_MAXFILE];
IMB_anim_get_fname(anim, fname, FILE_MAXFILE);
- BLI_strncpy(dir, base_dir, sizeof(dir));
- BLI_path_append(dir, sizeof(dir), fname);
+ BLI_path_join(dir, sizeof(dir), base_dir, fname);
IMB_anim_set_index_dir(anim, dir);
}
diff --git a/source/blender/sequencer/intern/proxy_job.c b/source/blender/sequencer/intern/proxy_job.c
index 8520c06f9a2..d7dfe0130d8 100644
--- a/source/blender/sequencer/intern/proxy_job.c
+++ b/source/blender/sequencer/intern/proxy_job.c
@@ -41,7 +41,7 @@ static void proxy_freejob(void *pjv)
}
/* Only this runs inside thread. */
-static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
+static void proxy_startjob(void *pjv, bool *stop, bool *do_update, float *progress)
{
ProxyJob *pj = pjv;
LinkData *link;
@@ -52,7 +52,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
SEQ_proxy_rebuild(context, stop, do_update, progress);
if (*stop) {
- pj->stop = 1;
+ pj->stop = true;
fprintf(stderr, "Canceling proxy rebuild on users request...\n");
break;
}
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index e3fd9216842..5c6a59a5943 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -2010,7 +2010,7 @@ ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context,
float SEQ_render_thumbnail_first_frame_get(const Scene *scene,
Sequence *seq,
float frame_step,
- rctf *view_area)
+ const rctf *view_area)
{
int first_drawable_frame = max_iii(
SEQ_time_left_handle_frame_get(scene, seq), seq->start, view_area->xmin);
@@ -2102,8 +2102,8 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
Sequence *seq,
Sequence *seq_orig,
float frame_step,
- rctf *view_area,
- const short *stop)
+ const rctf *view_area,
+ const bool *stop)
{
SeqRenderState state;
seq_render_state_init(&state);
@@ -2163,8 +2163,8 @@ int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Scene *scene, cons
void SEQ_render_thumbnails_base_set(const SeqRenderData *context,
Sequence *seq,
Sequence *seq_orig,
- rctf *view_area,
- const short *stop)
+ const rctf *view_area,
+ const bool *stop)
{
SeqRenderState state;
seq_render_state_init(&state);
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 1f9de8040f6..329e22c156a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -341,6 +341,18 @@ void WM_cursor_warp(struct wmWindow *win, int x, int y);
/* Handlers. */
+typedef enum eWM_EventHandlerFlag {
+ /** After this handler all others are ignored. */
+ WM_HANDLER_BLOCKING = (1 << 0),
+ /** Handler accepts double key press events. */
+ WM_HANDLER_ACCEPT_DBL_CLICK = (1 << 1),
+
+ /* Internal. */
+ /** Handler tagged to be freed in #wm_handlers_do(). */
+ WM_HANDLER_DO_FREE = (1 << 7),
+} eWM_EventHandlerFlag;
+ENUM_OPERATORS(eWM_EventHandlerFlag, WM_HANDLER_DO_FREE)
+
typedef bool (*EventHandlerPoll)(const ARegion *region, const struct wmEvent *event);
struct wmEventHandler_Keymap *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
struct wmEventHandler_Keymap *WM_event_add_keymap_handler_poll(ListBase *handlers,
@@ -407,7 +419,7 @@ struct wmEventHandler_UI *WM_event_add_ui_handler(const struct bContext *C,
wmUIHandlerFunc handle_fn,
wmUIHandlerRemoveFunc remove_fn,
void *user_data,
- char flag);
+ eWM_EventHandlerFlag flag);
/**
* Return the first modal operator of type \a ot or NULL.
@@ -450,15 +462,6 @@ void WM_event_modal_handler_region_replace(wmWindow *win,
*/
void WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
-/* handler flag */
-enum {
- WM_HANDLER_BLOCKING = (1 << 0), /* after this handler all others are ignored */
- WM_HANDLER_ACCEPT_DBL_CLICK = (1 << 1), /* handler accepts double key press events */
-
- /* internal */
- WM_HANDLER_DO_FREE = (1 << 7), /* handler tagged to be freed in wm_handlers_do() */
-};
-
struct wmEventHandler_Dropbox *WM_event_add_dropbox_handler(ListBase *handlers,
ListBase *dropboxes);
@@ -1355,17 +1358,18 @@ void wmOrtho2_pixelspace(float x, float y);
void wmGetProjectionMatrix(float mat[4][4], const struct rcti *winrct);
/* threaded Jobs Manager */
-enum {
+typedef enum eWM_JobFlag {
WM_JOB_PRIORITY = (1 << 0),
WM_JOB_EXCL_RENDER = (1 << 1),
WM_JOB_PROGRESS = (1 << 2),
-};
+} eWM_JobFlag;
+ENUM_OPERATORS(enum eWM_JobFlag, WM_JOB_PROGRESS);
/**
* Identifying jobs by owner alone is unreliable, this isn't saved,
* order can change (keep 0 for 'any').
*/
-enum {
+typedef enum eWM_JobType {
WM_JOB_TYPE_ANY = 0,
WM_JOB_TYPE_COMPOSITE,
WM_JOB_TYPE_RENDER,
@@ -1397,7 +1401,7 @@ enum {
WM_JOB_TYPE_SEQ_DRAG_DROP_PREVIEW,
/* add as needed, bake, seq proxy build
* if having hard coded values is a problem */
-};
+} eWM_JobType;
/**
* \return current job or adds new job, but doesn't run it.
@@ -1409,8 +1413,8 @@ struct wmJob *WM_jobs_get(struct wmWindowManager *wm,
struct wmWindow *win,
const void *owner,
const char *name,
- int flag,
- int job_type);
+ eWM_JobFlag flag,
+ eWM_JobType job_type);
/**
* Returns true if job runs, for UI (progress) indicators.
@@ -1432,8 +1436,8 @@ void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned
void WM_jobs_delay_start(struct wmJob *, double delay_time);
typedef void (*wm_jobs_start_callback)(void *custom_data,
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress);
void WM_jobs_callbacks(struct wmJob *,
wm_jobs_start_callback startjob,
@@ -1463,7 +1467,7 @@ void WM_jobs_stop(struct wmWindowManager *wm, const void *owner, void *startjob)
*/
void WM_jobs_kill(struct wmWindowManager *wm,
void *owner,
- void (*)(void *, short int *, short int *, float *));
+ void (*)(void *, bool *, bool *, float *));
/**
* Wait until every job ended.
*/
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index e25169109e7..e4050397aaa 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -359,7 +359,7 @@ typedef struct wmNotifier {
/* data type, 256 entries is enough, it can overlap */
#define NOTE_DATA 0x00FF0000
-/* NC_WM windowmanager */
+/* NC_WM (window-manager). */
#define ND_FILEREAD (1 << 16)
#define ND_FILESAVE (2 << 16)
#define ND_DATACHANGED (3 << 16)
diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc
index 181ec89cabd..c84df617f98 100644
--- a/source/blender/windowmanager/intern/wm_event_system.cc
+++ b/source/blender/windowmanager/intern/wm_event_system.cc
@@ -4535,7 +4535,7 @@ wmEventHandler_UI *WM_event_add_ui_handler(const bContext *C,
wmUIHandlerFunc handle_fn,
wmUIHandlerRemoveFunc remove_fn,
void *user_data,
- const char flag)
+ const eWM_EventHandlerFlag flag)
{
wmEventHandler_UI *handler = MEM_cnew<wmEventHandler_UI>(__func__);
handler->head.type = WM_HANDLER_TYPE_UI;
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 5360f327a0a..fcfc83312b8 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -108,8 +108,10 @@ struct wmJob {
/* internal */
const void *owner;
- int flag;
- short suspended, running, ready, do_update, stop, job_type;
+ eWM_JobFlag flag;
+ bool suspended, running, ready;
+ eWM_JobType job_type;
+ bool do_update, stop;
float progress;
/** For display in header, identification */
@@ -152,9 +154,9 @@ static void wm_job_main_thread_yield(wmJob *wm_job)
/**
* Finds if type or owner, compare for it, otherwise any matching job.
*/
-static wmJob *wm_job_find(const wmWindowManager *wm, const void *owner, const int job_type)
+static wmJob *wm_job_find(const wmWindowManager *wm, const void *owner, const eWM_JobType job_type)
{
- if (owner && job_type) {
+ if (owner && (job_type != WM_JOB_TYPE_ANY)) {
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
if (wm_job->owner == owner && wm_job->job_type == job_type) {
return wm_job;
@@ -168,7 +170,7 @@ static wmJob *wm_job_find(const wmWindowManager *wm, const void *owner, const in
}
}
}
- else if (job_type) {
+ else if (job_type != WM_JOB_TYPE_ANY) {
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
if (wm_job->job_type == job_type) {
return wm_job;
@@ -185,8 +187,8 @@ wmJob *WM_jobs_get(wmWindowManager *wm,
wmWindow *win,
const void *owner,
const char *name,
- int flag,
- int job_type)
+ const eWM_JobFlag flag,
+ const eWM_JobType job_type)
{
wmJob *wm_job = wm_job_find(wm, owner, job_type);
@@ -593,7 +595,7 @@ void WM_jobs_stop(wmWindowManager *wm, const void *owner, void *startjob)
void WM_jobs_kill(wmWindowManager *wm,
void *owner,
- void (*startjob)(void *, short int *, short int *, float *))
+ void (*startjob)(void *, bool *, bool *, float *))
{
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) {
if (wm_job->owner == owner || wm_job->startjob == startjob) {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 2ca7b5f470d..265aa08a6b1 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1625,6 +1625,9 @@ GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gp
case GPU_BACKEND_ANY:
case GPU_BACKEND_OPENGL:
return GHOST_kDrawingContextTypeOpenGL;
+ case GPU_BACKEND_VULKAN:
+ BLI_assert_unreachable();
+ return GHOST_kDrawingContextTypeNone;
case GPU_BACKEND_METAL:
#ifdef WITH_METAL_BACKEND
return GHOST_kDrawingContextTypeMetal;
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 0b54560c56a..0a27b9c1cfd 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -45,12 +45,12 @@ extern void wm_close_and_free_all(bContext *C, ListBase *);
extern void wm_add_default(struct Main *bmain, bContext *C);
extern void wm_clear_default_size(bContext *C);
-/* register to windowmanager for redo or macro */
+/* Register to window-manager for redo or macro. */
/**
* Called on event handling by `event_system.c`.
*
- * All operations get registered in the windowmanager here.
+ * All operations get registered in the window-manager here.
*/
void wm_operator_register(bContext *C, wmOperator *op);
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index edbfe0202de..f49be20e174 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -29,21 +29,21 @@ extern "C" {
/* wmKeyMap is in DNA_windowmanager.h, it's saveable */
/** Custom types for handlers, for signaling, freeing */
-enum eWM_EventHandlerType {
+typedef enum eWM_EventHandlerType {
WM_HANDLER_TYPE_GIZMO = 1,
WM_HANDLER_TYPE_UI,
WM_HANDLER_TYPE_OP,
WM_HANDLER_TYPE_DROPBOX,
WM_HANDLER_TYPE_KEYMAP,
-};
+} eWM_EventHandlerType;
typedef bool (*EventHandlerPoll)(const ARegion *region, const wmEvent *event);
typedef struct wmEventHandler {
struct wmEventHandler *next, *prev;
- enum eWM_EventHandlerType type;
- char flag; /* WM_HANDLER_BLOCKING, ... */
+ eWM_EventHandlerType type;
+ eWM_EventHandlerFlag flag;
EventHandlerPoll poll;
} wmEventHandler;
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index abc41833de6..aefc3afff66 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -178,7 +178,7 @@ static void wm_xr_session_base_pose_calc(const Scene *scene,
float tmp_quat[4];
float tmp_eul[3];
- mat4_to_loc_quat(r_base_pose->position, tmp_quat, base_pose_object->obmat);
+ mat4_to_loc_quat(r_base_pose->position, tmp_quat, base_pose_object->object_to_world);
/* Only use rotation around Z-axis to align view with floor. */
quat_to_eul(tmp_eul, tmp_quat);
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 8ecca487a2f..b836046d29d 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -952,8 +952,8 @@ elseif(WIN32)
DEBUG
)
- # This will not exist for 3.3 and earlier lib folders
- # to ease the transition, support both 3.3 and 3.4 lib
+ # This will not exist for 3.4 and earlier lib folders
+ # to ease the transition, support both 3.4 and 3.5 lib
# folders.
if(EXISTS ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd)
install(
@@ -1050,8 +1050,8 @@ elseif(WIN32)
)
if(WITH_USD)
- # This will not exist for 3.3 and earlier lib folders
- # to ease the transition, support both 3.3 and 3.4 lib
+ # This will not exist for 3.4 and earlier lib folders
+ # to ease the transition, support both 3.4 and 3.5 lib
# folders.
if(EXISTS ${USD_LIBRARY_DIR}/python/)
install(
@@ -1211,6 +1211,13 @@ elseif(WIN32)
)
endif()
+ if(WITH_PYTHON_MODULE AND TARGETDIR_BPY)
+ install(
+ TARGETS blender
+ LIBRARY DESTINATION ${TARGETDIR_BPY}
+ )
+ endif()
+
if(PLATFORM_BUNDLED_LIBRARIES)
install(
FILES ${PLATFORM_BUNDLED_LIBRARIES}
@@ -1439,8 +1446,13 @@ if(WITH_USD)
# On windows the usd library sits in ./blender.shared copy the files
# relative to the location of the USD dll, if the dll does not exist
- # assume we are linking against the static 3.4 lib.
- if(WIN32 AND EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll)
+ # assume we are linking against the static 3.5 lib.
+ if(WIN32 AND
+ (
+ EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll OR # USD 22.03
+ EXISTS ${LIBDIR}/usd/lib/usd_ms.dll # USD 22.11
+ )
+ )
install(DIRECTORY
${USD_LIBRARY_DIR}/usd
DESTINATION "./blender.shared"
@@ -1457,7 +1469,7 @@ if(WITH_USD)
)
endif()
if(WIN32)
- # If this file exists we are building against a 3.4 library folder
+ # If this file exists we are building against a 3.5 22.03 library folder
# that needs these dll's installed.
if(EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll)
windows_install_shared_manifest(FILES
@@ -1469,6 +1481,18 @@ if(WITH_USD)
DEBUG
)
endif()
+ # If this file exists we are building against a 3.5 22.11 library folder
+ # that needs these dll's installed.
+ if(EXISTS ${LIBDIR}/usd/lib/usd_ms.dll)
+ windows_install_shared_manifest(FILES
+ ${LIBDIR}/usd/lib/usd_ms.dll
+ RELEASE
+ )
+ windows_install_shared_manifest(FILES
+ ${LIBDIR}/usd/lib/usd_ms_d.dll
+ DEBUG
+ )
+ endif()
endif()
endif()
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 4144603555b..2ebdcdb35ba 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1116,10 +1116,13 @@ static int arg_handle_debug_gpu_set(int UNUSED(argc),
static const char arg_handle_gpu_backend_set_doc[] =
"\n"
"\tForce to use a specific GPU backend. Valid options: "
+# ifdef WITH_VULKAN_BACKEND
+ "'vulkan', "
+# endif
# ifdef WITH_METAL_BACKEND
"'metal', "
# endif
- "'opengl').";
+ "'opengl'.";
static int arg_handle_gpu_backend_set(int argc, const char **argv, void *UNUSED(data))
{
if (argc == 0) {
@@ -1132,6 +1135,11 @@ static int arg_handle_gpu_backend_set(int argc, const char **argv, void *UNUSED(
if (STREQ(argv[1], "opengl")) {
gpu_backend = GPU_BACKEND_OPENGL;
}
+# ifdef WITH_VULKAN_BACKEND
+ else if (STREQ(argv[1], "vulkan")) {
+ gpu_backend = GPU_BACKEND_VULKAN;
+ }
+# endif
# ifdef WITH_METAL_BACKEND
else if (STREQ(argv[1], "metal")) {
gpu_backend = GPU_BACKEND_METAL;
diff --git a/source/tools b/source/tools
-Subproject 2a541f164a222ef7bcd036d37687738acee8d94
+Subproject dfa16042bf7149475ad318d29a8202d969982ab
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 68fcfc89b96..9f634af7143 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -20,9 +20,9 @@ else()
endif()
endif()
-# The installation directory's Python is the best one to use. However, it can only be there after the install step,
-# which means that Python will never be there on a fresh system. To suit different needs, the user can pass
-# -DTEST_PYTHON_EXE=/path/to/python to CMake.
+# The installation directory's Python is the best one to use. However, it can only be there
+# after the install step, # which means that Python will never be there on a fresh system.
+# To suit different needs, the user can pass `-DTEST_PYTHON_EXE=/path/to/python` to CMake.
if(NOT TEST_PYTHON_EXE)
set(TEST_PYTHON_EXE ${PYTHON_EXECUTABLE})
message(STATUS "Tests: Using Python executable: ${TEST_PYTHON_EXE}")
@@ -31,6 +31,19 @@ elseif(NOT EXISTS ${TEST_PYTHON_EXE})
endif()
+# Include these arguments before all others, they must not interfere with Python execution.
+set(TEST_PYTHON_EXE_EXTRA_ARGS)
+
+# Check if this a Blender managed Python installation, if so, don't add `*.pyc` files.
+if(LIBDIR)
+ path_is_prefix(LIBDIR TEST_PYTHON_EXE _is_prefix)
+ if(_is_prefix)
+ # Keep the Python in Blender's SVN LIBDIR pristine, to avoid conflicts on updating.
+ set(TEST_PYTHON_EXE_EXTRA_ARGS "-B")
+ endif()
+ unset(_is_prefix)
+endif()
+
# For testing with Valgrind
# set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE})
diff --git a/tests/blender_as_python_module/CMakeLists.txt b/tests/blender_as_python_module/CMakeLists.txt
index 6e0ce524903..7387d5c41bf 100644
--- a/tests/blender_as_python_module/CMakeLists.txt
+++ b/tests/blender_as_python_module/CMakeLists.txt
@@ -8,7 +8,7 @@ function(add_blender_as_python_module_test testname testscript)
add_test(
NAME ${testname}
- COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN}
+ COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${testscript} ${ARGN}
)
# On macOS, asan library must be loaded early.
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index fe61b6d5aee..51da4c24538 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -44,7 +44,7 @@ function(add_python_test testname testscript)
add_test(
NAME ${testname}
- COMMAND ${TEST_PYTHON_EXE} ${testscript} ${ARGN}
+ COMMAND ${TEST_PYTHON_EXE} ${TEST_PYTHON_EXE_EXTRA_ARGS} ${testscript} ${ARGN}
WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>
)
set_tests_properties(${testname} PROPERTIES ENVIRONMENT