diff --git a/.gitignore b/.gitignore index ecbaac31b4e6..97e66b3223de 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,7 @@ waveletNoiseTile.bin CMakeSettings.json CMakePresets.json CMakeUserPresets.json + +# Compile commands generated by CMake that may be linked into the source code +# folder to make it easier for tools like clangd to discover. +compile_commands.json diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index 846deabaae21..a346035bbd96 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -96,7 +96,7 @@ set(BOOST_VERSION 1.82.0) set(BOOST_VERSION_SHORT 1.82) set(BOOST_VERSION_NODOTS 1_82_0) set(BOOST_VERSION_NODOTS_SHORT 1_82) -set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz) +set(BOOST_URI https://archives.boost.io/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz) set(BOOST_HASH f7050f554a65f6a42ece221eaeec1660) set(BOOST_HASH_TYPE MD5) set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz) diff --git a/build_files/config/pipeline_config.yaml b/build_files/config/pipeline_config.yaml index 3cb4c4f86459..eb699542f543 100644 --- a/build_files/config/pipeline_config.yaml +++ b/build_files/config/pipeline_config.yaml @@ -13,7 +13,10 @@ buildbot: cuda12: version: '12.1.1' hip: - version: '5.7.32000' + windows: + version: '5.7.32000' + linux: + version: '6.1.3' optix: version: '7.4.0' ocloc: diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp index 72b7cfde9e1c..5a4f9bea0019 100644 --- a/intern/cycles/blender/display_driver.cpp +++ b/intern/cycles/blender/display_driver.cpp @@ -62,6 +62,11 @@ static GPUShader *compile_fallback_shader() return shader; } +BlenderFallbackDisplayShader::~BlenderFallbackDisplayShader() +{ + destroy_shader(); +} + GPUShader *BlenderFallbackDisplayShader::bind(const int width, const int height) { create_shader_if_needed(); @@ -880,6 +885,8 @@ void BlenderDisplayDriver::gpu_resources_destroy() { gpu_context_enable(); + display_shader_.reset(); + tiles_->current_tile.gpu_resources_destroy(); tiles_->finished_tiles.gl_resources_destroy_and_clear(); diff --git a/intern/cycles/blender/display_driver.h b/intern/cycles/blender/display_driver.h index d62cf83e2320..234fcbc9912e 100644 --- a/intern/cycles/blender/display_driver.h +++ b/intern/cycles/blender/display_driver.h @@ -52,6 +52,8 @@ class BlenderDisplayShader { * display space shader. */ class BlenderFallbackDisplayShader : public BlenderDisplayShader { public: + ~BlenderFallbackDisplayShader() override; + GPUShader *bind(const int width, const int height) override; void unbind() override; diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp index 4fd4bd7bad33..b5070cd6e8f1 100644 --- a/intern/cycles/device/oneapi/device_impl.cpp +++ b/intern/cycles/device/oneapi/device_impl.cpp @@ -550,7 +550,7 @@ void OneapiDevice::const_copy_to(const char *name, void *host, const size_t size this, name, MEM_READ_ONLY); data_ptr->alloc(size); data = data_ptr.get(); - const_mem_map_.insert(ConstMemMap::value_type(name, std::move(data))); + const_mem_map_.insert(ConstMemMap::value_type(name, std::move(data_ptr))); } else { data = i->second.get(); diff --git a/intern/cycles/hydra/field.cpp b/intern/cycles/hydra/field.cpp index 1ed16a28c8a6..6bc2cf59d386 100644 --- a/intern/cycles/hydra/field.cpp +++ b/intern/cycles/hydra/field.cpp @@ -4,9 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ #include "hydra/field.h" -#include "hydra/session.h" -#include "scene/image_vdb.h" -#include "scene/scene.h" + +#ifdef WITH_OPENVDB +# include "hydra/session.h" +# include "scene/image_vdb.h" +# include "scene/scene.h" +#endif #include #include @@ -93,6 +96,9 @@ void HdCyclesField::Sync(HdSceneDelegate *sceneDelegate, } } } +#else + (void)sceneDelegate; + (void)renderParam; #endif *dirtyBits = DirtyBits::Clean; diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 64eb382cea08..134367cd2c09 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -730,7 +730,7 @@ endif() # HIP RT module if(WITH_CYCLES_DEVICE_HIPRT) - set(HIPRT_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for for HIP-RT kernels") + set(HIPRT_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for HIP-RT kernels") mark_as_advanced(HIPRT_COMPILER_PARALLEL_JOBS) set(bvh_file ${CMAKE_CURRENT_BINARY_DIR}/hiprt${HIPRT_VERSION}_${HIP_VERSION_SHORT}_amd.hipfb) diff --git a/intern/cycles/kernel/svm/closure.h b/intern/cycles/kernel/svm/closure.h index e331161fd55d..8d94e6ca32de 100644 --- a/intern/cycles/kernel/svm/closure.h +++ b/intern/cycles/kernel/svm/closure.h @@ -138,7 +138,11 @@ ccl_device // get Disney principled parameters const float metallic = saturatef(param1); +#ifdef __SUBSURFACE__ const float subsurface_weight = saturatef(param2); +#else + const float subsurface_weight = 0.0f; +#endif const float specular_ior_level = max(stack_load_float(stack, specular_ior_level_offset), 0.0f); const float roughness = saturatef(stack_load_float(stack, roughness_offset)); @@ -450,7 +454,6 @@ ccl_device sd->flag |= bssrdf_setup(sd, bssrdf, path_flag, subsurface_method); } #else - subsurface_weight = 0.0f; (void)data_subsurf; #endif diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp index 06c3a64d102f..5c76c3205161 100644 --- a/intern/cycles/scene/integrator.cpp +++ b/intern/cycles/scene/integrator.cpp @@ -130,6 +130,7 @@ NODE_DEFINE(Integrator) SOCKET_FLOAT(scrambling_distance, "Scrambling Distance", 1.0f); static NodeEnum denoiser_type_enum; + denoiser_type_enum.insert("none", DENOISER_NONE); denoiser_type_enum.insert("optix", DENOISER_OPTIX); denoiser_type_enum.insert("openimagedenoise", DENOISER_OPENIMAGEDENOISE); diff --git a/intern/cycles/scene/object.cpp b/intern/cycles/scene/object.cpp index 39b0e1119750..8ee3be8098c0 100644 --- a/intern/cycles/scene/object.cpp +++ b/intern/cycles/scene/object.cpp @@ -1055,9 +1055,9 @@ void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, P Mesh *mesh = static_cast(geom); apply = apply && mesh->get_subdivision_type() == Mesh::SUBDIVISION_NONE; } - else if (geom->is_hair()) { - /* Can't apply non-uniform scale to curves, this can't be represented by - * control points and radius alone. */ + else if (geom->is_hair() || geom->is_pointcloud()) { + /* Can't apply non-uniform scale to curves and points, this can't be + * represented by control points and radius alone. */ float scale; apply = apply && transform_uniform_scale(object->tfm, scale); } diff --git a/intern/eigen/eigen_capi.h b/intern/eigen/eigen_capi.h index b9fe4570a93a..564416d9b253 100644 --- a/intern/eigen/eigen_capi.h +++ b/intern/eigen/eigen_capi.h @@ -9,9 +9,9 @@ #ifndef __EIGEN_C_API_H__ #define __EIGEN_C_API_H__ -#include "intern/eigenvalues.h" -#include "intern/linear_solver.h" -#include "intern/matrix.h" -#include "intern/svd.h" +#include "intern/eigenvalues.h" // IWYU pragma: export +#include "intern/linear_solver.h" // IWYU pragma: export +#include "intern/matrix.h" // IWYU pragma: export +#include "intern/svd.h" // IWYU pragma: export #endif /* __EIGEN_C_API_H__ */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.cc b/intern/ghost/intern/GHOST_SystemWin32.cc index d9ddecdb0d58..0fefead3019a 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cc +++ b/intern/ghost/intern/GHOST_SystemWin32.cc @@ -1263,7 +1263,7 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA constexpr USHORT ALTGR_MAKE_CODE = 0x38; /* If the keyboard layout includes AltGr and the virtual key is Control, yet the - * scancode is actually for Right Alt (ALTGR_MAKE_CODE scan code with E0 prefix). + * scan-code is actually for Right Alt (ALTGR_MAKE_CODE scan code with E0 prefix). * Ignore these, so treating AltGR as regular Alt. #68256 */ if (system->m_hasAltGr && vk == VK_CONTROL && raw.data.keyboard.MakeCode == ALTGR_MAKE_CODE && (raw.data.keyboard.Flags & RI_KEY_E0)) diff --git a/release/datafiles/assets b/release/datafiles/assets index 6fbe0b497c04..60e97519eb4e 160000 --- a/release/datafiles/assets +++ b/release/datafiles/assets @@ -1 +1 @@ -Subproject commit 6fbe0b497c042ad01cec44c893a2f40eef221d18 +Subproject commit 60e97519eb4e9cc5edbaa93444497277eadaa7e5 diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c index 0c4ac7f63d23..e02a3211a956 100644 --- a/release/datafiles/userdef/userdef_default.c +++ b/release/datafiles/userdef/userdef_default.c @@ -23,8 +23,7 @@ const UserDef U_default = { .versionfile = BLENDER_FILE_VERSION, .subversionfile = BLENDER_FILE_SUBVERSION, - .flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_RELPATHS | USER_RELEASECONFIRM | - USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES), + .flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_RELPATHS | USER_RELEASECONFIRM), .dupflag = USER_DUP_MESH | USER_DUP_CURVE | USER_DUP_SURF | USER_DUP_LATTICE | USER_DUP_FONT | USER_DUP_MBALL | USER_DUP_LAMP | USER_DUP_ARM | USER_DUP_CAMERA | USER_DUP_SPEAKER | USER_DUP_ACT | USER_DUP_LIGHTPROBE | USER_DUP_GPENCIL | USER_DUP_CURVES | @@ -53,7 +52,7 @@ const UserDef U_default = { .mini_axis_type = USER_MINI_AXIS_TYPE_GIZMO, .uiflag = (USER_FILTERFILEEXTS | USER_DRAWVIEWINFO | USER_PLAINMENUS | USER_LOCK_CURSOR_ADJUST | USER_DEPTH_CURSOR | USER_AUTOPERSP | - USER_NODE_AUTO_OFFSET | USER_GLOBALUNDO | USER_HIDE_DOT | USER_SHOW_GIZMO_NAVIGATE | + USER_NODE_AUTO_OFFSET | USER_GLOBALUNDO | USER_SHOW_GIZMO_NAVIGATE | USER_SHOW_VIEWPORTNAME | USER_SHOW_FPS | USER_CONTINUOUS_MOUSE | USER_SAVE_PROMPT), .uiflag2 = USER_REGION_OVERLAP, .gpu_flag = USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE | USER_GPU_FLAG_SUBDIVISION_EVALUATION, diff --git a/release/freedesktop/org.upbge.UPBGE.desktop b/release/freedesktop/org.upbge.UPBGE.desktop index 65feedca2fb3..972f7d45e5f3 100644 --- a/release/freedesktop/org.upbge.UPBGE.desktop +++ b/release/freedesktop/org.upbge.UPBGE.desktop @@ -84,7 +84,6 @@ Icon=org.upbge.UPBGE Terminal=false Type=Application PrefersNonDefaultGPU=true -X-KDE-RunOnDiscreteGpu=true Categories=Graphics;3DGraphics; MimeType=application/x-blender; StartupWMClass=Blender diff --git a/scripts/addons_core/bl_pkg/cli/blender_ext.py b/scripts/addons_core/bl_pkg/cli/blender_ext.py index 83b19aa0bc0f..c6852f85b328 100755 --- a/scripts/addons_core/bl_pkg/cli/blender_ext.py +++ b/scripts/addons_core/bl_pkg/cli/blender_ext.py @@ -1290,6 +1290,26 @@ def _pattern_match_as_regex(path_patterns: Sequence[str]) -> list[tuple[bool, re # ----------------------------------------------------------------------------- # URL Downloading + +# NOTE: +# - Using return arguments isn't ideal but is better than including +# a static value in the iterator. +# - Other data could be added here as needed (response headers if the caller needs them). +class DataRetrieveInfo: + """ + When accessing a file from a URL or from the file-system, + this is a "return" argument so the caller can know the size of the chunks it's iterating over, + or -1 when the size is not known. + """ + __slots__ = ( + "size_hint", + ) + size_hint: int + + def __init__(self) -> None: + self.size_hint = -1 + + # Originally based on `urllib.request.urlretrieve`. def url_retrieve_to_data_iter( url: str, @@ -1298,21 +1318,16 @@ def url_retrieve_to_data_iter( headers: dict[str, str], chunk_size: int, timeout_in_seconds: float, -) -> Iterator[tuple[bytes, int, Any]]: + retrieve_info: DataRetrieveInfo, +) -> Iterator[bytes]: """ - Retrieve a URL into a temporary location on disk. - - Requires a URL argument. If a filename is passed, it is used as - the temporary file location. The reporthook argument should be - a callable that accepts a block number, a read size, and the - total file size of the URL target. The data argument should be - valid URL encoded data. + Iterate over byte data downloaded from a from a URL + limited to ``chunk_size``. - If a filename is passed and the URL points to a local resource, - the result is a copy from local file to new file. - - Returns a tuple containing the path to the newly created - data file as well as the resulting HTTPMessage object. + - The ``retrieve_info.size_hint`` + will be set once the iterator starts and can be used for progress display. + - The iterator will start with an empty block, so the size can be known + before time is spent downloading data. """ from urllib.error import ContentTooShortError from urllib.request import urlopen @@ -1334,7 +1349,10 @@ def url_retrieve_to_data_iter( if "content-length" in response_headers: size = int(response_headers["Content-Length"]) - yield (b'', size, response_headers) + retrieve_info.size_hint = size + + # Yield an empty block so progress display may start. + yield b"" if timeout_in_seconds <= 0.0: while True: @@ -1342,14 +1360,14 @@ def url_retrieve_to_data_iter( if not block: break read += len(block) - yield (block, size, response_headers) + yield block else: while True: block = read_with_timeout(fp, chunk_size, timeout_in_seconds=timeout_in_seconds) if not block: break read += len(block) - yield (block, size, response_headers) + yield block if size >= 0 and read < size: raise ContentTooShortError( @@ -1358,6 +1376,7 @@ def url_retrieve_to_data_iter( ) +# See `url_retrieve_to_data_iter` doc-string. def url_retrieve_to_filepath_iter( url: str, filepath: str, @@ -1366,69 +1385,77 @@ def url_retrieve_to_filepath_iter( data: Any | None = None, chunk_size: int, timeout_in_seconds: float, -) -> Iterator[tuple[int, int, Any]]: + retrieve_info: DataRetrieveInfo, +) -> Iterator[int]: # Handle temporary file setup. with open(filepath, 'wb') as fh_output: - for block, size, response_headers in url_retrieve_to_data_iter( + for block in url_retrieve_to_data_iter( url, headers=headers, data=data, chunk_size=chunk_size, timeout_in_seconds=timeout_in_seconds, + retrieve_info=retrieve_info, ): fh_output.write(block) - yield (len(block), size, response_headers) + yield len(block) +# See `url_retrieve_to_data_iter` doc-string. def filepath_retrieve_to_filepath_iter( filepath_src: str, filepath: str, *, chunk_size: int, timeout_in_seconds: float, -) -> Iterator[tuple[int, int]]: + retrieve_info: DataRetrieveInfo, +) -> Iterator[int]: # TODO: `timeout_in_seconds`. # Handle temporary file setup. _ = timeout_in_seconds with open(filepath_src, 'rb') as fh_input: - size = os.fstat(fh_input.fileno()).st_size + retrieve_info.size_hint = os.fstat(fh_input.fileno()).st_size + yield 0 with open(filepath, 'wb') as fh_output: while (block := fh_input.read(chunk_size)): fh_output.write(block) - yield (len(block), size) + yield len(block) def url_retrieve_to_data_iter_or_filesystem( url: str, headers: dict[str, str], + *, chunk_size: int, timeout_in_seconds: float, + retrieve_info: DataRetrieveInfo, ) -> Iterator[bytes]: if url_is_filesystem(url): with open(path_from_url(url), "rb") as fh_source: + retrieve_info.size_hint = os.fstat(fh_source.fileno()).st_size + yield b"" while (block := fh_source.read(chunk_size)): yield block else: - for ( - block, - _size, - _response_headers, - ) in url_retrieve_to_data_iter( + yield from url_retrieve_to_data_iter( url, headers=headers, chunk_size=chunk_size, timeout_in_seconds=timeout_in_seconds, - ): - yield block + retrieve_info=retrieve_info, + ) +# See `url_retrieve_to_data_iter` doc-string. def url_retrieve_to_filepath_iter_or_filesystem( url: str, filepath: str, + *, headers: dict[str, str], chunk_size: int, timeout_in_seconds: float, -) -> Iterator[tuple[int, int]]: + retrieve_info: DataRetrieveInfo, +) -> Iterator[int]: """ Callers should catch: ``(Exception, KeyboardInterrupt)`` and convert them to message using: ``url_retrieve_exception_as_message``. @@ -1439,16 +1466,17 @@ def url_retrieve_to_filepath_iter_or_filesystem( filepath, chunk_size=chunk_size, timeout_in_seconds=timeout_in_seconds, + retrieve_info=retrieve_info, ) else: - for (read, size, _response_headers) in url_retrieve_to_filepath_iter( + yield from url_retrieve_to_filepath_iter( url, filepath, headers=headers, chunk_size=chunk_size, timeout_in_seconds=timeout_in_seconds, - ): - yield (read, size) + retrieve_info=retrieve_info, + ) def url_retrieve_exception_is_connectivity( @@ -2965,8 +2993,9 @@ def repo_sync_from_remote( return False try: + retrieve_info = DataRetrieveInfo() read_total = 0 - for (read, size) in url_retrieve_to_filepath_iter_or_filesystem( + for read in url_retrieve_to_filepath_iter_or_filesystem( remote_json_url, local_json_path_temp, headers=url_request_headers_create( @@ -2976,12 +3005,14 @@ def repo_sync_from_remote( ), chunk_size=CHUNK_SIZE_DEFAULT, timeout_in_seconds=timeout_in_seconds, + retrieve_info=retrieve_info, ): - request_exit |= msglog.progress("Downloading...", read_total, size, 'BYTE') + request_exit |= msglog.progress("Downloading...", read_total, retrieve_info.size_hint, 'BYTE') if request_exit: break read_total += read del read_total + del retrieve_info except (Exception, KeyboardInterrupt) as ex: msg = url_retrieve_exception_as_message(ex, prefix="sync", url=remote_url) if demote_connection_errors_to_status and url_retrieve_exception_is_connectivity(ex): @@ -3888,6 +3919,7 @@ def list_packages( ), chunk_size=CHUNK_SIZE_DEFAULT, timeout_in_seconds=timeout_in_seconds, + retrieve_info=DataRetrieveInfo(), # Unused. ): result.write(block) @@ -4339,6 +4371,7 @@ def install_packages( ), chunk_size=CHUNK_SIZE_DEFAULT, timeout_in_seconds=timeout_in_seconds, + retrieve_info=DataRetrieveInfo(), # Unused. ): request_exit |= msglog.progress( "Downloading \"{:s}\"".format(pkg_idname), diff --git a/scripts/addons_core/pose_library/pose_creation.py b/scripts/addons_core/pose_library/pose_creation.py index c7384041bc02..2b9389a80db9 100644 --- a/scripts/addons_core/pose_library/pose_creation.py +++ b/scripts/addons_core/pose_library/pose_creation.py @@ -203,6 +203,15 @@ def _current_value(cls, datablock: bpy.types.ID, data_path: str, array_index: in """Resolve an RNA path + array index to an actual value.""" value_or_array = cls._path_resolve(datablock, data_path) + if isinstance(value_or_array, str): + # Enums resolve to a string. + bone_path, enum_property_name = data_path.rsplit("[", 1) + unescaped_property_name = bpy.utils.unescape_identifier(enum_property_name) + # unescaped_property_name still has the quotes and a bracket at the end hence the [1:-2]. + value = cls._path_resolve(datablock, bone_path).get(unescaped_property_name[1:-2]) + assert isinstance(value, (int, float)) + return cast(FCurveValue, value) + # Both indices -1 and 0 are used for non-array properties. # -1 cannot be used in arrays, whereas 0 can be used in both arrays and non-arrays. diff --git a/scripts/startup/bl_operators/uvcalc_follow_active.py b/scripts/startup/bl_operators/uvcalc_follow_active.py index 2ea3be5b359e..3c1388dbb344 100644 --- a/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -83,28 +83,38 @@ def walk_face(f): faces_a, faces_b = faces_b, faces_a faces_b.clear() - def walk_edgeloop(l): - """ - Could make this a generic function - """ - e_first = l.edge - e = None - while True: - e = l.edge - yield e - - # Don't step past non-manifold edges. - if e.is_manifold: - # Walk around the quad and then onto the next face. - l = l.link_loop_radial_next - if len(l.face.verts) == 4: - l = l.link_loop_next.link_loop_next - if l.edge is e_first: - break - else: - break - else: - break + # Utility, only for `walk_edgeloop_all`. + def walk_edgeloop_all_impl_loop(loop_stack, edges_visited, l): + l_other = l.link_loop_next.link_loop_next + l_other_edge = l_other.edge + if l_other_edge not in edges_visited: + edges_visited.add(l_other_edge) + yield l_other_edge + if not l_other_edge.is_boundary: + loop_stack.append(l_other) + + def walk_edgeloop_all(e): + # Walks over all edge loops connected by quads (even edges with 3+ users). + # Could make this a generic function. + + loop_stack = [] + edges_visited = {e} + + yield e + + # This initial iteration is needed because the loops never walk back over the face they come from. + for l in e.link_loops: + if len(l.face.verts) != 4: + continue + yield from walk_edgeloop_all_impl_loop(loop_stack, edges_visited, l) + + while loop_stack and (l_test := loop_stack.pop()): + # Walk around the quad and then onto the next face. + l = l_test + while (l := l.link_loop_radial_next) is not l_test: + if len(l.face.verts) != 4: + continue + yield from walk_edgeloop_all_impl_loop(loop_stack, edges_visited, l) def extrapolate_uv( fac, @@ -196,25 +206,29 @@ def apply_uv(_f_prev, l_prev, _f_next): for f in faces: # We know it's a quad. l_quad = f.loops[:] - l_pair_a = (l_quad[0], l_quad[2]) - l_pair_b = (l_quad[1], l_quad[3]) - for l_pair in (l_pair_a, l_pair_b): - if edge_lengths[l_pair[0].edge.index] is None: + # The opposite loops `l_quad[2]` & `l_quad[3]` are implicit (walking will handle). + for l_init in (l_quad[0], l_quad[1]): + # No need to check both because the initializing + # one side of the pair will have initialized the second. + l_init_edge = l_init.edge + if edge_lengths[l_init_edge.index] is not None: + continue - edge_length_store = [-1.0] - edge_length_accum = 0.0 - edge_length_total = 0 + edge_length_store = [-1.0] + edge_length_accum = 0.0 + edge_length_total = 0 - for l in l_pair: - if edge_lengths[l.edge.index] is None: - for e in walk_edgeloop(l): - if edge_lengths[e.index] is None: - edge_lengths[e.index] = edge_length_store - edge_length_accum += e.calc_length() - edge_length_total += 1 + for e in walk_edgeloop_all(l_init_edge): + # Any previously met edges should have expanded into `l_init_edge` + # (which has no length). + assert edge_lengths[e.index] is None - edge_length_store[0] = edge_length_accum / edge_length_total + edge_lengths[e.index] = edge_length_store + edge_length_accum += e.calc_length() + edge_length_total += 1 + + edge_length_store[0] = edge_length_accum / edge_length_total # done with average length # ------------------------ diff --git a/scripts/startup/bl_ui/properties_render.py b/scripts/startup/bl_ui/properties_render.py index 1e8ad8f1d337..8091e298e0f9 100644 --- a/scripts/startup/bl_ui/properties_render.py +++ b/scripts/startup/bl_ui/properties_render.py @@ -842,7 +842,8 @@ def draw(self, context): col = layout.column() row = col.row() row.prop(rd, "compositor_device", text="Device", expand=True) - col.prop(rd, "compositor_precision", text="Precision") + if rd.compositor_device == "GPU": + col.prop(rd, "compositor_precision", text="Precision") class CompositorDenoisePerformanceButtonsPanel: diff --git a/scripts/startup/bl_ui/space_image.py b/scripts/startup/bl_ui/space_image.py index 5cd24e089da0..e84fa1c46b44 100644 --- a/scripts/startup/bl_ui/space_image.py +++ b/scripts/startup/bl_ui/space_image.py @@ -401,7 +401,11 @@ class IMAGE_MT_uvs_unwrap(Menu): def draw(self, _context): layout = self.layout - layout.operator_enum("uv.unwrap", "method") + # It would be nice to do: `layout.operator_enum("uv.unwrap", "method")` + # However the menu items don't have an "Unwrap" prefix, so inline the operators. + layout.operator("uv.unwrap", text="Unwrap Angle Based").method = 'ANGLE_BASED' + layout.operator("uv.unwrap", text="Unwrap Conformal").method = 'CONFORMAL' + layout.operator("uv.unwrap", text="Unwrap Minimum Stretch").method = 'MINIMUM_STRETCH' layout.separator() diff --git a/scripts/startup/bl_ui/space_node.py b/scripts/startup/bl_ui/space_node.py index cdd099c40493..458e118faf73 100644 --- a/scripts/startup/bl_ui/space_node.py +++ b/scripts/startup/bl_ui/space_node.py @@ -853,7 +853,8 @@ def draw(self, context): col = layout.column() col.prop(rd, "compositor_device", text="Device") - col.prop(rd, "compositor_precision", text="Precision") + if rd.compositor_device == "GPU": + col.prop(rd, "compositor_precision", text="Precision") col = layout.column() col.prop(tree, "use_viewer_border") diff --git a/scripts/startup/bl_ui/space_sequencer.py b/scripts/startup/bl_ui/space_sequencer.py index dfc84447681b..d87315202611 100644 --- a/scripts/startup/bl_ui/space_sequencer.py +++ b/scripts/startup/bl_ui/space_sequencer.py @@ -1406,7 +1406,7 @@ def draw(self, _context): row = layout.row(align=True) row.operator("sequencer.strip_color_tag_set", icon='X').color = 'NONE' for i in range(1, 10): - icon = 'SEQUENCE_COLOR_{:02d}'.format(i) + icon = 'STRIP_COLOR_{:02d}'.format(i) row.operator("sequencer.strip_color_tag_set", icon=icon).color = 'COLOR_{:02d}'.format(i) diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index e061516d5145..8ff1ae65ed21 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -1406,7 +1406,7 @@ class VIEW3D_MT_uv_map(Menu): def draw(self, _context): layout = self.layout - layout.menu("IMAGE_MT_uvs_unwrap") + layout.menu_contents("IMAGE_MT_uvs_unwrap") layout.separator() @@ -3254,7 +3254,16 @@ class VIEW3D_MT_object_modifiers(Menu): def draw(self, _context): active_object = bpy.context.active_object - supported_types = {'MESH', 'CURVE', 'CURVES', 'SURFACE', 'FONT', 'VOLUME', 'GREASEPENCIL'} + supported_types = { + 'MESH', + 'CURVE', + 'CURVES', + 'SURFACE', + 'FONT', + 'VOLUME', + 'GREASEPENCIL', + 'LATTICE', + 'POINTCLOUD'} layout = self.layout diff --git a/source/blender/animrig/ANIM_action.hh b/source/blender/animrig/ANIM_action.hh index 48f7de454c49..2c88844681ab 100644 --- a/source/blender/animrig/ANIM_action.hh +++ b/source/blender/animrig/ANIM_action.hh @@ -18,7 +18,6 @@ #include "BKE_action.hh" #include "BKE_anim_data.hh" -#include "BLI_math_vector.hh" #include "BLI_span.hh" #include "BLI_string_ref.hh" #include "BLI_vector.hh" @@ -54,14 +53,20 @@ class Slot; * * \note This wrapper class for the `bAction` DNA struct only has functionality * for the layered animation data. The legacy F-Curves (in `bAction::curves`) - * and their groups (in `bAction::groups`) are not managed here. To see whether - * an Action uses this legacy data, or has been converted to the current layered - * structure, use `Action::is_action_legacy()` and - * `Action::is_action_layered()`. Note that an empty Action is considered valid - * for both. + * and their groups (in `bAction::groups`) are not managed here. + * + * To continue supporting legacy actions at runtime, there are + * `Action::is_action_legacy()` and `Action::is_action_layered()` that report + * whether an Action uses that legacy F-Curve data or is instead a layered + * Action. These methods will eventually be removed when runtime support for + * legacy actions is fully removed. For code in blend file loading and + * versioning, which will stick around for the long-term, use + * `animrig::versioning::action_is_layered()` instead. (Note that an empty + * Action is considered both a valid legacy *and* layered action.) * * \see #AnimData::action * \see #AnimData::slot_handle + * \see #animrig::versioning::action_is_layered() */ class Action : public ::bAction { public: @@ -89,6 +94,13 @@ class Action : public ::bAction { * * \note An empty Action is valid as both a legacy and layered Action. Code that only supports * layered Actions should assert on `is_action_layered()`. + * + * \note This method will be removed when runtime support for legacy Actions + * is removed, so only use it in such runtime code. See + * `BKE_action_is_layered()` for uses that should stick around for the long + * term, such as blend file loading and versioning. + * + * \see #BKE_action_is_layered */ bool is_action_legacy() const; /** @@ -98,6 +110,13 @@ class Action : public ::bAction { * - Evaluated for data-blocks based on their slot handle. * * \note An empty Action is valid as both a legacy and layered Action. + * + * \note This method will be removed when runtime support for legacy Actions + * is removed, so only use it in such runtime code. See + * `BKE_action_is_layered()` for uses that should stick around for the long + * term, such as blend file loading and versioning. + * + * \see #BKE_action_is_layered */ bool is_action_layered() const; @@ -856,7 +875,7 @@ class Channelbag : public ::ActionChannelbag { /** * Create an F-Curve, but only if it doesn't exist yet in this Channelbag. * - * \return the F-Curve it it was created, or nullptr if it already existed. + * \return the F-Curve was created, or nullptr if it already existed. * * \param bmain: Used to tag the dependency graph(s) for relationship * rebuilding. This is necessary when adding a new F-Curve, as a @@ -1026,7 +1045,7 @@ class Channelbag : public ::ActionChannelbag { bool fcurve_assign_to_channel_group(FCurve &fcurve, bActionGroup &to_group); /** - * Removes the the given FCurve from the channel group it's in, if any. + * Removes the given FCurve from the channel group it's in, if any. * * As part of removing `fcurve` from its group, `fcurve` is moved to the end * of the fcurve array. However, if `fcurve` is already ungrouped then this diff --git a/source/blender/animrig/ANIM_action_iterators.hh b/source/blender/animrig/ANIM_action_iterators.hh index 2a9cba12e3ec..c13c57ea23a9 100644 --- a/source/blender/animrig/ANIM_action_iterators.hh +++ b/source/blender/animrig/ANIM_action_iterators.hh @@ -10,9 +10,7 @@ #pragma once -#include - -#include "BLI_vector.hh" +#include "BLI_function_ref.hh" #include "DNA_action_types.h" struct FCurve; diff --git a/source/blender/animrig/ANIM_bone_collections.hh b/source/blender/animrig/ANIM_bone_collections.hh index 222d0e63c968..9fae47d25779 100644 --- a/source/blender/animrig/ANIM_bone_collections.hh +++ b/source/blender/animrig/ANIM_bone_collections.hh @@ -17,7 +17,6 @@ #include #include "BLI_map.hh" -#include "BLI_math_bits.h" #include "BKE_armature.hh" diff --git a/source/blender/animrig/ANIM_evaluation.hh b/source/blender/animrig/ANIM_evaluation.hh index 682e2001897c..c2d4c1619c3b 100644 --- a/source/blender/animrig/ANIM_evaluation.hh +++ b/source/blender/animrig/ANIM_evaluation.hh @@ -12,10 +12,6 @@ #include "BLI_map.hh" #include "BLI_string_ref.hh" -#include "DNA_anim_types.h" - -#include "RNA_access.hh" - #include "ANIM_action.hh" namespace blender::animrig { diff --git a/source/blender/animrig/ANIM_keyframing.hh b/source/blender/animrig/ANIM_keyframing.hh index bba14d1c7ae0..5a6ce3a1782d 100644 --- a/source/blender/animrig/ANIM_keyframing.hh +++ b/source/blender/animrig/ANIM_keyframing.hh @@ -11,12 +11,8 @@ #pragma once #include -#include -#include "BLI_array.hh" -#include "BLI_bit_span.hh" #include "BLI_string_ref.hh" -#include "BLI_vector.hh" #include "DNA_anim_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/animrig/ANIM_keyingsets.hh b/source/blender/animrig/ANIM_keyingsets.hh index 200383a36a38..72881a4d8821 100644 --- a/source/blender/animrig/ANIM_keyingsets.hh +++ b/source/blender/animrig/ANIM_keyingsets.hh @@ -10,6 +10,8 @@ #pragma once +#include "RNA_types.hh" + struct KeyingSet; struct ExtensionRNA; /* Forward declaration for this struct which is declared a bit later. */ diff --git a/source/blender/animrig/ANIM_versioning.hh b/source/blender/animrig/ANIM_versioning.hh new file mode 100644 index 000000000000..63a07691c068 --- /dev/null +++ b/source/blender/animrig/ANIM_versioning.hh @@ -0,0 +1,81 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup animrig + * + * \brief Versioning of old animation data. Most animation versioning code lives + * in the versioning_xxx.cc files, but some is broken out and placed here. + */ + +struct bAction; +struct BlendFileReadReport; +struct ID; +struct Main; +struct ReportList; + +namespace blender::animrig { +class Action; +} + +namespace blender::animrig::versioning { + +/** + * Return whether an action is layered (as opposed to legacy). + * + * This will return false for both Animato and pre-Animato actions. It is used + * during file read and versioning to determine how forward-compatible and + * legacy data should be handled. + * + * NOTE: this is semi-duplicated from `Action::is_action_layered()`, but with + * tweaks to also recognize ultra-legacy (pre-Animato) data. Because this needs access to + * deprecated DNA fields, which is ok here in the versioning code, the other "is this legacy or + * layered?" functions do not check for pre-Animato data. + * + * \see Action::is_action_layered() + */ +bool action_is_layered(const bAction &dna_action); + +/** + * Convert all legacy (Animato) Actions to slotted Actions, in-place. + * + * This function does *not* work on pre-Animato actions. + */ +void convert_legacy_animato_actions(Main &bmain); + +/** + * Convert legacy (Animato) Action to slotted Action, in-place. + * + * \note This function does *not* work on pre-Animato actions. + * + * This always creates a slot and a layer for the Action, even when the Action doesn't actually + * contain any animation data. This ensures that versioned Actions all look the same, and there's + * just less variations to keep track of. */ +void convert_legacy_animato_action(bAction &dna_action); + +/** + * Go over all animated IDs, and tag them whenever they use a legacy Action. + * + * \see convert_legacy_action_assignments + */ +void tag_action_users_for_slotted_actions_conversion(Main &bmain); + +/** + * Tag this ID so it'll get its legacy Action assignment converted. + * + * \see convert_legacy_action_assignments + */ +void tag_action_user_for_slotted_actions_conversion(ID &animated_id); + +/** + * Convert the Action assignments of all animated IDs. + * + * For all IDs that use an Action, this also picks an Action Slot to ensure the ID is still + * animated. + * + * This only visits IDs tagged by #tag_action_users_for_slotted_actions_conversion. + */ +void convert_legacy_action_assignments(Main &bmain, ReportList *reports); + +} // namespace blender::animrig::versioning diff --git a/source/blender/animrig/CMakeLists.txt b/source/blender/animrig/CMakeLists.txt index adea1b49c20f..32b996a5fbb2 100644 --- a/source/blender/animrig/CMakeLists.txt +++ b/source/blender/animrig/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRC intern/keyingsets.cc intern/nla.cc intern/pose.cc + intern/versioning.cc intern/visualkey.cc ANIM_action.hh @@ -51,6 +52,7 @@ set(SRC ANIM_nla.hh ANIM_pose.hh ANIM_rna.hh + ANIM_versioning.hh ANIM_visualkey.hh intern/action_runtime.hh intern/bone_collections_internal.hh @@ -60,6 +62,7 @@ set(SRC set(LIB PRIVATE bf::blenkernel bf::blenlib + PRIVATE bf::blenloader PRIVATE bf::blentranslation PRIVATE bf::depsgraph bf::dna @@ -84,6 +87,7 @@ if(WITH_GTESTS) intern/keyframing_test.cc intern/nla_test.cc intern/pose_test.cc + intern/versioning_test.cc ) set(TEST_LIB PRIVATE bf::animrig diff --git a/source/blender/animrig/intern/action_runtime.hh b/source/blender/animrig/intern/action_runtime.hh index f92b1256ed31..388cc30b9803 100644 --- a/source/blender/animrig/intern/action_runtime.hh +++ b/source/blender/animrig/intern/action_runtime.hh @@ -13,6 +13,7 @@ #include "BLI_vector.hh" struct ID; +struct Main; namespace blender::animrig { diff --git a/source/blender/animrig/intern/bone_collections_internal.hh b/source/blender/animrig/intern/bone_collections_internal.hh index 78b2bcfde664..0fd8059ec0f5 100644 --- a/source/blender/animrig/intern/bone_collections_internal.hh +++ b/source/blender/animrig/intern/bone_collections_internal.hh @@ -11,7 +11,8 @@ #pragma once -#include +struct bArmature; +struct BoneCollection; namespace blender::animrig::internal { diff --git a/source/blender/animrig/intern/bone_collections_test.cc b/source/blender/animrig/intern/bone_collections_test.cc index e8c1dbfe8525..1695bdb200cb 100644 --- a/source/blender/animrig/intern/bone_collections_test.cc +++ b/source/blender/animrig/intern/bone_collections_test.cc @@ -2,6 +2,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_listbase.h" #include "BLI_string.h" #include "BLT_translation.hh" diff --git a/source/blender/animrig/intern/evaluation_internal.hh b/source/blender/animrig/intern/evaluation_internal.hh index 0d5ab53daed3..e2597518a502 100644 --- a/source/blender/animrig/intern/evaluation_internal.hh +++ b/source/blender/animrig/intern/evaluation_internal.hh @@ -4,6 +4,13 @@ #pragma once +#include "ANIM_evaluation.hh" + +struct AnimationEvalContext; +struct PointerRNA; +struct Action; +struct Layer; + namespace blender::animrig::internal { /** diff --git a/source/blender/animrig/intern/nla_test.cc b/source/blender/animrig/intern/nla_test.cc index 87d8d3dcca79..f93ecbc190c1 100644 --- a/source/blender/animrig/intern/nla_test.cc +++ b/source/blender/animrig/intern/nla_test.cc @@ -151,7 +151,7 @@ TEST_F(NLASlottedActionTest, assign_slot_to_multiple_strips) EXPECT_STREQ(strip1->last_slot_identifier, slot.identifier); EXPECT_EQ(slot.idtype, ID_OB); - /* Assign another slot slot 'manually'. */ + /* Assign another slot 'manually'. */ Slot &other_slot = action->slot_add(); EXPECT_EQ(nla::assign_action_slot(*strip1, &other_slot, cube->id), ActionSlotAssignmentResult::OK); diff --git a/source/blender/animrig/intern/versioning.cc b/source/blender/animrig/intern/versioning.cc new file mode 100644 index 000000000000..44823f102c90 --- /dev/null +++ b/source/blender/animrig/intern/versioning.cc @@ -0,0 +1,304 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup animrig + */ + +/* This is versioning code, so it's allowed to touch on deprecated DNA fields. */ + +#define DNA_DEPRECATED_ALLOW + +#include "ANIM_action.hh" +#include "ANIM_action_iterators.hh" +#include "ANIM_versioning.hh" + +#include "DNA_action_defaults.h" +#include "DNA_action_types.h" + +#include "BKE_main.hh" +#include "BKE_node.hh" +#include "BKE_report.hh" + +#include "BLI_listbase.h" +#include "BLI_string_utf8.h" + +#include "BLT_translation.hh" + +#include "BLO_readfile.hh" + +namespace blender::animrig::versioning { + +constexpr const char *DEFAULT_VERSIONED_SLOT_NAME = "Legacy Slot"; + +bool action_is_layered(const bAction &dna_action) +{ + const animrig::Action &action = dna_action.wrap(); + + const bool has_layered_data = action.layer_array_num > 0 || action.slot_array_num > 0; + const bool has_animato_data = !(BLI_listbase_is_empty(&action.curves) && + BLI_listbase_is_empty(&action.groups)); + const bool has_pre_animato_data = !BLI_listbase_is_empty(&action.chanbase); + + return has_layered_data || (!has_animato_data && !has_pre_animato_data); +} + +void convert_legacy_animato_actions(Main &bmain) +{ + LISTBASE_FOREACH (bAction *, dna_action, &bmain.actions) { + blender::animrig::Action &action = dna_action->wrap(); + + if (action_is_layered(action) && !action.is_empty()) { + /* This is just a safety net. Blender files that trigger this versioning code are not + * expected to have any layered/slotted Actions. + * + * Empty Actions, even though they are valid "layered" Actions, should still get through + * versioning, though, to ensure they have the default "Legacy Slot" and a zero idroot. */ + continue; + } + + /* This function should skip pre-2.50 Actions, as those are versioned in a special step (see + * `do_versions_after_setup()` in `versioning_common.cc`). */ + if (!BLI_listbase_is_empty(&action.chanbase)) { + continue; + } + + convert_legacy_animato_action(action); + } +} + +void convert_legacy_animato_action(bAction &dna_action) +{ + BLI_assert_msg(BLI_listbase_is_empty(&dna_action.chanbase), + "this function cannot handle pre-2.50 Actions"); + if (!BLI_listbase_is_empty(&dna_action.chanbase)) { + /* This is a pre-2.5 Action, which cannot be converted here. It's converted in another function + * to a post-2.5 Action (aka Animato Action), and after that, this function will be called + * again. */ + return; + } + + Action &action = dna_action.wrap(); + BLI_assert(action.is_action_legacy()); + + /* Store this ahead of time, because adding the slot sets the action's idroot + * to 0. We also set the action's idroot to 0 manually, just to be defensive + * so we don't depend on esoteric behavior in `slot_add()`. */ + const int16_t idtype = action.idroot; + action.idroot = 0; + + /* Initialize the Action's last_slot_handle field to its default value, before + * we create a new slot. */ + action.last_slot_handle = DNA_DEFAULT_ACTION_LAST_SLOT_HANDLE; + + Slot &slot = action.slot_add(); + slot.idtype = idtype; + + const std::string slot_identifier{slot.identifier_prefix_for_idtype() + + DATA_(DEFAULT_VERSIONED_SLOT_NAME)}; + action.slot_identifier_define(slot, slot_identifier); + + Layer &layer = action.layer_add("Layer"); + blender::animrig::Strip &strip = layer.strip_add(action, + blender::animrig::Strip::Type::Keyframe); + Channelbag &bag = strip.data(action).channelbag_for_slot_ensure(slot); + const int fcu_count = BLI_listbase_count(&action.curves); + const int group_count = BLI_listbase_count(&action.groups); + bag.fcurve_array = MEM_cnew_array(fcu_count, "Action versioning - fcurves"); + bag.fcurve_array_num = fcu_count; + bag.group_array = MEM_cnew_array(group_count, "Action versioning - groups"); + bag.group_array_num = group_count; + + int group_index = 0; + int fcurve_index = 0; + LISTBASE_FOREACH_INDEX (bActionGroup *, group, &action.groups, group_index) { + bag.group_array[group_index] = group; + + group->channelbag = &bag; + group->fcurve_range_start = fcurve_index; + + LISTBASE_FOREACH (FCurve *, fcu, &group->channels) { + if (fcu->grp != group) { + break; + } + bag.fcurve_array[fcurve_index++] = fcu; + } + + group->fcurve_range_length = fcurve_index - group->fcurve_range_start; + } + + LISTBASE_FOREACH (FCurve *, fcu, &action.curves) { + /* Any fcurves with groups have already been added to the fcurve array. */ + if (fcu->grp) { + continue; + } + bag.fcurve_array[fcurve_index++] = fcu; + } + + BLI_assert(fcurve_index == fcu_count); + + action.curves = {nullptr, nullptr}; + action.groups = {nullptr, nullptr}; +} + +void tag_action_user_for_slotted_actions_conversion(ID &animated_id) +{ + animated_id.runtime.readfile_data->tags.action_assignment_needs_slot = true; +} + +void tag_action_users_for_slotted_actions_conversion(Main &bmain) +{ + /* This function is only called when the blend-file is old enough to NOT use + * slotted Actions, so we can safely tag anything that uses an Action. */ + + auto flag_adt = [](ID &animated_id, + bAction *& /*action_ptr_ref*/, + slot_handle_t & /*slot_handle_ref*/, + char * /*slot_name*/) -> bool { + tag_action_user_for_slotted_actions_conversion(animated_id); + + /* Once tagged, the foreach loop can stop, because more tagging of the same + * ID doesn't do anything. */ + return false; + }; + + ID *id; + FOREACH_MAIN_ID_BEGIN (&bmain, id) { + foreach_action_slot_use_with_references(*id, flag_adt); + + /* Process embedded IDs, as these are not listed in bmain, but still can + * have their own Action+Slot. Unfortunately there is no generic looper + * for embedded IDs. At this moment the only animatable embedded ID is a + * node tree. */ + bNodeTree *node_tree = blender::bke::node_tree_from_id(id); + if (node_tree) { + foreach_action_slot_use_with_references(node_tree->id, flag_adt); + } + } + FOREACH_MAIN_ID_END; +} + +void convert_legacy_action_assignments(Main &bmain, ReportList *reports) +{ + auto version_slot_assignment = [&](ID &animated_id, + bAction *&action_ptr_ref, + slot_handle_t &slot_handle_ref, + char *last_used_slot_identifier) { + BLI_assert(action_ptr_ref); /* Ensured by the foreach loop. */ + Action &action = action_ptr_ref->wrap(); + + if (action.slot_array_num == 0) { + /* animated_id is from an older file (because it is in the being-versioned-right-now bmain), + * and it's referring to an Action from an already-versioned library file. We know this + * because versioned legacy Actions always have a single slot called "Legacy Slot", and so + * this Action must have been opened in some Blender and had its slot removed. */ + + /* Another reason that there is no slot is that it was a _really_ old (pre-2.50) + * Action that should have been upgraded already. */ + BLI_assert_msg(BLI_listbase_is_empty(&action.chanbase), + "Did not expect pre-2.5 Action at this stage of the versioning code"); + + return true; + } + + /* Reset the "last used slot identifier" to the default "Legacy Slot". That way + * generic_slot_for_autoassign() will pick up on legacy slots automatically. + * + * Note that this function should only run on legacy users of Actions, i.e. they are not + * expected to have any last-used slot at all. The field in DNA can still be set, though, + * because the 4.3 code already has the data model for slotted Actions. */ + + /* Ensure that the identifier has the correct ID type prefix. */ + *reinterpret_cast(last_used_slot_identifier) = GS(animated_id.name); + + static_assert(Slot::identifier_length_max > 2); /* Because of the -2 below. */ + BLI_strncpy_utf8(last_used_slot_identifier + 2, + DATA_(DEFAULT_VERSIONED_SLOT_NAME), + Slot::identifier_length_max - 2); + + Slot *slot_to_assign = generic_slot_for_autoassign( + animated_id, action, last_used_slot_identifier); + if (!slot_to_assign) { + /* This means that there is no slot that can be found by name, not even the "Legacy Slot" + * name. Keep the ID unanimated, as this means that the referenced Action has changed + * significantly since this file was opened. */ + BKE_reportf(reports, + RPT_WARNING, + "\"%s\" is using Action \"%s\", which does not have a slot with identifier " + "\"%s\" or \"%s\". Manually assign the right action slot to \"%s\".\n", + animated_id.name, + action.id.name + 2, + last_used_slot_identifier, + animated_id.name, + animated_id.name + 2); + return true; + } + + const ActionSlotAssignmentResult result = generic_assign_action_slot( + slot_to_assign, animated_id, action_ptr_ref, slot_handle_ref, last_used_slot_identifier); + switch (result) { + case ActionSlotAssignmentResult::OK: + break; + case ActionSlotAssignmentResult::SlotNotSuitable: + /* If the slot wasn't suitable for the ID, we force assignment anyway, + * but with a warning. + * + * This happens when the legacy action assigned to the ID had a + * mismatched idroot, and therefore the created slot does as well. + * This mismatch can happen in a variety of ways, and we opt to + * preserve this unusual (but technically valid) state of affairs. + */ + slot_handle_ref = slot_to_assign->handle; + BLI_strncpy_utf8( + last_used_slot_identifier, slot_to_assign->identifier, Slot::identifier_length_max); + /* Not necessary to add this ID to the slot user list, as that list is + * going to get refreshed after versioning anyway. */ + + BKE_reportf( + reports, + RPT_WARNING, + "Legacy action \"%s\" is assigned to \"%s\", which does not match the " + "action's id_root \"%s\". The action has been upgraded to a slotted action with " + "slot \"%s\" with an id_type \"%s\", which has also been assigned to \"%s\" despite " + "this type mismatch. This likely indicates something odd about the blend file.\n", + action.id.name + 2, + animated_id.name, + slot_to_assign->identifier_prefix_for_idtype().c_str(), + slot_to_assign->identifier_without_prefix().c_str(), + slot_to_assign->identifier_prefix_for_idtype().c_str(), + animated_id.name); + break; + case ActionSlotAssignmentResult::SlotNotFromAction: + BLI_assert_msg(false, "SlotNotFromAction should not be returned here"); + break; + case ActionSlotAssignmentResult::MissingAction: + BLI_assert_msg(false, "MissingAction should not be returned here"); + break; + } + + return true; + }; + + ID *id; + FOREACH_MAIN_ID_BEGIN (&bmain, id) { + /* Process the ID itself. */ + if (BLO_readfile_id_runtime_tags(*id).action_assignment_needs_slot) { + foreach_action_slot_use_with_references(*id, version_slot_assignment); + id->runtime.readfile_data->tags.action_assignment_needs_slot = false; + } + + /* Process embedded IDs, as these are not listed in bmain, but still can + * have their own Action+Slot. Unfortunately there is no generic looper + * for embedded IDs. At this moment the only animatable embedded ID is a + * node tree. */ + bNodeTree *node_tree = blender::bke::node_tree_from_id(id); + if (node_tree && BLO_readfile_id_runtime_tags(node_tree->id).action_assignment_needs_slot) { + foreach_action_slot_use_with_references(node_tree->id, version_slot_assignment); + node_tree->id.runtime.readfile_data->tags.action_assignment_needs_slot = false; + } + } + FOREACH_MAIN_ID_END; +} + +} // namespace blender::animrig::versioning diff --git a/source/blender/animrig/intern/versioning_test.cc b/source/blender/animrig/intern/versioning_test.cc new file mode 100644 index 000000000000..5021508abb5c --- /dev/null +++ b/source/blender/animrig/intern/versioning_test.cc @@ -0,0 +1,94 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/* The tests in this file need to be able to test deprecated data as well. */ +#define DNA_DEPRECATED_ALLOW + +#include "ANIM_versioning.hh" + +#include "DNA_action_types.h" +#include "DNA_anim_types.h" + +#include "BLI_listbase.h" + +#include "MEM_guardedalloc.h" + +#include "testing/testing.h" + +namespace blender::animrig::versioning::tests { + +TEST(animrig_versioning, action_is_layered) +{ + /* This unit test doesn't put valid data in the action under test. Since action_is_layered() + * only looks at the length of lists, and not their contents, that should be fine. */ + + { /* Pre-Animato Action / Blender version 2.49 and older. */ + bAction action = {{nullptr}}; + Ipo *fake_ipo = nullptr; + + BLI_addtail(&action.chanbase, &fake_ipo); + EXPECT_FALSE(action_is_layered(action)) + << "Pre-2.5 Actions should NOT be considered 'layered'"; + } + + { /* Animato Action only fcurves / Blender version [2.5, 4.4) */ + bAction action = {{nullptr}}; + FCurve *fake_fcurve = nullptr; + + BLI_addtail(&action.curves, &fake_fcurve); + EXPECT_FALSE(action_is_layered(action)) + << "Animato Actions should NOT be considered 'layered'"; + } + + { /* Animato Action with fcurves + groups / Blender version [2.5, 4.4) */ + bAction action = {{nullptr}}; + FCurve *fake_fcurve = nullptr; + bActionGroup *fake_group = nullptr; + + BLI_addtail(&action.curves, &fake_fcurve); + BLI_addtail(&action.groups, &fake_group); + EXPECT_FALSE(action_is_layered(action)) + << "Animato Actions should NOT be considered 'layered'"; + } + + { /* Animato Action with only groups / Blender version [2.5, 4.4) */ + bAction action = {{nullptr}}; + bActionGroup *fake_group = nullptr; + + BLI_addtail(&action.groups, &fake_group); + EXPECT_FALSE(action_is_layered(action)) + << "Animato Actions should NOT be considered 'layered'"; + } + + { /* Layered Action with only layers / Blender version 4.4 and newer. */ + bAction action = {{nullptr}}; + action.layer_array_num = 1; + + EXPECT_TRUE(action_is_layered(action)) << "Layered Actions should be considered 'layered'"; + } + + { /* Layered Action with only slots / Blender version 4.4 and newer. */ + bAction action = {{nullptr}}; + action.slot_array_num = 1; + + EXPECT_TRUE(action_is_layered(action)) << "Layered Actions should be considered 'layered'"; + } + + { /* Layered Action as it exists on disk, with forward-compatible info in there. */ + bAction action = {{nullptr}}; + FCurve *fake_fcurve = nullptr; + action.layer_array_num = 1; + + BLI_addtail(&action.curves, &fake_fcurve); + EXPECT_TRUE(action_is_layered(action)) + << "Layered Actions with forward-compat data should be considered 'layered'"; + } + + { /* Completely zeroed out Action. */ + bAction action = {{nullptr}}; + EXPECT_TRUE(action_is_layered(action)) << "Zero'ed-out Actions should be considered 'layered'"; + } +} + +} // namespace blender::animrig::versioning::tests diff --git a/source/blender/asset_system/AS_asset_catalog_path.hh b/source/blender/asset_system/AS_asset_catalog_path.hh index 31df4815438f..06fe68a716a7 100644 --- a/source/blender/asset_system/AS_asset_catalog_path.hh +++ b/source/blender/asset_system/AS_asset_catalog_path.hh @@ -10,7 +10,6 @@ #include "BLI_function_ref.hh" #include "BLI_string_ref.hh" -#include "BLI_sys_types.h" #include diff --git a/source/blender/blenfont/intern/blf_internal_types.hh b/source/blender/blenfont/intern/blf_internal_types.hh index 35834bda0fc4..157e5412bbed 100644 --- a/source/blender/blenfont/intern/blf_internal_types.hh +++ b/source/blender/blenfont/intern/blf_internal_types.hh @@ -11,6 +11,8 @@ #include #include +#include "DNA_vec_types.h" + #include "BLF_api.hh" #include "BLI_map.hh" @@ -19,8 +21,13 @@ #include "GPU_texture.hh" #include "GPU_vertex_buffer.hh" +#include + struct ColorManagedDisplay; struct FontBLF; +struct GlyphCacheBLF; +struct GlyphBLF; + namespace blender::gpu { class Batch; class VertBuf; diff --git a/source/blender/blenkernel/BKE_action.hh b/source/blender/blenkernel/BKE_action.hh index 7dfdbff9c97c..b89b629cf7fa 100644 --- a/source/blender/blenkernel/BKE_action.hh +++ b/source/blender/blenkernel/BKE_action.hh @@ -14,8 +14,7 @@ #include "BLI_compiler_attrs.h" #include "BLI_function_ref.hh" -#include "DNA_listBase.h" - +#include "DNA_action_defaults.h" struct BlendDataReader; struct BlendLibReader; struct BlendWriter; diff --git a/source/blender/blenkernel/BKE_anim_data.hh b/source/blender/blenkernel/BKE_anim_data.hh index 95b4d6caf8ca..de8881a5b2e9 100644 --- a/source/blender/blenkernel/BKE_anim_data.hh +++ b/source/blender/blenkernel/BKE_anim_data.hh @@ -8,7 +8,6 @@ * \ingroup bke */ -#include #include #include "BLI_function_ref.hh" diff --git a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh index 5941ca47c514..204243f25f0d 100644 --- a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh +++ b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh @@ -4,7 +4,6 @@ #pragma once -#include "BLI_set.hh" #include "BLI_string_ref.hh" #include "BKE_attribute_filter.hh" diff --git a/source/blender/blenkernel/BKE_armature.hh b/source/blender/blenkernel/BKE_armature.hh index 7a161aef8f8d..a541cb0c382c 100644 --- a/source/blender/blenkernel/BKE_armature.hh +++ b/source/blender/blenkernel/BKE_armature.hh @@ -8,9 +8,10 @@ * \ingroup bke */ +#include + #include "BLI_bounds_types.hh" #include "BLI_function_ref.hh" -#include "BLI_listbase.h" #include "BLI_math_matrix_types.hh" #include "BLI_math_vector_types.hh" #include "BLI_set.hh" diff --git a/source/blender/blenkernel/BKE_asset.hh b/source/blender/blenkernel/BKE_asset.hh index 56529bbf7386..75b9f17976ae 100644 --- a/source/blender/blenkernel/BKE_asset.hh +++ b/source/blender/blenkernel/BKE_asset.hh @@ -9,7 +9,6 @@ #pragma once #include "BLI_compiler_attrs.h" -#include "BLI_utildefines.h" #include "DNA_asset_types.h" diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index 93fc94ae3088..e99a68df3f44 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -9,13 +9,11 @@ #include "BLI_function_ref.hh" #include "BLI_generic_pointer.hh" -#include "BLI_generic_span.hh" #include "BLI_generic_virtual_array.hh" #include "BLI_offset_indices.hh" #include "BLI_set.hh" #include "BLI_struct_equality_utils.hh" -#include "BKE_anonymous_attribute_id.hh" #include "BKE_attribute.h" #include "BKE_attribute_filters.hh" diff --git a/source/blender/blenkernel/BKE_attribute_filter.hh b/source/blender/blenkernel/BKE_attribute_filter.hh index 07f61c9651c4..8f5aa561fb37 100644 --- a/source/blender/blenkernel/BKE_attribute_filter.hh +++ b/source/blender/blenkernel/BKE_attribute_filter.hh @@ -4,7 +4,6 @@ #pragma once -#include "BLI_function_ref.hh" #include "BLI_string_ref.hh" namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_bake_data_block_id.hh b/source/blender/blenkernel/BKE_bake_data_block_id.hh index 4df8b1a1ae09..d69f79a21e09 100644 --- a/source/blender/blenkernel/BKE_bake_data_block_id.hh +++ b/source/blender/blenkernel/BKE_bake_data_block_id.hh @@ -8,7 +8,9 @@ * \ingroup bke */ -#include "BLI_string_ref.hh" +#include +#include + #include "BLI_struct_equality_utils.hh" #include "BLI_vector.hh" diff --git a/source/blender/blenkernel/BKE_bake_data_block_map.hh b/source/blender/blenkernel/BKE_bake_data_block_map.hh index d67e0da4f47f..3765be124d7f 100644 --- a/source/blender/blenkernel/BKE_bake_data_block_map.hh +++ b/source/blender/blenkernel/BKE_bake_data_block_map.hh @@ -8,15 +8,8 @@ * \ingroup bke */ -#include - -#include "BLI_string_ref.hh" -#include "BLI_struct_equality_utils.hh" - #include "BKE_bake_data_block_id.hh" -#include "DNA_ID_enums.h" - namespace blender::bke::bake { /** diff --git a/source/blender/blenkernel/BKE_blender.hh b/source/blender/blenkernel/BKE_blender.hh index 8e442ce6c4bc..434046295481 100644 --- a/source/blender/blenkernel/BKE_blender.hh +++ b/source/blender/blenkernel/BKE_blender.hh @@ -8,8 +8,6 @@ * \brief Blender util stuff */ -#include "BLI_compiler_attrs.h" - struct Main; struct UserDef; diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 510a58eddde9..715115fe08a1 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -38,7 +38,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 17 +#define BLENDER_FILE_SUBVERSION 19 /* UPBGE file format version. */ #define UPBGE_FILE_VERSION UPBGE_VERSION diff --git a/source/blender/blenkernel/BKE_collection.hh b/source/blender/blenkernel/BKE_collection.hh index 389b619159ce..f3e7c8a9c1ad 100644 --- a/source/blender/blenkernel/BKE_collection.hh +++ b/source/blender/blenkernel/BKE_collection.hh @@ -8,7 +8,6 @@ * \ingroup bke */ -#include "BLI_compiler_compat.h" #include "BLI_ghash.h" #include "BLI_iterator.h" #include "BLI_sys_types.h" diff --git a/source/blender/blenkernel/BKE_context.hh b/source/blender/blenkernel/BKE_context.hh index 35aac7c1848d..1c440d70bb98 100644 --- a/source/blender/blenkernel/BKE_context.hh +++ b/source/blender/blenkernel/BKE_context.hh @@ -11,7 +11,6 @@ #include #include "BLI_string_ref.hh" -#include "BLI_utildefines.h" #include "BLI_vector.hh" #include "DNA_listBase.h" diff --git a/source/blender/blenkernel/BKE_curve_legacy_convert.hh b/source/blender/blenkernel/BKE_curve_legacy_convert.hh index 0319f6620e07..f43d5e3bafd0 100644 --- a/source/blender/blenkernel/BKE_curve_legacy_convert.hh +++ b/source/blender/blenkernel/BKE_curve_legacy_convert.hh @@ -8,8 +8,7 @@ * \ingroup bke */ -#include "BKE_curves.hh" - +struct ListBase; struct Curve; struct Curves; diff --git a/source/blender/blenkernel/BKE_customdata.hh b/source/blender/blenkernel/BKE_customdata.hh index 796f30f4d4a5..a4f83343d023 100644 --- a/source/blender/blenkernel/BKE_customdata.hh +++ b/source/blender/blenkernel/BKE_customdata.hh @@ -9,14 +9,14 @@ #pragma once -#include "BLI_cpp_type.hh" +#include + #include "BLI_implicit_sharing.h" #include "BLI_memory_counter_fwd.hh" #include "BLI_set.hh" #include "BLI_span.hh" #include "BLI_string_ref.hh" #include "BLI_sys_types.h" -#include "BLI_utildefines.h" #include "BLI_vector.hh" #include "BKE_volume_enums.hh" diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h index 4a527d8cd117..03c0e2e9bcb0 100644 --- a/source/blender/blenkernel/BKE_customdata_file.h +++ b/source/blender/blenkernel/BKE_customdata_file.h @@ -8,6 +8,8 @@ * \ingroup bke */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenkernel/BKE_editmesh.hh b/source/blender/blenkernel/BKE_editmesh.hh index b1271b877e79..c1129e88b472 100644 --- a/source/blender/blenkernel/BKE_editmesh.hh +++ b/source/blender/blenkernel/BKE_editmesh.hh @@ -17,8 +17,6 @@ #include "BLI_array.hh" #include "BLI_math_vector_types.hh" -#include "DNA_customdata_types.h" - #include "bmesh.hh" struct BMLoop; @@ -99,7 +97,7 @@ BMEditMesh *BKE_editmesh_from_object(Object *ob); /** * Return whether the evaluated mesh is a "descendant" of the original mesh: whether it is a * version of the original mesh propagated during evaluation. This will be false if the mesh was - * taken from from an different object during evaluation, with the object info node for example. + * taken from an different object during evaluation, with the object info node for example. */ bool BKE_editmesh_eval_orig_map_available(const Mesh &mesh_eval, const Mesh *mesh_orig); diff --git a/source/blender/blenkernel/BKE_global.hh b/source/blender/blenkernel/BKE_global.hh index c66fe106db16..58872c5d7b4c 100644 --- a/source/blender/blenkernel/BKE_global.hh +++ b/source/blender/blenkernel/BKE_global.hh @@ -11,7 +11,6 @@ * for every fresh Blender run. */ -#include "BLI_utildefines.h" #include "DNA_listBase.h" struct Main; diff --git a/source/blender/blenkernel/BKE_grease_pencil.hh b/source/blender/blenkernel/BKE_grease_pencil.hh index 170feb78cde5..e6825b4f0f44 100644 --- a/source/blender/blenkernel/BKE_grease_pencil.hh +++ b/source/blender/blenkernel/BKE_grease_pencil.hh @@ -12,14 +12,12 @@ #include #include "BLI_color.hh" -#include "BLI_function_ref.hh" #include "BLI_implicit_sharing_ptr.hh" #include "BLI_map.hh" #include "BLI_math_matrix_types.hh" #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" #include "BLI_shared_cache.hh" -#include "BLI_utility_mixins.hh" #include "BLI_virtual_array_fwd.hh" #include "DNA_grease_pencil_types.h" diff --git a/source/blender/blenkernel/BKE_image.hh b/source/blender/blenkernel/BKE_image.hh index 5d280baee2c2..eb599903fe99 100644 --- a/source/blender/blenkernel/BKE_image.hh +++ b/source/blender/blenkernel/BKE_image.hh @@ -8,12 +8,10 @@ */ #include "BLI_compiler_attrs.h" -#include "BLI_utildefines.h" - -#include "BLI_rect.h" #include +struct rcti; struct Depsgraph; struct GPUTexture; struct ID; diff --git a/source/blender/blenkernel/BKE_image_format.hh b/source/blender/blenkernel/BKE_image_format.hh index b24a71d3c6a9..a9c7df7798d0 100644 --- a/source/blender/blenkernel/BKE_image_format.hh +++ b/source/blender/blenkernel/BKE_image_format.hh @@ -8,6 +8,8 @@ * \ingroup bke */ +#include + struct BlendDataReader; struct BlendWriter; struct ID; diff --git a/source/blender/blenkernel/BKE_image_partial_update.hh b/source/blender/blenkernel/BKE_image_partial_update.hh index d437f8e43ce3..a6e77a03afad 100644 --- a/source/blender/blenkernel/BKE_image_partial_update.hh +++ b/source/blender/blenkernel/BKE_image_partial_update.hh @@ -15,10 +15,9 @@ #pragma once -#include "BLI_utildefines.h" - #include "BLI_rect.h" +#include "BKE_image.hh" #include "BKE_image_wrappers.hh" #include "DNA_image_types.h" diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index 81d87dfa31ac..de8572885a58 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -14,8 +14,16 @@ extern "C" { struct Main; /** - * Called from #do_versions() in `readfile.cc` to convert the old 'IPO/adrcode' system - * to the new 'Animato/RNA' system. + * Called from #do_versions() in `readfile.cc` to convert the old 'IPO/adrcode' + * system to the new Layered Action system. + * + * Note: this *only* deals with animation data that is *pre-Animato*, and + * upgrades it all the way past Animato to modern Layered Actions and drivers. + * Actions that are already Animato actions are ignored, as they are versioned + * elsewhere (see `animrig::versioning::convert_legacy_actions()`). This is admittedly + * weird, but it's due to the fact that versioning pre-Animato data requires + * creating new datablocks, which must happen at a stage *after* the standard + * versioning where the simpler Animato-to-Layered upgrades are done. * * The basic method used here, is to loop over data-blocks which have IPO-data, * and add those IPO's to new AnimData blocks as Actions. @@ -26,7 +34,7 @@ struct Main; * * \note Currently done after all file reading. */ -void do_versions_ipos_to_animato(struct Main *bmain); +void do_versions_ipos_to_layered_actions(struct Main *bmain); /* --------------------- xxx stuff ------------------------ */ diff --git a/source/blender/blenkernel/BKE_keyconfig.h b/source/blender/blenkernel/BKE_keyconfig.h index 4b42c90d0e02..9d7448e19193 100644 --- a/source/blender/blenkernel/BKE_keyconfig.h +++ b/source/blender/blenkernel/BKE_keyconfig.h @@ -7,6 +7,8 @@ * \ingroup bke */ +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenkernel/BKE_lattice.hh b/source/blender/blenkernel/BKE_lattice.hh index b0452d022d50..87fe627c043d 100644 --- a/source/blender/blenkernel/BKE_lattice.hh +++ b/source/blender/blenkernel/BKE_lattice.hh @@ -13,7 +13,6 @@ #include "BLI_bounds_types.hh" #include "BLI_compiler_attrs.h" #include "BLI_math_vector_types.hh" -#include "BLI_sys_types.h" struct BMEditMesh; struct BPoint; diff --git a/source/blender/blenkernel/BKE_lib_query.hh b/source/blender/blenkernel/BKE_lib_query.hh index 7888896b8115..d2f5c5f2725a 100644 --- a/source/blender/blenkernel/BKE_lib_query.hh +++ b/source/blender/blenkernel/BKE_lib_query.hh @@ -22,7 +22,6 @@ #include "DNA_ID.h" #include "BLI_function_ref.hh" -#include "BLI_sys_types.h" #include diff --git a/source/blender/blenkernel/BKE_library.hh b/source/blender/blenkernel/BKE_library.hh index e78cf1529a41..1e53c03a2e89 100644 --- a/source/blender/blenkernel/BKE_library.hh +++ b/source/blender/blenkernel/BKE_library.hh @@ -9,8 +9,6 @@ * API to manage `Library` data-blocks. */ -#include "BLI_compiler_attrs.h" - struct Library; struct Main; diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h index bd139a73d703..0ad17473f7a1 100644 --- a/source/blender/blenkernel/BKE_lightprobe.h +++ b/source/blender/blenkernel/BKE_lightprobe.h @@ -9,6 +9,8 @@ * \brief General operations for probes. */ +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenkernel/BKE_main_idmap.hh b/source/blender/blenkernel/BKE_main_idmap.hh index a59eac1590b4..05707420b2ec 100644 --- a/source/blender/blenkernel/BKE_main_idmap.hh +++ b/source/blender/blenkernel/BKE_main_idmap.hh @@ -18,7 +18,9 @@ */ #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" +struct Library; struct ID; struct IDNameLib_Map; struct Main; diff --git a/source/blender/blenkernel/BKE_mesh.hh b/source/blender/blenkernel/BKE_mesh.hh index e72c8c41f62f..24943910b1c9 100644 --- a/source/blender/blenkernel/BKE_mesh.hh +++ b/source/blender/blenkernel/BKE_mesh.hh @@ -12,8 +12,8 @@ #include "BLI_offset_indices.hh" #include "BLI_string_ref.hh" -#include "BKE_mesh.h" -#include "BKE_mesh_types.hh" +#include "BKE_mesh.h" // IWYU pragma: export +#include "BKE_mesh_types.hh" // IWYU pragma: export namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_mesh_fair.hh b/source/blender/blenkernel/BKE_mesh_fair.hh index d18014481fc5..3cfdfaa9ae85 100644 --- a/source/blender/blenkernel/BKE_mesh_fair.hh +++ b/source/blender/blenkernel/BKE_mesh_fair.hh @@ -12,7 +12,6 @@ #include "BLI_math_vector_types.hh" #include "BLI_span.hh" -#include "BLI_utildefines.h" struct Mesh; diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.hh b/source/blender/blenkernel/BKE_mesh_legacy_convert.hh index b1300add9307..439134a89fd1 100644 --- a/source/blender/blenkernel/BKE_mesh_legacy_convert.hh +++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.hh @@ -8,14 +8,13 @@ * \ingroup bke */ -#include "BLI_resource_scope.hh" #include "BLI_span.hh" -#include "BLI_utildefines.h" struct CustomData; struct Main; struct Mesh; struct MFace; +struct CustomDataLayer; namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_mesh_legacy_derived_mesh.hh b/source/blender/blenkernel/BKE_mesh_legacy_derived_mesh.hh index 5c54c27ce20e..0a3d439979f1 100644 --- a/source/blender/blenkernel/BKE_mesh_legacy_derived_mesh.hh +++ b/source/blender/blenkernel/BKE_mesh_legacy_derived_mesh.hh @@ -47,9 +47,7 @@ * as it is and stick with using BMesh and CDDM. */ -#include "BLI_compiler_attrs.h" #include "BLI_math_vector_types.hh" -#include "BLI_span.hh" #include "DNA_customdata_types.h" diff --git a/source/blender/blenkernel/BKE_mesh_remap.hh b/source/blender/blenkernel/BKE_mesh_remap.hh index 4938c4b2748b..f41e9f11b576 100644 --- a/source/blender/blenkernel/BKE_mesh_remap.hh +++ b/source/blender/blenkernel/BKE_mesh_remap.hh @@ -9,7 +9,6 @@ */ #include "BLI_math_matrix.h" -#include "BLI_math_rotation.h" #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" diff --git a/source/blender/blenkernel/BKE_mesh_runtime.hh b/source/blender/blenkernel/BKE_mesh_runtime.hh index 7f166a722bd1..93a164508426 100644 --- a/source/blender/blenkernel/BKE_mesh_runtime.hh +++ b/source/blender/blenkernel/BKE_mesh_runtime.hh @@ -9,6 +9,9 @@ * This file contains access functions for the Mesh.runtime struct. */ +#include "BLI_math_vector_types.hh" +#include "BLI_span.hh" + struct BMEditMesh; struct CustomData_MeshMasks; struct Depsgraph; diff --git a/source/blender/blenkernel/BKE_mesh_tangent.hh b/source/blender/blenkernel/BKE_mesh_tangent.hh index 2823e88cbe2a..ddf3952006fc 100644 --- a/source/blender/blenkernel/BKE_mesh_tangent.hh +++ b/source/blender/blenkernel/BKE_mesh_tangent.hh @@ -14,6 +14,7 @@ #include "BLI_sys_types.h" struct ReportList; +struct Mesh; /** * Compute simplified tangent space normals, i.e. diff --git a/source/blender/blenkernel/BKE_multires.hh b/source/blender/blenkernel/BKE_multires.hh index 10cb76f04d65..a8e4c8ed8f61 100644 --- a/source/blender/blenkernel/BKE_multires.hh +++ b/source/blender/blenkernel/BKE_multires.hh @@ -215,4 +215,4 @@ BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3] */ void multires_do_versions_simple_to_catmull_clark(Object *object, MultiresModifierData *mmd); -#include "intern/multires_inline.hh" +#include "intern/multires_inline.hh" // IWYU pragma: export diff --git a/source/blender/blenkernel/BKE_node.hh b/source/blender/blenkernel/BKE_node.hh index b764be051a27..fcd607b3a754 100644 --- a/source/blender/blenkernel/BKE_node.hh +++ b/source/blender/blenkernel/BKE_node.hh @@ -10,11 +10,8 @@ #include "BLI_compiler_compat.h" #include "BLI_ghash.h" -#include "BLI_math_vector_types.hh" #include "BLI_span.hh" -#include "DNA_listBase.h" - #include "BKE_volume_enums.hh" /* for FOREACH_NODETREE_BEGIN */ @@ -150,53 +147,59 @@ using NodeInverseEvalFunction = void (*)(blender::nodes::inverse_eval::InverseEv */ struct bNodeSocketType { /** Identifier name. */ - char idname[64]; + std::string idname; /** Type label. */ - char label[64]; + std::string label; /** Sub-type label. */ - char subtype_label[64]; - - void (*draw)( - bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, StringRefNull text); - void (*draw_color)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color); - void (*draw_color_simple)(const bNodeSocketType *socket_type, float *r_color); - - void (*interface_draw)(ID *id, bNodeTreeInterfaceSocket *socket, bContext *C, uiLayout *layout); + std::string subtype_label; + + void (*draw)(bContext *C, + uiLayout *layout, + PointerRNA *ptr, + PointerRNA *node_ptr, + StringRefNull text) = nullptr; + void (*draw_color)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color) = nullptr; + void (*draw_color_simple)(const bNodeSocketType *socket_type, float *r_color) = nullptr; + + void (*interface_draw)(ID *id, + bNodeTreeInterfaceSocket *socket, + bContext *C, + uiLayout *layout) = nullptr; void (*interface_init_socket)(ID *id, const bNodeTreeInterfaceSocket *interface_socket, bNode *node, bNodeSocket *socket, - StringRefNull data_path); + StringRefNull data_path) = nullptr; void (*interface_from_socket)(ID *id, bNodeTreeInterfaceSocket *interface_socket, const bNode *node, - const bNodeSocket *socket); + const bNodeSocket *socket) = nullptr; /* RNA integration */ - ExtensionRNA ext_socket; - ExtensionRNA ext_interface; + ExtensionRNA ext_socket = {}; + ExtensionRNA ext_interface = {}; /* for standard socket types in C */ - int type, subtype; + int type = 0, subtype = 0; /* When set, bNodeSocket->limit does not have any effect anymore. */ - bool use_link_limits_of_type; - int input_link_limit; - int output_link_limit; + bool use_link_limits_of_type = 0; + int input_link_limit = 0; + int output_link_limit = 0; /* Callback to free the socket type. */ - void (*free_self)(bNodeSocketType *stype); + void (*free_self)(bNodeSocketType *stype) = nullptr; /* Return the CPPType of this socket. */ - const blender::CPPType *base_cpp_type; + const blender::CPPType *base_cpp_type = nullptr; /* Get the value of this socket in a generic way. */ - SocketGetCPPValueFunction get_base_cpp_value; + SocketGetCPPValueFunction get_base_cpp_value = nullptr; /* Get geometry nodes cpp type. */ - const blender::CPPType *geometry_nodes_cpp_type; + const blender::CPPType *geometry_nodes_cpp_type = nullptr; /* Get geometry nodes cpp value. */ - SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value; + SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value = nullptr; /* Default value for this socket type. */ - const void *geometry_nodes_default_cpp_value; + const void *geometry_nodes_default_cpp_value = nullptr; }; using NodeInitExecFunction = void *(*)(bNodeExecContext *context, @@ -216,47 +219,50 @@ using NodeMaterialXFunction = void (*)(void *data, bNode *node, bNodeSocket *out * implementing the node behavior. */ struct bNodeType { - char idname[64]; /* identifier name */ + std::string idname; int type; - char ui_name[64]; /* MAX_NAME */ - char ui_description[256]; + std::string ui_name; + std::string ui_description; int ui_icon; /** Should usually use the idname instead, but this enum type is still exposed in Python. */ - const char *enum_name_legacy; + const char *enum_name_legacy = nullptr; - float width, minwidth, maxwidth; - float height, minheight, maxheight; - short nclass, flag; + float width = 0.0f, minwidth = 0.0f, maxwidth = 0.0f; + float height = 0.0f, minheight = 0.0f, maxheight = 0.0f; + short nclass = 0, flag = 0; /* templates for static sockets */ - bNodeSocketTemplate *inputs, *outputs; + bNodeSocketTemplate *inputs = nullptr, *outputs = nullptr; - char storagename[64]; /* struct name for DNA */ + std::string storagename; /* struct name for DNA */ /* Draw the option buttons on the node */ - void (*draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr); + void (*draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr) = nullptr; /* Additional parameters in the side panel */ - void (*draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr); + void (*draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr) = nullptr; /* Additional drawing on backdrop */ - void (*draw_backdrop)(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y); + void (*draw_backdrop)(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y) = nullptr; /** * Optional custom label function for the node header. * \note Used as a fallback when #bNode.label isn't set. */ - void (*labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy); + void (*labelfunc)(const bNodeTree *ntree, + const bNode *node, + char *label, + int label_maxncpy) = nullptr; /** Optional override for node class, used for drawing node header. */ - int (*ui_class)(const bNode *node); + int (*ui_class)(const bNode *node) = nullptr; /** Optional dynamic description of what the node group does. */ - std::string (*ui_description_fn)(const bNode &node); + std::string (*ui_description_fn)(const bNode &node) = nullptr; /** Called when the node is updated in the editor. */ - void (*updatefunc)(bNodeTree *ntree, bNode *node); + void (*updatefunc)(bNodeTree *ntree, bNode *node) = nullptr; /** Check and update if internal ID data has changed. */ - void (*group_update_func)(bNodeTree *ntree, bNode *node); + void (*group_update_func)(bNodeTree *ntree, bNode *node) = nullptr; /** * Initialize a new node instance of this type after creation. @@ -264,7 +270,7 @@ struct bNodeType { * \note Assignments to `node->id` must not increment the user of the ID. * This is handled by the caller of this callback. */ - void (*initfunc)(bNodeTree *ntree, bNode *node); + void (*initfunc)(bNodeTree *ntree, bNode *node) = nullptr; /** * Free the node instance. * @@ -272,20 +278,20 @@ struct bNodeType { * while freeing #Main, the state of this ID is undefined. * Higher level logic to remove the node handles the user-count. */ - void (*freefunc)(bNode *node); + void (*freefunc)(bNode *node) = nullptr; /** Make a copy of the node instance. */ - void (*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node); + void (*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node) = nullptr; /* Registerable API callback versions, called in addition to C callbacks */ - void (*initfunc_api)(const bContext *C, PointerRNA *ptr); - void (*freefunc_api)(PointerRNA *ptr); - void (*copyfunc_api)(PointerRNA *ptr, const bNode *src_node); + void (*initfunc_api)(const bContext *C, PointerRNA *ptr) = nullptr; + void (*freefunc_api)(PointerRNA *ptr) = nullptr; + void (*copyfunc_api)(PointerRNA *ptr, const bNode *src_node) = nullptr; /** * An additional poll test for deciding whether nodes should be an option in search menus. * Potentially more strict poll than #poll(), but doesn't have to check the same things. */ - bool (*add_ui_poll)(const bContext *C); + bool (*add_ui_poll)(const bContext *C) = nullptr; /** * Can this node type be added to a node tree? @@ -296,47 +302,49 @@ struct bNodeType { * when it's not just a dummy, that is, if it actually wants to access * the returned disabled-hint (null-check needed!). */ - bool (*poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint); + bool (*poll)(const bNodeType *ntype, + const bNodeTree *nodetree, + const char **r_disabled_hint) = nullptr; /** * Can this node be added to a node tree? * \param r_disabled_hint: See `poll()`. */ bool (*poll_instance)(const bNode *node, const bNodeTree *nodetree, - const char **r_disabled_hint); + const char **r_disabled_hint) = nullptr; /* Optional handling of link insertion. Returns false if the link shouldn't be created. */ - bool (*insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link); + bool (*insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link) = nullptr; - void (*free_self)(bNodeType *ntype); + void (*free_self)(bNodeType *ntype) = nullptr; /* **** execution callbacks **** */ - NodeInitExecFunction init_exec_fn; - NodeFreeExecFunction free_exec_fn; - NodeExecFunction exec_fn; + NodeInitExecFunction init_exec_fn = nullptr; + NodeFreeExecFunction free_exec_fn = nullptr; + NodeExecFunction exec_fn = nullptr; /* gpu */ - NodeGPUExecFunction gpu_fn; + NodeGPUExecFunction gpu_fn = nullptr; /* MaterialX */ - NodeMaterialXFunction materialx_fn; + NodeMaterialXFunction materialx_fn = nullptr; /* Get an instance of this node's compositor operation. Freeing the instance is the * responsibility of the caller. */ - NodeGetCompositorOperationFunction get_compositor_operation; + NodeGetCompositorOperationFunction get_compositor_operation = nullptr; /* Get an instance of this node's compositor shader node. Freeing the instance is the * responsibility of the caller. */ - NodeGetCompositorShaderNodeFunction get_compositor_shader_node; + NodeGetCompositorShaderNodeFunction get_compositor_shader_node = nullptr; /* A message to display in the node header for unsupported compositor nodes. The message * is assumed to be static and thus require no memory handling. This field is to be removed when * all nodes are supported. */ - const char *compositor_unsupported_message; + const char *compositor_unsupported_message = nullptr; /* Build a multi-function for this node. */ - NodeMultiFunctionBuildFunction build_multi_function; + NodeMultiFunctionBuildFunction build_multi_function = nullptr; /* Execute a geometry node. */ - NodeGeometryExecFunction geometry_node_execute; + NodeGeometryExecFunction geometry_node_execute = nullptr; /** * Declares which sockets and panels the node has. It has to be able to generate a declaration @@ -344,7 +352,7 @@ struct bNodeType { * is not provided, then the declaration should be generated as much as possible and everything * that depends on the node context should be skipped. */ - NodeDeclareFunction declare; + NodeDeclareFunction declare = nullptr; /** * Declaration of the node outside of any context. If the node declaration is never dependent on @@ -353,51 +361,51 @@ struct bNodeType { * the node. In this case, the static declaration is mostly just a hint, and does not have to * match with the final node. */ - blender::nodes::NodeDeclaration *static_declaration; + blender::nodes::NodeDeclaration *static_declaration = nullptr; /** * Add to the list of search names and operations gathered by node link drag searching. * Usually it isn't necessary to override the default behavior here, but a node type can have * custom behavior here like adding custom search items. */ - NodeGatherSocketLinkOperationsFunction gather_link_search_ops; + NodeGatherSocketLinkOperationsFunction gather_link_search_ops = nullptr; /** Get extra information that is drawn next to the node. */ - NodeExtraInfoFunction get_extra_info; + NodeExtraInfoFunction get_extra_info = nullptr; /** * "Abstract" evaluation of the node. It tells the caller which parts of the inputs affect which * parts of the outputs. */ - NodeElemEvalFunction eval_elem; + NodeElemEvalFunction eval_elem = nullptr; /** * Similar to #eval_elem but tells the caller which parts of the inputs have to be modified to * modify the outputs. */ - NodeInverseElemEvalFunction eval_inverse_elem; + NodeInverseElemEvalFunction eval_inverse_elem = nullptr; /** * Evaluates the inverse of the node if possible. This evaluation has access to logged values of * all input sockets as well as new values for output sockets. Based on that, it should determine * how one or more of the inputs should change so that the output becomes the given one. */ - NodeInverseEvalFunction eval_inverse; + NodeInverseEvalFunction eval_inverse = nullptr; /** * Registers operators that are specific to this node. This allows nodes to be more * self-contained compared to the alternative to registering all operators in a more central * place. */ - void (*register_operators)(); + void (*register_operators)() = nullptr; /** True when the node cannot be muted. */ - bool no_muting; + bool no_muting = false; /** True when the node still works but it's usage is discouraged. */ - const char *deprecation_notice; + const char *deprecation_notice = nullptr; /* RNA integration */ - ExtensionRNA rna_ext; + ExtensionRNA rna_ext = {}; }; /** #bNodeType.nclass (for add-menu and themes). */ @@ -449,38 +457,41 @@ enum class NodeColorTag { using bNodeClassCallback = void (*)(void *calldata, int nclass, StringRefNull name); struct bNodeTreeType { - int type; /* type identifier */ - char idname[64]; /* identifier name */ + int type = 0; /* type identifier */ + std::string idname; /* identifier name */ /* The ID name of group nodes for this type. */ - char group_idname[64]; + std::string group_idname; - char ui_name[64]; - char ui_description[256]; - int ui_icon; + std::string ui_name; + std::string ui_description; + int ui_icon = 0; /* callbacks */ /* Iteration over all node classes. */ - void (*foreach_nodeclass)(void *calldata, bNodeClassCallback func); + void (*foreach_nodeclass)(void *calldata, bNodeClassCallback func) = nullptr; /* Check visibility in the node editor */ - bool (*poll)(const bContext *C, bNodeTreeType *ntreetype); + bool (*poll)(const bContext *C, bNodeTreeType *ntreetype) = nullptr; /* Select a node tree from the context */ - void (*get_from_context)( - const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from); + void (*get_from_context)(const bContext *C, + bNodeTreeType *ntreetype, + bNodeTree **r_ntree, + ID **r_id, + ID **r_from) = nullptr; /* calls allowing threaded composite */ - void (*localize)(bNodeTree *localtree, bNodeTree *ntree); - void (*local_merge)(Main *bmain, bNodeTree *localtree, bNodeTree *ntree); + void (*localize)(bNodeTree *localtree, bNodeTree *ntree) = nullptr; + void (*local_merge)(Main *bmain, bNodeTree *localtree, bNodeTree *ntree) = nullptr; /* Tree update. Overrides `nodetype->updatetreefunc`. */ - void (*update)(bNodeTree *ntree); + void (*update)(bNodeTree *ntree) = nullptr; - bool (*validate_link)(eNodeSocketDatatype from, eNodeSocketDatatype to); + bool (*validate_link)(eNodeSocketDatatype from, eNodeSocketDatatype to) = nullptr; - void (*node_add_init)(bNodeTree *ntree, bNode *bnode); + void (*node_add_init)(bNodeTree *ntree, bNode *bnode) = nullptr; /* Check if the socket type is valid for this tree type. */ - bool (*valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type); + bool (*valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type) = nullptr; /** * If true, then some UI elements related to building node groups will be hidden. @@ -488,10 +499,10 @@ struct bNodeTreeType { * * This is a uint8_t instead of bool to avoid compiler warnings in generated RNA code. */ - uint8_t no_group_interface; + uint8_t no_group_interface = 0; /* RNA integration */ - ExtensionRNA rna_ext; + ExtensionRNA rna_ext = {}; }; /** \} */ @@ -1699,7 +1710,7 @@ std::optional nodeSocketShortLabel(const bNodeSocket *sock); /** * Initialize a new node type struct with default values and callbacks. */ -void node_type_base(bNodeType *ntype, int type, StringRefNull name, short nclass); +void node_type_base(bNodeType *ntype, int type, short nclass); void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index c6de5535c88e..d4756eec3ba2 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -10,7 +10,6 @@ #include "BLI_cache_mutex.hh" #include "BLI_math_vector_types.hh" #include "BLI_multi_value_map.hh" -#include "BLI_resource_scope.hh" #include "BLI_set.hh" #include "BLI_utility_mixins.hh" #include "BLI_vector.hh" diff --git a/source/blender/blenkernel/BKE_node_socket_value.hh b/source/blender/blenkernel/BKE_node_socket_value.hh index d26892e9367a..ac939af4f26d 100644 --- a/source/blender/blenkernel/BKE_node_socket_value.hh +++ b/source/blender/blenkernel/BKE_node_socket_value.hh @@ -11,7 +11,6 @@ #include "DNA_node_types.h" #include "BLI_any.hh" -#include "BLI_cpp_type.hh" #include "BLI_generic_pointer.hh" namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_node_tree_interface.hh b/source/blender/blenkernel/BKE_node_tree_interface.hh index 67748d171b85..b451e9066552 100644 --- a/source/blender/blenkernel/BKE_node_tree_interface.hh +++ b/source/blender/blenkernel/BKE_node_tree_interface.hh @@ -9,12 +9,10 @@ #include "BKE_node.hh" -#include #include #include "BLI_cache_mutex.hh" #include "BLI_parameter_pack_utils.hh" -#include "BLI_vector.hh" #include "BLI_vector_set.hh" namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_paint_bvh.hh b/source/blender/blenkernel/BKE_paint_bvh.hh index 606ab45d7040..6c8ae08debfa 100644 --- a/source/blender/blenkernel/BKE_paint_bvh.hh +++ b/source/blender/blenkernel/BKE_paint_bvh.hh @@ -9,17 +9,13 @@ * \brief A BVH for high poly meshes. */ -#include -#include #include #include "BLI_array.hh" #include "BLI_bit_group_vector.hh" #include "BLI_bit_vector.hh" #include "BLI_bounds_types.hh" -#include "BLI_compiler_compat.h" #include "BLI_function_ref.hh" -#include "BLI_generic_span.hh" #include "BLI_index_mask_fwd.hh" #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" @@ -28,6 +24,7 @@ #include "BLI_string_ref.hh" #include "BLI_utildefines.h" #include "BLI_vector.hh" +#include "BLI_vector_set.hh" struct BMFace; struct BMLog; @@ -566,14 +563,14 @@ Span vert_positions_eval_from_eval(const Object &object_eval); /** * Retrieve write access to the evaluated deform positions, or the original object positions if - * there are no deformation modifiers. Writing the the evaluated positions is necessary because + * there are no deformation modifiers. Writing the evaluated positions is necessary because * they are used for drawing and we don't run a full dependency graph update whenever they are * changed. */ MutableSpan vert_positions_eval_for_write(const Depsgraph &depsgraph, Object &object_orig); /** - * Return the vertex normals corresponding the the positions from #vert_positions_eval. This may be + * Return the vertex normals corresponding the positions from #vert_positions_eval. This may be * a reference to the normals cache on the original mesh. */ Span vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig); diff --git a/source/blender/blenkernel/BKE_paint_bvh_pixels.hh b/source/blender/blenkernel/BKE_paint_bvh_pixels.hh index f447b12bd3bf..adc9b7a2bc9b 100644 --- a/source/blender/blenkernel/BKE_paint_bvh_pixels.hh +++ b/source/blender/blenkernel/BKE_paint_bvh_pixels.hh @@ -4,6 +4,7 @@ #pragma once +#include "BLI_array.hh" #include "BLI_math_vector.hh" #include "BLI_rect.h" #include "BLI_vector.hh" @@ -12,6 +13,7 @@ #include "BKE_image.hh" #include "BKE_image_wrappers.hh" +#include "BKE_paint_bvh.hh" #include "IMB_imbuf_types.hh" diff --git a/source/blender/blenkernel/BKE_pointcloud.hh b/source/blender/blenkernel/BKE_pointcloud.hh index 31d47ad47e7b..db0b69d90200 100644 --- a/source/blender/blenkernel/BKE_pointcloud.hh +++ b/source/blender/blenkernel/BKE_pointcloud.hh @@ -9,8 +9,6 @@ * \brief General operations for point clouds. */ -#include - #include "BLI_bounds_types.hh" #include "BLI_math_vector_types.hh" #include "BLI_shared_cache.hh" diff --git a/source/blender/blenkernel/BKE_preview_image.hh b/source/blender/blenkernel/BKE_preview_image.hh index 83441621e9df..0b7eae25a43c 100644 --- a/source/blender/blenkernel/BKE_preview_image.hh +++ b/source/blender/blenkernel/BKE_preview_image.hh @@ -8,8 +8,6 @@ #include #include -#include "BLI_sys_types.h" - #include "DNA_ID_enums.h" struct BlendDataReader; diff --git a/source/blender/blenkernel/BKE_report.hh b/source/blender/blenkernel/BKE_report.hh index 792650c075dd..f51373071d29 100644 --- a/source/blender/blenkernel/BKE_report.hh +++ b/source/blender/blenkernel/BKE_report.hh @@ -11,7 +11,6 @@ #include #include "BLI_compiler_attrs.h" -#include "BLI_utildefines.h" #include "DNA_windowmanager_types.h" /** diff --git a/source/blender/blenkernel/BKE_scene.hh b/source/blender/blenkernel/BKE_scene.hh index 268e43193461..42e2e1daa66f 100644 --- a/source/blender/blenkernel/BKE_scene.hh +++ b/source/blender/blenkernel/BKE_scene.hh @@ -241,12 +241,6 @@ int BKE_render_preview_pixel_size(const RenderData *r); /**********************************/ -/** - * Apply the needed correction factor to value, based on unit_type - * (only length-related are affected currently) and `unit->scale_length`. - */ -double BKE_scene_unit_scale(const UnitSettings *unit, int unit_type, double value); - /* Multi-view. */ bool BKE_scene_multiview_is_stereo3d(const RenderData *rd); diff --git a/source/blender/blenkernel/BKE_scene_runtime.hh b/source/blender/blenkernel/BKE_scene_runtime.hh index bbb118a5c94c..3d7e5140f037 100644 --- a/source/blender/blenkernel/BKE_scene_runtime.hh +++ b/source/blender/blenkernel/BKE_scene_runtime.hh @@ -8,6 +8,8 @@ #include "BLI_timeit.hh" #include "BLI_utility_mixins.hh" +#include "DNA_node_types.h" + struct Depsgraph; namespace blender::bke { diff --git a/source/blender/blenkernel/BKE_screen.hh b/source/blender/blenkernel/BKE_screen.hh index 8700a606cd3b..0bc7c18c2e18 100644 --- a/source/blender/blenkernel/BKE_screen.hh +++ b/source/blender/blenkernel/BKE_screen.hh @@ -13,9 +13,10 @@ #include "BLI_compiler_attrs.h" #include "BLI_map.hh" #include "BLI_math_vector_types.hh" -#include "BLI_rect.h" #include "BLI_vector.hh" +#include "DNA_vec_types.h" + #include "RNA_types.hh" #include "BKE_context.hh" diff --git a/source/blender/blenkernel/BKE_sequencer_offscreen.h b/source/blender/blenkernel/BKE_sequencer_offscreen.h index 616a2c26ba80..382798aa3e0c 100644 --- a/source/blender/blenkernel/BKE_sequencer_offscreen.h +++ b/source/blender/blenkernel/BKE_sequencer_offscreen.h @@ -7,6 +7,10 @@ /** \file * \ingroup bke */ + +#include "DNA_object_enums.h" +#include "DNA_view3d_enums.h" + #include "IMB_imbuf_types.hh" #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_shrinkwrap.hh b/source/blender/blenkernel/BKE_shrinkwrap.hh index f662130d2cd7..e69cf06a39f9 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.hh +++ b/source/blender/blenkernel/BKE_shrinkwrap.hh @@ -10,6 +10,7 @@ /* Shrinkwrap stuff */ #include "BKE_bvhutils.hh" +#include "BKE_context.hh" #include "BLI_array.hh" #include "BLI_bit_vector.hh" #include "BLI_math_vector_types.hh" @@ -29,6 +30,7 @@ * (So that you don't have to pass an enormous amount of arguments to functions) */ +struct Depsgraph; struct BVHTree; struct MDeformVert; struct Mesh; diff --git a/source/blender/blenkernel/BKE_subdiv.hh b/source/blender/blenkernel/BKE_subdiv.hh index 774f2a42bba1..078b6896cedd 100644 --- a/source/blender/blenkernel/BKE_subdiv.hh +++ b/source/blender/blenkernel/BKE_subdiv.hh @@ -9,7 +9,6 @@ #pragma once #include "BLI_compiler_compat.h" -#include "BLI_sys_types.h" struct Mesh; struct MultiresModifierData; @@ -306,4 +305,4 @@ BLI_INLINE float crease_to_sharpness(float edge_crease); } // namespace blender::bke::subdiv -#include "intern/subdiv_inline.hh" +#include "intern/subdiv_inline.hh" // IWYU pragma: export diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.hh b/source/blender/blenkernel/BKE_subdiv_ccg.hh index f820d62b4a71..8d11d667fdd3 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.hh +++ b/source/blender/blenkernel/BKE_subdiv_ccg.hh @@ -16,7 +16,6 @@ #include "BLI_index_mask_fwd.hh" #include "BLI_offset_indices.hh" #include "BLI_span.hh" -#include "BLI_sys_types.h" #include "BLI_utility_mixins.hh" #include "BLI_vector.hh" diff --git a/source/blender/blenkernel/BKE_subdiv_deform.hh b/source/blender/blenkernel/BKE_subdiv_deform.hh index 92c8a0e85d1a..2aa71a9344c3 100644 --- a/source/blender/blenkernel/BKE_subdiv_deform.hh +++ b/source/blender/blenkernel/BKE_subdiv_deform.hh @@ -10,7 +10,6 @@ #include "BLI_math_vector_types.hh" #include "BLI_span.hh" -#include "BLI_sys_types.h" struct Mesh; diff --git a/source/blender/blenkernel/BKE_subdiv_eval.hh b/source/blender/blenkernel/BKE_subdiv_eval.hh index f3af1f524f47..6cbb030b3b61 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.hh +++ b/source/blender/blenkernel/BKE_subdiv_eval.hh @@ -10,7 +10,6 @@ #include "BLI_math_vector_types.hh" #include "BLI_span.hh" -#include "BLI_sys_types.h" struct Mesh; struct OpenSubdiv_EvaluatorCache; diff --git a/source/blender/blenkernel/BKE_subdiv_mesh.hh b/source/blender/blenkernel/BKE_subdiv_mesh.hh index fa46fd023188..2565eb3dd1b7 100644 --- a/source/blender/blenkernel/BKE_subdiv_mesh.hh +++ b/source/blender/blenkernel/BKE_subdiv_mesh.hh @@ -10,7 +10,6 @@ #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" -#include "BLI_sys_types.h" struct Mesh; diff --git a/source/blender/blenkernel/BKE_subdiv_modifier.hh b/source/blender/blenkernel/BKE_subdiv_modifier.hh index bf364cb667f6..70d1c3f10d49 100644 --- a/source/blender/blenkernel/BKE_subdiv_modifier.hh +++ b/source/blender/blenkernel/BKE_subdiv_modifier.hh @@ -10,8 +10,6 @@ #include "BKE_subdiv.hh" -#include "BLI_sys_types.h" - /* Hardcoded for until GPU shaders are automatically generated, then we will have a more * programmatic way of detecting this. */ #define MAX_GPU_SUBDIV_SSBOS 12 diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index ef59f2597da0..6a3946c1c8ad 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -16,6 +16,7 @@ struct Text; struct TextLine; #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" /** * \note caller must handle `compiled` member. diff --git a/source/blender/blenkernel/BKE_unit.hh b/source/blender/blenkernel/BKE_unit.hh index c1276a9582f2..3d2e59a643dd 100644 --- a/source/blender/blenkernel/BKE_unit.hh +++ b/source/blender/blenkernel/BKE_unit.hh @@ -34,9 +34,20 @@ size_t BKE_unit_value_as_string(char *str, double value, int prec, int type, - const UnitSettings *settings, + const UnitSettings &settings, bool pad); +/** + * A version of #BKE_unit_value_as_string with the `value` scaled by #BKE_unit_value_scale. + */ +size_t BKE_unit_value_as_string_scaled(char *str, + int str_maxncpy, + double value, + int prec, + int type, + const UnitSettings &settings, + bool pad); + /** * Replace units with values, used before python button evaluation. * @@ -65,7 +76,7 @@ bool BKE_unit_string_contains_unit(const char *str, int type); /** * If user does not specify a unit, this converts it to the unit from the settings. */ -double BKE_unit_apply_preferred_unit(const UnitSettings *settings, int type, double value); +double BKE_unit_apply_preferred_unit(const UnitSettings &settings, int type, double value); /** * Make string keyboard-friendly, e.g: `10µm -> 10um`. @@ -87,6 +98,12 @@ double BKE_unit_base_scalar(int system, int type); */ bool BKE_unit_is_valid(int system, int type); +/** + * Apply the needed correction factor to value, based on unit_type + * (only length-related are affected currently) and `unit->scale_length`. + */ +double BKE_unit_value_scale(const UnitSettings &settings, int unit_type, double value); + /** * Loop over scales, could add names later. */ diff --git a/source/blender/blenkernel/BKE_volume_enums.hh b/source/blender/blenkernel/BKE_volume_enums.hh index 3817b52e8cf0..f7b7d369d8c4 100644 --- a/source/blender/blenkernel/BKE_volume_enums.hh +++ b/source/blender/blenkernel/BKE_volume_enums.hh @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + enum VolumeGridType : int8_t { VOLUME_GRID_UNKNOWN = 0, VOLUME_GRID_BOOLEAN, diff --git a/source/blender/blenkernel/BKE_volume_grid_type_traits.hh b/source/blender/blenkernel/BKE_volume_grid_type_traits.hh index 49605364b1e6..c1be36f4ca51 100644 --- a/source/blender/blenkernel/BKE_volume_grid_type_traits.hh +++ b/source/blender/blenkernel/BKE_volume_grid_type_traits.hh @@ -10,7 +10,6 @@ #ifdef WITH_OPENVDB -# include "BLI_math_quaternion_types.hh" # include "BLI_math_vector_types.hh" # include "BKE_volume_enums.hh" diff --git a/source/blender/blenkernel/BKE_volume_openvdb.hh b/source/blender/blenkernel/BKE_volume_openvdb.hh index 47cd65fcb52d..2af01be05a55 100644 --- a/source/blender/blenkernel/BKE_volume_openvdb.hh +++ b/source/blender/blenkernel/BKE_volume_openvdb.hh @@ -16,6 +16,7 @@ # include "BLI_string_ref.hh" # include "BKE_volume_enums.hh" +# include "BKE_volume_grid_fwd.hh" struct Volume; diff --git a/source/blender/blenkernel/BKE_volume_render.hh b/source/blender/blenkernel/BKE_volume_render.hh index aae351c352db..127f3c48c1e1 100644 --- a/source/blender/blenkernel/BKE_volume_render.hh +++ b/source/blender/blenkernel/BKE_volume_render.hh @@ -9,8 +9,6 @@ * \brief Volume data-block rendering and viewport drawing utilities. */ -#include "BLI_sys_types.h" - #include "DNA_volume_types.h" #include "BKE_volume_enums.hh" diff --git a/source/blender/blenkernel/BKE_volume_to_mesh.hh b/source/blender/blenkernel/BKE_volume_to_mesh.hh index 1a1499aa508a..9b0723776f55 100644 --- a/source/blender/blenkernel/BKE_volume_to_mesh.hh +++ b/source/blender/blenkernel/BKE_volume_to_mesh.hh @@ -4,6 +4,7 @@ #pragma once +#include "BLI_math_vector_types.hh" #include "BLI_span.hh" #include "DNA_modifier_types.h" diff --git a/source/blender/blenkernel/BKE_workspace.hh b/source/blender/blenkernel/BKE_workspace.hh index 8a1d60a73c74..7b9396a10512 100644 --- a/source/blender/blenkernel/BKE_workspace.hh +++ b/source/blender/blenkernel/BKE_workspace.hh @@ -8,8 +8,14 @@ #pragma once +#include + +#include "DNA_listBase.h" + #include "BLI_compiler_attrs.h" +#include "BLI_vector.hh" + struct Main; struct bScreen; struct bToolRef; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.cc b/source/blender/blenkernel/intern/CCGSubSurf.cc index c50fb6c40d35..5822ba2bf781 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.cc +++ b/source/blender/blenkernel/intern/CCGSubSurf.cc @@ -6,7 +6,6 @@ * \ingroup bke */ -#include #include #include @@ -18,6 +17,7 @@ #include "BKE_ccg.hh" #include "BKE_subsurf.hh" #include "CCGSubSurf.h" +#include "CCGSubSurf_inline.h" #include "CCGSubSurf_intern.h" /***/ diff --git a/source/blender/blenkernel/intern/CCGSubSurf_inline.h b/source/blender/blenkernel/intern/CCGSubSurf_inline.h index 59a05824ad0d..a917b27065a2 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_inline.h +++ b/source/blender/blenkernel/intern/CCGSubSurf_inline.h @@ -8,7 +8,13 @@ #pragma once +#include "BLI_assert.h" +#include "BLI_compiler_compat.h" + +#include "CCGSubSurf_intern.h" + #include +#include #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h index 0f527c428ea5..781407177c24 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h +++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h @@ -8,6 +8,8 @@ #pragma once +#include "CCGSubSurf.h" + #ifdef __cplusplus extern "C" { #endif @@ -264,5 +266,3 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss); #ifdef __cplusplus } #endif - -#include "CCGSubSurf_inline.h" diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.cc b/source/blender/blenkernel/intern/CCGSubSurf_legacy.cc index 5ccb590a5582..6eb1922a27cf 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.cc +++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.cc @@ -13,6 +13,7 @@ #include "BLI_utildefines.h" /* for BLI_assert */ #include "CCGSubSurf.h" +#include "CCGSubSurf_inline.h" #include "CCGSubSurf_intern.h" #define FACE_calcIFNo(f, lvl, S, x, y, no) \ diff --git a/source/blender/blenkernel/intern/CCGSubSurf_util.cc b/source/blender/blenkernel/intern/CCGSubSurf_util.cc index 5704994aee2e..433992911de4 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_util.cc +++ b/source/blender/blenkernel/intern/CCGSubSurf_util.cc @@ -16,6 +16,7 @@ #include "BLI_utildefines.h" /* for BLI_assert */ #include "CCGSubSurf.h" +#include "CCGSubSurf_inline.h" #include "CCGSubSurf_intern.h" /** diff --git a/source/blender/blenkernel/intern/action.cc b/source/blender/blenkernel/intern/action.cc index a9f5160205a8..fef3980da579 100644 --- a/source/blender/blenkernel/intern/action.cc +++ b/source/blender/blenkernel/intern/action.cc @@ -72,6 +72,7 @@ #include "ANIM_action_legacy.hh" #include "ANIM_bone_collections.hh" #include "ANIM_bonecolor.hh" +#include "ANIM_versioning.hh" #include "CLG_log.h" @@ -680,11 +681,14 @@ static void action_blend_read_data(BlendDataReader *reader, ID *id) read_layers(reader, action); read_slots(reader, action); - if (action.is_action_layered()) { + if (animrig::versioning::action_is_layered(action)) { /* Clear the forward-compatible storage (see action_blend_write_data()). */ - BLI_listbase_clear(&action.chanbase); BLI_listbase_clear(&action.curves); BLI_listbase_clear(&action.groups); + + /* Should never be stored as part of the forward-compatible data in a + * layered action, and thus should always be empty here. */ + BLI_assert(BLI_listbase_is_empty(&action.chanbase)); } else { /* Read legacy data. */ diff --git a/source/blender/blenkernel/intern/constraint.cc b/source/blender/blenkernel/intern/constraint.cc index 051b127b0999..523b93d9b959 100644 --- a/source/blender/blenkernel/intern/constraint.cc +++ b/source/blender/blenkernel/intern/constraint.cc @@ -24,6 +24,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" +#include "BLI_math_vector.hh" #include "BLI_string_utils.hh" #include "BLI_utildefines.h" #include "BLT_translation.hh" diff --git a/source/blender/blenkernel/intern/crazyspace.cc b/source/blender/blenkernel/intern/crazyspace.cc index 5191dd875a2d..d1765d45447e 100644 --- a/source/blender/blenkernel/intern/crazyspace.cc +++ b/source/blender/blenkernel/intern/crazyspace.cc @@ -15,6 +15,8 @@ #include "BLI_linklist.h" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" +#include "BLI_math_vector_types.hh" +#include "BLI_span.hh" #include "BLI_utildefines.h" #include "BKE_crazyspace.hh" diff --git a/source/blender/blenkernel/intern/data_transfer.cc b/source/blender/blenkernel/intern/data_transfer.cc index 118e1229d892..d47e49764b1e 100644 --- a/source/blender/blenkernel/intern/data_transfer.cc +++ b/source/blender/blenkernel/intern/data_transfer.cc @@ -12,10 +12,10 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "BLI_blenlib.h" +#include "BLI_math_base.h" #include "BLI_math_matrix.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_attribute.hh" @@ -29,7 +29,6 @@ #include "BKE_mesh_wrapper.hh" #include "BKE_modifier.hh" #include "BKE_object.hh" -#include "BKE_object_deform.h" #include "BKE_report.hh" #include "DEG_depsgraph_query.hh" diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index bcd71ea1cec2..2e67ba79b9e0 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -19,6 +19,7 @@ #include "BLI_index_range.hh" #include "BLI_listbase.h" #include "BLI_math_rotation.h" +#include "BLI_math_vector.h" #include "BLI_memarena.h" #include "BLI_scanfill.h" #include "BLI_span.hh" @@ -644,10 +645,11 @@ void BKE_curve_calc_modifiers_pre(Depsgraph *depsgraph, static bool do_curve_implicit_mesh_conversion(const Curve *curve, ModifierData *first_modifier, const Scene *scene, - const ModifierMode required_mode) + const ModifierMode required_mode, + const bool editmode) { /* Skip implicit filling and conversion to mesh when using "fast text editing". */ - if (curve->flag & CU_FAST) { + if ((curve->flag & CU_FAST) && editmode) { return false; } @@ -710,7 +712,9 @@ static blender::bke::GeometrySet curve_calc_modifiers_post(Depsgraph *depsgraph, pretessellatePoint->next; blender::bke::GeometrySet geometry_set; - if (ob->type == OB_SURF || do_curve_implicit_mesh_conversion(cu, md, scene, required_mode)) { + if (ob->type == OB_SURF || + do_curve_implicit_mesh_conversion(cu, md, scene, required_mode, editmode)) + { Mesh *mesh = BKE_mesh_new_nomain_from_curve_displist(ob, dispbase); geometry_set.replace_mesh(mesh); } diff --git a/source/blender/blenkernel/intern/fluid.cc b/source/blender/blenkernel/intern/fluid.cc index 8e6a45294ecd..58083160c525 100644 --- a/source/blender/blenkernel/intern/fluid.cc +++ b/source/blender/blenkernel/intern/fluid.cc @@ -51,6 +51,7 @@ # include "BLI_kdopbvh.hh" # include "BLI_kdtree.h" +# include "BLI_math_vector.hh" # include "BLI_threads.h" # include "BLI_voxel.h" diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 15cea6a23cac..9cae45969062 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -1865,10 +1865,10 @@ static void stampdata( } if (use_dynamic && scene->r.stamp & R_STAMP_SEQSTRIP) { - const Strip *seq = SEQ_get_topmost_sequence(scene, scene->r.cfra); + const Strip *strip = SEQ_get_topmost_sequence(scene, scene->r.cfra); - if (seq) { - STRNCPY(text, seq->name + 2); + if (strip) { + STRNCPY(text, strip->name + 2); } else { STRNCPY(text, ""); diff --git a/source/blender/blenkernel/intern/ipo.cc b/source/blender/blenkernel/intern/ipo.cc index 566fdb43d895..e8a07f922422 100644 --- a/source/blender/blenkernel/intern/ipo.cc +++ b/source/blender/blenkernel/intern/ipo.cc @@ -58,6 +58,7 @@ #include "BKE_nla.hh" #include "ANIM_action.hh" +#include "ANIM_versioning.hh" #include "CLG_log.h" @@ -1029,7 +1030,7 @@ static char *get_rna_access(ID *id, int adrcode, const char actname[], const char constname[], - Strip *seq, + Strip *strip, int *r_array_index) { DynStr *path = BLI_dynstr_new(); @@ -1098,15 +1099,15 @@ static char *get_rna_access(ID *id, /* XXX problematic block-types. */ case ID_SEQ: /* sequencer strip */ - /* SEQ_FAC1: */ + /* STRIP_FAC1: */ switch (adrcode) { - case SEQ_FAC1: + case STRIP_FAC1: propname = "effect_fader"; break; - case SEQ_FAC_SPEED: + case STRIP_FAC_SPEED: propname = "speed_fader"; break; - case SEQ_FAC_OPACITY: + case STRIP_FAC_OPACITY: propname = "blend_alpha"; break; } @@ -1178,11 +1179,11 @@ static char *get_rna_access(ID *id, BLI_str_escape(constname_esc, constname, sizeof(constname_esc)); SNPRINTF(buf, "constraints[\"%s\"]", constname_esc); } - else if (seq) { - /* Sequence names in Scene */ - char seq_name_esc[(sizeof(seq->name) - 2) * 2]; - BLI_str_escape(seq_name_esc, seq->name + 2, sizeof(seq_name_esc)); - SNPRINTF(buf, "sequence_editor.sequences_all[\"%s\"]", seq_name_esc); + else if (strip) { + /* Strip names in Scene */ + char strip_name_esc[(sizeof(strip->name) - 2) * 2]; + BLI_str_escape(strip_name_esc, strip->name + 2, sizeof(strip_name_esc)); + SNPRINTF(buf, "sequence_editor.sequences_all[\"%s\"]", strip_name_esc); } else { buf[0] = '\0'; /* empty string */ @@ -1395,6 +1396,9 @@ static void fcurve_add_to_list( * Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that * is not relevant, BUT do not free the IPO-Curve itself... * + * \param `id`: data-block that the IPO-Curve is attached to and/or which the new + * data-paths will start from. May be null, which may impact the data-paths of the + * created F-Curves in some cases. * \param actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to. * \param constname: name of Constraint-Channel (if applicable) * that IPO-Curve's IPO-block belonged to \a seq. @@ -1406,7 +1410,7 @@ static void icu_to_fcurves(ID *id, IpoCurve *icu, char *actname, char *constname, - Strip *seq, + Strip *strip, int muteipo) { AdrBit2Path *abp; @@ -1566,7 +1570,7 @@ static void icu_to_fcurves(ID *id, * - we will need to set the 'disabled' flag if no path is able to be made (for now) */ fcu->rna_path = get_rna_access( - id, icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index); + id, icu->blocktype, icu->adrcode, actname, constname, strip, &fcu->array_index); if (fcu->rna_path == nullptr) { fcu->flag |= FCURVE_DISABLED; } @@ -1656,9 +1660,9 @@ static void icu_to_fcurves(ID *id, } /* correct values for sequencer curves, that were not locked to frame */ - if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) { - const float mul = (seq->enddisp - seq->startdisp) / 100.0f; - const float offset = seq->startdisp; + if (strip && (strip->flag & SEQ_IPO_FRAME_LOCKED) == 0) { + const float mul = (strip->enddisp - strip->startdisp) / 100.0f; + const float offset = strip->startdisp; dst->vec[0][0] *= mul; dst->vec[0][0] += offset; @@ -1685,18 +1689,32 @@ static void icu_to_fcurves(ID *id, /* ------------------------- */ -/* Convert IPO-block (i.e. all its IpoCurves) to the new system. +/** + * Convert an IPO block to listbases of Animato data. + * * This does not assume that any ID or AnimData uses it, but does assume that * it is given two lists, which it will perform driver/animation-data separation. + * + * \param `id`: Data-block that the IPO-Curve is attached to and/or which the + * new data-paths will start from. May be null, which may impact the data-paths of + * the created F-Curves in some cases. + * \param `actname`: Contrary to what you might think, this is not the name of + * an action. I (Nathan) don't know what it *is*, but I'm leaving this note here + * so people in the future are not misled by the awful parameter name. + * \param `animgroups`: List of channel groups that the converted data will be + * added to. + * \param `anim`: List of FCurves that the converted animation data will be + * added to. + * \param `drivers`: List of FCurves that converted drivers will be added to. */ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], - Strip *seq, - ListBase *animgroups, - ListBase *anim, - ListBase *drivers) + Strip *strip, + ListBase /* bActionGroup */ *animgroups, + ListBase /* FCurve */ *anim, + ListBase /* FCurve */ *drivers) { IpoCurve *icu; @@ -1733,7 +1751,7 @@ static void ipo_to_animato(ID *id, /* Blender 2.4x allowed empty drivers, * but we don't now, since they cause more trouble than they're worth. */ if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON)) { - icu_to_fcurves(id, nullptr, drivers, icu, actname, constname, seq, ipo->muteipo); + icu_to_fcurves(id, nullptr, drivers, icu, actname, constname, strip, ipo->muteipo); } else { MEM_freeN(icu->driver); @@ -1741,7 +1759,7 @@ static void ipo_to_animato(ID *id, } } else { - icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seq, ipo->muteipo); + icu_to_fcurves(id, animgroups, anim, icu, actname, constname, strip, ipo->muteipo); } } @@ -1772,23 +1790,27 @@ static void ipo_to_animato(ID *id, } } -/* Convert Action-block to new system, separating animation and drivers +/** + * Convert a pre-Animato Action to an Animato Action and drivers. + * * New curves may not be converted directly into the given Action (i.e. for Actions linked * to Objects, where ob->ipo and ob->action need to be combined). - * NOTE: we need to be careful here, as same data-structs are used for new system too! + * + * Pre-Animato Actions can contain drivers, which are added to `drivers`. + * + * Note: this was refactored from older code. In general `groups` and `curves` + * should just be from `act`, and `drivers` should be from the adt of `id`. + * However, this is not always the case for `drivers`, and diving into the + * spaghetti of where this is called it wasn't clear to me (Nathan) if that's + * actually *always* the case for `groups` and `curves` either, so I (Nathan) + * left them as separate parameters to be on the safe side. */ -static void action_to_animato( +static void convert_pre_animato_action_to_animato_action_in_place( ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers) { - bActionChannel *achan, *achann; - bConstraintChannel *conchan, *conchann; - - BLI_assert_msg( - act->wrap().is_action_legacy(), - "Conversion from pre-2.5 animation data should happen before conversion to layered Actions"); - - /* only continue if there are Action Channels (indicating unconverted data) */ - if (BLI_listbase_is_empty(&act->chanbase)) { + const bool is_pre_animato_action = !BLI_listbase_is_empty(&act->chanbase); + BLI_assert_msg(is_pre_animato_action, "Action is not pre-Animato."); + if (!is_pre_animato_action) { return; } @@ -1799,10 +1821,7 @@ static void action_to_animato( } /* loop through Action-Channels, converting data, freeing as we go */ - for (achan = static_cast(act->chanbase.first); achan; achan = achann) { - /* get pointer to next Action Channel */ - achann = achan->next; - + LISTBASE_FOREACH_MUTABLE (bActionChannel *, achan, &act->chanbase) { /* convert Action Channel's IPO data */ if (achan->ipo) { ipo_to_animato(id, achan->ipo, achan->name, nullptr, nullptr, groups, curves, drivers); @@ -1811,12 +1830,7 @@ static void action_to_animato( } /* convert constraint channel IPO-data */ - for (conchan = static_cast(achan->constraintChannels.first); conchan; - conchan = conchann) - { - /* get pointer to next Constraint Channel */ - conchann = conchan->next; - + LISTBASE_FOREACH_MUTABLE (bConstraintChannel *, conchan, &achan->constraintChannels) { /* convert Constraint Channel's IPO data */ if (conchan->ipo) { ipo_to_animato( @@ -1834,6 +1848,45 @@ static void action_to_animato( } } +/** + * Ensure that the action is a modern layered action, upgrading if necessary. + * + * This deals with both Animato and pre-Animato actions, ensuring that they are + * fully upgraded. In the case of a pre-Animato action, it may contain drivers + * as well, which are converted and added to `drivers`. + * + * Much of the behavior of this function, and the reason for most of the + * parameters, is due to + * `convert_pre_animato_action_to_animato_action_in_place()`. See its + * documentation for more details. + * + * \see convert_pre_animato_action_to_animato_action_in_place() + */ +static void ensure_action_is_layered( + ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers) +{ + /* Already converted to the most modern kind of action, so no need to + * convert. */ + if (blender::animrig::versioning::action_is_layered(*act)) { + return; + } + + /* If there are Action Channels, indicating a pre-Animato action, then convert + * to Animato data. Note that pre-Animato actions may include drivers! */ + const bool is_pre_animato_action = !BLI_listbase_is_empty(&act->chanbase); + if (is_pre_animato_action) { + convert_pre_animato_action_to_animato_action_in_place(id, act, groups, curves, drivers); + } + + /* If there is an animated ID, tag it so that its Action usage also will get converted. */ + if (id) { + blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id); + } + + /* Convert to layered action. */ + blender::animrig::versioning::convert_legacy_animato_action(*act); +} + /* ------------------------- */ /* Convert IPO-block (i.e. all its IpoCurves) for some ID to the new system @@ -1841,7 +1894,7 @@ static void action_to_animato( * from animation data is accomplished here too... */ static void ipo_to_animdata( - Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Strip *seq) + Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Strip *strip) { AnimData *adt = BKE_animdata_from_id(id); ListBase anim = {nullptr, nullptr}; @@ -1857,12 +1910,12 @@ static void ipo_to_animdata( } if (G.debug & G_DEBUG) { - printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n", + printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s stripname:%s curves:%d\n", id->name + 2, ipo->id.name + 2, (actname) ? actname : "", (constname) ? constname : "", - (seq) ? (seq->name + 2) : "", + (strip) ? (strip->name + 2) : "", BLI_listbase_count(&ipo->curve)); } @@ -1870,7 +1923,7 @@ static void ipo_to_animdata( * (separated into separate lists of F-Curves for animation and drivers), * and the try to put these lists in the right places, but do not free the lists here. */ /* XXX there shouldn't be any need for the groups, so don't supply pointer for that now... */ - ipo_to_animato(id, ipo, actname, constname, seq, nullptr, &anim, &drivers); + ipo_to_animato(id, ipo, actname, constname, strip, nullptr, &anim, &drivers); /* deal with animation first */ if (anim.first) { @@ -1894,8 +1947,12 @@ static void ipo_to_animdata( } } - /* add F-Curves to action */ + /* Add F-Curves to action, creating an Animato action. */ BLI_movelisttolist(&adt->action->curves, &anim); + + /* Upgrade Animato action to a layered action. */ + blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id); + blender::animrig::versioning::convert_legacy_animato_action(*adt->action); } /* deal with drivers */ @@ -1932,7 +1989,7 @@ static void action_to_animdata(ID *id, bAction *act) } /* convert Action data */ - action_to_animato(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers); + ensure_action_is_layered(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers); } /* ------------------------- */ @@ -1956,7 +2013,7 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips) /* this old strip is only worth something if it had an action... */ if (as->act) { /* convert Action data (if not yet converted), storing the results in the same Action */ - action_to_animato(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers); + ensure_action_is_layered(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers); /* Create a new-style NLA-strip which references this Action, * then copy over relevant settings. */ @@ -2043,31 +2100,31 @@ struct Seq_callback_data { AnimData *adt; }; -static bool seq_convert_callback(Strip *seq, void *userdata) +static bool strip_convert_callback(Strip *strip, void *userdata) { - IpoCurve *icu = static_cast((seq->ipo) ? seq->ipo->curve.first : nullptr); - short adrcode = SEQ_FAC1; + IpoCurve *icu = static_cast((strip->ipo) ? strip->ipo->curve.first : nullptr); + short adrcode = STRIP_FAC1; if (G.debug & G_DEBUG) { - printf("\tconverting sequence strip %s\n", seq->name + 2); + printf("\tconverting sequence strip %s\n", strip->name + 2); } - if (ELEM(nullptr, seq->ipo, icu)) { - seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; + if (ELEM(nullptr, strip->ipo, icu)) { + strip->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; return true; } /* Patch `adrcode`, so that we can map to different DNA variables later (semi-hack (tm)). */ - switch (seq->type) { - case SEQ_TYPE_IMAGE: - case SEQ_TYPE_META: - case SEQ_TYPE_SCENE: - case SEQ_TYPE_MOVIE: - case SEQ_TYPE_COLOR: - adrcode = SEQ_FAC_OPACITY; + switch (strip->type) { + case STRIP_TYPE_IMAGE: + case STRIP_TYPE_META: + case STRIP_TYPE_SCENE: + case STRIP_TYPE_MOVIE: + case STRIP_TYPE_COLOR: + adrcode = STRIP_FAC_OPACITY; break; - case SEQ_TYPE_SPEED: - adrcode = SEQ_FAC_SPEED; + case STRIP_TYPE_SPEED: + adrcode = STRIP_FAC_SPEED; break; } icu->adrcode = adrcode; @@ -2075,22 +2132,24 @@ static bool seq_convert_callback(Strip *seq, void *userdata) Seq_callback_data *cd = (Seq_callback_data *)userdata; /* convert IPO */ - ipo_to_animdata(cd->bmain, (ID *)cd->scene, seq->ipo, nullptr, nullptr, seq); + ipo_to_animdata(cd->bmain, (ID *)cd->scene, strip->ipo, nullptr, nullptr, strip); - if (cd->adt->action) { + if (cd->adt->action && !blender::animrig::versioning::action_is_layered(*cd->adt->action)) { cd->adt->action->idroot = ID_SCE; /* scene-rooted */ } - id_us_min(&seq->ipo->id); - seq->ipo = nullptr; + id_us_min(&strip->ipo->id); + strip->ipo = nullptr; return true; } /* *************************************************** */ /* External API - Only Called from do_versions() */ -void do_versions_ipos_to_animato(Main *bmain) +void do_versions_ipos_to_layered_actions(Main *bmain) { + using blender::animrig::versioning::action_is_layered; + ListBase drivers = {nullptr, nullptr}; ID *id; @@ -2099,13 +2158,47 @@ void do_versions_ipos_to_animato(Main *bmain) return; } - /* only convert if version is right */ + /* Only convert if the bmain version is old enough. + * + * Note that the mixing of pre-2.50 and post-2.50 animation data is not supported, and so there + * is no need to check for the version of library blend files. + * + * See the check in #BKE_blendfile_link(), that actively warns users that their animation data + * will not be converted when linking to a pre-2.50 blend file. + * + * But even when the main file is newer, it could still link in pre-2.50 Actions, and those need + * to be converted in this function as well. + */ if (bmain->versionfile >= 250) { - CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile); + bool shown_info = false; + + LISTBASE_FOREACH (ID *, id, &bmain->actions) { + bAction *action = reinterpret_cast(id); + + const bool is_pre_animato_action = !BLI_listbase_is_empty(&action->chanbase); + if (!is_pre_animato_action) { + continue; + } + + if (G.debug & G_DEBUG) { + if (!shown_info) { + printf("INFO: Converting IPO Action to modern animation data types...\n"); + shown_info = true; + } + + printf("\tconverting action %s\n", id->name + 2); + } + + /* This Action will be object-only. */ + action->idroot = ID_OB; + + ensure_action_is_layered(nullptr, action, &action->groups, &action->curves, &drivers); + } return; } + if (G.debug & G_DEBUG) { - printf("INFO: Converting to Animato...\n"); + printf("INFO: Converting IPO to modern animation data types...\n"); } /* ----------- Animation Attached to Data -------------- */ @@ -2230,7 +2323,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* object's action will always be object-rooted */ { AnimData *adt = BKE_animdata_from_id(id); - if (adt && adt->action) { + if (adt && adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = ID_OB; } } @@ -2255,7 +2348,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Shape-key data... */ ipo_to_animdata(bmain, id, key->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = key->ipo->blocktype; } @@ -2280,7 +2373,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Material data... */ ipo_to_animdata(bmain, id, ma->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = ma->ipo->blocktype; } @@ -2305,7 +2398,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert World data... */ ipo_to_animdata(bmain, id, wo->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = wo->ipo->blocktype; } @@ -2320,7 +2413,7 @@ void do_versions_ipos_to_animato(Main *bmain) Editing *ed = scene->ed; if (ed && ed->seqbasep) { Seq_callback_data cb_data = {bmain, scene, BKE_animdata_ensure_id(id)}; - SEQ_for_each_callback(&ed->seqbase, seq_convert_callback, &cb_data); + SEQ_for_each_callback(&ed->seqbase, strip_convert_callback, &cb_data); } } @@ -2340,7 +2433,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Texture data... */ ipo_to_animdata(bmain, id, te->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = te->ipo->blocktype; } @@ -2365,7 +2458,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Camera data... */ ipo_to_animdata(bmain, id, ca->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = ca->ipo->blocktype; } @@ -2390,7 +2483,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Light data... */ ipo_to_animdata(bmain, id, la->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = la->ipo->blocktype; } @@ -2415,7 +2508,7 @@ void do_versions_ipos_to_animato(Main *bmain) /* Convert Curve data... */ ipo_to_animdata(bmain, id, cu->ipo, nullptr, nullptr, nullptr); - if (adt->action) { + if (adt->action && !action_is_layered(*adt->action)) { adt->action->idroot = cu->ipo->blocktype; } @@ -2449,7 +2542,7 @@ void do_versions_ipos_to_animato(Main *bmain) } /* be careful! some of the actions we encounter will be converted ones... */ - action_to_animato(nullptr, act, &act->groups, &act->curves, &drivers); + ensure_action_is_layered(nullptr, act, &act->groups, &act->curves, &drivers); } /* ipo's */ @@ -2468,6 +2561,10 @@ void do_versions_ipos_to_animato(Main *bmain) new_act = BKE_action_add(bmain, id->name + 2); ipo_to_animato(nullptr, ipo, nullptr, nullptr, nullptr, nullptr, &new_act->curves, &drivers); new_act->idroot = ipo->blocktype; + + /* Upgrade the resulting Animato action to a layered action. */ + blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id); + blender::animrig::versioning::convert_legacy_animato_action(*new_act); } /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */ diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc b/source/blender/blenkernel/intern/mesh_calc_edges.cc index 6ed07b81acf6..f342e9f25fa1 100644 --- a/source/blender/blenkernel/intern/mesh_calc_edges.cc +++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc @@ -7,6 +7,7 @@ */ #include "BLI_array_utils.hh" +#include "BLI_math_base.h" #include "BLI_ordered_edge.hh" #include "BLI_task.hh" #include "BLI_threads.h" diff --git a/source/blender/blenkernel/intern/mesh_merge_customdata.cc b/source/blender/blenkernel/intern/mesh_merge_customdata.cc index 6bf7db57071a..1070fa44c240 100644 --- a/source/blender/blenkernel/intern/mesh_merge_customdata.cc +++ b/source/blender/blenkernel/intern/mesh_merge_customdata.cc @@ -8,6 +8,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_math_base.h" #include "BLI_math_vector_types.hh" #include "BLI_task.hh" #include "BLI_utildefines.h" diff --git a/source/blender/blenkernel/intern/mesh_remap.cc b/source/blender/blenkernel/intern/mesh_remap.cc index 3ca420afcd0b..733c2adc3309 100644 --- a/source/blender/blenkernel/intern/mesh_remap.cc +++ b/source/blender/blenkernel/intern/mesh_remap.cc @@ -17,6 +17,7 @@ #include "BLI_array.hh" #include "BLI_astar.h" #include "BLI_bit_vector.hh" +#include "BLI_index_mask.hh" #include "BLI_math_geom.h" #include "BLI_math_matrix.h" #include "BLI_math_solvers.h" diff --git a/source/blender/blenkernel/intern/multires.cc b/source/blender/blenkernel/intern/multires.cc index 6b63eccc5d01..3b47fb2aa086 100644 --- a/source/blender/blenkernel/intern/multires.cc +++ b/source/blender/blenkernel/intern/multires.cc @@ -17,9 +17,9 @@ #include "DNA_scene_types.h" #include "BLI_bitmap.h" +#include "BLI_index_mask.hh" #include "BLI_math_matrix.h" #include "BLI_task.h" -#include "BLI_utildefines.h" #include "BKE_ccg.hh" #include "BKE_editmesh.hh" diff --git a/source/blender/blenkernel/intern/multires_inline.hh b/source/blender/blenkernel/intern/multires_inline.hh index fdedb014665f..9c39244f7fc6 100644 --- a/source/blender/blenkernel/intern/multires_inline.hh +++ b/source/blender/blenkernel/intern/multires_inline.hh @@ -10,7 +10,6 @@ #include "BKE_multires.hh" #include "BLI_math_vector.h" -#include "BLI_utildefines.h" BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3], const float dPdu[3], diff --git a/source/blender/blenkernel/intern/multires_reshape.hh b/source/blender/blenkernel/intern/multires_reshape.hh index 6a3254ff08b9..fa0beb094bc9 100644 --- a/source/blender/blenkernel/intern/multires_reshape.hh +++ b/source/blender/blenkernel/intern/multires_reshape.hh @@ -11,7 +11,6 @@ #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" #include "BLI_span.hh" -#include "BLI_sys_types.h" #include "BLI_virtual_array.hh" #include "BKE_multires.hh" diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.hh b/source/blender/blenkernel/intern/multires_unsubdivide.hh index 896acb8a6ad6..477c5babfc6d 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.hh +++ b/source/blender/blenkernel/intern/multires_unsubdivide.hh @@ -8,10 +8,11 @@ #pragma once -#include "BLI_sys_types.h" +#include "BLI_span.hh" struct BMesh; struct Mesh; +struct MDisps; struct MultiresModifierData; struct MultiresUnsubdivideGrid { diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index b7558b4a10cc..d931677f4802 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -486,14 +486,14 @@ static bNodeSocket *make_socket(bNodeTree *ntree, const StringRef name, const StringRef identifier) { - bNodeSocketType *stype = node_socket_type_find(idname.data()); + bNodeSocketType *stype = node_socket_type_find(idname); if (stype == nullptr) { return nullptr; } bNodeSocket *sock = MEM_cnew(__func__); sock->runtime = MEM_new(__func__); - STRNCPY(sock->idname, stype->idname); + StringRef(stype->idname).copy(sock->idname); sock->in_out = int(in_out); sock->type = int(SOCK_CUSTOM); /* int type undefined by default */ node_socket_set_typeinfo(ntree, sock, stype); @@ -800,7 +800,7 @@ void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree) if (nss->bytecode) { BLO_write_string(writer, nss->bytecode); } - BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage); + BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), node->storage); } else if ((ntree->type == NTREE_COMPOSIT) && ELEM(node->type, CMP_NODE_TIME, @@ -835,7 +835,7 @@ void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree) break; } } - BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage); + BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), node->storage); } else if ((ntree->type == NTREE_COMPOSIT) && ELEM(node->type, CMP_NODE_CRYPTOMATTE, CMP_NODE_CRYPTOMATTE_LEGACY)) @@ -845,14 +845,14 @@ void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree) LISTBASE_FOREACH (CryptomatteEntry *, entry, &nc->entries) { BLO_write_struct(writer, CryptomatteEntry, entry); } - BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage); + BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), node->storage); } else if (node->type == FN_NODE_INPUT_STRING) { NodeInputString *storage = static_cast(node->storage); if (storage->string) { BLO_write_string(writer, storage->string); } - BLO_write_struct_by_name(writer, node->typeinfo->storagename, storage); + BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), storage); } else if (node->type == GEO_NODE_CAPTURE_ATTRIBUTE) { auto &storage = *static_cast(node->storage); @@ -872,7 +872,7 @@ void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree) nodes::socket_items::blend_write(writer, *node); } else if (node->typeinfo != &NodeTypeUndefined) { - BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage); + BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), node->storage); } } @@ -1468,7 +1468,7 @@ static void node_init(const bContext *C, bNodeTree *ntree, bNode *node) * Data have their own translation option! * This solution may be a bit rougher than nodeLabel()'s returned string, but it's simpler * than adding "do_translate" flags to this func (and labelfunc() as well). */ - STRNCPY_UTF8(node->name, DATA_(ntype->ui_name)); + STRNCPY_UTF8(node->name, DATA_(ntype->ui_name.c_str())); node_unique_name(ntree, node); /* Generally sockets should be added after the initialization, because the set of sockets might @@ -1583,24 +1583,24 @@ static void update_typeinfo(Main *bmain, } FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (treetype && STREQ(ntree->idname, treetype->idname)) { + if (treetype && ntree->idname == treetype->idname) { ntree_set_typeinfo(ntree, unregister ? nullptr : treetype); } /* initialize nodes */ for (bNode *node : ntree->all_nodes()) { - if (nodetype && STREQ(node->idname, nodetype->idname)) { + if (nodetype && node->idname == nodetype->idname) { node_set_typeinfo(C, ntree, node, unregister ? nullptr : nodetype); } /* initialize node sockets */ LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { - if (socktype && STREQ(sock->idname, socktype->idname)) { + if (socktype && sock->idname == socktype->idname) { node_socket_set_typeinfo(ntree, sock, unregister ? nullptr : socktype); } } LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) { - if (socktype && STREQ(sock->idname, socktype->idname)) { + if (socktype && sock->idname == socktype->idname) { node_socket_set_typeinfo(ntree, sock, unregister ? nullptr : socktype); } } @@ -1630,18 +1630,18 @@ void node_tree_set_type(const bContext *C, bNodeTree *ntree) template struct StructPointerIDNameHash { uint64_t operator()(const T *value) const { - return get_default_hash(value->idname); + return get_default_hash(value->idname); } uint64_t operator()(const StringRef name) const { - return get_default_hash(name); + return get_default_hash(name); } }; template struct StructPointerNameEqual { bool operator()(const T *a, const T *b) const { - return STREQ(a->idname, b->idname); + return a->idname == b->idname; } bool operator()(const StringRef idname, const T *a) const { @@ -1710,7 +1710,7 @@ static void ntree_free_type(void *treetype_v) /* Probably not. It is pretty much expected we want to update G_MAIN here I think - * or we'd want to update *all* active Mains, which we cannot do anyway currently. */ update_typeinfo(G_MAIN, nullptr, treetype, nullptr, nullptr, true); - MEM_freeN(treetype); + MEM_delete(treetype); } void node_tree_type_free_link(const bNodeTreeType *nt) @@ -1767,12 +1767,14 @@ static void node_free_type(void *nodetype_v) void node_register_type(bNodeType *nt) { /* debug only: basic verification of registered types */ - BLI_assert(nt->idname[0] != '\0'); + BLI_assert(!nt->idname.empty()); BLI_assert(nt->poll != nullptr); + RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name.c_str(), nt->ui_description.c_str()); + if (!nt->enum_name_legacy) { /* For new nodes, use the idname as a unique identifier. */ - nt->enum_name_legacy = nt->idname; + nt->enum_name_legacy = nt->idname.c_str(); } if (nt->declare) { @@ -2696,7 +2698,7 @@ bNode *node_add_node(const bContext *C, bNodeTree *ntree, const StringRefNull id bNode *node_add_static_node(const bContext *C, bNodeTree *ntree, const int type) { - const char *idname = nullptr; + std::optional idname; for (bNodeType *ntype : node_types_get()) { /* Do an extra poll here, because some int types are used @@ -2715,7 +2717,7 @@ bNode *node_add_static_node(const bContext *C, bNodeTree *ntree, const int type) CLOG_ERROR(&LOG, "static node type %d undefined", type); return nullptr; } - return node_add_node(C, ntree, idname); + return node_add_node(C, ntree, *idname); } static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src, const int flag) @@ -4290,7 +4292,7 @@ void nodeLabel(const bNodeTree *ntree, const bNode *node, char *label, const int return; } - BLI_strncpy(label, IFACE_(node->typeinfo->ui_name), label_maxncpy); + BLI_strncpy(label, IFACE_(node->typeinfo->ui_name.c_str()), label_maxncpy); } std::optional nodeSocketShortLabel(const bNodeSocket *sock) @@ -4333,7 +4335,7 @@ static bool node_poll_instance_default(const bNode *node, return node->typeinfo->poll(node->typeinfo, ntree, r_disabled_hint); } -void node_type_base(bNodeType *ntype, const int type, const StringRefNull name, const short nclass) +void node_type_base(bNodeType *ntype, const int type, const short nclass) { /* Use static type info header to map static int type to identifier string and RNA struct type. * Associate the RNA struct type with the bNodeType. @@ -4342,15 +4344,13 @@ void node_type_base(bNodeType *ntype, const int type, const StringRefNull name, * created in makesrna, which can not be associated to a bNodeType immediately, * since bNodeTypes are registered afterward ... */ -#define DefNode(Category, ID, DefFunc, StructName, UIName, UIDesc) \ +#define DefNode(Category, ID, DefFunc, StructName) \ case ID: { \ - STRNCPY(ntype->idname, #Category #StructName); \ + ntype->idname = (#Category #StructName); \ StructRNA *srna = RNA_struct_find(#Category #StructName); \ BLI_assert(srna != nullptr); \ ntype->rna_ext.srna = srna; \ RNA_struct_blender_type_set(srna, ntype); \ - RNA_def_struct_ui_text(srna, UIName, UIDesc); \ - STRNCPY(ntype->ui_description, UIDesc); \ break; \ } @@ -4362,7 +4362,6 @@ void node_type_base(bNodeType *ntype, const int type, const StringRefNull name, BLI_assert(ntype->idname[0] != '\0'); ntype->type = type; - name.copy(ntype->ui_name); ntype->nclass = nclass; node_type_base_defaults(ntype); @@ -4377,9 +4376,9 @@ void node_type_base_custom(bNodeType *ntype, const StringRefNull enum_name, const short nclass) { - idname.copy(ntype->idname); + ntype->idname = idname; ntype->type = NODE_CUSTOM; - name.copy(ntype->ui_name); + ntype->ui_name = name; ntype->nclass = nclass; ntype->enum_name_legacy = enum_name.c_str(); @@ -4646,12 +4645,7 @@ void node_type_storage(bNodeType *ntype, bNode *dest_node, const bNode *src_node)) { - if (storagename.has_value()) { - storagename->copy(ntype->storagename); - } - else { - ntype->storagename[0] = '\0'; - } + ntype->storagename = storagename.value_or(""); ntype->copyfunc = copyfunc; ntype->freefunc = freefunc; } diff --git a/source/blender/blenkernel/intern/node_tree_interface.cc b/source/blender/blenkernel/intern/node_tree_interface.cc index ef5d86fae8da..2f5885bb4100 100644 --- a/source/blender/blenkernel/intern/node_tree_interface.cc +++ b/source/blender/blenkernel/intern/node_tree_interface.cc @@ -2,6 +2,8 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include + #include "BKE_idprop.hh" #include "BKE_lib_id.hh" #include "BKE_lib_query.hh" @@ -22,6 +24,8 @@ #include "DNA_node_tree_interface_types.h" #include "DNA_node_types.h" +using blender::StringRef; + /** * These flags are used by the `changed_flag` field in #bNodeTreeInterfaceRuntime. */ @@ -40,22 +44,20 @@ namespace socket_types { * `NodeSocketFloatUnsigned`, `NodeSocketFloatFactor`. Only the "base type" (`NodeSocketFloat`) * is considered valid for interface sockets. */ -static const char *try_get_supported_socket_type(const StringRef socket_type) +static std::optional try_get_supported_socket_type(const StringRef socket_type) { - /* Make a copy of the string for `.c_str()` until the socket type map uses C++ types. */ - const std::string idname(socket_type); - const blender::bke::bNodeSocketType *typeinfo = bke::node_socket_type_find(idname.c_str()); + const blender::bke::bNodeSocketType *typeinfo = bke::node_socket_type_find(socket_type); if (typeinfo == nullptr) { - return nullptr; + return std::nullopt; } /* For builtin socket types only the base type is supported. */ if (node_is_static_socket_type(typeinfo)) { - const std::optional type_name = bke::node_static_socket_type(typeinfo->type, - PROP_NONE); - if (type_name.has_value()) { - return type_name->c_str(); + if (const std::optional type_name = bke::node_static_socket_type(typeinfo->type, + PROP_NONE)) + { + return *type_name; } - return nullptr; + return std::nullopt; } return typeinfo->idname; } @@ -680,10 +682,11 @@ blender::ColorGeometry4f bNodeTreeInterfaceSocket::socket_color() const } } -bool bNodeTreeInterfaceSocket::set_socket_type(const char *new_socket_type) +bool bNodeTreeInterfaceSocket::set_socket_type(const StringRef new_socket_type) { - const char *idname = socket_types::try_get_supported_socket_type(new_socket_type); - if (idname == nullptr) { + const std::optional idname = socket_types::try_get_supported_socket_type( + new_socket_type); + if (!idname) { return false; } @@ -693,7 +696,7 @@ bool bNodeTreeInterfaceSocket::set_socket_type(const char *new_socket_type) } MEM_SAFE_FREE(this->socket_type); - this->socket_type = BLI_strdup(new_socket_type); + this->socket_type = BLI_strdupn(new_socket_type.data(), new_socket_type.size()); this->socket_data = socket_types::make_socket_data(new_socket_type); return true; @@ -701,8 +704,9 @@ bool bNodeTreeInterfaceSocket::set_socket_type(const char *new_socket_type) void bNodeTreeInterfaceSocket::init_from_socket_instance(const bNodeSocket *socket) { - const char *idname = socket_types::try_get_supported_socket_type(socket->idname); - BLI_assert(idname != nullptr); + const std::optional idname = socket_types::try_get_supported_socket_type( + socket->idname); + BLI_assert(idname.has_value()); if (this->socket_data != nullptr) { socket_types::socket_data_free(*this, true); @@ -713,8 +717,8 @@ void bNodeTreeInterfaceSocket::init_from_socket_instance(const bNodeSocket *sock this->flag |= NODE_INTERFACE_SOCKET_HIDE_VALUE; } - this->socket_type = BLI_strdup(idname); - this->socket_data = socket_types::make_socket_data(idname); + this->socket_type = BLI_strdupn(idname->data(), idname->size()); + this->socket_data = socket_types::make_socket_data(*idname); socket_types::socket_data_copy_ptr(*this, socket->default_value, 0); } @@ -1045,8 +1049,8 @@ static bNodeTreeInterfaceSocket *make_socket(const int uid, { BLI_assert(!socket_type.is_empty()); - const char *idname = socket_types::try_get_supported_socket_type(socket_type); - if (idname == nullptr) { + const std::optional idname = socket_types::try_get_supported_socket_type(socket_type); + if (!idname) { return nullptr; } diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index 9f4a933189d9..f3c5d3079c8b 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -170,7 +170,7 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN /* The rest of the socket types only allow an internal link if both the input and output socket * have the same type. If the sockets are custom, we check the idname instead. */ - if (to->type == from->type && (to->type != SOCK_CUSTOM || STREQ(to->idname, from->idname))) { + if (to->type == from->type && (to->type != SOCK_CUSTOM || to->idname == from->idname)) { return 1; } @@ -1231,8 +1231,8 @@ class NodeTreeMainUpdater { NodeLinkError{fmt::format("{}: {} " BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE " {}", TIP_("Conversion is not supported"), - TIP_(link->fromsock->typeinfo->label), - TIP_(link->tosock->typeinfo->label))}); + TIP_(link->fromsock->typeinfo->label.c_str()), + TIP_(link->tosock->typeinfo->label.c_str()))}); continue; } } diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index c3b1a4cc93fa..bc34a5895c83 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -4425,6 +4425,28 @@ void BKE_object_foreach_display_point(Object *ob, func_cb(co, user_data); } } + else if (ob->type == OB_GREASE_PENCIL) { + using namespace blender::bke::greasepencil; + GreasePencil &grease_pencil = *static_cast(ob->data); + for (const Layer *layer : grease_pencil.layers()) { + if (!layer->is_visible()) { + continue; + } + const float4x4 layer_to_world = layer->to_world_space(*ob); + if (const Drawing *drawing = grease_pencil.get_drawing_at(*layer, + grease_pencil.runtime->eval_frame)) + { + const blender::bke::CurvesGeometry &curves = drawing->strokes(); + const Span positions = curves.evaluated_positions(); + blender::threading::parallel_for( + positions.index_range(), 4096, [&](const blender::IndexRange range) { + for (const int i : range) { + func_cb(blender::math::transform_point(layer_to_world, positions[i]), user_data); + } + }); + } + } + } else if (ob->runtime->curve_cache && ob->runtime->curve_cache->disp.first) { LISTBASE_FOREACH (DispList *, dl, &ob->runtime->curve_cache->disp) { const float *v3 = dl->verts; diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.hh b/source/blender/blenkernel/intern/pbvh_pixels_copy.hh index e310e36da1aa..e8c4fc06e8db 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels_copy.hh +++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.hh @@ -2,15 +2,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include "BLI_math_vector_types.hh" -#include "BLI_vector.hh" - -#include "IMB_imbuf.hh" -#include "IMB_imbuf_types.hh" - -#include "BKE_image_wrappers.hh" #include "BKE_paint_bvh.hh" -#include "BKE_paint_bvh_pixels.hh" #include "pbvh_uv_islands.hh" diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc index 58fce1923e4f..ccef4d0c956a 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc @@ -7,6 +7,7 @@ #include "BLI_math_matrix.hh" #include "BLI_math_vector.h" #include "BLI_ordered_edge.hh" +#include "BLI_rect.h" #include "pbvh_uv_islands.hh" diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.hh b/source/blender/blenkernel/intern/pbvh_uv_islands.hh index 5a81d0898ffb..5194fc59f0d1 100644 --- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh +++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh @@ -21,18 +21,14 @@ #pragma once -#include #include #include "BLI_array.hh" #include "BLI_map.hh" -#include "BLI_math_matrix_types.hh" #include "BLI_math_vector_types.hh" #include "BLI_offset_indices.hh" -#include "BLI_rect.h" #include "BLI_vector.hh" #include "BLI_vector_list.hh" -#include "BLI_virtual_array.hh" namespace blender::bke::pbvh::uv_islands { diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 21248a59a887..aa7681a2dc79 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -361,7 +361,7 @@ static void scene_copy_data(Main *bmain, scene_dst, &scene_dst->ed->seqbase, &scene_src->ed->seqbase, - SEQ_DUPE_ALL, + STRIP_DUPE_ALL, flag_subdata); BLI_duplicatelist(&scene_dst->ed->channels, &scene_src->ed->channels); scene_dst->ed->displayed_channels = &scene_dst->ed->channels; @@ -794,7 +794,7 @@ static void scene_foreach_layer_collection(LibraryForeachIDData *data, } } -static bool seq_foreach_member_id_cb(Strip *seq, void *user_data) +static bool strip_foreach_member_id_cb(Strip *strip, void *user_data) { LibraryForeachIDData *data = static_cast(user_data); const int flag = BKE_lib_query_foreachid_process_flags_get(data); @@ -816,25 +816,25 @@ static bool seq_foreach_member_id_cb(Strip *seq, void *user_data) } \ ((void)0) - FOREACHID_PROCESS_IDSUPER(data, seq->scene, IDWALK_CB_NEVER_SELF); - FOREACHID_PROCESS_IDSUPER(data, seq->scene_camera, IDWALK_CB_NOP); - FOREACHID_PROCESS_IDSUPER(data, seq->clip, IDWALK_CB_USER); - FOREACHID_PROCESS_IDSUPER(data, seq->mask, IDWALK_CB_USER); - FOREACHID_PROCESS_IDSUPER(data, seq->sound, IDWALK_CB_USER); - IDP_foreach_property(seq->prop, IDP_TYPE_FILTER_ID, [&](IDProperty *prop) { + FOREACHID_PROCESS_IDSUPER(data, strip->scene, IDWALK_CB_NEVER_SELF); + FOREACHID_PROCESS_IDSUPER(data, strip->scene_camera, IDWALK_CB_NOP); + FOREACHID_PROCESS_IDSUPER(data, strip->clip, IDWALK_CB_USER); + FOREACHID_PROCESS_IDSUPER(data, strip->mask, IDWALK_CB_USER); + FOREACHID_PROCESS_IDSUPER(data, strip->sound, IDWALK_CB_USER); + IDP_foreach_property(strip->prop, IDP_TYPE_FILTER_ID, [&](IDProperty *prop) { BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data); }); - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { FOREACHID_PROCESS_IDSUPER(data, smd->mask_id, IDWALK_CB_USER); } - if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) { - TextVars *text_data = static_cast(seq->effectdata); + if (strip->type == STRIP_TYPE_TEXT && strip->effectdata) { + TextVars *text_data = static_cast(strip->effectdata); FOREACHID_PROCESS_IDSUPER(data, text_data->text_font, IDWALK_CB_USER); } if (flag & IDWALK_DO_DEPRECATED_POINTERS) { - FOREACHID_PROCESS_ID_NOCHECK(data, seq->ipo, IDWALK_CB_USER); + FOREACHID_PROCESS_ID_NOCHECK(data, strip->ipo, IDWALK_CB_USER); } #undef FOREACHID_PROCESS_IDSUPER @@ -861,7 +861,7 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data) } if (scene->ed) { BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL( - data, SEQ_for_each_callback(&scene->ed->seqbase, seq_foreach_member_id_cb, data)); + data, SEQ_for_each_callback(&scene->ed->seqbase, strip_foreach_member_id_cb, data)); } BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data, @@ -942,20 +942,20 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data) } } -static bool seq_foreach_path_callback(Strip *seq, void *user_data) +static bool strip_foreach_path_callback(Strip *strip, void *user_data) { - if (SEQ_HAS_PATH(seq)) { - StripElem *se = seq->data->stripdata; + if (STRIP_HAS_PATH(strip)) { + StripElem *se = strip->data->stripdata; BPathForeachPathData *bpath_data = (BPathForeachPathData *)user_data; - if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM) && se) { + if (ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_SOUND_RAM) && se) { BKE_bpath_foreach_path_dirfile_fixed_process(bpath_data, - seq->data->dirpath, - sizeof(seq->data->dirpath), + strip->data->dirpath, + sizeof(strip->data->dirpath), se->filename, sizeof(se->filename)); } - else if ((seq->type == SEQ_TYPE_IMAGE) && se) { + else if ((strip->type == STRIP_TYPE_IMAGE) && se) { /* NOTE: An option not to loop over all strips could be useful? */ uint len = uint(MEM_allocN_len(se)) / uint(sizeof(*se)); uint i; @@ -967,8 +967,8 @@ static bool seq_foreach_path_callback(Strip *seq, void *user_data) for (i = 0; i < len; i++, se++) { BKE_bpath_foreach_path_dirfile_fixed_process(bpath_data, - seq->data->dirpath, - sizeof(seq->data->dirpath), + strip->data->dirpath, + sizeof(strip->data->dirpath), se->filename, sizeof(se->filename)); } @@ -976,7 +976,7 @@ static bool seq_foreach_path_callback(Strip *seq, void *user_data) else { /* simple case */ BKE_bpath_foreach_path_fixed_process( - bpath_data, seq->data->dirpath, sizeof(seq->data->dirpath)); + bpath_data, strip->data->dirpath, sizeof(strip->data->dirpath)); } } return true; @@ -986,7 +986,7 @@ static void scene_foreach_path(ID *id, BPathForeachPathData *bpath_data) { Scene *scene = (Scene *)id; if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_foreach_path_callback, bpath_data); + SEQ_for_each_callback(&scene->ed->seqbase, strip_foreach_path_callback, bpath_data); } } @@ -1302,7 +1302,7 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id) BLO_read_get_new_data_address_no_us(reader, ed->act_seq, sizeof(Strip))); ed->cache = nullptr; ed->prefetch_job = nullptr; - ed->runtime.sequence_lookup = nullptr; + ed->runtime.strip_lookup = nullptr; ed->runtime.media_presence = nullptr; ed->runtime.thumbnail_cache = nullptr; @@ -2885,32 +2885,6 @@ int BKE_render_preview_pixel_size(const RenderData *r) return r->preview_pixel_size; } -double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value) -{ - if (unit->system == USER_UNIT_NONE) { - /* Never apply scale_length when not using a unit setting! */ - return value; - } - - switch (unit_type) { - case B_UNIT_LENGTH: - case B_UNIT_VELOCITY: - case B_UNIT_ACCELERATION: - return value * double(unit->scale_length); - case B_UNIT_AREA: - case B_UNIT_POWER: - return value * pow(unit->scale_length, 2); - case B_UNIT_VOLUME: - return value * pow(unit->scale_length, 3); - case B_UNIT_MASS: - return value * pow(unit->scale_length, 3); - case B_UNIT_CAMERA: /* *Do not* use scene's unit scale for camera focal lens! See #42026. */ - case B_UNIT_WAVELENGTH: /* Wavelength values are independent of the scene scale. */ - default: - return value; - } -} - /******************** multiview *************************/ int BKE_scene_multiview_num_views_get(const RenderData *rd) diff --git a/source/blender/blenkernel/intern/sound.cc b/source/blender/blenkernel/intern/sound.cc index 80a889814248..9c873b7cffb1 100644 --- a/source/blender/blenkernel/intern/sound.cc +++ b/source/blender/blenkernel/intern/sound.cc @@ -14,6 +14,7 @@ #include "BLI_blenlib.h" #include "BLI_iterator.h" +#include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLI_threads.h" diff --git a/source/blender/blenkernel/intern/unit.cc b/source/blender/blenkernel/intern/unit.cc index e33424f944f0..cc04674ac671 100644 --- a/source/blender/blenkernel/intern/unit.cc +++ b/source/blender/blenkernel/intern/unit.cc @@ -1734,15 +1734,15 @@ struct PreferredUnits { int temperature; }; -static PreferredUnits preferred_units_from_UnitSettings(const UnitSettings *settings) +static PreferredUnits preferred_units_from_UnitSettings(const UnitSettings &settings) { PreferredUnits units = {0}; - units.system = settings->system; - units.rotation = settings->system_rotation; - units.length = settings->length_unit; - units.mass = settings->mass_unit; - units.time = settings->time_unit; - units.temperature = settings->temperature_unit; + units.system = settings.system; + units.rotation = settings.system_rotation; + units.length = settings.length_unit; + units.mass = settings.mass_unit; + units.time = settings.time_unit; + units.temperature = settings.temperature_unit; return units; } @@ -1878,14 +1878,52 @@ size_t BKE_unit_value_as_string(char *str, double value, int prec, int type, - const UnitSettings *settings, + const UnitSettings &settings, bool pad) { - bool do_split = (settings->flag & USER_UNIT_OPT_SPLIT) != 0; + bool do_split = (settings.flag & USER_UNIT_OPT_SPLIT) != 0; PreferredUnits units = preferred_units_from_UnitSettings(settings); return unit_as_string_main(str, str_maxncpy, value, prec, type, do_split, pad, units); } +size_t BKE_unit_value_as_string_scaled(char *str, + int str_maxncpy, + double value, + int prec, + int type, + const UnitSettings &settings, + bool pad) +{ + return BKE_unit_value_as_string( + str, str_maxncpy, BKE_unit_value_scale(settings, type, value), prec, type, settings, pad); +} + +double BKE_unit_value_scale(const UnitSettings &settings, const int unit_type, double value) +{ + if (settings.system == USER_UNIT_NONE) { + /* Never apply scale_length when not using a unit setting! */ + return value; + } + + switch (unit_type) { + case B_UNIT_LENGTH: + case B_UNIT_VELOCITY: + case B_UNIT_ACCELERATION: + return value * double(settings.scale_length); + case B_UNIT_AREA: + case B_UNIT_POWER: + return value * pow(settings.scale_length, 2); + case B_UNIT_VOLUME: + return value * pow(settings.scale_length, 3); + case B_UNIT_MASS: + return value * pow(settings.scale_length, 3); + case B_UNIT_CAMERA: /* *Do not* use scene's unit scale for camera focal lens! See #42026. */ + case B_UNIT_WAVELENGTH: /* Wavelength values are independent of the scene scale. */ + default: + return value; + } +} + BLI_INLINE bool isalpha_or_utf8(const int ch) { return (ch >= 128 || isalpha(ch)); @@ -2300,7 +2338,7 @@ bool BKE_unit_string_contains_unit(const char *str, int type) return false; } -double BKE_unit_apply_preferred_unit(const UnitSettings *settings, int type, double value) +double BKE_unit_apply_preferred_unit(const UnitSettings &settings, int type, double value) { PreferredUnits units = preferred_units_from_UnitSettings(settings); const bUnitDef *unit = get_preferred_display_unit_if_used(type, units); diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 40d7bf1db1b3..429aede040c6 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -17,18 +17,14 @@ #include "DNA_volume_types.h" #include "BLI_bounds.hh" -#include "BLI_compiler_compat.h" #include "BLI_fileops.h" -#include "BLI_ghash.h" #include "BLI_index_range.hh" -#include "BLI_map.hh" -#include "BLI_math_matrix.h" +#include "BLI_math_base.h" #include "BLI_math_matrix_types.hh" #include "BLI_math_vector_types.hh" #include "BLI_path_utils.hh" #include "BLI_string.h" #include "BLI_string_ref.hh" -#include "BLI_task.hh" #include "BLI_utildefines.h" #include "BKE_anim_data.hh" @@ -74,10 +70,8 @@ using blender::StringRefNull; using blender::bke::GVolumeGrid; #ifdef WITH_OPENVDB -# include # include # include -# include # include # include diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index e7f6b4f1a06f..e49239b2d985 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -10,6 +10,10 @@ #include "BLI_bitmap.h" #include "BLI_ghash.h" + +#include "DNA_anim_types.h" +#include "DNA_listBase.h" + #include "RNA_types.hh" #ifdef __cplusplus diff --git a/source/blender/blenkernel/particle_private.h b/source/blender/blenkernel/particle_private.h index 144c67ef449b..f9c2b957ec69 100644 --- a/source/blender/blenkernel/particle_private.h +++ b/source/blender/blenkernel/particle_private.h @@ -8,6 +8,8 @@ #pragma once +#include "BKE_particle.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenkernel/tracking_private.h b/source/blender/blenkernel/tracking_private.h index cd6014599734..8c9643a2b7ce 100644 --- a/source/blender/blenkernel/tracking_private.h +++ b/source/blender/blenkernel/tracking_private.h @@ -11,6 +11,9 @@ #pragma once +#include "DNA_ID.h" +#include "DNA_movieclip_types.h" + #include "BLI_threads.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h index 1c96fb389780..4a5d096e61a7 100644 --- a/source/blender/blenlib/BLI_args.h +++ b/source/blender/blenlib/BLI_args.h @@ -17,6 +17,7 @@ struct bArgs; typedef struct bArgs bArgs; #include /* For `va_list`. */ +#include #include "BLI_compiler_attrs.h" diff --git a/source/blender/blenlib/BLI_array_store.h b/source/blender/blenlib/BLI_array_store.h index 3ccdc182f1f0..73732c19240a 100644 --- a/source/blender/blenlib/BLI_array_store.h +++ b/source/blender/blenlib/BLI_array_store.h @@ -9,6 +9,8 @@ * \brief Efficient in-memory storage of multiple similar arrays. */ +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h index 59d9b0575d22..4bca2cfb68c3 100644 --- a/source/blender/blenlib/BLI_array_store_utils.h +++ b/source/blender/blenlib/BLI_array_store_utils.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -19,11 +21,11 @@ struct BArrayStore_AtSize { int stride_table_len; }; -BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride, - int stride, - int chunk_size); +struct BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride, + int stride, + int chunk_size); -BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, int stride); +struct BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, int stride); void BLI_array_store_at_size_clear(struct BArrayStore_AtSize *bs_stride); diff --git a/source/blender/blenlib/BLI_binary_search.hh b/source/blender/blenlib/BLI_binary_search.hh index 4f37a1f1c313..2794240f5d50 100644 --- a/source/blender/blenlib/BLI_binary_search.hh +++ b/source/blender/blenlib/BLI_binary_search.hh @@ -10,8 +10,6 @@ #include -#include "BLI_utildefines.h" - namespace blender::binary_search { /** diff --git a/source/blender/blenlib/BLI_bit_ref.hh b/source/blender/blenlib/BLI_bit_ref.hh index 1312b095af9c..ac94e370e175 100644 --- a/source/blender/blenlib/BLI_bit_ref.hh +++ b/source/blender/blenlib/BLI_bit_ref.hh @@ -17,7 +17,6 @@ * - Within each #BitInt, the bits are ordered from least to most significant. */ -#include "BLI_index_range.hh" #include "BLI_utildefines.h" #include diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h index 271fafd766ce..528deb3184b8 100644 --- a/source/blender/blenlib/BLI_boxpack_2d.h +++ b/source/blender/blenlib/BLI_boxpack_2d.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h index c5cc87016047..2cc7a508d7e6 100644 --- a/source/blender/blenlib/BLI_buffer.h +++ b/source/blender/blenlib/BLI_buffer.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_compute_context.hh b/source/blender/blenlib/BLI_compute_context.hh index b01ab9041816..101db521fee3 100644 --- a/source/blender/blenlib/BLI_compute_context.hh +++ b/source/blender/blenlib/BLI_compute_context.hh @@ -36,7 +36,6 @@ #include -#include "BLI_array.hh" #include "BLI_linear_allocator.hh" #include "BLI_stack.hh" #include "BLI_string_ref.hh" diff --git a/source/blender/blenlib/BLI_concurrent_map.hh b/source/blender/blenlib/BLI_concurrent_map.hh index e74f91d24cfd..82e0fca0d402 100644 --- a/source/blender/blenlib/BLI_concurrent_map.hh +++ b/source/blender/blenlib/BLI_concurrent_map.hh @@ -23,13 +23,12 @@ # undef NOMINMAX # endif # endif +#else +# include "BLI_set.hh" #endif -#include - #include "BLI_hash.hh" #include "BLI_hash_tables.hh" -#include "BLI_set.hh" namespace blender { diff --git a/source/blender/blenlib/BLI_cpp_type.hh b/source/blender/blenlib/BLI_cpp_type.hh index ef67114ee87a..f110447421a9 100644 --- a/source/blender/blenlib/BLI_cpp_type.hh +++ b/source/blender/blenlib/BLI_cpp_type.hh @@ -75,7 +75,6 @@ #include "BLI_hash.hh" #include "BLI_index_mask.hh" #include "BLI_map.hh" -#include "BLI_math_base.h" #include "BLI_parameter_pack_utils.hh" #include "BLI_string_ref.hh" #include "BLI_utility_mixins.hh" diff --git a/source/blender/blenlib/BLI_cpp_types.hh b/source/blender/blenlib/BLI_cpp_types.hh index 7cf89e70bd8a..a66240c4e35c 100644 --- a/source/blender/blenlib/BLI_cpp_types.hh +++ b/source/blender/blenlib/BLI_cpp_types.hh @@ -5,7 +5,6 @@ #pragma once #include "BLI_cpp_type.hh" -#include "BLI_vector.hh" namespace blender { diff --git a/source/blender/blenlib/BLI_devirtualize_parameters.hh b/source/blender/blenlib/BLI_devirtualize_parameters.hh index 1641b301c5c3..c1066600576a 100644 --- a/source/blender/blenlib/BLI_devirtualize_parameters.hh +++ b/source/blender/blenlib/BLI_devirtualize_parameters.hh @@ -33,6 +33,8 @@ * finding a good compromise for each function. */ +#include + namespace blender { /** diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h index c6b7a0074797..633bc972446e 100644 --- a/source/blender/blenlib/BLI_endian_switch_inline.h +++ b/source/blender/blenlib/BLI_endian_switch_inline.h @@ -4,6 +4,9 @@ #pragma once +#include "BLI_compiler_compat.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_fileops.hh b/source/blender/blenlib/BLI_fileops.hh index 2a4ebfb75934..98ff73d6ad94 100644 --- a/source/blender/blenlib/BLI_fileops.hh +++ b/source/blender/blenlib/BLI_fileops.hh @@ -13,7 +13,7 @@ # error This is a C++ header #endif -#include "BLI_fileops.h" +#include "BLI_fileops.h" // IWYU pragma: export #include "BLI_string_ref.hh" #include diff --git a/source/blender/blenlib/BLI_function_ref.hh b/source/blender/blenlib/BLI_function_ref.hh index a21d4a498c64..95f60fae5545 100644 --- a/source/blender/blenlib/BLI_function_ref.hh +++ b/source/blender/blenlib/BLI_function_ref.hh @@ -4,7 +4,6 @@ #pragma once -#include #include #include @@ -68,8 +67,6 @@ * some_function([]() { return 0; }); */ -#include "BLI_memory_utils.hh" - namespace blender { template class FunctionRef; diff --git a/source/blender/blenlib/BLI_generic_key.hh b/source/blender/blenlib/BLI_generic_key.hh index 04e9815fbe86..c9899d4464b6 100644 --- a/source/blender/blenlib/BLI_generic_key.hh +++ b/source/blender/blenlib/BLI_generic_key.hh @@ -10,7 +10,7 @@ #include -#include "BLI_utildefines.h" +#include "BLI_assert.h" namespace blender { diff --git a/source/blender/blenlib/BLI_generic_virtual_array.hh b/source/blender/blenlib/BLI_generic_virtual_array.hh index c47b6da1e6a9..abfa5072b1a1 100644 --- a/source/blender/blenlib/BLI_generic_virtual_array.hh +++ b/source/blender/blenlib/BLI_generic_virtual_array.hh @@ -13,7 +13,6 @@ #include "BLI_generic_array.hh" #include "BLI_generic_span.hh" -#include "BLI_timeit.hh" #include "BLI_virtual_array.hh" namespace blender { diff --git a/source/blender/blenlib/BLI_hash.hh b/source/blender/blenlib/BLI_hash.hh index d16328cc8199..bcfb5678f9f6 100644 --- a/source/blender/blenlib/BLI_hash.hh +++ b/source/blender/blenlib/BLI_hash.hh @@ -66,7 +66,6 @@ #include #include "BLI_string_ref.hh" -#include "BLI_utildefines.h" namespace blender { diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh index 4bfe657b67b3..1d12ce34200e 100644 --- a/source/blender/blenlib/BLI_hash_tables.hh +++ b/source/blender/blenlib/BLI_hash_tables.hh @@ -12,7 +12,6 @@ #include -#include "BLI_memory_utils.hh" #include "BLI_utildefines.h" #include "BLI_vector.hh" diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h index f9786f7394c2..5de0e3f0850d 100644 --- a/source/blender/blenlib/BLI_heap.h +++ b/source/blender/blenlib/BLI_heap.h @@ -9,6 +9,9 @@ * \brief A min-heap / priority queue ADT */ +#include +#include + #include "BLI_compiler_attrs.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_heap_simple.h b/source/blender/blenlib/BLI_heap_simple.h index bfb5f1ddc9ae..1363c94d01a0 100644 --- a/source/blender/blenlib/BLI_heap_simple.h +++ b/source/blender/blenlib/BLI_heap_simple.h @@ -9,6 +9,9 @@ * \brief A min-heap / priority queue ADT */ +#include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_index_ranges_builder_fwd.hh b/source/blender/blenlib/BLI_index_ranges_builder_fwd.hh index 3fd8b1d2fcfb..d6f053ec1320 100644 --- a/source/blender/blenlib/BLI_index_ranges_builder_fwd.hh +++ b/source/blender/blenlib/BLI_index_ranges_builder_fwd.hh @@ -4,8 +4,6 @@ #pragma once -#include "BLI_utildefines.h" - namespace blender { template class IndexRangesBuilder; diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h index c0830d25fb6e..473d81120def 100644 --- a/source/blender/blenlib/BLI_iterator.h +++ b/source/blender/blenlib/BLI_iterator.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_kdopbvh.hh b/source/blender/blenlib/BLI_kdopbvh.hh index 11a890228003..e0eec79f3e7e 100644 --- a/source/blender/blenlib/BLI_kdopbvh.hh +++ b/source/blender/blenlib/BLI_kdopbvh.hh @@ -9,7 +9,7 @@ */ #include "BLI_function_ref.hh" -#include "BLI_math_vector.hh" +#include "BLI_math_vector_types.hh" #include "BLI_sys_types.h" struct BVHTree; diff --git a/source/blender/blenlib/BLI_kdtree_impl.h b/source/blender/blenlib/BLI_kdtree_impl.h index bbbc83d1794c..78df08698042 100644 --- a/source/blender/blenlib/BLI_kdtree_impl.h +++ b/source/blender/blenlib/BLI_kdtree_impl.h @@ -14,6 +14,11 @@ #define _BLI_CONCAT(MACRO_ARG1, MACRO_ARG2) _BLI_CONCAT_AUX(MACRO_ARG1, MACRO_ARG2) #define BLI_kdtree_nd_(id) _BLI_CONCAT(KDTREE_PREFIX_ID, _##id) +/* For auto-complete / `clangd`. */ +#ifndef KD_DIMS +# define KD_DIMS 0 +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh index 816ab95f552d..02986699e4a6 100644 --- a/source/blender/blenlib/BLI_map_slots.hh +++ b/source/blender/blenlib/BLI_map_slots.hh @@ -22,6 +22,7 @@ * - Implement slot type that stores the hash. */ +#include "BLI_hash_tables.hh" #include "BLI_memory_utils.hh" namespace blender { diff --git a/source/blender/blenlib/BLI_math_axis_angle_types.hh b/source/blender/blenlib/BLI_math_axis_angle_types.hh index b73264891560..e1fdaa8763b9 100644 --- a/source/blender/blenlib/BLI_math_axis_angle_types.hh +++ b/source/blender/blenlib/BLI_math_axis_angle_types.hh @@ -23,7 +23,6 @@ #include #include "BLI_math_angle_types.hh" -#include "BLI_math_base.hh" #include "BLI_math_basis_types.hh" #include "BLI_math_vector_types.hh" diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index a97b2d16a35f..4ec84e0ded9a 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -50,49 +50,12 @@ #endif #include "BLI_assert.h" -#include "BLI_math_inline.h" +#include "BLI_math_inline.h" // IWYU pragma: export #include "BLI_sys_types.h" -#include -#ifndef M_PI -# define M_PI 3.14159265358979323846 /* pi */ -#endif -#ifndef M_PI_2 -# define M_PI_2 1.57079632679489661923 /* pi/2 */ -#endif -#ifndef M_PI_4 -# define M_PI_4 0.78539816339744830962 /* pi/4 */ -#endif -#ifndef M_SQRT2 -# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#endif -#ifndef M_SQRT1_2 -# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ -#endif -#ifndef M_SQRT3 -# define M_SQRT3 1.73205080756887729352 /* sqrt(3) */ -#endif -#ifndef M_SQRT1_3 -# define M_SQRT1_3 0.57735026918962576450 /* 1/sqrt(3) */ -#endif -#ifndef M_1_PI -# define M_1_PI 0.318309886183790671538 /* 1/pi */ -#endif -#ifndef M_E -# define M_E 2.7182818284590452354 /* e */ -#endif -#ifndef M_LOG2E -# define M_LOG2E 1.4426950408889634074 /* log_2 e */ -#endif -#ifndef M_LOG10E -# define M_LOG10E 0.43429448190325182765 /* log_10 e */ -#endif -#ifndef M_LN2 -# define M_LN2 0.69314718055994530942 /* log_e 2 */ -#endif -#ifndef M_LN10 -# define M_LN10 2.30258509299404568402 /* log_e 10 */ -#endif +#include // IWYU pragma: export + +#include "BLI_math_constants.h" // IWYU pragma: export #if defined(__GNUC__) # define NAN_FLT __builtin_nanf("") @@ -102,7 +65,7 @@ static const int NAN_INT = 0x7FC00000; #endif #if BLI_MATH_DO_INLINE -# include "intern/math_base_inline.c" +# include "intern/math_base_inline.c" // IWYU pragma: export #endif #ifdef BLI_MATH_GCC_WARN_PRAGMA diff --git a/source/blender/blenlib/BLI_math_base_safe.h b/source/blender/blenlib/BLI_math_base_safe.h index 63b278202125..6f50c32bdc3d 100644 --- a/source/blender/blenlib/BLI_math_base_safe.h +++ b/source/blender/blenlib/BLI_math_base_safe.h @@ -31,5 +31,5 @@ MINLINE float safe_powf(float base, float exponent); #endif #if BLI_MATH_DO_INLINE -# include "intern/math_base_safe_inline.c" +# include "intern/math_base_safe_inline.c" // IWYU pragma: export #endif diff --git a/source/blender/blenlib/BLI_math_bits.h b/source/blender/blenlib/BLI_math_bits.h index 49ec8acde009..3e69f1bdaeb2 100644 --- a/source/blender/blenlib/BLI_math_bits.h +++ b/source/blender/blenlib/BLI_math_bits.h @@ -61,7 +61,7 @@ MINLINE float uint_as_float(unsigned int i); MINLINE float xor_fl(float x, int y); #if BLI_MATH_DO_INLINE -# include "intern/math_bits_inline.c" +# include "intern/math_bits_inline.c" // IWYU pragma: export #endif #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_math_color.hh b/source/blender/blenlib/BLI_math_color.hh index 0e11052ffe23..4232b3c79d70 100644 --- a/source/blender/blenlib/BLI_math_color.hh +++ b/source/blender/blenlib/BLI_math_color.hh @@ -8,9 +8,6 @@ * \ingroup bli */ -#include -#include - #include "BLI_color.hh" #include "BLI_math_base.hh" #include "BLI_math_matrix_types.hh" diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h index 5215fc67dfbb..d8a1d2e783f5 100644 --- a/source/blender/blenlib/BLI_math_color_blend.h +++ b/source/blender/blenlib/BLI_math_color_blend.h @@ -10,7 +10,6 @@ #include "BLI_math_inline.h" #include "BLI_sys_types.h" -#include "BLI_utildefines.h" #ifdef __cplusplus extern "C" { @@ -127,10 +126,10 @@ MINLINE void blend_color_interpolate_float(float dst[4], const float src2[4], float t); -#if BLI_MATH_DO_INLINE -# include "intern/math_color_blend_inline.c" -#endif - #ifdef __cplusplus } #endif + +#if BLI_MATH_DO_INLINE +# include "intern/math_color_blend_inline.c" // IWYU pragma: export +#endif diff --git a/source/blender/blenlib/BLI_math_constants.h b/source/blender/blenlib/BLI_math_constants.h new file mode 100644 index 000000000000..135644fb8ccc --- /dev/null +++ b/source/blender/blenlib/BLI_math_constants.h @@ -0,0 +1,49 @@ +/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +/** \file + * \ingroup bli + */ + +#ifndef M_PI +# define M_PI 3.14159265358979323846 /* `pi` */ +#endif +#ifndef M_PI_2 +# define M_PI_2 1.57079632679489661923 /* `pi/2` */ +#endif +#ifndef M_PI_4 +# define M_PI_4 0.78539816339744830962 /* `pi/4` */ +#endif +#ifndef M_SQRT2 +# define M_SQRT2 1.41421356237309504880 /* `sqrt(2)` */ +#endif +#ifndef M_SQRT1_2 +# define M_SQRT1_2 0.70710678118654752440 /* `1/sqrt(2)` */ +#endif +#ifndef M_SQRT3 +# define M_SQRT3 1.73205080756887729352 /* `sqrt(3)` */ +#endif +#ifndef M_SQRT1_3 +# define M_SQRT1_3 0.57735026918962576450 /* `1/sqrt(3)` */ +#endif +#ifndef M_1_PI +# define M_1_PI 0.318309886183790671538 /* `1/pi` */ +#endif +#ifndef M_E +# define M_E 2.7182818284590452354 /* `e` */ +#endif +#ifndef M_LOG2E +# define M_LOG2E 1.4426950408889634074 /* `log_2 e` */ +#endif +#ifndef M_LOG10E +# define M_LOG10E 0.43429448190325182765 /* `log_10 e` */ +#endif +#ifndef M_LN2 +# define M_LN2 0.69314718055994530942 /* `log_e 2` */ +#endif +#ifndef M_LN10 +# define M_LN10 2.30258509299404568402 /* `log_e 10` */ +#endif diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 52f2d127178d..04e94a653bf6 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -1392,7 +1392,7 @@ float geodesic_distance_propagate_across_triangle( * \{ */ #if BLI_MATH_DO_INLINE -# include "intern/math_geom_inline.c" +# include "intern/math_geom_inline.c" // IWYU pragma: export #endif #ifdef BLI_MATH_GCC_WARN_PRAGMA diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index d5aeec033ef6..3388f815f67d 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -9,7 +9,6 @@ */ #include "BLI_compiler_attrs.h" -#include "BLI_sys_types.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenlib/BLI_math_matrix.hh b/source/blender/blenlib/BLI_math_matrix.hh index 505f9547bc7b..6d1972f5b21c 100644 --- a/source/blender/blenlib/BLI_math_matrix.hh +++ b/source/blender/blenlib/BLI_math_matrix.hh @@ -12,6 +12,7 @@ #include "BLI_math_matrix_types.hh" #include "BLI_math_rotation_types.hh" #include "BLI_math_vector.hh" +#include "BLI_unroll.hh" namespace blender::math { diff --git a/source/blender/blenlib/BLI_math_matrix_types.hh b/source/blender/blenlib/BLI_math_matrix_types.hh index 785cf4d87037..d0d662f8f822 100644 --- a/source/blender/blenlib/BLI_math_matrix_types.hh +++ b/source/blender/blenlib/BLI_math_matrix_types.hh @@ -31,11 +31,11 @@ * defined outside of the class in the `blender::math` namespace. */ -#include -#include #include #include +#include "BLI_unroll.hh" + #include "BLI_math_vector_types.hh" #include "BLI_utildefines.h" #include "BLI_utility_mixins.hh" diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 5b2db05350ff..b98e21825791 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -8,7 +8,7 @@ * \ingroup bli */ -#include "BLI_math_base.h" +#include "BLI_math_base.h" // IWYU pragma: keep #include "BLI_utildefines.h" #include "DNA_vec_types.h" diff --git a/source/blender/blenlib/BLI_math_rotation_types.hh b/source/blender/blenlib/BLI_math_rotation_types.hh index ec489849560d..b05b0e979be2 100644 --- a/source/blender/blenlib/BLI_math_rotation_types.hh +++ b/source/blender/blenlib/BLI_math_rotation_types.hh @@ -13,8 +13,8 @@ * They also prevent implicit cast from rotation to vector types. */ -#include "BLI_math_angle_types.hh" -#include "BLI_math_axis_angle_types.hh" -#include "BLI_math_basis_types.hh" -#include "BLI_math_euler_types.hh" -#include "BLI_math_quaternion_types.hh" +#include "BLI_math_angle_types.hh" // IWYU pragma: export +#include "BLI_math_axis_angle_types.hh" // IWYU pragma: export +#include "BLI_math_basis_types.hh" // IWYU pragma: export +#include "BLI_math_euler_types.hh" // IWYU pragma: export +#include "BLI_math_quaternion_types.hh" // IWYU pragma: export diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 26826d8c7ee9..fd0c01a7c96c 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -8,7 +8,6 @@ * \ingroup bli */ -#include "BLI_compiler_attrs.h" #include "BLI_math_inline.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index bbb83a34546e..eb4a7bb94cc3 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -8,8 +8,8 @@ * \ingroup bli */ -#include "BLI_compiler_attrs.h" #include "BLI_math_inline.h" +#include "BLI_sys_types.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 6f114a1e4078..aada5632db74 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -635,7 +635,7 @@ void mul_vn_db(double *array_tar, int size, double f); * \{ */ #if BLI_MATH_DO_INLINE -# include "intern/math_vector_inline.c" +# include "intern/math_vector_inline.c" // IWYU pragma: export #endif #ifdef BLI_MATH_GCC_WARN_PRAGMA diff --git a/source/blender/blenlib/BLI_math_vector.hh b/source/blender/blenlib/BLI_math_vector.hh index b826d04be73c..c7d9d8f2dc4a 100644 --- a/source/blender/blenlib/BLI_math_vector.hh +++ b/source/blender/blenlib/BLI_math_vector.hh @@ -8,7 +8,6 @@ * \ingroup bli */ -#include #include #include "BLI_math_base.hh" diff --git a/source/blender/blenlib/BLI_math_vector_types.hh b/source/blender/blenlib/BLI_math_vector_types.hh index 079704d7b167..68209b93a96a 100644 --- a/source/blender/blenlib/BLI_math_vector_types.hh +++ b/source/blender/blenlib/BLI_math_vector_types.hh @@ -9,12 +9,10 @@ */ #include -#include #include #include #include "BLI_math_vector_unroll.hh" -#include "BLI_unroll.hh" #include "BLI_utildefines.h" namespace blender { diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h index 8f613ec67d5a..b813a61a1acd 100644 --- a/source/blender/blenlib/BLI_memarena.h +++ b/source/blender/blenlib/BLI_memarena.h @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_memblock.h b/source/blender/blenlib/BLI_memblock.h index 42741e7ea13c..9813e4f572d3 100644 --- a/source/blender/blenlib/BLI_memblock.h +++ b/source/blender/blenlib/BLI_memblock.h @@ -9,6 +9,7 @@ */ #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenlib/BLI_memory_counter.hh b/source/blender/blenlib/BLI_memory_counter.hh index ce90268d0ec4..5d1d833b60fe 100644 --- a/source/blender/blenlib/BLI_memory_counter.hh +++ b/source/blender/blenlib/BLI_memory_counter.hh @@ -10,10 +10,8 @@ #include "BLI_function_ref.hh" #include "BLI_implicit_sharing_ptr.hh" -#include "BLI_map.hh" #include "BLI_memory_counter_fwd.hh" #include "BLI_set.hh" -#include "BLI_vector_set.hh" namespace blender::memory_counter { diff --git a/source/blender/blenlib/BLI_memory_utils.h b/source/blender/blenlib/BLI_memory_utils.h index d23f81321c7c..8707724bf1f6 100644 --- a/source/blender/blenlib/BLI_memory_utils.h +++ b/source/blender/blenlib/BLI_memory_utils.h @@ -11,6 +11,8 @@ * \brief Generic memory manipulation API. */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh index 9edd4abdad91..7128ce69c600 100644 --- a/source/blender/blenlib/BLI_memory_utils.hh +++ b/source/blender/blenlib/BLI_memory_utils.hh @@ -10,7 +10,6 @@ #include #include -#include #include #include "BLI_utildefines.h" diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index d4c902a5038b..880bdd47086c 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -9,7 +9,6 @@ */ #include "BLI_compiler_attrs.h" -#include "BLI_utildefines.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index fc935bcbd211..dd566bf498eb 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -24,7 +24,6 @@ # include "BLI_math_vector_types.hh" # include "BLI_span.hh" # include "BLI_utility_mixins.hh" -# include "BLI_vector.hh" namespace blender::meshintersect { diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h index fedbeb372bec..b8d5c48fa450 100644 --- a/source/blender/blenlib/BLI_noise.h +++ b/source/blender/blenlib/BLI_noise.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h index 629e86dd6e5b..543e2a0e1a09 100644 --- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h +++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h index 0c07c58a4ad3..13d8c95b1b83 100644 --- a/source/blender/blenlib/BLI_quadric.h +++ b/source/blender/blenlib/BLI_quadric.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index b43445637802..2382da9e0a89 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -8,6 +8,10 @@ * \ingroup bli */ +#include "DNA_listBase.h" + +#include + struct ScanFillVert; #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_set_slots.hh b/source/blender/blenlib/BLI_set_slots.hh index 63ca7b74c35b..829fbfb9a13a 100644 --- a/source/blender/blenlib/BLI_set_slots.hh +++ b/source/blender/blenlib/BLI_set_slots.hh @@ -19,6 +19,7 @@ * destructor might not be called in that case. */ +#include "BLI_hash_tables.hh" #include "BLI_memory_utils.hh" #include "BLI_string_ref.hh" diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h index 0d684172027b..038e37c135c4 100644 --- a/source/blender/blenlib/BLI_stack.h +++ b/source/blender/blenlib/BLI_stack.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #include "BLI_compiler_attrs.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index 6ecca1f2b35a..b95bff3e14aa 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index f377b953d118..b4a9b2101e0a 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -26,7 +26,7 @@ extern "C" { defined(__FreeBSD_kernel__) || defined(__HAIKU__) /* Linux-i386, Linux-Alpha, Linux-PPC */ -# include +# include // IWYU pragma: export /* XXX */ # ifndef UINT64_MAX @@ -39,29 +39,29 @@ typedef uint64_t u_int64_t; #elif defined(__APPLE__) -# include +# include // IWYU pragma: export /* MSVC >= 2010 */ #elif defined(_MSC_VER) -# include +# include // IWYU pragma: export #else /* FreeBSD, Solaris */ -# include -# include +# include // IWYU pragma: export +# include // IWYU pragma: export #endif /* ifdef platform for types */ -#include -#include /* size_t define */ +#include // IWYU pragma: export +#include // IWYU pragma: export #ifndef __cplusplus /* The standard header is missing on some systems. */ # if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) typedef unsigned int char32_t; # else -# include +# include // IWYU pragma: export # endif #endif diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index f8b9d4df4794..4f4e84f63389 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -8,6 +8,8 @@ * \ingroup bli */ +#include + #include "BLI_compiler_attrs.h" #ifdef __cplusplus diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 6936362bb900..4ed1b94040cb 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -13,7 +13,7 @@ /* avoid many includes for now */ #include "BLI_compiler_compat.h" #include "BLI_sys_types.h" -#include "BLI_utildefines_variadic.h" +#include "BLI_utildefines_variadic.h" // IWYU prama: export /* We could remove in future. */ #include "BLI_assert.h" diff --git a/source/blender/blenlib/BLI_vector_set_slots.hh b/source/blender/blenlib/BLI_vector_set_slots.hh index 6099bab95f10..2304f782ead9 100644 --- a/source/blender/blenlib/BLI_vector_set_slots.hh +++ b/source/blender/blenlib/BLI_vector_set_slots.hh @@ -24,7 +24,7 @@ * result in better performance, due to better cache utilization. */ -#include "BLI_sys_types.h" +#include namespace blender { diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index f2dfeaa60e75..bff1bfa34fff 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -299,6 +299,7 @@ set(SRC BLI_math_color.h BLI_math_color.hh BLI_math_color_blend.h + BLI_math_constants.h BLI_math_euler.hh BLI_math_euler_types.hh BLI_math_geom.h diff --git a/source/blender/blenlib/intern/BLI_mempool_private.h b/source/blender/blenlib/intern/BLI_mempool_private.h index 646af946895f..14b2726835e4 100644 --- a/source/blender/blenlib/intern/BLI_mempool_private.h +++ b/source/blender/blenlib/intern/BLI_mempool_private.h @@ -50,7 +50,3 @@ void mempool_iter_threadsafe_destroy(ParallelMempoolTaskData *iter_arr) ATTR_NON * (threaded section noted in comments). */ void *mempool_iter_threadsafe_step(BLI_mempool_threadsafe_iter *ts_iter); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 8f45e0852b83..ab183106975a 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -14,7 +14,10 @@ #include #include -#include "BLI_math_base.h" +#include "BLI_assert.h" +#include "BLI_math_constants.h" +#include "BLI_math_inline.h" +#include "BLI_sys_types.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c index 8df824f6bb51..e7e3dac5462d 100644 --- a/source/blender/blenlib/intern/math_color_blend_inline.c +++ b/source/blender/blenlib/intern/math_color_blend_inline.c @@ -7,13 +7,21 @@ */ #include "BLI_math_base.h" + +#if !BLI_MATH_DO_INLINE +# include "BLI_math_color_blend.h" +#endif + #include "BLI_math_color.h" -#include "BLI_math_color_blend.h" #include "BLI_math_vector.h" #ifndef __MATH_COLOR_BLEND_INLINE_C__ # define __MATH_COLOR_BLEND_INLINE_C__ +# ifdef __cplusplus +extern "C" { +# endif + /* don't add any saturation to a completely black and white image */ # define EPS_SATURATION 0.0005f # define EPS_ALPHA 0.0005f @@ -1127,4 +1135,8 @@ MINLINE void blend_color_interpolate_float(float dst[4], # undef EPS_SATURATION # undef EPS_ALPHA +# ifdef __cplusplus +} +# endif + #endif /* __MATH_COLOR_BLEND_INLINE_C__ */ diff --git a/source/blender/blenlib/intern/math_vector.cc b/source/blender/blenlib/intern/math_vector.cc index 3a5100ad70f0..480470eca6bb 100644 --- a/source/blender/blenlib/intern/math_vector.cc +++ b/source/blender/blenlib/intern/math_vector.cc @@ -6,6 +6,7 @@ * \ingroup bli */ +#include "BLI_math_base.h" #include "BLI_math_vector.h" #include "BLI_math_base_safe.h" diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 739854e81386..b0845db07840 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -10,6 +10,7 @@ #define __MATH_VECTOR_INLINE_C__ #include "BLI_math_base.h" +#include "BLI_utildefines.h" /********************************** Init *************************************/ @@ -634,6 +635,8 @@ MINLINE float dot_v3v3(const float a[3], const float b[3]) return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } +MINLINE bool is_zero_v3(const float v[3]); + MINLINE float dot_v3v3v3(const float p[3], const float a[3], const float b[3]) { float vec1[3], vec2[3]; diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc index 61565a85a2bd..2b6f1dce9d1f 100644 --- a/source/blender/blenlib/intern/task_pool.cc +++ b/source/blender/blenlib/intern/task_pool.cc @@ -8,6 +8,7 @@ * Task pool to run tasks in parallel. */ +#include #include #include #include diff --git a/source/blender/blenlib/tests/BLI_math_matrix_test.cc b/source/blender/blenlib/tests/BLI_math_matrix_test.cc index a310be5930bb..ed62a76b75ff 100644 --- a/source/blender/blenlib/tests/BLI_math_matrix_test.cc +++ b/source/blender/blenlib/tests/BLI_math_matrix_test.cc @@ -4,6 +4,7 @@ #include "testing/testing.h" +#include "BLI_math_base.h" #include "BLI_math_matrix.h" #include "BLI_math_matrix.hh" #include "BLI_math_rotation.h" diff --git a/source/blender/blenlib/tests/BLI_math_rotation_types_test.cc b/source/blender/blenlib/tests/BLI_math_rotation_types_test.cc index 011e18872512..24e9c54cd4c7 100644 --- a/source/blender/blenlib/tests/BLI_math_rotation_types_test.cc +++ b/source/blender/blenlib/tests/BLI_math_rotation_types_test.cc @@ -6,6 +6,7 @@ #include "DNA_action_types.h" +#include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLI_math_rotation.hh" #include "BLI_math_rotation_types.hh" diff --git a/source/blender/blenloader/BLO_readfile.hh b/source/blender/blenloader/BLO_readfile.hh index 030e069a49a5..ebc917a54725 100644 --- a/source/blender/blenloader/BLO_readfile.hh +++ b/source/blender/blenloader/BLO_readfile.hh @@ -545,9 +545,23 @@ short BLO_version_from_file(const char *filepath); struct ID_Readfile_Data { struct Tags { bool is_id_link_placeholder : 1; + + /** + * Set when this ID used a legacy Action, in which case it also should pick + * an appropriate slot. + * + * \see ANIM_versioning.hh + */ + bool action_assignment_needs_slot : 1; } tags; }; +/** + * Return `id->runtime.readfile_data->tags` if the `readfile_data` is allocated, + * otherwise return an all-zero set of tags. + */ +ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(ID &id); + /** * Free the ID_Readfile_Data of all IDs in this bmain and all their embedded IDs. * @@ -557,7 +571,7 @@ struct ID_Readfile_Data { void BLO_readfile_id_runtime_data_free_all(Main &bmain); /** - * Free the ID_Readfile_Data of this ID. Does _not_ deal with embeded IDs. + * Free the ID_Readfile_Data of this ID. Does _not_ deal with embedded IDs. */ void BLO_readfile_id_runtime_data_free(ID &id); diff --git a/source/blender/blenloader/BLO_writefile.hh b/source/blender/blenloader/BLO_writefile.hh index 2bbc7f3be550..704356178663 100644 --- a/source/blender/blenloader/BLO_writefile.hh +++ b/source/blender/blenloader/BLO_writefile.hh @@ -9,6 +9,8 @@ * \brief external `writefile.cc` function prototypes. */ +#include "BLI_sys_types.h" + struct BlendThumbnail; struct Main; struct MemFile; diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc index c58b98140663..f6b2078f0100 100644 --- a/source/blender/blenloader/intern/readfile.cc +++ b/source/blender/blenloader/intern/readfile.cc @@ -2185,16 +2185,12 @@ static void readfile_id_runtime_data_ensure(ID &id) id.runtime.readfile_data = MEM_cnew(__func__); } -/** - * Return `id.runtime.readfile_data->tags` if the `readfile_data` is allocated, - * otherwise return an all-zero set of tags. - */ -static ID_Readfile_Data::Tags readfile_id_runtime_tags(ID *id) +ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(ID &id) { - if (!id->runtime.readfile_data) { + if (!id.runtime.readfile_data) { return ID_Readfile_Data::Tags{}; } - return id->runtime.readfile_data->tags; + return id.runtime.readfile_data->tags; } void BLO_readfile_id_runtime_data_free(ID &id) @@ -2279,7 +2275,7 @@ static void direct_link_id_common(BlendDataReader *reader, id->runtime.readfile_data->tags = id_read_tags; } - if (readfile_id_runtime_tags(id).is_id_link_placeholder) { + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder) { /* For placeholder we only need to set the tag and properly initialize generic ID fields above, * no further data to read. */ return; @@ -2591,7 +2587,7 @@ static bool direct_link_id(FileData *fd, /* Read part of datablock that is common between real and embedded datablocks. */ direct_link_id_common(&reader, main->curlib, id, id_old, tag, id_read_tags); - if (readfile_id_runtime_tags(id).is_id_link_placeholder) { + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder) { /* For placeholder we only need to set the tag, no further data to read. */ id->tag = tag; return true; @@ -4255,7 +4251,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) else { /* Convert any previously read weak link to regular link * to signal that we want to read this data-block. */ - if (readfile_id_runtime_tags(id).is_id_link_placeholder) { + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder) { id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK; } @@ -4295,7 +4291,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) /* Convert any previously read weak link to regular link to signal that we want to read this * data-block. Note that this function also visits already-loaded data-blocks, and thus their * `readfile_data` field might already have been freed. */ - if (readfile_id_runtime_tags(id).is_id_link_placeholder) { + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder) { id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK; } @@ -4711,7 +4707,7 @@ static int has_linked_ids_to_read(Main *mainvar) while (a--) { LISTBASE_FOREACH (ID *, id, lbarray[a]) { - if (readfile_id_runtime_tags(id).is_id_link_placeholder && + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder && !(id->flag & ID_FLAG_INDIRECT_WEAK_LINK)) { return true; @@ -4789,7 +4785,7 @@ static void read_library_linked_ids(FileData *basefd, while (id) { ID *id_next = static_cast(id->next); - if (readfile_id_runtime_tags(id).is_id_link_placeholder && + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder && !(id->flag & ID_FLAG_INDIRECT_WEAK_LINK)) { BLI_remlink(lbarray[a], id); @@ -4853,7 +4849,7 @@ static void read_library_clear_weak_links(FileData *basefd, ListBase *mainlist, /* This function also visits already-loaded data-blocks, and thus their * `readfile_data` field might already have been freed. */ - if (readfile_id_runtime_tags(id).is_id_link_placeholder && + if (BLO_readfile_id_runtime_tags(*id).is_id_link_placeholder && (id->flag & ID_FLAG_INDIRECT_WEAK_LINK)) { CLOG_INFO(&LOG, 3, "Dropping weak link to '%s'", id->name); diff --git a/source/blender/blenloader/intern/versioning_250.cc b/source/blender/blenloader/intern/versioning_250.cc index 66c843b06fc6..55ecec4b902a 100644 --- a/source/blender/blenloader/intern/versioning_250.cc +++ b/source/blender/blenloader/intern/versioning_250.cc @@ -624,36 +624,36 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock) } } -static bool seq_sound_proxy_update_cb(Strip *seq, void * /*user_data*/) +static bool strip_sound_proxy_update_cb(Strip *strip, void * /*user_data*/) { -#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) -#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) +#define STRIP_USE_PROXY_CUSTOM_DIR (1 << 19) +#define STRIP_USE_PROXY_CUSTOM_FILE (1 << 21) /* don't know, if anybody used that this way, but just in case, upgrade to new way... */ - if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) && !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { - SNPRINTF(seq->data->proxy->dirpath, "%s" SEP_STR "BL_proxy", seq->data->dirpath); + if ((strip->flag & STRIP_USE_PROXY_CUSTOM_FILE) && !(strip->flag & STRIP_USE_PROXY_CUSTOM_DIR)) { + SNPRINTF(strip->data->proxy->dirpath, "%s" SEP_STR "BL_proxy", strip->data->dirpath); } -#undef SEQ_USE_PROXY_CUSTOM_DIR -#undef SEQ_USE_PROXY_CUSTOM_FILE +#undef STRIP_USE_PROXY_CUSTOM_DIR +#undef STRIP_USE_PROXY_CUSTOM_FILE return true; } -static bool seq_set_volume_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_volume_cb(Strip *strip, void * /*user_data*/) { - seq->volume = 1.0f; + strip->volume = 1.0f; return true; } -static bool seq_set_sat_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_sat_cb(Strip *strip, void * /*user_data*/) { - if (seq->sat == 0.0f) { - seq->sat = 1.0f; + if (strip->sat == 0.0f) { + strip->sat = 1.0f; } return true; } -static bool seq_set_pitch_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_pitch_cb(Strip *strip, void * /*user_data*/) { - seq->pitch = 1.0f; + strip->pitch = 1.0f; return true; } @@ -703,7 +703,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_sound_proxy_update_cb, bmain); + SEQ_for_each_callback(&scene->ed->seqbase, strip_sound_proxy_update_cb, bmain); } } @@ -1388,7 +1388,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain) sce->r.ffcodecdata.audio_codec = 0x0; /* `CODEC_ID_NONE` */ } if (sce->ed) { - SEQ_for_each_callback(&sce->ed->seqbase, seq_set_volume_cb, nullptr); + SEQ_for_each_callback(&sce->ed->seqbase, strip_set_volume_cb, nullptr); } } @@ -1623,7 +1623,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_set_sat_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_set_sat_cb, nullptr); } } @@ -2054,7 +2054,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain) scene->r.ffcodecdata.audio_channels = 2; scene->audio.volume = 1.0f; if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_set_pitch_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_set_pitch_cb, nullptr); } } diff --git a/source/blender/blenloader/intern/versioning_260.cc b/source/blender/blenloader/intern/versioning_260.cc index dc979dd79714..9c0415defcb6 100644 --- a/source/blender/blenloader/intern/versioning_260.cc +++ b/source/blender/blenloader/intern/versioning_260.cc @@ -996,12 +996,12 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int /*is_group*/) } } -static bool seq_colorbalance_update_cb(Strip *seq, void * /*user_data*/) +static bool strip_colorbalance_update_cb(Strip *strip, void * /*user_data*/) { - StripData *data = seq->data; + StripData *data = strip->data; if (data && data->color_balance) { - SequenceModifierData *smd = SEQ_modifier_new(seq, nullptr, seqModifierType_ColorBalance); + SequenceModifierData *smd = SEQ_modifier_new(strip, nullptr, seqModifierType_ColorBalance); ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; cbmd->color_balance = *data->color_balance; @@ -1010,8 +1010,8 @@ static bool seq_colorbalance_update_cb(Strip *seq, void * /*user_data*/) * so we need to move multiplication to modifier so files would be * compatible */ - cbmd->color_multiply = seq->mul; - seq->mul = 1.0f; + cbmd->color_multiply = strip->mul; + strip->mul = 1.0f; MEM_freeN(data->color_balance); data->color_balance = nullptr; @@ -1019,22 +1019,22 @@ static bool seq_colorbalance_update_cb(Strip *seq, void * /*user_data*/) return true; } -static bool seq_set_alpha_mode_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_alpha_mode_cb(Strip *strip, void * /*user_data*/) { enum { SEQ_MAKE_PREMUL = (1 << 6) }; - if (seq->flag & SEQ_MAKE_PREMUL) { - seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + if (strip->flag & SEQ_MAKE_PREMUL) { + strip->alpha_mode = SEQ_ALPHA_STRAIGHT; } else { - SEQ_alpha_mode_from_file_extension(seq); + SEQ_alpha_mode_from_file_extension(strip); } return true; } -static bool seq_set_wipe_angle_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_wipe_angle_cb(Strip *strip, void * /*user_data*/) { - if (seq->type == SEQ_TYPE_WIPE) { - WipeVars *wv = static_cast(seq->effectdata); + if (strip->type == STRIP_TYPE_WIPE) { + WipeVars *wv = static_cast(strip->effectdata); wv->angle = DEG2RADF(wv->angle); } return true; @@ -1846,7 +1846,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 18)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_colorbalance_update_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_colorbalance_update_cb, nullptr); } } } @@ -2085,7 +2085,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 265, 5)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_set_alpha_mode_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_set_alpha_mode_cb, nullptr); } if (scene->r.bake_samples == 0) { @@ -2785,7 +2785,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_set_wipe_angle_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_set_wipe_angle_cb, nullptr); } } diff --git a/source/blender/blenloader/intern/versioning_270.cc b/source/blender/blenloader/intern/versioning_270.cc index 4ec3b5a2e0ab..9108717e0968 100644 --- a/source/blender/blenloader/intern/versioning_270.cc +++ b/source/blender/blenloader/intern/versioning_270.cc @@ -423,39 +423,38 @@ static void do_version_bbone_easing_fcurve_fix(ID * /*id*/, FCurve *fcu) } } -static bool seq_update_proxy_cb(Strip *seq, void * /*user_data*/) +static bool strip_update_proxy_cb(Strip *strip, void * /*user_data*/) { - seq->stereo3d_format = static_cast( + strip->stereo3d_format = static_cast( MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format")); -#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) -#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) - if (seq->data && seq->data->proxy && !seq->data->proxy->storage) { - if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { - seq->data->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR; +#define STRIP_USE_PROXY_CUSTOM_DIR (1 << 19) +#define STRIP_USE_PROXY_CUSTOM_FILE (1 << 21) + if (strip->data && strip->data->proxy && !strip->data->proxy->storage) { + if (strip->flag & STRIP_USE_PROXY_CUSTOM_DIR) { + strip->data->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR; } - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - seq->data->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE; + if (strip->flag & STRIP_USE_PROXY_CUSTOM_FILE) { + strip->data->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE; } } -#undef SEQ_USE_PROXY_CUSTOM_DIR -#undef SEQ_USE_PROXY_CUSTOM_FILE +#undef STRIP_USE_PROXY_CUSTOM_DIR +#undef STRIP_USE_PROXY_CUSTOM_FILE return true; } -static bool seq_update_effectdata_cb(Strip *seq, void * /*user_data*/) +static bool strip_update_effectdata_cb(Strip *strip, void * /*user_data*/) { - - if (seq->type != SEQ_TYPE_TEXT) { + if (strip->type != STRIP_TYPE_TEXT) { return true; } - if (seq->effectdata == nullptr) { - SeqEffectHandle effect_handle = SEQ_effect_handle_get(seq); - effect_handle.init(seq); + if (strip->effectdata == nullptr) { + SeqEffectHandle effect_handle = SEQ_effect_handle_get(strip); + effect_handle.init(strip); } - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); if (data->color[3] == 0.0f) { copy_v4_fl(data->color, 1.0f); data->shadow_color[3] = 1.0f; @@ -872,7 +871,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain) STRNCPY(srv->suffix, STEREO_RIGHT_SUFFIX); if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_update_proxy_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_update_proxy_cb, nullptr); } } @@ -1145,7 +1144,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_update_effectdata_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_update_effectdata_cb, nullptr); } } diff --git a/source/blender/blenloader/intern/versioning_280.cc b/source/blender/blenloader/intern/versioning_280.cc index 413232d17f3a..673f44e2f45e 100644 --- a/source/blender/blenloader/intern/versioning_280.cc +++ b/source/blender/blenloader/intern/versioning_280.cc @@ -615,7 +615,7 @@ static void do_version_constraints_copy_rotation_mix_mode(ListBase *lb) static void do_versions_seq_alloc_transform_and_crop(ListBase *seqbase) { LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD) == 0) { + if (ELEM(seq->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD) == 0) { if (seq->data->transform == nullptr) { seq->data->transform = static_cast( MEM_callocN(sizeof(StripTransform), "StripTransform")); @@ -3009,11 +3009,11 @@ static void do_versions_seq_set_cache_defaults(Editing *ed) ed->recycle_max_cost = 10.0f; } -static bool seq_update_flags_cb(Strip *seq, void * /*user_data*/) +static bool strip_update_flags_cb(Strip *strip, void * /*user_data*/) { - seq->flag &= ~((1 << 6) | (1 << 18) | (1 << 19) | (1 << 21)); - if (seq->type == SEQ_TYPE_SPEED) { - SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; + strip->flag &= ~((1 << 6) | (1 << 18) | (1 << 19) | (1 << 21)); + if (strip->type == STRIP_TYPE_SPEED) { + SpeedControlVars *s = (SpeedControlVars *)strip->effectdata; s->flags &= ~(SEQ_SPEED_UNUSED_1); } return true; @@ -4647,7 +4647,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain) } if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_update_flags_cb, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_update_flags_cb, nullptr); } } diff --git a/source/blender/blenloader/intern/versioning_290.cc b/source/blender/blenloader/intern/versioning_290.cc index f612412c4eb0..1e876f962b4d 100644 --- a/source/blender/blenloader/intern/versioning_290.cc +++ b/source/blender/blenloader/intern/versioning_290.cc @@ -99,21 +99,22 @@ static eSpaceSeq_Proxy_RenderSize get_sequencer_render_size(Main *bmain) return render_size; } -static bool can_use_proxy(const Strip *seq, int psize) +static bool can_use_proxy(const Strip *strip, int psize) { - if (seq->data->proxy == nullptr) { + if (strip->data->proxy == nullptr) { return false; } - short size_flags = seq->data->proxy->build_size_flags; - return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; + short size_flags = strip->data->proxy->build_size_flags; + return (strip->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && + (size_flags & psize) != 0; } /* image_size is width or height depending what RNA property is converted - X or Y. */ -static void seq_convert_transform_animation(const Strip *seq, - const Scene *scene, - const char *path, - const int image_size, - const int scene_size) +static void strip_convert_transform_animation(const Strip *strip, + const Scene *scene, + const char *path, + const int image_size, + const int scene_size) { if (scene->adt == nullptr || scene->adt->action == nullptr) { return; @@ -124,7 +125,7 @@ static void seq_convert_transform_animation(const Strip *seq, const uint32_t use_crop_flag = (1 << 17); /* Convert offset animation, but only if crop is not used. */ - if ((seq->flag & use_transform_flag) != 0 && (seq->flag & use_crop_flag) == 0) { + if ((strip->flag & use_transform_flag) != 0 && (strip->flag & use_crop_flag) == 0) { FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0); if (fcu != nullptr && !BKE_fcurve_is_empty(fcu)) { BezTriple *bezt = fcu->bezt; @@ -143,19 +144,19 @@ static void seq_convert_transform_animation(const Strip *seq, } } -static void seq_convert_transform_crop(const Scene *scene, - Strip *seq, - const eSpaceSeq_Proxy_RenderSize render_size) +static void strip_convert_transform_crop(const Scene *scene, + Strip *strip, + const eSpaceSeq_Proxy_RenderSize render_size) { - if (seq->data->transform == nullptr) { - seq->data->transform = MEM_cnew(__func__); + if (strip->data->transform == nullptr) { + strip->data->transform = MEM_cnew(__func__); } - if (seq->data->crop == nullptr) { - seq->data->crop = MEM_cnew(__func__); + if (strip->data->crop == nullptr) { + strip->data->crop = MEM_cnew(__func__); } - StripCrop *c = seq->data->crop; - StripTransform *t = seq->data->transform; + StripCrop *c = strip->data->crop; + StripTransform *t = strip->data->transform; int old_image_center_x = scene->r.xsch / 2; int old_image_center_y = scene->r.ysch / 2; int image_size_x = scene->r.xsch; @@ -165,12 +166,12 @@ static void seq_convert_transform_crop(const Scene *scene, const uint32_t use_transform_flag = (1 << 16); const uint32_t use_crop_flag = (1 << 17); - const StripElem *s_elem = seq->data->stripdata; + const StripElem *s_elem = strip->data->stripdata; if (s_elem != nullptr) { image_size_x = s_elem->orig_width; image_size_y = s_elem->orig_height; - if (can_use_proxy(seq, SEQ_rendersize_to_proxysize(render_size))) { + if (can_use_proxy(strip, SEQ_rendersize_to_proxysize(render_size))) { image_size_x /= SEQ_rendersize_to_scale_factor(render_size); image_size_y /= SEQ_rendersize_to_scale_factor(render_size); } @@ -183,11 +184,11 @@ static void seq_convert_transform_crop(const Scene *scene, } /* Clear crop if it was unused. This must happen before converting values. */ - if ((seq->flag & use_crop_flag) == 0) { + if ((strip->flag & use_crop_flag) == 0) { c->bottom = c->top = c->left = c->right = 0; } - if ((seq->flag & use_transform_flag) == 0) { + if ((strip->flag & use_transform_flag) == 0) { t->xofs = t->yofs = 0; /* Reverse scale to fit for strips not using offset. */ @@ -201,7 +202,7 @@ static void seq_convert_transform_crop(const Scene *scene, } } - if ((seq->flag & use_crop_flag) != 0 && (seq->flag & use_transform_flag) == 0) { + if ((strip->flag & use_crop_flag) != 0 && (strip->flag & use_transform_flag) == 0) { /* Calculate image offset. */ float s_x = scene->r.xsch / image_size_x; float s_y = scene->r.ysch / image_size_y; @@ -216,7 +217,7 @@ static void seq_convert_transform_crop(const Scene *scene, t->scale_y *= float(image_size_y) / float(cropped_image_size_y); } - if ((seq->flag & use_transform_flag) != 0) { + if ((strip->flag & use_transform_flag) != 0) { /* Convert image offset. */ old_image_center_x = image_size_x / 2 - c->left + t->xofs; old_image_center_y = image_size_y / 2 - c->bottom + t->yofs; @@ -226,7 +227,7 @@ static void seq_convert_transform_crop(const Scene *scene, float(image_size_y) / float(scene->r.ysch)); /* Convert crop. */ - if ((seq->flag & use_crop_flag) != 0) { + if ((strip->flag & use_crop_flag) != 0) { c->top /= t->scale_x; c->bottom /= t->scale_x; c->left /= t->scale_x; @@ -237,38 +238,38 @@ static void seq_convert_transform_crop(const Scene *scene, t->xofs = old_image_center_x - scene->r.xsch / 2; t->yofs = old_image_center_y - scene->r.ysch / 2; - char name_esc[(sizeof(seq->name) - 2) * 2], *path; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + char name_esc[(sizeof(strip->name) - 2) * 2], *path; + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_x", name_esc); - seq_convert_transform_animation(seq, scene, path, image_size_x, scene->r.xsch); + strip_convert_transform_animation(strip, scene, path, image_size_x, scene->r.xsch); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_y", name_esc); - seq_convert_transform_animation(seq, scene, path, image_size_y, scene->r.ysch); + strip_convert_transform_animation(strip, scene, path, image_size_y, scene->r.ysch); MEM_freeN(path); - seq->flag &= ~use_transform_flag; - seq->flag &= ~use_crop_flag; + strip->flag &= ~use_transform_flag; + strip->flag &= ~use_crop_flag; } -static void seq_convert_transform_crop_lb(const Scene *scene, - const ListBase *lb, - const eSpaceSeq_Proxy_RenderSize render_size) +static void strip_convert_transform_crop_lb(const Scene *scene, + const ListBase *lb, + const eSpaceSeq_Proxy_RenderSize render_size) { LISTBASE_FOREACH (Strip *, seq, lb) { - if (!ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { - seq_convert_transform_crop(scene, seq, render_size); + if (!ELEM(seq->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD)) { + strip_convert_transform_crop(scene, seq, render_size); } - if (seq->type == SEQ_TYPE_META) { - seq_convert_transform_crop_lb(scene, &seq->seqbase, render_size); + if (seq->type == STRIP_TYPE_META) { + strip_convert_transform_crop_lb(scene, &seq->seqbase, render_size); } } } -static void seq_convert_transform_animation_2(const Scene *scene, - const char *path, - const float scale_to_fit_factor) +static void strip_convert_transform_animation_2(const Scene *scene, + const char *path, + const float scale_to_fit_factor) { if (scene->adt == nullptr || scene->adt->action == nullptr) { return; @@ -286,21 +287,21 @@ static void seq_convert_transform_animation_2(const Scene *scene, } } -static void seq_convert_transform_crop_2(const Scene *scene, - Strip *seq, - const eSpaceSeq_Proxy_RenderSize render_size) +static void strip_convert_transform_crop_2(const Scene *scene, + Strip *strip, + const eSpaceSeq_Proxy_RenderSize render_size) { - const StripElem *s_elem = seq->data->stripdata; + const StripElem *s_elem = strip->data->stripdata; if (s_elem == nullptr) { return; } - StripCrop *c = seq->data->crop; - StripTransform *t = seq->data->transform; + StripCrop *c = strip->data->crop; + StripTransform *t = strip->data->transform; int image_size_x = s_elem->orig_width; int image_size_y = s_elem->orig_height; - if (can_use_proxy(seq, SEQ_rendersize_to_proxysize(render_size))) { + if (can_use_proxy(strip, SEQ_rendersize_to_proxysize(render_size))) { image_size_x /= SEQ_rendersize_to_scale_factor(render_size); image_size_y /= SEQ_rendersize_to_scale_factor(render_size); } @@ -315,39 +316,39 @@ static void seq_convert_transform_crop_2(const Scene *scene, c->left /= scale_to_fit_factor; c->right /= scale_to_fit_factor; - char name_esc[(sizeof(seq->name) - 2) * 2], *path; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + char name_esc[(sizeof(strip->name) - 2) * 2], *path; + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.scale_x", name_esc); - seq_convert_transform_animation_2(scene, path, scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, scale_to_fit_factor); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.scale_y", name_esc); - seq_convert_transform_animation_2(scene, path, scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, scale_to_fit_factor); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.min_x", name_esc); - seq_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.max_x", name_esc); - seq_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.min_y", name_esc); - seq_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); MEM_freeN(path); path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop.max_x", name_esc); - seq_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); + strip_convert_transform_animation_2(scene, path, 1 / scale_to_fit_factor); MEM_freeN(path); } -static void seq_convert_transform_crop_lb_2(const Scene *scene, - const ListBase *lb, - const eSpaceSeq_Proxy_RenderSize render_size) +static void strip_convert_transform_crop_lb_2(const Scene *scene, + const ListBase *lb, + const eSpaceSeq_Proxy_RenderSize render_size) { LISTBASE_FOREACH (Strip *, seq, lb) { - if (!ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { - seq_convert_transform_crop_2(scene, seq, render_size); + if (!ELEM(seq->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD)) { + strip_convert_transform_crop_2(scene, seq, render_size); } - if (seq->type == SEQ_TYPE_META) { - seq_convert_transform_crop_lb_2(scene, &seq->seqbase, render_size); + if (seq->type == STRIP_TYPE_META) { + strip_convert_transform_crop_lb_2(scene, &seq->seqbase, render_size); } } } @@ -622,7 +623,7 @@ void do_versions_after_linking_290(FileData * /*fd*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - seq_convert_transform_crop_lb(scene, &scene->ed->seqbase, render_size); + strip_convert_transform_crop_lb(scene, &scene->ed->seqbase, render_size); } } } @@ -646,7 +647,7 @@ void do_versions_after_linking_290(FileData * /*fd*/, Main *bmain) eSpaceSeq_Proxy_RenderSize render_size = get_sequencer_render_size(bmain); LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - seq_convert_transform_crop_lb_2(scene, &scene->ed->seqbase, render_size); + strip_convert_transform_crop_lb_2(scene, &scene->ed->seqbase, render_size); } } } @@ -784,7 +785,7 @@ static void do_versions_strip_cache_settings_recursive(const ListBase *seqbase) { LISTBASE_FOREACH (Strip *, seq, seqbase) { seq->cache_flag = 0; - if (seq->type == SEQ_TYPE_META) { + if (seq->type == STRIP_TYPE_META) { do_versions_strip_cache_settings_recursive(&seq->seqbase); } } diff --git a/source/blender/blenloader/intern/versioning_300.cc b/source/blender/blenloader/intern/versioning_300.cc index b8667a2a68ab..7040a2faab82 100644 --- a/source/blender/blenloader/intern/versioning_300.cc +++ b/source/blender/blenloader/intern/versioning_300.cc @@ -289,10 +289,10 @@ static void do_versions_idproperty_bones_recursive(Bone *bone) static void do_versions_idproperty_seq_recursive(ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - version_idproperty_ui_data(seq->prop); - if (seq->type == SEQ_TYPE_META) { - do_versions_idproperty_seq_recursive(&seq->seqbase); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + version_idproperty_ui_data(strip->prop); + if (strip->type == STRIP_TYPE_META) { + do_versions_idproperty_seq_recursive(&strip->seqbase); } } } @@ -422,47 +422,48 @@ static void move_vertex_group_names_to_object_data(Main *bmain) static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const ListBase *seqbase) { /* Old SpeedControlVars->flags. */ -#define SEQ_SPEED_INTEGRATE (1 << 0) -#define SEQ_SPEED_COMPRESS_IPO_Y (1 << 2) +#define STRIP_SPEED_INTEGRATE (1 << 0) +#define STRIP_SPEED_COMPRESS_IPO_Y (1 << 2) - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_SPEED) { - SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type == STRIP_TYPE_SPEED) { + SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; const char *substr = nullptr; float globalSpeed = v->globalSpeed; - if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { + if (strip->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { if (globalSpeed == 1.0f) { v->speed_control_type = SEQ_SPEED_STRETCH; } else { v->speed_control_type = SEQ_SPEED_MULTIPLY; v->speed_fader = globalSpeed * - (float(seq->seq1->len) / - max_ff(float(SEQ_time_right_handle_frame_get(scene, seq->seq1) - - seq->seq1->start), + (float(strip->seq1->len) / + max_ff(float(SEQ_time_right_handle_frame_get(scene, strip->seq1) - + strip->seq1->start), 1.0f)); } } - else if (v->flags & SEQ_SPEED_INTEGRATE) { + else if (v->flags & STRIP_SPEED_INTEGRATE) { v->speed_control_type = SEQ_SPEED_MULTIPLY; - v->speed_fader = seq->speed_fader * globalSpeed; + v->speed_fader = strip->speed_fader * globalSpeed; } - else if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) { + else if (v->flags & STRIP_SPEED_COMPRESS_IPO_Y) { globalSpeed *= 100.0f; v->speed_control_type = SEQ_SPEED_LENGTH; - v->speed_fader_length = seq->speed_fader * globalSpeed; + v->speed_fader_length = strip->speed_fader * globalSpeed; substr = "speed_length"; } else { v->speed_control_type = SEQ_SPEED_FRAME_NUMBER; - v->speed_fader_frame_number = int(seq->speed_fader * globalSpeed); + v->speed_fader_frame_number = int(strip->speed_fader * globalSpeed); substr = "speed_frame_number"; } - v->flags &= ~(SEQ_SPEED_INTEGRATE | SEQ_SPEED_COMPRESS_IPO_Y); + v->flags &= ~(STRIP_SPEED_INTEGRATE | STRIP_SPEED_COMPRESS_IPO_Y); if (substr || globalSpeed != 1.0f) { - FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "speed_factor", 0, nullptr); + FCurve *fcu = id_data_find_fcurve( + &scene->id, strip, &RNA_Strip, "speed_factor", 0, nullptr); if (fcu) { if (globalSpeed != 1.0f) { for (int i = 0; i < fcu->totvert; i++) { @@ -480,24 +481,24 @@ static void do_versions_sequencer_speed_effect_recursive(Scene *scene, const Lis } } } - else if (seq->type == SEQ_TYPE_META) { - do_versions_sequencer_speed_effect_recursive(scene, &seq->seqbase); + else if (strip->type == STRIP_TYPE_META) { + do_versions_sequencer_speed_effect_recursive(scene, &strip->seqbase); } } -#undef SEQ_SPEED_INTEGRATE -#undef SEQ_SPEED_COMPRESS_IPO_Y +#undef STRIP_SPEED_INTEGRATE +#undef STRIP_SPEED_COMPRESS_IPO_Y } -static bool do_versions_sequencer_color_tags(Strip *seq, void * /*user_data*/) +static bool do_versions_sequencer_color_tags(Strip *strip, void * /*user_data*/) { - seq->color_tag = SEQUENCE_COLOR_NONE; + strip->color_tag = STRIP_COLOR_NONE; return true; } -static bool do_versions_sequencer_color_balance_sop(Strip *seq, void * /*user_data*/) +static bool do_versions_sequencer_color_balance_sop(Strip *strip, void * /*user_data*/) { - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { if (smd->type == seqModifierType_ColorBalance) { StripColorBalance *cb = &((ColorBalanceModifierData *)smd)->color_balance; cb->method = SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN; @@ -630,10 +631,10 @@ static bNodeTree *add_realize_node_tree(Main *bmain) return node_tree; } -static void seq_speed_factor_fix_rna_path(Strip *seq, ListBase *fcurves) +static void strip_speed_factor_fix_rna_path(Strip *strip, ListBase *fcurves) { - char name_esc[(sizeof(seq->name) - 2) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + char name_esc[(sizeof(strip->name) - 2) * 2]; + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); char *path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].pitch", name_esc); FCurve *fcu = BKE_fcurve_find(fcurves, path, 0); if (fcu != nullptr) { @@ -643,36 +644,36 @@ static void seq_speed_factor_fix_rna_path(Strip *seq, ListBase *fcurves) MEM_freeN(path); } -static bool version_fix_seq_meta_range(Strip *seq, void *user_data) +static bool version_fix_seq_meta_range(Strip *strip, void *user_data) { Scene *scene = (Scene *)user_data; - if (seq->type == SEQ_TYPE_META) { - SEQ_time_update_meta_strip_range(scene, seq); + if (strip->type == STRIP_TYPE_META) { + SEQ_time_update_meta_strip_range(scene, strip); } return true; } -static bool seq_speed_factor_set(Strip *seq, void *user_data) +static bool strip_speed_factor_set(Strip *strip, void *user_data) { const Scene *scene = static_cast(user_data); - if (seq->type == SEQ_TYPE_SOUND_RAM) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { /* Move `pitch` animation to `speed_factor` */ if (scene->adt && scene->adt->action) { - seq_speed_factor_fix_rna_path(seq, &scene->adt->action->curves); + strip_speed_factor_fix_rna_path(strip, &scene->adt->action->curves); } if (scene->adt && !BLI_listbase_is_empty(&scene->adt->drivers)) { - seq_speed_factor_fix_rna_path(seq, &scene->adt->drivers); + strip_speed_factor_fix_rna_path(strip, &scene->adt->drivers); } /* Pitch value of 0 has been found in some files. This would cause problems. */ - if (seq->pitch <= 0.0f) { - seq->pitch = 1.0f; + if (strip->pitch <= 0.0f) { + strip->pitch = 1.0f; } - seq->speed_factor = seq->pitch; + strip->speed_factor = strip->pitch; } else { - seq->speed_factor = 1.0f; + strip->speed_factor = 1.0f; } return true; } @@ -1319,7 +1320,7 @@ void do_versions_after_linking_300(FileData * /*fd*/, Main *bmain) if (ed == nullptr) { continue; } - SEQ_for_each_callback(&ed->seqbase, seq_speed_factor_set, scene); + SEQ_for_each_callback(&ed->seqbase, strip_speed_factor_set, scene); SEQ_for_each_callback(&ed->seqbase, version_fix_seq_meta_range, scene); } } @@ -1502,28 +1503,28 @@ static bNodeSocket *do_version_replace_float_size_with_vector(bNodeTree *ntree, return new_socket; } -static bool seq_transform_origin_set(Strip *seq, void * /*user_data*/) +static bool strip_transform_origin_set(Strip *strip, void * /*user_data*/) { - StripTransform *transform = seq->data->transform; - if (seq->data->transform != nullptr) { + StripTransform *transform = strip->data->transform; + if (strip->data->transform != nullptr) { transform->origin[0] = transform->origin[1] = 0.5f; } return true; } -static bool seq_transform_filter_set(Strip *seq, void * /*user_data*/) +static bool strip_transform_filter_set(Strip *strip, void * /*user_data*/) { - StripTransform *transform = seq->data->transform; - if (seq->data->transform != nullptr) { + StripTransform *transform = strip->data->transform; + if (strip->data->transform != nullptr) { transform->filter = SEQ_TRANSFORM_FILTER_BILINEAR; } return true; } -static bool seq_meta_channels_ensure(Strip *seq, void * /*user_data*/) +static bool strip_meta_channels_ensure(Strip *strip, void * /*user_data*/) { - if (seq->type == SEQ_TYPE_META) { - SEQ_channels_ensure(&seq->channels); + if (strip->type == STRIP_TYPE_META) { + SEQ_channels_ensure(&strip->channels); } return true; } @@ -1749,44 +1750,44 @@ static void version_node_tree_socket_id_delim(bNodeTree *ntree) } } -static bool version_merge_still_offsets(Strip *seq, void * /*user_data*/) +static bool version_merge_still_offsets(Strip *strip, void * /*user_data*/) { - seq->startofs -= seq->startstill; - seq->endofs -= seq->endstill; - seq->startstill = 0; - seq->endstill = 0; + strip->startofs -= strip->startstill; + strip->endofs -= strip->endstill; + strip->startstill = 0; + strip->endstill = 0; return true; } -static bool version_fix_delete_flag(Strip *seq, void * /*user_data*/) +static bool version_fix_delete_flag(Strip *strip, void * /*user_data*/) { - seq->flag &= ~SEQ_FLAG_DELETE; + strip->flag &= ~SEQ_FLAG_DELETE; return true; } -static bool version_set_seq_single_frame_content(Strip *seq, void * /*user_data*/) +static bool version_set_seq_single_frame_content(Strip *strip, void * /*user_data*/) { - if ((seq->len == 1) && - (seq->type == SEQ_TYPE_IMAGE || - ((seq->type & SEQ_TYPE_EFFECT) && SEQ_effect_get_num_inputs(seq->type) == 0))) + if ((strip->len == 1) && + (strip->type == STRIP_TYPE_IMAGE || + ((strip->type & STRIP_TYPE_EFFECT) && SEQ_effect_get_num_inputs(strip->type) == 0))) { - seq->flag |= SEQ_SINGLE_FRAME_CONTENT; + strip->flag |= SEQ_SINGLE_FRAME_CONTENT; } return true; } -static bool version_seq_fix_broken_sound_strips(Strip *seq, void * /*user_data*/) +static bool version_seq_fix_broken_sound_strips(Strip *strip, void * /*user_data*/) { - if (seq->type != SEQ_TYPE_SOUND_RAM || seq->speed_factor != 0.0f) { + if (strip->type != STRIP_TYPE_SOUND_RAM || strip->speed_factor != 0.0f) { return true; } - seq->speed_factor = 1.0f; - SEQ_retiming_data_clear(seq); + strip->speed_factor = 1.0f; + SEQ_retiming_data_clear(strip); /* Broken files do have negative start offset, which should not be present in sound strips. */ - if (seq->startofs < 0) { - seq->startofs = 0.0f; + if (strip->startofs < 0) { + strip->startofs = 0.0f; } return true; @@ -2938,7 +2939,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain) sequencer_tool_settings->pivot_point = V3D_AROUND_CENTER_MEDIAN; if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_transform_origin_set, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_transform_origin_set, nullptr); } } LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { @@ -3087,7 +3088,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain) } } - /* Set strip color tags to SEQUENCE_COLOR_NONE. */ + /* Set strip color tags to STRIP_COLOR_NONE. */ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { SEQ_for_each_callback(&scene->ed->seqbase, do_versions_sequencer_color_tags, nullptr); @@ -3473,7 +3474,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 302, 2)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_transform_filter_set, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_transform_filter_set, nullptr); } } } @@ -3682,7 +3683,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain) continue; } SEQ_channels_ensure(&ed->channels); - SEQ_for_each_callback(&scene->ed->seqbase, seq_meta_channels_ensure, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_meta_channels_ensure, nullptr); ed->displayed_channels = &ed->channels; diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 2d8fcddef83b..fbb4e8c0c183 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -10,6 +10,9 @@ #include #include +#include + +#include /* Define macros in `DNA_genfile.h`. */ #define DNA_GENFILE_VERSIONING_MACROS @@ -44,14 +47,18 @@ #include "BLI_assert.h" #include "BLI_listbase.h" #include "BLI_map.hh" +#include "BLI_math_base.hh" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" +#include "BLI_math_vector.hh" +#include "BLI_math_vector_types.hh" #include "BLI_set.hh" #include "BLI_string.h" #include "BLI_string_ref.hh" #include "BLI_string_utf8.h" #include "BLI_string_utils.hh" +#include "BKE_action.hh" #include "BKE_anim_data.hh" #include "BKE_animsys.h" #include "BKE_armature.hh" @@ -62,6 +69,7 @@ #include "BKE_curve.hh" #include "BKE_customdata.hh" #include "BKE_effect.h" +#include "BKE_fcurve.hh" #include "BKE_file_handler.hh" #include "BKE_grease_pencil.hh" #include "BKE_idprop.hh" @@ -89,6 +97,7 @@ #include "ANIM_action_iterators.hh" #include "ANIM_armature_iter.hh" #include "ANIM_bone_collections.hh" +#include "ANIM_versioning.hh" #include "BLT_translation.hh" @@ -113,181 +122,6 @@ static void version_composite_nodetree_null_id(bNodeTree *ntree, Scene *scene) } } -static void convert_action_in_place(blender::animrig::Action &action) -{ - using namespace blender::animrig; - if (action.is_action_layered()) { - return; - } - - /* Store this ahead of time, because adding the slot sets the action's idroot - * to 0. We also set the action's idroot to 0 manually, just to be defensive - * so we don't depend on esoteric behavior in `slot_add()`. */ - const int16_t idtype = action.idroot; - action.idroot = 0; - - /* Initialize the Action's last_slot_handle field to its default value, before - * we create a new slot. */ - action.last_slot_handle = DNA_DEFAULT_ACTION_LAST_SLOT_HANDLE; - - Slot &slot = action.slot_add(); - slot.idtype = idtype; - slot.identifier_ensure_prefix(); - - Layer &layer = action.layer_add("Layer"); - blender::animrig::Strip &strip = layer.strip_add(action, - blender::animrig::Strip::Type::Keyframe); - Channelbag &bag = strip.data(action).channelbag_for_slot_ensure(slot); - const int fcu_count = BLI_listbase_count(&action.curves); - const int group_count = BLI_listbase_count(&action.groups); - bag.fcurve_array = MEM_cnew_array(fcu_count, "Action versioning - fcurves"); - bag.fcurve_array_num = fcu_count; - bag.group_array = MEM_cnew_array(group_count, "Action versioning - groups"); - bag.group_array_num = group_count; - - int group_index = 0; - int fcurve_index = 0; - LISTBASE_FOREACH_INDEX (bActionGroup *, group, &action.groups, group_index) { - bag.group_array[group_index] = group; - - group->channelbag = &bag; - group->fcurve_range_start = fcurve_index; - - LISTBASE_FOREACH (FCurve *, fcu, &group->channels) { - if (fcu->grp != group) { - break; - } - bag.fcurve_array[fcurve_index++] = fcu; - } - - group->fcurve_range_length = fcurve_index - group->fcurve_range_start; - } - - LISTBASE_FOREACH (FCurve *, fcu, &action.curves) { - /* Any fcurves with groups have already been added to the fcurve array. */ - if (fcu->grp) { - continue; - } - bag.fcurve_array[fcurve_index++] = fcu; - } - - BLI_assert(fcurve_index == fcu_count); - - action.curves = {nullptr, nullptr}; - action.groups = {nullptr, nullptr}; -} - -static void version_legacy_actions_to_layered(Main *bmain) -{ - using namespace blender::animrig; - - struct ActionUserInfo { - ID *id; - slot_handle_t *slot_handle; - bAction **action_ptr_ptr; - char *slot_name; - }; - - blender::Map> action_users; - LISTBASE_FOREACH (bAction *, dna_action, &bmain->actions) { - Action &action = dna_action->wrap(); - if (action.is_action_layered()) { - continue; - } - action_users.add(dna_action, {}); - } - - auto callback = [&](ID &animated_id, - bAction *&action_ptr_ref, - slot_handle_t &slot_handle_ref, - char *slot_name) -> bool { - blender::Vector *action_user_vector = action_users.lookup_ptr(action_ptr_ref); - /* Only actions that need to be converted are in this map. */ - if (!action_user_vector) { - return true; - } - ActionUserInfo user_info; - user_info.id = &animated_id; - user_info.action_ptr_ptr = &action_ptr_ref; - user_info.slot_handle = &slot_handle_ref; - user_info.slot_name = slot_name; - action_user_vector->append(user_info); - return true; - }; - - ID *id; - FOREACH_MAIN_ID_BEGIN (bmain, id) { - /* Process the ID itself. */ - foreach_action_slot_use_with_references(*id, callback); - - /* Process embedded IDs, as these are not listed in bmain, but still can - * have their own Action+Slot. Unfortunately there is no generic looper - * for embedded IDs. At this moment the only animatable embedded ID is a - * node tree. */ - bNodeTree *node_tree = blender::bke::node_tree_from_id(id); - if (node_tree) { - foreach_action_slot_use_with_references(node_tree->id, callback); - } - } - FOREACH_MAIN_ID_END; - - for (const auto &item : action_users.items()) { - Action &action = item.key->wrap(); - convert_action_in_place(action); - blender::Vector &user_infos = item.value; - Slot &slot_to_assign = *action.slot(0); - - if (user_infos.size() == 1) { - /* Rename the slot after its single user. If there are multiple users, the name is unchanged - * because there is no good way to determine a name. */ - action.slot_identifier_set(*bmain, slot_to_assign, user_infos[0].id->name); - } - for (ActionUserInfo &action_user : user_infos) { - const ActionSlotAssignmentResult result = generic_assign_action_slot( - &slot_to_assign, - *action_user.id, - *action_user.action_ptr_ptr, - *action_user.slot_handle, - action_user.slot_name); - switch (result) { - case ActionSlotAssignmentResult::OK: - break; - case ActionSlotAssignmentResult::SlotNotSuitable: - /* If the slot wasn't suitable for the ID, we force assignment anyway, - * but with a warning. - * - * This happens when the legacy action assigned to the ID had a - * mismatched idroot, and therefore the created slot does as well. - * This mismatch can happen in a variety of ways, and we opt to - * preserve this unusual (but technically valid) state of affairs. - */ - *action_user.slot_handle = slot_to_assign.handle; - BLI_strncpy_utf8( - action_user.slot_name, slot_to_assign.identifier, Slot::identifier_length_max); - - printf( - "Warning: legacy action \"%s\" is assigned to \"%s\", which does not match the " - "action's id_root \"%s\". The action has been upgraded to a slotted action with " - "slot \"%s\" with an id_type \"%s\", which has also been assigned to \"%s\" despite " - "this type mismatch. This likely indicates something odd about the blend file.\n", - action.id.name + 2, - action_user.id->name, - slot_to_assign.identifier_prefix_for_idtype().c_str(), - slot_to_assign.identifier_without_prefix().c_str(), - slot_to_assign.identifier_prefix_for_idtype().c_str(), - action_user.id->name); - break; - case ActionSlotAssignmentResult::SlotNotFromAction: - BLI_assert(!"SlotNotFromAction should not be returned here"); - break; - case ActionSlotAssignmentResult::MissingAction: - BLI_assert(!"MissingAction should not be returned here"); - break; - } - } - } -} - static void version_fcurve_noise_modifier(FCurve &fcurve) { LISTBASE_FOREACH (FModifier *, fcurve_modifier, &fcurve.modifiers) { @@ -1019,35 +853,234 @@ static void version_nla_tweakmode_incomplete(Main *bmain) } } -static bool versioning_convert_strip_speed_factor(Strip *seq, void *user_data) +static bool versioning_convert_strip_speed_factor(Strip *strip, void *user_data) { const Scene *scene = static_cast(user_data); - const float speed_factor = seq->speed_factor; + const float speed_factor = strip->speed_factor; - if (speed_factor == 1.0f || !SEQ_retiming_is_allowed(seq) || SEQ_retiming_keys_count(seq) > 0) { + if (speed_factor == 1.0f || !SEQ_retiming_is_allowed(strip) || + SEQ_retiming_keys_count(strip) > 0) + { return true; } - SEQ_retiming_data_ensure(seq); - SeqRetimingKey *last_key = &SEQ_retiming_keys_get(seq)[1]; + SEQ_retiming_data_ensure(strip); + SeqRetimingKey *last_key = &SEQ_retiming_keys_get(strip)[1]; - last_key->strip_frame_index = (seq->len) / speed_factor; + last_key->strip_frame_index = (strip->len) / speed_factor; - if (seq->type == SEQ_TYPE_SOUND_RAM) { - const int prev_length = seq->len - seq->startofs - seq->endofs; - const float left_handle = SEQ_time_left_handle_frame_get(scene, seq); - SEQ_time_right_handle_frame_set(scene, seq, left_handle + prev_length); + if (strip->type == STRIP_TYPE_SOUND_RAM) { + const int prev_length = strip->len - strip->startofs - strip->endofs; + const float left_handle = SEQ_time_left_handle_frame_get(scene, strip); + SEQ_time_right_handle_frame_set(scene, strip, left_handle + prev_length); } return true; } -static bool versioning_clear_strip_unused_flag(Strip *seq, void * /*user_data*/) +static bool versioning_clear_strip_unused_flag(Strip *strip, void * /*user_data*/) { - seq->flag &= ~(1 << 6); + strip->flag &= ~(1 << 6); return true; } +/* Adjust the values of the given FCurve key frames by applying the given function. The function is + * expected to get and return a float representing the value of the key frame. The FCurve is + * potentially changed to have the given property type, if not already the case. */ +template +static void adjust_fcurve_key_frame_values(FCurve *fcurve, + const PropertyType property_type, + const Function &function) +{ + /* Adjust key frames. */ + if (fcurve->bezt) { + for (int i = 0; i < fcurve->totvert; i++) { + fcurve->bezt[i].vec[0][1] = function(fcurve->bezt[i].vec[0][1]); + fcurve->bezt[i].vec[1][1] = function(fcurve->bezt[i].vec[1][1]); + fcurve->bezt[i].vec[2][1] = function(fcurve->bezt[i].vec[2][1]); + } + } + + /* Adjust baked key frames. */ + if (fcurve->fpt) { + for (int i = 0; i < fcurve->totvert; i++) { + fcurve->fpt[i].vec[1] = function(fcurve->fpt[i].vec[1]); + } + } + + /* Setup the flags based on the property type. */ + fcurve->flag &= ~(FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES); + switch (property_type) { + case PROP_FLOAT: + break; + case PROP_INT: + fcurve->flag |= FCURVE_INT_VALUES; + break; + default: + fcurve->flag |= (FCURVE_DISCRETE_VALUES | FCURVE_INT_VALUES); + break; + } + + /* Recalculate the automatic handles of the FCurve after adjustments. */ + BKE_fcurve_handles_recalc(fcurve); +} + +/* The Threshold, Mix, and Size properties of the node were converted into node inputs, and + * two new outputs were added. + * + * A new Highlights output was added to expose the extracted highlights, this is not relevant for + * versioning. + * + * A new Glare output was added to expose just the generated glare without the input image itself. + * this relevant for versioning the Mix property as will be shown. + * + * The Threshold, Iterations, Fade, Color Modulation, Streaks, and Streaks Angle Offset properties + * were converted into node inputs, maintaining its type and range, so we just transfer its value + * as is. + * + * The Mix property was converted into a Strength input, but its range changed from [-1, 1] to [0, + * 1]. For the [-1, 0] sub-range, -1 used to mean zero strength and 0 used to mean full strength, + * so we can convert between the two ranges by negating the mix factor and subtracting it from 1. + * The [0, 1] sub-range on the other hand was useless except for the value 1, because it linearly + * interpolates between Image + Glare and Glare, so it essentially adds an attenuated version of + * the input image to the glare. When it is 1, only the glare is returned. So we split that range + * in half as a heuristic and for values in the range [0.5, 1], we just reconnect the output to the + * newly added Glare output. + * + * The Size property was converted into a float node input, and its range was changed from [1, 9] + * to [0, 1]. For Bloom, the [1, 9] range was related exponentially to the actual size of the + * glare, that is, 9 meant the glare covers the entire image, 8 meant it covers half, 7 meant it + * covers quarter and so on. The new range is linear and relative to the image size, that is, 1 + * means the entire image and 0 means nothing. So we can convert from the [1, 9] range to [0, 1] + * range using the relation 2^(x-9). + * For Fog Glow, the [1, 9] range was related to the absolute size of the Fog Glow kernel in + * pixels, where it is 2^size pixels in size. There is no way to version this accurately, since the + * new size is relative to the input image size, which is runtime information. But we can assume + * the render size as a guess and compute the size relative to that. */ +static void do_version_glare_node_options_to_inputs(const Scene *scene, + bNodeTree *node_tree, + bNode *node) +{ + NodeGlare *storage = static_cast(node->storage); + if (!storage) { + return; + } + + /* Get the newly added inputs. */ + bNodeSocket *threshold = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Threshold", "Threshold"); + bNodeSocket *strength = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Strength", "Strength"); + bNodeSocket *size = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Size", "Size"); + bNodeSocket *streaks = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_INT, PROP_NONE, "Streaks", "Streaks"); + bNodeSocket *streaks_angle = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Streaks Angle", "Streaks Angle"); + bNodeSocket *iterations = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_INT, PROP_NONE, "Iterations", "Iterations"); + bNodeSocket *fade = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Fade", "Fade"); + bNodeSocket *color_modulation = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Color Modulation", "Color Modulation"); + + /* Function to remap the Mix property to the range of the new Strength input. See function + * description. */ + auto mix_to_strength = [](const float mix) { + return 1.0f - blender::math::clamp(-mix, 0.0f, 1.0f); + }; + + /* Function to remap the Size property to its new range. See function description. */ + blender::int2 render_size; + BKE_render_resolution(&scene->r, true, &render_size.x, &render_size.y); + const int max_render_size = blender::math::reduce_max(render_size); + auto size_to_linear = [&](const int size) { + if (storage->type == CMP_NODE_GLARE_BLOOM) { + return blender::math::pow(2.0f, float(size - 9)); + } + return blender::math::min(1.0f, float((1 << size) + 1) / float(max_render_size)); + }; + + /* Assign the inputs the values from the old deprecated properties. */ + threshold->default_value_typed()->value = storage->threshold; + strength->default_value_typed()->value = mix_to_strength(storage->mix); + size->default_value_typed()->value = size_to_linear(storage->size); + streaks->default_value_typed()->value = storage->streaks; + streaks_angle->default_value_typed()->value = storage->angle_ofs; + iterations->default_value_typed()->value = storage->iter; + fade->default_value_typed()->value = storage->fade; + color_modulation->default_value_typed()->value = storage->colmod; + + /* Compute the RNA path of the node. */ + char escaped_node_name[sizeof(node->name) * 2 + 1]; + BLI_str_escape(escaped_node_name, node->name, sizeof(escaped_node_name)); + const std::string node_rna_path = fmt::format("nodes[\"{}\"]", escaped_node_name); + + BKE_fcurves_id_cb(&node_tree->id, [&](ID * /*id*/, FCurve *fcurve) { + /* The FCurve does not belong to the node since its RNA path doesn't start with the node's RNA + * path. */ + if (!blender::StringRef(fcurve->rna_path).startswith(node_rna_path)) { + return; + } + + /* Change the RNA path of the FCurve from the old properties to the new inputs, adjusting the + * values of the FCurves frames when needed. */ + char *old_rna_path = fcurve->rna_path; + if (BLI_str_endswith(fcurve->rna_path, "threshold")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[1].default_value"); + } + else if (BLI_str_endswith(fcurve->rna_path, "mix")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[2].default_value"); + adjust_fcurve_key_frame_values( + fcurve, PROP_FLOAT, [&](const float value) { return mix_to_strength(value); }); + } + else if (BLI_str_endswith(fcurve->rna_path, "size")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[3].default_value"); + adjust_fcurve_key_frame_values( + fcurve, PROP_FLOAT, [&](const float value) { return size_to_linear(value); }); + } + else if (BLI_str_endswith(fcurve->rna_path, "streaks")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[4].default_value"); + } + else if (BLI_str_endswith(fcurve->rna_path, "angle_offset")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[5].default_value"); + } + else if (BLI_str_endswith(fcurve->rna_path, "iterations")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[6].default_value"); + } + else if (BLI_str_endswith(fcurve->rna_path, "fade")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[7].default_value"); + } + else if (BLI_str_endswith(fcurve->rna_path, "color_modulation")) { + fcurve->rna_path = BLI_sprintfN("%s.%s", node_rna_path.c_str(), "inputs[8].default_value"); + } + + /* The RNA path was changed, free the old path. */ + if (fcurve->rna_path != old_rna_path) { + MEM_freeN(old_rna_path); + } + }); + + /* If the Mix factor is between [0.5, 1], then the user actually wants the Glare output, so + * reconnect the output to the newly created Glare output. */ + if (storage->mix > 0.5f) { + bNodeSocket *image_output = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_OUT, SOCK_RGBA, PROP_NONE, "Image", "Image"); + bNodeSocket *glare_output = version_node_add_socket_if_not_exist( + node_tree, node, SOCK_OUT, SOCK_RGBA, PROP_NONE, "Glare", "Glare"); + + LISTBASE_FOREACH_BACKWARD_MUTABLE (bNodeLink *, link, &node_tree->links) { + if (link->fromsock != image_output) { + continue; + } + + /* Relink from the Image output to the Glare output. */ + blender::bke::node_add_link(node_tree, node, glare_output, link->tonode, link->tosock); + blender::bke::node_remove_link(node_tree, link); + } + } +} + static bool all_scenes_use(Main *bmain, const blender::Span engines) { if (!bmain->scenes.first) { @@ -1268,7 +1301,8 @@ void do_versions_after_linking_400(FileData *fd, Main *bmain) } if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 2)) { - version_legacy_actions_to_layered(bmain); + blender::animrig::versioning::convert_legacy_animato_actions(*bmain); + blender::animrig::versioning::tag_action_users_for_slotted_actions_conversion(*bmain); } if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 7)) { @@ -1283,6 +1317,27 @@ void do_versions_after_linking_400(FileData *fd, Main *bmain) } } + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 18)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type != NTREE_COMPOSIT) { + continue; + } + + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type != CMP_NODE_GLARE) { + continue; + } + do_version_glare_node_options_to_inputs(reinterpret_cast(id), ntree, node); + } + } + FOREACH_NODETREE_END; + } + + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 19)) { + /* Two new inputs were added, Saturation and Tint. */ + version_node_socket_index_animdata(bmain, NTREE_COMPOSIT, CMP_NODE_GLARE, 3, 2, 11); + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check. @@ -2973,9 +3028,9 @@ static void fix_geometry_nodes_object_info_scale(bNodeTree &ntree) } } -static bool seq_filter_bilinear_to_auto(Strip *seq, void * /*user_data*/) +static bool strip_filter_bilinear_to_auto(Strip *strip, void * /*user_data*/) { - StripTransform *transform = seq->data->transform; + StripTransform *transform = strip->data->transform; if (transform != nullptr && transform->filter == SEQ_TRANSFORM_FILTER_BILINEAR) { transform->filter = SEQ_TRANSFORM_FILTER_AUTO; } @@ -3047,9 +3102,9 @@ static void hue_correct_set_wrapping(CurveMapping *curve_mapping) curve_mapping->curr.ymax = 1.0f; } -static bool seq_hue_correct_set_wrapping(Strip *seq, void * /*user_data*/) +static bool strip_hue_correct_set_wrapping(Strip *strip, void * /*user_data*/) { - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { if (smd->type == seqModifierType_HueCorrect) { HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; CurveMapping *cumap = (CurveMapping *)&hcmd->curve_mapping; @@ -3067,23 +3122,23 @@ static void versioning_update_timecode(short int *tc) } } -static bool seq_proxies_timecode_update(Strip *seq, void * /*user_data*/) +static bool strip_proxies_timecode_update(Strip *strip, void * /*user_data*/) { - if (seq->data == nullptr || seq->data->proxy == nullptr) { + if (strip->data == nullptr || strip->data->proxy == nullptr) { return true; } - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; versioning_update_timecode(&proxy->tc); return true; } -static bool seq_text_data_update(Strip *seq, void * /*user_data*/) +static bool strip_text_data_update(Strip *strip, void * /*user_data*/) { - if (seq->type != SEQ_TYPE_TEXT || seq->effectdata == nullptr) { + if (strip->type != STRIP_TYPE_TEXT || strip->effectdata == nullptr) { return true; } - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); if (data->shadow_angle == 0.0f) { data->shadow_angle = DEG2RADF(65.0f); data->shadow_offset = 0.04f; @@ -3252,13 +3307,13 @@ static void hide_simulation_node_skip_socket_value(Main &bmain) } } -static bool versioning_convert_seq_text_anchor(Strip *seq, void * /*user_data*/) +static bool versioning_convert_seq_text_anchor(Strip *strip, void * /*user_data*/) { - if (seq->type != SEQ_TYPE_TEXT || seq->effectdata == nullptr) { + if (strip->type != STRIP_TYPE_TEXT || strip->effectdata == nullptr) { return true; } - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); data->anchor_x = data->align; data->anchor_y = data->align_y; data->align = SEQ_TEXT_ALIGN_X_LEFT; @@ -4285,7 +4340,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 18)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_filter_bilinear_to_auto, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_filter_bilinear_to_auto, nullptr); } } } @@ -4445,7 +4500,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_hue_correct_set_wrapping, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_hue_correct_set_wrapping, nullptr); } } } @@ -4604,7 +4659,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 28)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_proxies_timecode_update, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_proxies_timecode_update, nullptr); } } @@ -4617,7 +4672,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 29)) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { if (scene->ed) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_text_data_update, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_text_data_update, nullptr); } } } diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc index ce8b39a5e863..fc38384c5a25 100644 --- a/source/blender/blenloader/intern/versioning_common.cc +++ b/source/blender/blenloader/intern/versioning_common.cc @@ -33,6 +33,8 @@ #include "BKE_node_tree_update.hh" #include "BKE_screen.hh" +#include "ANIM_versioning.hh" + #include "NOD_socket.hh" #include "BLT_translation.hh" @@ -210,7 +212,7 @@ bNode &version_node_add_empty(bNodeTree &ntree, const char *idname) blender::bke::node_unique_id(&ntree, node); STRNCPY(node->idname, idname); - STRNCPY_UTF8(node->name, DATA_(ntype->ui_name)); + STRNCPY_UTF8(node->name, DATA_(ntype->ui_name.c_str())); blender::bke::node_unique_name(&ntree, node); node->flag = NODE_SELECT | NODE_OPTIONS | NODE_INIT; @@ -645,7 +647,7 @@ void do_versions_after_setup(Main *new_bmain, * the versions of all the linked libraries. */ if (!blendfile_or_libraries_versions_atleast(new_bmain, 250, 0)) { - do_versions_ipos_to_animato(new_bmain); + do_versions_ipos_to_layered_actions(new_bmain); } if (!blendfile_or_libraries_versions_atleast(new_bmain, 250, 0)) { @@ -679,4 +681,9 @@ void do_versions_after_setup(Main *new_bmain, /* Convert all the legacy grease pencil objects. This does not touch annotations. */ blender::bke::greasepencil::convert::legacy_main(*new_bmain, lapp_context, *reports); } + + if (!blendfile_or_libraries_versions_atleast(new_bmain, 404, 2)) { + /* Version all the action assignments of just-versioned datablocks. */ + blender::animrig::versioning::convert_legacy_action_assignments(*new_bmain, reports->reports); + } } diff --git a/source/blender/blenloader/intern/versioning_common.hh b/source/blender/blenloader/intern/versioning_common.hh index 84a13eb8e5c1..89c5e570e176 100644 --- a/source/blender/blenloader/intern/versioning_common.hh +++ b/source/blender/blenloader/intern/versioning_common.hh @@ -11,6 +11,8 @@ #include "BLI_function_ref.hh" #include "BLI_map.hh" +#include "DNA_node_types.h" + struct ARegion; struct bNode; struct bNodeSocket; diff --git a/source/blender/blenloader/intern/versioning_legacy.cc b/source/blender/blenloader/intern/versioning_legacy.cc index 338657e33c3e..bc1a21a74117 100644 --- a/source/blender/blenloader/intern/versioning_legacy.cc +++ b/source/blender/blenloader/intern/versioning_legacy.cc @@ -462,18 +462,18 @@ void blo_do_version_old_trackto_to_constraints(Object *ob) ob->track = nullptr; } -static bool seq_set_alpha_mode_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_alpha_mode_cb(Strip *strip, void * /*user_data*/) { - if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) { - seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + if (ELEM(strip->type, STRIP_TYPE_IMAGE, STRIP_TYPE_MOVIE)) { + strip->alpha_mode = SEQ_ALPHA_STRAIGHT; } return true; } -static bool seq_set_blend_mode_cb(Strip *seq, void * /*user_data*/) +static bool strip_set_blend_mode_cb(Strip *strip, void * /*user_data*/) { - if (seq->blend_mode == 0) { - seq->blend_opacity = 100.0f; + if (strip->blend_mode == 0) { + strip->blend_opacity = 100.0f; } return true; } @@ -1223,7 +1223,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) while (sce) { ed = sce->ed; if (ed) { - SEQ_for_each_callback(&sce->ed->seqbase, seq_set_alpha_mode_cb, nullptr); + SEQ_for_each_callback(&sce->ed->seqbase, strip_set_alpha_mode_cb, nullptr); } sce = static_cast(sce->id.next); @@ -2451,7 +2451,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) sce = static_cast(sce->id.next)) { if (sce->ed) { - SEQ_for_each_callback(&sce->ed->seqbase, seq_set_blend_mode_cb, nullptr); + SEQ_for_each_callback(&sce->ed->seqbase, strip_set_blend_mode_cb, nullptr); } } } diff --git a/source/blender/bmesh/bmesh.hh b/source/blender/bmesh/bmesh.hh index f1b9a30641d9..3daabde3c7c0 100644 --- a/source/blender/bmesh/bmesh.hh +++ b/source/blender/bmesh/bmesh.hh @@ -182,35 +182,35 @@ #include #include -#include "bmesh_class.hh" +#include "bmesh_class.hh" // IWYU pragma: export /* include the rest of the API */ -#include "intern/bmesh_error.hh" -#include "intern/bmesh_operator_api.hh" +#include "intern/bmesh_error.hh" // IWYU pragma: export +#include "intern/bmesh_operator_api.hh" // IWYU pragma: export -#include "intern/bmesh_callback_generic.hh" -#include "intern/bmesh_construct.hh" -#include "intern/bmesh_core.hh" -#include "intern/bmesh_delete.hh" -#include "intern/bmesh_edgeloop.hh" -#include "intern/bmesh_interp.hh" -#include "intern/bmesh_iterators.hh" -#include "intern/bmesh_log.hh" -#include "intern/bmesh_marking.hh" -#include "intern/bmesh_mesh.hh" -#include "intern/bmesh_mesh_convert.hh" -#include "intern/bmesh_mesh_debug.hh" -#include "intern/bmesh_mesh_duplicate.hh" -#include "intern/bmesh_mesh_normals.hh" -#include "intern/bmesh_mesh_partial_update.hh" -#include "intern/bmesh_mesh_tessellate.hh" -#include "intern/bmesh_mesh_validate.hh" -#include "intern/bmesh_mods.hh" -#include "intern/bmesh_operators.hh" -#include "intern/bmesh_polygon.hh" -#include "intern/bmesh_polygon_edgenet.hh" -#include "intern/bmesh_query.hh" -#include "intern/bmesh_query_uv.hh" -#include "intern/bmesh_walkers.hh" +#include "intern/bmesh_callback_generic.hh" // IWYU pragma: export +#include "intern/bmesh_construct.hh" // IWYU pragma: export +#include "intern/bmesh_core.hh" // IWYU pragma: export +#include "intern/bmesh_delete.hh" // IWYU pragma: export +#include "intern/bmesh_edgeloop.hh" // IWYU pragma: export +#include "intern/bmesh_interp.hh" // IWYU pragma: export +#include "intern/bmesh_iterators.hh" // IWYU pragma: export +#include "intern/bmesh_log.hh" // IWYU pragma: export +#include "intern/bmesh_marking.hh" // IWYU pragma: export +#include "intern/bmesh_mesh.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_convert.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_debug.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_duplicate.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_normals.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_partial_update.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_tessellate.hh" // IWYU pragma: export +#include "intern/bmesh_mesh_validate.hh" // IWYU pragma: export +#include "intern/bmesh_mods.hh" // IWYU pragma: export +#include "intern/bmesh_operators.hh" // IWYU pragma: export +#include "intern/bmesh_polygon.hh" // IWYU pragma: export +#include "intern/bmesh_polygon_edgenet.hh" // IWYU pragma: export +#include "intern/bmesh_query.hh" // IWYU pragma: export +#include "intern/bmesh_query_uv.hh" // IWYU pragma: export +#include "intern/bmesh_walkers.hh" // IWYU pragma: export -#include "intern/bmesh_inline.hh" +#include "intern/bmesh_inline.hh" // IWYU pragma: export diff --git a/source/blender/bmesh/bmesh_class.hh b/source/blender/bmesh/bmesh_class.hh index 2aeff28f615e..f2ebb1405315 100644 --- a/source/blender/bmesh/bmesh_class.hh +++ b/source/blender/bmesh/bmesh_class.hh @@ -12,6 +12,10 @@ */ #include "BLI_assert.h" +#include "BLI_sys_types.h" + +#include "DNA_customdata_types.h" +#include "DNA_listBase.h" /* disable holes for now, * these are ifdef'd because they use more memory and can't be saved in DNA currently */ diff --git a/source/blender/bmesh/bmesh_tools.hh b/source/blender/bmesh/bmesh_tools.hh index 9bf0427e7796..d6b79af036c0 100644 --- a/source/blender/bmesh/bmesh_tools.hh +++ b/source/blender/bmesh/bmesh_tools.hh @@ -11,17 +11,17 @@ * These can be used by both Modifiers and BMesh-Operators. */ -#include "tools/bmesh_beautify.hh" -#include "tools/bmesh_bevel.hh" -#include "tools/bmesh_bisect_plane.hh" -#include "tools/bmesh_boolean.hh" -#include "tools/bmesh_decimate.hh" -#include "tools/bmesh_edgenet.hh" -#include "tools/bmesh_edgesplit.hh" -#include "tools/bmesh_path.hh" -#include "tools/bmesh_path_region.hh" -#include "tools/bmesh_path_region_uv.hh" -#include "tools/bmesh_path_uv.hh" -#include "tools/bmesh_region_match.hh" -#include "tools/bmesh_separate.hh" -#include "tools/bmesh_triangulate.hh" +#include "tools/bmesh_beautify.hh" // IWYU pragma: export +#include "tools/bmesh_bevel.hh" // IWYU pragma: export +#include "tools/bmesh_bisect_plane.hh" // IWYU pragma: export +#include "tools/bmesh_boolean.hh" // IWYU pragma: export +#include "tools/bmesh_decimate.hh" // IWYU pragma: export +#include "tools/bmesh_edgenet.hh" // IWYU pragma: export +#include "tools/bmesh_edgesplit.hh" // IWYU pragma: export +#include "tools/bmesh_path.hh" // IWYU pragma: export +#include "tools/bmesh_path_region.hh" // IWYU pragma: export +#include "tools/bmesh_path_region_uv.hh" // IWYU pragma: export +#include "tools/bmesh_path_uv.hh" // IWYU pragma: export +#include "tools/bmesh_region_match.hh" // IWYU pragma: export +#include "tools/bmesh_separate.hh" // IWYU pragma: export +#include "tools/bmesh_triangulate.hh" // IWYU pragma: export diff --git a/source/blender/bmesh/intern/bmesh_callback_generic.hh b/source/blender/bmesh/intern/bmesh_callback_generic.hh index 1d780ab28fdc..182997d47d0d 100644 --- a/source/blender/bmesh/intern/bmesh_callback_generic.hh +++ b/source/blender/bmesh/intern/bmesh_callback_generic.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +struct BMElem; + bool BM_elem_cb_check_hflag_enabled(BMElem *, void *user_data); bool BM_elem_cb_check_hflag_disabled(BMElem *, void *user_data); bool BM_elem_cb_check_hflag_ex(BMElem *, void *user_data); diff --git a/source/blender/bmesh/intern/bmesh_construct.hh b/source/blender/bmesh/intern/bmesh_construct.hh index 7a5cf2871355..f0d89c98a2a0 100644 --- a/source/blender/bmesh/intern/bmesh_construct.hh +++ b/source/blender/bmesh/intern/bmesh_construct.hh @@ -8,9 +8,11 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" #include "bmesh_core.hh" struct BMAllocTemplate; +struct BMCustomDataCopyMap; struct Mesh; /** diff --git a/source/blender/bmesh/intern/bmesh_core.hh b/source/blender/bmesh/intern/bmesh_core.hh index ceaf3be2cf7e..2053ec7f777a 100644 --- a/source/blender/bmesh/intern/bmesh_core.hh +++ b/source/blender/bmesh/intern/bmesh_core.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BKE_customdata.hh" + +#include "bmesh_class.hh" + /** * When copying between different BMesh objects, * `copy_verts` & `copy_edges` should always be true. diff --git a/source/blender/bmesh/intern/bmesh_delete.hh b/source/blender/bmesh/intern/bmesh_delete.hh index 64e1cb014359..569a3cde9992 100644 --- a/source/blender/bmesh/intern/bmesh_delete.hh +++ b/source/blender/bmesh/intern/bmesh_delete.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + void BMO_mesh_delete_oflag_tagged(BMesh *bm, short oflag, char htype); void BM_mesh_delete_hflag_tagged(BMesh *bm, char hflag, char htype); diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.hh b/source/blender/bmesh/intern/bmesh_edgeloop.hh index 12286ae42a62..e9d92f180402 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.hh +++ b/source/blender/bmesh/intern/bmesh_edgeloop.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + struct BMEdgeLoopStore; struct GSet; struct ListBase; diff --git a/source/blender/bmesh/intern/bmesh_error.hh b/source/blender/bmesh/intern/bmesh_error.hh index 7f42c496ac1f..87ace4d2fa40 100644 --- a/source/blender/bmesh/intern/bmesh_error.hh +++ b/source/blender/bmesh/intern/bmesh_error.hh @@ -10,6 +10,8 @@ #include "bmesh_operator_api.hh" +#include "bmesh_class.hh" + /*----------- BMOP error system ----------*/ /** diff --git a/source/blender/bmesh/intern/bmesh_inline.hh b/source/blender/bmesh/intern/bmesh_inline.hh index 7c2514444cce..2b9cffb11c0c 100644 --- a/source/blender/bmesh/intern/bmesh_inline.hh +++ b/source/blender/bmesh/intern/bmesh_inline.hh @@ -10,6 +10,11 @@ #pragma once +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + +#include "bmesh_class.hh" + /* stuff for dealing with header flags */ #define BM_elem_flag_test(ele, hflag) _bm_elem_flag_test(&(ele)->head, hflag) #define BM_elem_flag_test_bool(ele, hflag) _bm_elem_flag_test_bool(&(ele)->head, hflag) diff --git a/source/blender/bmesh/intern/bmesh_interp.hh b/source/blender/bmesh/intern/bmesh_interp.hh index 7a7d37f809ed..689b8108a98a 100644 --- a/source/blender/bmesh/intern/bmesh_interp.hh +++ b/source/blender/bmesh/intern/bmesh_interp.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + struct LinkNode; struct MemArena; diff --git a/source/blender/bmesh/intern/bmesh_iterators.hh b/source/blender/bmesh/intern/bmesh_iterators.hh index 39c837e72b81..8d5d072b694b 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.hh +++ b/source/blender/bmesh/intern/bmesh_iterators.hh @@ -23,6 +23,9 @@ #include "BLI_compiler_attrs.h" #include "BLI_mempool.h" +#include "bmesh_class.hh" +#include "intern/bmesh_operator_api.hh" + /* these iterator over all elements of a specific * type in the mesh. * diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.hh b/source/blender/bmesh/intern/bmesh_iterators_inline.hh index 8cdf5f34b258..be9dac642950 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.hh +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.hh @@ -10,6 +10,9 @@ #pragma once +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + /* inline here optimizes out the switch statement when called with * constant values (which is very common), nicer for loop-in-loop situations */ diff --git a/source/blender/bmesh/intern/bmesh_marking.hh b/source/blender/bmesh/intern/bmesh_marking.hh index d81042777fc1..5cb9e3d01245 100644 --- a/source/blender/bmesh/intern/bmesh_marking.hh +++ b/source/blender/bmesh/intern/bmesh_marking.hh @@ -4,6 +4,8 @@ #pragma once +#include "bmesh_class.hh" + /** \file * \ingroup bmesh */ diff --git a/source/blender/bmesh/intern/bmesh_mesh.hh b/source/blender/bmesh/intern/bmesh_mesh.hh index 24fec9693f04..196c9ee82238 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.hh +++ b/source/blender/bmesh/intern/bmesh_mesh.hh @@ -14,6 +14,8 @@ #include "bmesh_class.hh" +#include "intern/bmesh_operator_api.hh" + struct BMAllocTemplate; void BM_mesh_elem_toolflags_ensure(BMesh *bm); diff --git a/source/blender/bmesh/intern/bmesh_mesh_duplicate.hh b/source/blender/bmesh/intern/bmesh_mesh_duplicate.hh index ebf41bcfa3e0..0c35bf4b64d5 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_duplicate.hh +++ b/source/blender/bmesh/intern/bmesh_mesh_duplicate.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * Geometry must be completely isolated. */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.hh b/source/blender/bmesh/intern/bmesh_mesh_normals.hh index f9c86fdb1a5e..c6e821f4148e 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_normals.hh +++ b/source/blender/bmesh/intern/bmesh_mesh_normals.hh @@ -8,6 +8,9 @@ * \ingroup bmesh */ +#include "BLI_math_vector_types.hh" +#include "BLI_span.hh" + #include "bmesh_class.hh" struct BMPartialUpdate; diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.cc b/source/blender/bmesh/intern/bmesh_mesh_partial_update.cc index 70ec7a4dedba..0b6c70ef96a6 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.cc @@ -38,6 +38,7 @@ #include "MEM_guardedalloc.h" #include "BLI_bitmap.h" +#include "BLI_math_base.h" #include "bmesh.hh" diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.hh b/source/blender/bmesh/intern/bmesh_mesh_partial_update.hh index 1c9603b11fb7..4ccac4ddfc42 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.hh +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.hh @@ -10,6 +10,8 @@ #include "BLI_compiler_attrs.h" +#include "bmesh_class.hh" + /** * Parameters used to determine which kinds of data needs to be generated. */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_tessellate.hh b/source/blender/bmesh/intern/bmesh_mesh_tessellate.hh index a00896af08ce..b49032cae044 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_tessellate.hh +++ b/source/blender/bmesh/intern/bmesh_mesh_tessellate.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BLI_span.hh" + +#include "bmesh_class.hh" + struct BMPartialUpdate; struct BMeshCalcTessellation_Params { diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.hh b/source/blender/bmesh/intern/bmesh_mesh_validate.hh index 178c230f152a..88003c6fe8f6 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_validate.hh +++ b/source/blender/bmesh/intern/bmesh_mesh_validate.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * Check of this #BMesh is valid, * this function can be slow since its intended to help with debugging. diff --git a/source/blender/bmesh/intern/bmesh_mods.hh b/source/blender/bmesh/intern/bmesh_mods.hh index 0034d60a7093..2d5405203871 100644 --- a/source/blender/bmesh/intern/bmesh_mods.hh +++ b/source/blender/bmesh/intern/bmesh_mods.hh @@ -4,6 +4,8 @@ #pragma once +#include "bmesh_class.hh" + /** \file * \ingroup bmesh */ diff --git a/source/blender/bmesh/intern/bmesh_operator_api.hh b/source/blender/bmesh/intern/bmesh_operator_api.hh index 55d7b0a5a613..bda6c2dd3741 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.hh +++ b/source/blender/bmesh/intern/bmesh_operator_api.hh @@ -9,9 +9,12 @@ */ #include "BLI_ghash.h" +#include "BLI_utildefines.h" #include +#include "bmesh_class.hh" + /** * operators represent logical, executable mesh modules. all topological * operations involving a bmesh has to go through them. diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.hh b/source/blender/bmesh/intern/bmesh_operator_api_inline.hh index fb62b4c59494..1fce45a173b8 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api_inline.hh +++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.hh @@ -10,6 +10,15 @@ #pragma once +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + +#include "bmesh_class.hh" + +#include "intern/bmesh_operator_api.hh" + +struct BMOperator; + /* Tool Flag API: Tool code must never put junk in header flags (#BMHeader.hflag) * instead, use this API to set flags. * If you need to store a value per element, use a #GHash or a mapping slot to do it. */ diff --git a/source/blender/bmesh/intern/bmesh_operators.hh b/source/blender/bmesh/intern/bmesh_operators.hh index 5b1d0f0f4ddb..e75648df07a1 100644 --- a/source/blender/bmesh/intern/bmesh_operators.hh +++ b/source/blender/bmesh/intern/bmesh_operators.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "intern/bmesh_operator_api.hh" + /* See comments in `intern/bmesh_opdefines.cc` for documentation of specific operators. */ /*--------defines/enumerations for specific operators-------*/ diff --git a/source/blender/bmesh/intern/bmesh_polygon.hh b/source/blender/bmesh/intern/bmesh_polygon.hh index e9cc88c79572..14c32c5e1578 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.hh +++ b/source/blender/bmesh/intern/bmesh_polygon.hh @@ -14,6 +14,8 @@ struct Heap; #include "BLI_math_vector_types.hh" #include "BLI_span.hh" +#include "bmesh_class.hh" + /** * For tools that insist on using triangles, ideally we would cache this data. * diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.hh b/source/blender/bmesh/intern/bmesh_polygon_edgenet.hh index f772d0ddd4c7..deb548ffb0af 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.hh +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.hh @@ -6,6 +6,8 @@ #include "BLI_vector.hh" +#include "bmesh_class.hh" + /** \file * \ingroup bmesh */ diff --git a/source/blender/bmesh/intern/bmesh_private.hh b/source/blender/bmesh/intern/bmesh_private.hh index 8a53f72ea847..c0112b8d6707 100644 --- a/source/blender/bmesh/intern/bmesh_private.hh +++ b/source/blender/bmesh/intern/bmesh_private.hh @@ -12,6 +12,8 @@ * parts of the bmesh internals. */ +#include "bmesh_class.hh" + /* returns positive nonzero on error */ #ifdef NDEBUG diff --git a/source/blender/bmesh/intern/bmesh_query.cc b/source/blender/bmesh/intern/bmesh_query.cc index ea0dba07205c..c10c71ca987c 100644 --- a/source/blender/bmesh/intern/bmesh_query.cc +++ b/source/blender/bmesh/intern/bmesh_query.cc @@ -17,6 +17,7 @@ #include "BLI_alloca.h" #include "BLI_linklist.h" +#include "BLI_math_base.h" #include "BLI_math_geom.h" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" diff --git a/source/blender/bmesh/intern/bmesh_query.hh b/source/blender/bmesh/intern/bmesh_query.hh index 122661b3ffcf..9b58c9fe9053 100644 --- a/source/blender/bmesh/intern/bmesh_query.hh +++ b/source/blender/bmesh/intern/bmesh_query.hh @@ -8,6 +8,11 @@ * \ingroup bmesh */ +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + +#include "bmesh_class.hh" + /** * Returns true if the vertex is used in a given face. */ diff --git a/source/blender/bmesh/intern/bmesh_query_inline.hh b/source/blender/bmesh/intern/bmesh_query_inline.hh index 5e4aaa5d724b..4511561e00cb 100644 --- a/source/blender/bmesh/intern/bmesh_query_inline.hh +++ b/source/blender/bmesh/intern/bmesh_query_inline.hh @@ -8,6 +8,12 @@ #pragma once +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" +#include "BLI_utildefines.h" + +#include "bmesh_class.hh" + /** * Returns whether or not a given vertex is * is part of a given edge. diff --git a/source/blender/bmesh/intern/bmesh_query_uv.hh b/source/blender/bmesh/intern/bmesh_query_uv.hh index 1848f2dc199e..98e8c48ebb9a 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.hh +++ b/source/blender/bmesh/intern/bmesh_query_uv.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BKE_customdata.hh" + +#include "bmesh_class.hh" + /** * Retrieve the custom data offsets for the UV map. * \param layer: The layer index (where 0 is the first UV map). diff --git a/source/blender/bmesh/intern/bmesh_structure.hh b/source/blender/bmesh/intern/bmesh_structure.hh index 4b76136598b8..cbc110c7b6e6 100644 --- a/source/blender/bmesh/intern/bmesh_structure.hh +++ b/source/blender/bmesh/intern/bmesh_structure.hh @@ -15,6 +15,11 @@ * descriptive comments. but seriously, don't use this stuff. */ +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + +#include "bmesh_class.hh" + /* LOOP CYCLE MANAGEMENT */ /*****loop cycle functions, e.g. loops surrounding a face**** */ bool bmesh_loop_validate(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/bmesh/intern/bmesh_structure_inline.hh b/source/blender/bmesh/intern/bmesh_structure_inline.hh index e42b81089b0b..51d723bdc606 100644 --- a/source/blender/bmesh/intern/bmesh_structure_inline.hh +++ b/source/blender/bmesh/intern/bmesh_structure_inline.hh @@ -10,6 +10,12 @@ #pragma once +#include "BLI_compiler_attrs.h" +#include "BLI_compiler_compat.h" + +#include "bmesh_class.hh" +#include "intern/bmesh_query.hh" + ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(const BMEdge *e, const BMVert *v) { diff --git a/source/blender/bmesh/intern/bmesh_walkers.hh b/source/blender/bmesh/intern/bmesh_walkers.hh index 58890e765b4a..13ae3724f1ab 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.hh +++ b/source/blender/bmesh/intern/bmesh_walkers.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /* * NOTE: do NOT modify topology while walking a mesh! */ diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.hh b/source/blender/bmesh/intern/bmesh_walkers_private.hh index 9a8e0073e3a0..8fcd8a50f03a 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_private.hh +++ b/source/blender/bmesh/intern/bmesh_walkers_private.hh @@ -10,6 +10,10 @@ * BMesh walker API. */ +#include "bmesh_class.hh" + +struct BMWalker; + extern BMWalker *bm_walker_types[]; extern const int bm_totwalkers; diff --git a/source/blender/bmesh/operators/bmo_dissolve.cc b/source/blender/bmesh/operators/bmo_dissolve.cc index 7a8b255ff632..c9499101ec59 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.cc +++ b/source/blender/bmesh/operators/bmo_dissolve.cc @@ -8,8 +8,7 @@ * Removes isolated geometry regions without creating holes in the mesh. */ -#include "MEM_guardedalloc.h" - +#include "BLI_math_base.h" #include "BLI_math_vector.h" #include "BLI_stack.h" #include "BLI_vector.hh" diff --git a/source/blender/bmesh/operators/bmo_extrude.cc b/source/blender/bmesh/operators/bmo_extrude.cc index 6cc59c97d10a..4b08388461ee 100644 --- a/source/blender/bmesh/operators/bmo_extrude.cc +++ b/source/blender/bmesh/operators/bmo_extrude.cc @@ -13,6 +13,7 @@ #include "DNA_meshdata_types.h" #include "BLI_buffer.h" +#include "BLI_math_base.h" #include "BLI_math_geom.h" #include "BLI_math_vector.h" diff --git a/source/blender/bmesh/operators/bmo_join_triangles.cc b/source/blender/bmesh/operators/bmo_join_triangles.cc index 168ce9763703..c50929420d38 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.cc +++ b/source/blender/bmesh/operators/bmo_join_triangles.cc @@ -14,6 +14,7 @@ #include "MEM_guardedalloc.h" #include "BLI_heap.h" +#include "BLI_math_base.h" #include "BLI_math_geom.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" @@ -619,7 +620,7 @@ static void rotate_to_plane(const JoinEdgesState &s, * the four vertices of quad_a. Instead, They are four unit vectors, aligned * parallel to the respective edge loop of quad_a. * \param quad_b_verts: an array of four vertices, giving the four corners of `quad_b`. - * \param l_shared: a loop known to be one of the the common manifold loops that is + * \param l_shared: a loop known to be one of the common manifold loops that is * shared between the two quads. This is used as a 'hinge' to flatten the two * quads into the same plane as much as possible. * \param plane_normal: The normal vector of quad_a. @@ -669,7 +670,7 @@ static float compute_alignment(const JoinEdgesState &s, normalize_v3(quad_b_vecs[2]); normalize_v3(quad_b_vecs[3]); - /* Given that we're not certain of how the the first loop of the quad and the first loop + /* Given that we're not certain of how the first loop of the quad and the first loop * of the proposed merge quad relate to each other, there are four possible combinations * to check, to test that the neighbor face and the merged face have good alignment. * @@ -680,7 +681,7 @@ static float compute_alignment(const JoinEdgesState &s, * * Instead, this code does the math twice, then it just flips each component by 180 degrees to * pick up the other two cases. Four extra angle tests aren't that much worse than optimal. - * Brute forcing the math and ending up with with clear and understandable code is better. */ + * Brute forcing the math and ending up with clear and understandable code is better. */ float error[4] = {0.0f}; for (int i = 0; i < ARRAY_SIZE(error); i++) { @@ -732,7 +733,7 @@ static float compute_alignment(const JoinEdgesState &s, * even though there might be an alternate quad with lower numerical error. * * This algorithm reduces the error of a given edge based on three factors: - * - The error of the neighboring quad. The the better the neighbor quad, the more the impact. + * - The error of the neighboring quad. The better the neighbor quad, the more the impact. * - The alignment of the proposed new quad the existing quad. * Grids of rectangles or trapezoids improve well. Trapezoids and diamonds are left alone. * - topology_influence. The higher the operator parameter is set, the more the impact. @@ -1024,7 +1025,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) } } - /* Go through all the the faces of the input slot, this time to find quads. + /* Go through all the faces of the input slot, this time to find quads. * Improve the candidates around any preexisting quads in the mesh. * * NOTE: This unfortunately misses any quads which are not selected, but @@ -1045,7 +1046,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) * allow them to have an especially strong influence on the resulting mesh. * At a topology influence of 200%, they're considered to be *almost perfect* quads * regardless of their actual error. Either way, the multiplier is never completely - * allowed to reach reach zero. Instead, 1% of the original error is preserved... + * allowed to reach zero. Instead, 1% of the original error is preserved... * which is enough to maintain the relative priority sorting between existing quads. */ f_error *= (2.0f - (s.topo_influnce * maximum_improvement)); diff --git a/source/blender/bmesh/operators/bmo_mirror.cc b/source/blender/bmesh/operators/bmo_mirror.cc index 1073315221bd..8efb7fbb86d8 100644 --- a/source/blender/bmesh/operators/bmo_mirror.cc +++ b/source/blender/bmesh/operators/bmo_mirror.cc @@ -8,7 +8,7 @@ * Basic mirror, optionally with UVs's. */ -#include "MEM_guardedalloc.h" +#include "BLI_math_base.h" #include "BKE_customdata.hh" diff --git a/source/blender/bmesh/operators/bmo_rotate_edges.cc b/source/blender/bmesh/operators/bmo_rotate_edges.cc index de929969391c..8af2d8de378a 100644 --- a/source/blender/bmesh/operators/bmo_rotate_edges.cc +++ b/source/blender/bmesh/operators/bmo_rotate_edges.cc @@ -8,6 +8,8 @@ * Rotate edges topology that share two faces. */ +#include + #include "MEM_guardedalloc.h" #include "BLI_heap.h" diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.cc b/source/blender/bmesh/operators/bmo_unsubdivide.cc index ab09932842f7..39d097c8b6c8 100644 --- a/source/blender/bmesh/operators/bmo_unsubdivide.cc +++ b/source/blender/bmesh/operators/bmo_unsubdivide.cc @@ -9,7 +9,7 @@ * a subdivide operation. */ -#include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "bmesh.hh" #include "bmesh_tools.hh" diff --git a/source/blender/bmesh/tools/bmesh_beautify.hh b/source/blender/bmesh/tools/bmesh_beautify.hh index f9aba8ed9c34..30a87269ed3f 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.hh +++ b/source/blender/bmesh/tools/bmesh_beautify.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + enum { /** Vertices tags must match (special case). */ VERT_RESTRICT_TAG = (1 << 0), diff --git a/source/blender/bmesh/tools/bmesh_bevel.cc b/source/blender/bmesh/tools/bmesh_bevel.cc index 630799d416b0..2a6afbdee9dc 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.cc +++ b/source/blender/bmesh/tools/bmesh_bevel.cc @@ -15,6 +15,7 @@ #include "DNA_modifier_types.h" #include "BLI_alloca.h" +#include "BLI_math_base.h" #include "BLI_math_geom.h" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" diff --git a/source/blender/bmesh/tools/bmesh_bevel.hh b/source/blender/bmesh/tools/bmesh_bevel.hh index 4f034b20a98f..be539e46bbff 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.hh +++ b/source/blender/bmesh/tools/bmesh_bevel.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + struct CurveProfile; struct MDeformVert; diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.hh b/source/blender/bmesh/tools/bmesh_bisect_plane.hh index a625c078cb86..7f385689b4a0 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.hh +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * \param use_snap_center: Snap verts onto the plane. * \param use_tag: Only bisect tagged edges and faces. diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index a34ede82f898..6f5c4bfbc655 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -11,6 +11,7 @@ #include #include "BLI_array.hh" +#include "BLI_math_base.h" #include "BLI_math_mpq.hh" #include "BLI_mesh_boolean.hh" #include "BLI_mesh_intersect.hh" diff --git a/source/blender/bmesh/tools/bmesh_boolean.hh b/source/blender/bmesh/tools/bmesh_boolean.hh index 26ed8fe25d87..8c3cb60be3f9 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.hh +++ b/source/blender/bmesh/tools/bmesh_boolean.hh @@ -8,6 +8,12 @@ * \ingroup bmesh */ +#include + +#include "BLI_span.hh" + +#include "bmesh_class.hh" + bool BM_mesh_boolean(BMesh *bm, blender::Span> looptris, int (*test_fn)(BMFace *f, void *user_data), diff --git a/source/blender/bmesh/tools/bmesh_decimate.hh b/source/blender/bmesh/tools/bmesh_decimate.hh index e45885cdd3f0..c68216362554 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.hh +++ b/source/blender/bmesh/tools/bmesh_decimate.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "intern/bmesh_operator_api.hh" + +#include "bmesh_class.hh" + /** * \brief BM_mesh_decimate * \param bm: The mesh diff --git a/source/blender/bmesh/tools/bmesh_edgenet.hh b/source/blender/bmesh/tools/bmesh_edgenet.hh index 939166b4a514..910f2a1e950a 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.hh +++ b/source/blender/bmesh/tools/bmesh_edgenet.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * Fill in faces from an edgenet made up of boundary and wire edges. * diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.hh b/source/blender/bmesh/tools/bmesh_edgesplit.hh index ff58c0da0a0d..4ab9027fb1e9 100644 --- a/source/blender/bmesh/tools/bmesh_edgesplit.hh +++ b/source/blender/bmesh/tools/bmesh_edgesplit.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * \param use_verts: Use flagged verts instead of edges. * \param tag_only: Only split tagged edges. diff --git a/source/blender/bmesh/tools/bmesh_intersect.hh b/source/blender/bmesh/tools/bmesh_intersect.hh index b3d385e81cdb..42fea95f7ad4 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.hh +++ b/source/blender/bmesh/tools/bmesh_intersect.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BLI_span.hh" + +#include "bmesh_class.hh" + /** * Intersect tessellated faces * leaving the resulting edges tagged. diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.hh b/source/blender/bmesh/tools/bmesh_intersect_edges.hh index 56c64334eba3..aa0a83af9af8 100644 --- a/source/blender/bmesh/tools/bmesh_intersect_edges.hh +++ b/source/blender/bmesh/tools/bmesh_intersect_edges.hh @@ -8,5 +8,9 @@ #pragma once +#include "BLI_ghash.h" + +#include "bmesh_class.hh" + bool BM_mesh_intersect_edges( BMesh *bm, char hflag, float dist, bool split_faces, GHash *r_targetmap); diff --git a/source/blender/bmesh/tools/bmesh_path.hh b/source/blender/bmesh/tools/bmesh_path.hh index c5d3bb9e48b2..b0088ca0fe2c 100644 --- a/source/blender/bmesh/tools/bmesh_path.hh +++ b/source/blender/bmesh/tools/bmesh_path.hh @@ -8,6 +8,13 @@ * \ingroup bmesh */ +#include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" + +#include "bmesh_class.hh" + +struct LinkNode; + struct BMCalcPathParams { uint use_topology_distance : 1; uint use_step_face : 1; diff --git a/source/blender/bmesh/tools/bmesh_path_region.hh b/source/blender/bmesh/tools/bmesh_path_region.hh index 50264e07f7d8..c424aaf61228 100644 --- a/source/blender/bmesh/tools/bmesh_path_region.hh +++ b/source/blender/bmesh/tools/bmesh_path_region.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BLI_compiler_attrs.h" + +#include "bmesh_class.hh" + struct LinkNode *BM_mesh_calc_path_region_vert(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, diff --git a/source/blender/bmesh/tools/bmesh_path_region_uv.hh b/source/blender/bmesh/tools/bmesh_path_region_uv.hh index cc7eaa67fca6..bac07daccaf3 100644 --- a/source/blender/bmesh/tools/bmesh_path_region_uv.hh +++ b/source/blender/bmesh/tools/bmesh_path_region_uv.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BLI_linklist.h" + +#include "bmesh_class.hh" + LinkNode *BM_mesh_calc_path_uv_region_vert(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, diff --git a/source/blender/bmesh/tools/bmesh_path_uv.hh b/source/blender/bmesh/tools/bmesh_path_uv.hh index 720d3c264c2f..69d6ad18be8e 100644 --- a/source/blender/bmesh/tools/bmesh_path_uv.hh +++ b/source/blender/bmesh/tools/bmesh_path_uv.hh @@ -8,6 +8,11 @@ * \ingroup bmesh */ +#include "BLI_linklist.h" +#include "BLI_sys_types.h" + +#include "bmesh_class.hh" + struct BMCalcPathUVParams { uint use_topology_distance : 1; uint use_step_face : 1; diff --git a/source/blender/bmesh/tools/bmesh_region_match.hh b/source/blender/bmesh/tools/bmesh_region_match.hh index 337c8d66da85..d9edb6dbcbf2 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.hh +++ b/source/blender/bmesh/tools/bmesh_region_match.hh @@ -8,6 +8,10 @@ * \ingroup bmesh */ +#include "BLI_sys_types.h" + +#include "bmesh_class.hh" + /** * Take a face-region and return a list of matching face-regions. * diff --git a/source/blender/bmesh/tools/bmesh_separate.hh b/source/blender/bmesh/tools/bmesh_separate.hh index 0c90c78cc37c..9542c03ce095 100644 --- a/source/blender/bmesh/tools/bmesh_separate.hh +++ b/source/blender/bmesh/tools/bmesh_separate.hh @@ -8,6 +8,8 @@ * \ingroup bmesh */ +#include "bmesh_class.hh" + /** * Split all faces that match `filter_fn`. * \note diff --git a/source/blender/bmesh/tools/bmesh_triangulate.hh b/source/blender/bmesh/tools/bmesh_triangulate.hh index 57d9e4accc28..b4f87fe5097c 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.hh +++ b/source/blender/bmesh/tools/bmesh_triangulate.hh @@ -10,6 +10,8 @@ #pragma once +#include "bmesh_class.hh" + void BM_mesh_triangulate(BMesh *bm, int quad_method, int ngon_method, diff --git a/source/blender/bmesh/tools/bmesh_wireframe.cc b/source/blender/bmesh/tools/bmesh_wireframe.cc index 8edfb203f579..83fc91b42e01 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.cc +++ b/source/blender/bmesh/tools/bmesh_wireframe.cc @@ -14,6 +14,7 @@ #include "bmesh.hh" +#include "BLI_math_base.h" #include "BLI_math_geom.h" #include "BLI_math_vector.h" diff --git a/source/blender/bmesh/tools/bmesh_wireframe.hh b/source/blender/bmesh/tools/bmesh_wireframe.hh index 6ba20ca7f455..bebbeee92a00 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.hh +++ b/source/blender/bmesh/tools/bmesh_wireframe.hh @@ -10,6 +10,8 @@ #pragma once +#include "bmesh_class.hh" + /** * \param defgrp_index: Vertex group index, -1 for no vertex groups. * diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 5d7b13a7bbb3..6516aeaa7998 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -193,6 +193,8 @@ set(GLSL_SRC shaders/compositor_glare_simple_star_vertical_pass.glsl shaders/compositor_glare_streaks_accumulate.glsl shaders/compositor_glare_streaks_filter.glsl + shaders/compositor_glare_write_glare_output.glsl + shaders/compositor_glare_write_highlights_output.glsl shaders/compositor_id_mask.glsl shaders/compositor_image_crop.glsl shaders/compositor_inpaint_compute_boundary.glsl @@ -246,6 +248,7 @@ set(GLSL_SRC shaders/compositor_symmetric_separable_blur_variable_size.glsl shaders/compositor_tone_map_photoreceptor.glsl shaders/compositor_tone_map_simple.glsl + shaders/compositor_translate_wrapped.glsl shaders/compositor_van_vliet_gaussian_blur.glsl shaders/compositor_van_vliet_gaussian_blur_sum.glsl shaders/compositor_write_output.glsl diff --git a/source/blender/compositor/COM_result.hh b/source/blender/compositor/COM_result.hh index 3de33a5f4e9c..90ace1d846ec 100644 --- a/source/blender/compositor/COM_result.hh +++ b/source/blender/compositor/COM_result.hh @@ -206,7 +206,7 @@ class Result { * the size of the given domain, and set the domain of the result to the given domain. * * If from_pool is true, the texture will be allocated from the texture pool of the context, - * otherwise, a new texture will be allocated. Pooling should not be be used for persistent + * otherwise, a new texture will be allocated. Pooling should not be used for persistent * results that might span more than one evaluation, like cached resources. While pooling should * be used for most other cases where the result will be allocated then later released in the * same evaluation. diff --git a/source/blender/compositor/algorithms/intern/transform.cc b/source/blender/compositor/algorithms/intern/transform.cc index d958553b4098..d17790cb3bb4 100644 --- a/source/blender/compositor/algorithms/intern/transform.cc +++ b/source/blender/compositor/algorithms/intern/transform.cc @@ -83,20 +83,11 @@ void transform(Context &context, const float3x3 &transformation, RealizationOptions realization_options) { - /* If we are wrapping, the input is translated but the target domain remains fixed, which results - * in the input clipping on one side and wrapping on the opposite side. This mask vector can be - * multiplied to the translation component of the transformation to remove it. */ - const float2 wrap_mask = float2(realization_options.wrap_x ? 0.0f : 1.0f, - realization_options.wrap_y ? 0.0f : 1.0f); - - /* Compute a transformed input domain, excluding translations of wrapped axes. */ - Domain input_domain = input.domain(); - float3x3 domain_transformation = transformation; - domain_transformation.location() *= wrap_mask; - input_domain.transform(domain_transformation); + Domain transformed_domain = input.domain(); + transformed_domain.transform(transformation); /* Realize the input on the target domain using the full transformation. */ - const Domain target_domain = compute_realized_transformation_domain(context, input_domain); + const Domain target_domain = compute_realized_transformation_domain(context, transformed_domain); realize_on_domain(context, input, output, diff --git a/source/blender/compositor/cached_resources/COM_morphological_distance_feather_weights.hh b/source/blender/compositor/cached_resources/COM_morphological_distance_feather_weights.hh index d9cd8859912d..24acc4b76f05 100644 --- a/source/blender/compositor/cached_resources/COM_morphological_distance_feather_weights.hh +++ b/source/blender/compositor/cached_resources/COM_morphological_distance_feather_weights.hh @@ -11,6 +11,7 @@ #include "BLI_map.hh" #include "COM_cached_resource.hh" +#include "COM_result.hh" namespace blender::compositor { diff --git a/source/blender/compositor/cached_resources/COM_ocio_color_space_conversion_shader.hh b/source/blender/compositor/cached_resources/COM_ocio_color_space_conversion_shader.hh index 64baa67761a6..9a2688bb5779 100644 --- a/source/blender/compositor/cached_resources/COM_ocio_color_space_conversion_shader.hh +++ b/source/blender/compositor/cached_resources/COM_ocio_color_space_conversion_shader.hh @@ -7,8 +7,12 @@ #include #include +#include "BLI_map.hh" + #include "COM_cached_resource.hh" +struct GPUShader; + namespace blender::compositor { class Context; diff --git a/source/blender/compositor/cached_resources/COM_symmetric_blur_weights.hh b/source/blender/compositor/cached_resources/COM_symmetric_blur_weights.hh index 1bc11a6924a4..74621bf06c76 100644 --- a/source/blender/compositor/cached_resources/COM_symmetric_blur_weights.hh +++ b/source/blender/compositor/cached_resources/COM_symmetric_blur_weights.hh @@ -12,6 +12,7 @@ #include "BLI_math_vector_types.hh" #include "COM_cached_resource.hh" +#include "COM_result.hh" namespace blender::compositor { diff --git a/source/blender/compositor/cached_resources/COM_symmetric_separable_blur_weights.hh b/source/blender/compositor/cached_resources/COM_symmetric_separable_blur_weights.hh index 7f326e071a87..517778c7fd6b 100644 --- a/source/blender/compositor/cached_resources/COM_symmetric_separable_blur_weights.hh +++ b/source/blender/compositor/cached_resources/COM_symmetric_separable_blur_weights.hh @@ -12,6 +12,7 @@ #include "BLI_math_vector_types.hh" #include "COM_cached_resource.hh" +#include "COM_result.hh" namespace blender::compositor { diff --git a/source/blender/compositor/shaders/compositor_glare_bloom_upsample.glsl b/source/blender/compositor/shaders/compositor_glare_bloom_upsample.glsl index c5edc96253eb..b7a1a5564d53 100644 --- a/source/blender/compositor/shaders/compositor_glare_bloom_upsample.glsl +++ b/source/blender/compositor/shaders/compositor_glare_bloom_upsample.glsl @@ -37,5 +37,6 @@ void main() upsampled += (1.0 / 16.0) * texture(input_tx, coordinates + pixel_size * vec2(1.0, -1.0)); upsampled += (1.0 / 16.0) * texture(input_tx, coordinates + pixel_size * vec2(1.0, 1.0)); - imageStore(output_img, texel, imageLoad(output_img, texel) + upsampled); + vec4 combined = imageLoad(output_img, texel) + upsampled; + imageStore(output_img, texel, vec4(combined.rgb, 1.0f)); } diff --git a/source/blender/compositor/shaders/compositor_glare_ghost_accumulate.glsl b/source/blender/compositor/shaders/compositor_glare_ghost_accumulate.glsl index 10fd146348d6..c2a269be81a9 100644 --- a/source/blender/compositor/shaders/compositor_glare_ghost_accumulate.glsl +++ b/source/blender/compositor/shaders/compositor_glare_ghost_accumulate.glsl @@ -37,5 +37,6 @@ void main() } vec4 current_accumulated_ghost = imageLoad(accumulated_ghost_img, texel); - imageStore(accumulated_ghost_img, texel, current_accumulated_ghost + accumulated_ghost); + vec4 combined_ghost = current_accumulated_ghost + accumulated_ghost; + imageStore(accumulated_ghost_img, texel, vec4(combined_ghost.rgb, 1.0f)); } diff --git a/source/blender/compositor/shaders/compositor_glare_mix.glsl b/source/blender/compositor/shaders/compositor_glare_mix.glsl index 45718c8e3a63..bab35ddf55b1 100644 --- a/source/blender/compositor/shaders/compositor_glare_mix.glsl +++ b/source/blender/compositor/shaders/compositor_glare_mix.glsl @@ -2,31 +2,27 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "gpu_shader_common_color_utils.glsl" #include "gpu_shader_compositor_texture_utilities.glsl" void main() { ivec2 texel = ivec2(gl_GlobalInvocationID.xy); - /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the input image - * size to get the relevant coordinates into the sampler's expected [0, 1] range. Make sure the - * input color is not negative to avoid a subtractive effect when mixing the glare. */ + /* Make sure the input is not negative to avoid a subtractive effect when mixing the glare. */ + vec4 input_color = max(vec4(0.0), texture_load(input_tx, texel)); + vec2 normalized_coordinates = (vec2(texel) + vec2(0.5)) / vec2(texture_size(input_tx)); vec4 glare_color = texture(glare_tx, normalized_coordinates); - vec4 input_color = max(vec4(0.0), texture_load(input_tx, texel)); - /* The mix factor is in the range [-1, 1] and linearly interpolate between the three values such - * that: - * 1 => Glare only. - * 0 => Input + Glare. - * -1 => Input only. - * We implement that as a weighted sum as follows. When the mix factor is 1, the glare weight - * should be 1 and the input weight should be 0. When the mix factor is -1, the glare weight - * should be 0 and the input weight should be 1. When the mix factor is 0, both weights should - * be 1. This can be expressed using the following compact min max expressions. */ - float input_weight = 1.0 - max(0.0, mix_factor); - float glare_weight = 1.0 + min(0.0, mix_factor); - vec3 highlights = input_weight * input_color.rgb + glare_weight * glare_color.rgb; + /* Adjust saturation of glare. */ + vec4 glare_hsva; + rgb_to_hsv(glare_color, glare_hsva); + glare_hsva.y = clamp(glare_hsva.y * saturation, 0.0, 1.0); + vec4 glare_rgba; + hsv_to_rgb(glare_hsva, glare_rgba); + + vec3 combined_color = input_color.rgb + glare_rgba.rgb * tint; - imageStore(output_img, texel, vec4(highlights, input_color.a)); + imageStore(output_img, texel, vec4(combined_color, input_color.a)); } diff --git a/source/blender/compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl b/source/blender/compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl index b2b60ab1883a..16085c32ef43 100644 --- a/source/blender/compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl +++ b/source/blender/compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl @@ -54,6 +54,7 @@ void main() ivec2 texel = start + j * direction; vec4 horizontal = texture_load(diagonal_tx, texel); vec4 vertical = imageLoad(anti_diagonal_img, texel); - imageStore(anti_diagonal_img, texel, horizontal + vertical); + vec4 combined = horizontal + vertical; + imageStore(anti_diagonal_img, texel, vec4(combined.rgb, 1.0)); } } diff --git a/source/blender/compositor/shaders/compositor_glare_simple_star_vertical_pass.glsl b/source/blender/compositor/shaders/compositor_glare_simple_star_vertical_pass.glsl index 2dd5bbf4672f..e993eed597fa 100644 --- a/source/blender/compositor/shaders/compositor_glare_simple_star_vertical_pass.glsl +++ b/source/blender/compositor/shaders/compositor_glare_simple_star_vertical_pass.glsl @@ -48,6 +48,7 @@ void main() ivec2 texel = ivec2(gl_GlobalInvocationID.x, y); vec4 horizontal = texture_load(horizontal_tx, texel); vec4 vertical = imageLoad(vertical_img, texel); - imageStore(vertical_img, texel, horizontal + vertical); + vec4 combined = horizontal + vertical; + imageStore(vertical_img, texel, vec4(combined.rgb, 1.0)); } } diff --git a/source/blender/compositor/shaders/compositor_glare_streaks_accumulate.glsl b/source/blender/compositor/shaders/compositor_glare_streaks_accumulate.glsl index e51edc199667..75115c2e5d42 100644 --- a/source/blender/compositor/shaders/compositor_glare_streaks_accumulate.glsl +++ b/source/blender/compositor/shaders/compositor_glare_streaks_accumulate.glsl @@ -9,5 +9,6 @@ void main() ivec2 texel = ivec2(gl_GlobalInvocationID.xy); vec4 attenuated_streak = texture_load(streak_tx, texel) * attenuation_factor; vec4 current_accumulated_streaks = imageLoad(accumulated_streaks_img, texel); - imageStore(accumulated_streaks_img, texel, current_accumulated_streaks + attenuated_streak); + vec4 combined_streaks = current_accumulated_streaks + attenuated_streak; + imageStore(accumulated_streaks_img, texel, vec4(combined_streaks.rgb, 1.0)); } diff --git a/source/blender/compositor/shaders/compositor_glare_write_glare_output.glsl b/source/blender/compositor/shaders/compositor_glare_write_glare_output.glsl new file mode 100644 index 000000000000..8449e5ecc891 --- /dev/null +++ b/source/blender/compositor/shaders/compositor_glare_write_glare_output.glsl @@ -0,0 +1,23 @@ +/* SPDX-FileCopyrightText: 2025 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_common_color_utils.glsl" + +void main() +{ + ivec2 texel = ivec2(gl_GlobalInvocationID.xy); + + vec2 normalized_coordinates = (vec2(texel) + vec2(0.5)) / vec2(imageSize(output_img)); + vec4 glare_color = texture(input_tx, normalized_coordinates); + + /* Adjust saturation of glare. */ + vec4 glare_hsva; + rgb_to_hsv(glare_color, glare_hsva); + glare_hsva.y = clamp(glare_hsva.y * saturation, 0.0, 1.0); + vec4 glare_rgba; + hsv_to_rgb(glare_hsva, glare_rgba); + + vec3 adjusted_glare_value = glare_rgba.rgb * tint; + imageStore(output_img, texel, vec4(adjusted_glare_value, 1.0)); +} diff --git a/source/blender/compositor/shaders/compositor_glare_write_highlights_output.glsl b/source/blender/compositor/shaders/compositor_glare_write_highlights_output.glsl new file mode 100644 index 000000000000..814a6f3cb70c --- /dev/null +++ b/source/blender/compositor/shaders/compositor_glare_write_highlights_output.glsl @@ -0,0 +1,11 @@ +/* SPDX-FileCopyrightText: 2025 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +void main() +{ + ivec2 texel = ivec2(gl_GlobalInvocationID.xy); + + vec2 normalized_coordinates = (vec2(texel) + vec2(0.5)) / vec2(imageSize(output_img)); + imageStore(output_img, texel, texture(input_tx, normalized_coordinates)); +} diff --git a/source/blender/compositor/shaders/compositor_translate_wrapped.glsl b/source/blender/compositor/shaders/compositor_translate_wrapped.glsl new file mode 100644 index 000000000000..a2227f9fc43a --- /dev/null +++ b/source/blender/compositor/shaders/compositor_translate_wrapped.glsl @@ -0,0 +1,16 @@ +/* SPDX-FileCopyrightText: 2025 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_bicubic_sampler_lib.glsl" +#include "gpu_shader_compositor_texture_utilities.glsl" + +void main() +{ + ivec2 texel = ivec2(gl_GlobalInvocationID.xy); + + ivec2 size = texture_size(input_tx); + vec2 translated_coordinates = (vec2(texel) + vec2(0.5f) - translation) / vec2(size); + + imageStore(output_img, texel, SAMPLER_FUNCTION(input_tx, translated_coordinates)); +} diff --git a/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh b/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh index 121e402a4dce..1dafe13dbdbb 100644 --- a/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh @@ -4,6 +4,8 @@ #include "gpu_shader_create_info.hh" +using namespace blender::gpu::shader; + GPU_SHADER_CREATE_INFO(compositor_cryptomatte_pick) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(IVEC2, lower_bound) diff --git a/source/blender/compositor/shaders/infos/compositor_glare_info.hh b/source/blender/compositor/shaders/infos/compositor_glare_info.hh index dae0ecaac313..1276f06b5b46 100644 --- a/source/blender/compositor/shaders/infos/compositor_glare_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_glare_info.hh @@ -19,7 +19,8 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_mix) LOCAL_GROUP_SIZE(16, 16) -PUSH_CONSTANT(FLOAT, mix_factor) +PUSH_CONSTANT(FLOAT, saturation) +PUSH_CONSTANT(VEC3, tint) SAMPLER(0, FLOAT_2D, input_tx) SAMPLER(1, FLOAT_2D, glare_tx) IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) @@ -27,6 +28,24 @@ COMPUTE_SOURCE("compositor_glare_mix.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() +GPU_SHADER_CREATE_INFO(compositor_glare_write_glare_output) +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(FLOAT, saturation) +PUSH_CONSTANT(VEC3, tint) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_write_glare_output.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() + +GPU_SHADER_CREATE_INFO(compositor_glare_write_highlights_output) +LOCAL_GROUP_SIZE(16, 16) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_glare_write_highlights_output.glsl") +DO_STATIC_COMPILATION() +GPU_SHADER_CREATE_END() + /* ------------ * Ghost Glare. * ------------ */ diff --git a/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh b/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh new file mode 100644 index 000000000000..a487ca867e69 --- /dev/null +++ b/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh @@ -0,0 +1,23 @@ +/* SPDX-FileCopyrightText: 2025 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(compositor_translate_wrapped_shared) +LOCAL_GROUP_SIZE(16, 16) +PUSH_CONSTANT(VEC2, translation) +SAMPLER(0, FLOAT_2D, input_tx) +IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img) +COMPUTE_SOURCE("compositor_translate_wrapped.glsl") +GPU_SHADER_CREATE_END() + +GPU_SHADER_CREATE_INFO(compositor_translate_wrapped) +ADDITIONAL_INFO(compositor_translate_wrapped_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture") +GPU_SHADER_CREATE_END() + +GPU_SHADER_CREATE_INFO(compositor_translate_wrapped_bicubic) +ADDITIONAL_INFO(compositor_translate_wrapped_shared) +DEFINE_VALUE("SAMPLER_FUNCTION", "texture_bicubic") +GPU_SHADER_CREATE_END() diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 3be4e388bea1..1aefbdb19a2d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -2236,22 +2236,22 @@ void DepsgraphNodeBuilder::build_vfont(VFont *vfont) &vfont->id, NodeType::GENERIC_DATABLOCK, OperationCode::GENERIC_DATABLOCK_UPDATE); } -static bool seq_node_build_cb(Strip *seq, void *user_data) +static bool strip_node_build_cb(Strip *strip, void *user_data) { DepsgraphNodeBuilder *nb = (DepsgraphNodeBuilder *)user_data; - nb->build_idproperties(seq->prop); - if (seq->sound != nullptr) { - nb->build_sound(seq->sound); + nb->build_idproperties(strip->prop); + if (strip->sound != nullptr) { + nb->build_sound(strip->sound); } - if (seq->scene != nullptr) { - nb->build_scene_parameters(seq->scene); + if (strip->scene != nullptr) { + nb->build_scene_parameters(strip->scene); } - if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) { - if (seq->flag & SEQ_SCENE_STRIPS) { - nb->build_scene_sequencer(seq->scene); + if (strip->type == STRIP_TYPE_SCENE && strip->scene != nullptr) { + if (strip->flag & SEQ_SCENE_STRIPS) { + nb->build_scene_sequencer(strip->scene); } - ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene); - nb->build_scene_speakers(seq->scene, sequence_view_layer); + ViewLayer *sequence_view_layer = BKE_view_layer_default_render(strip->scene); + nb->build_scene_speakers(strip->scene, sequence_view_layer); } /* TODO(sergey): Movie clip, scene, camera, mask. */ return true; @@ -2274,7 +2274,7 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) SEQ_eval_sequences(depsgraph, scene_cow, &scene_cow->ed->seqbase); }); /* Make sure data for sequences is in the graph. */ - SEQ_for_each_callback(&scene->ed->seqbase, seq_node_build_cb, this); + SEQ_for_each_callback(&scene->ed->seqbase, strip_node_build_cb, this); } void DepsgraphNodeBuilder::build_scene_audio(Scene *scene) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 243cd606a301..8842938cbbf2 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -3349,34 +3349,34 @@ struct Seq_build_prop_cb_data { bool has_audio_strips; }; -static bool seq_build_prop_cb(Strip *seq, void *user_data) +static bool strip_build_prop_cb(Strip *strip, void *user_data) { Seq_build_prop_cb_data *cd = (Seq_build_prop_cb_data *)user_data; - cd->builder->build_idproperties(seq->prop); - if (seq->sound != nullptr) { - cd->builder->build_sound(seq->sound); - ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO); + cd->builder->build_idproperties(strip->prop); + if (strip->sound != nullptr) { + cd->builder->build_sound(strip->sound); + ComponentKey sound_key(&strip->sound->id, NodeType::AUDIO); cd->builder->add_relation(sound_key, cd->sequencer_key, "Sound -> Sequencer"); cd->has_audio_strips = true; } - if (seq->scene != nullptr) { - cd->builder->build_scene_parameters(seq->scene); + if (strip->scene != nullptr) { + cd->builder->build_scene_parameters(strip->scene); /* This is to support 3D audio. */ cd->has_audio_strips = true; } - if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) { - if (seq->flag & SEQ_SCENE_STRIPS) { - cd->builder->build_scene_sequencer(seq->scene); - ComponentKey sequence_scene_audio_key(&seq->scene->id, NodeType::AUDIO); + if (strip->type == STRIP_TYPE_SCENE && strip->scene != nullptr) { + if (strip->flag & SEQ_SCENE_STRIPS) { + cd->builder->build_scene_sequencer(strip->scene); + ComponentKey sequence_scene_audio_key(&strip->scene->id, NodeType::AUDIO); cd->builder->add_relation( sequence_scene_audio_key, cd->sequencer_key, "Sequence Scene Audio -> Sequencer"); - ComponentKey sequence_scene_key(&seq->scene->id, NodeType::SEQUENCER); + ComponentKey sequence_scene_key(&strip->scene->id, NodeType::SEQUENCER); cd->builder->add_relation( sequence_scene_key, cd->sequencer_key, "Sequence Scene -> Sequencer"); } - ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene); - cd->builder->build_scene_speakers(seq->scene, sequence_view_layer); + ViewLayer *sequence_view_layer = BKE_view_layer_default_render(strip->scene); + cd->builder->build_scene_speakers(strip->scene, sequence_view_layer); } /* TODO(sergey): Movie clip, camera, mask. */ return true; @@ -3400,7 +3400,7 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) Seq_build_prop_cb_data cb_data = {this, sequencer_key, false}; - SEQ_for_each_callback(&scene->ed->seqbase, seq_build_prop_cb, &cb_data); + SEQ_for_each_callback(&scene->ed->seqbase, strip_build_prop_cb, &cb_data); if (cb_data.has_audio_strips) { add_relation(sequencer_key, scene_audio_key, "Sequencer -> Audio"); } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc index 91102ea2e11e..858f84dda8ab 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc @@ -21,13 +21,13 @@ namespace blender::deg { SequencerBackup::SequencerBackup(const Depsgraph *depsgraph) : depsgraph(depsgraph) {} -static bool seq_init_cb(Strip *seq, void *user_data) +static bool strip_init_cb(Strip *strip, void *user_data) { SequencerBackup *sb = (SequencerBackup *)user_data; SequenceBackup sequence_backup(sb->depsgraph); - sequence_backup.init_from_sequence(seq); + sequence_backup.init_from_sequence(strip); if (!sequence_backup.isEmpty()) { - const SessionUID &session_uid = seq->runtime.session_uid; + const SessionUID &session_uid = strip->runtime.session_uid; BLI_assert(BLI_session_uid_is_generated(&session_uid)); sb->sequences_backup.add(session_uid, sequence_backup); } @@ -37,18 +37,18 @@ static bool seq_init_cb(Strip *seq, void *user_data) void SequencerBackup::init_from_scene(Scene *scene) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_init_cb, this); + SEQ_for_each_callback(&scene->ed->seqbase, strip_init_cb, this); } } -static bool seq_restore_cb(Strip *seq, void *user_data) +static bool strip_restore_cb(Strip *strip, void *user_data) { SequencerBackup *sb = (SequencerBackup *)user_data; - const SessionUID &session_uid = seq->runtime.session_uid; + const SessionUID &session_uid = strip->runtime.session_uid; BLI_assert(BLI_session_uid_is_generated(&session_uid)); SequenceBackup *sequence_backup = sb->sequences_backup.lookup_ptr(session_uid); if (sequence_backup != nullptr) { - sequence_backup->restore_to_sequence(seq); + sequence_backup->restore_to_sequence(strip); } return true; } @@ -56,7 +56,7 @@ static bool seq_restore_cb(Strip *seq, void *user_data) void SequencerBackup::restore_to_scene(Scene *scene) { if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_restore_cb, this); + SEQ_for_each_callback(&scene->ed->seqbase, strip_restore_cb, this); } /* Cleanup audio while the scene is still known. */ for (SequenceBackup &sequence_backup : sequences_backup.values()) { diff --git a/source/blender/draw/engines/compositor/compositor_engine.h b/source/blender/draw/engines/compositor/compositor_engine.h index 4b76ec70c759..77e2f61035ff 100644 --- a/source/blender/draw/engines/compositor/compositor_engine.h +++ b/source/blender/draw/engines/compositor/compositor_engine.h @@ -8,6 +8,8 @@ extern "C" { #endif +struct DrawEngineType; + extern DrawEngineType draw_engine_compositor_type; #ifdef __cplusplus diff --git a/source/blender/draw/engines/eevee_next/eevee_lookdev.cc b/source/blender/draw/engines/eevee_next/eevee_lookdev.cc index 41ebd7499694..45c568e4bc40 100644 --- a/source/blender/draw/engines/eevee_next/eevee_lookdev.cc +++ b/source/blender/draw/engines/eevee_next/eevee_lookdev.cc @@ -6,6 +6,8 @@ * \ingroup eevee */ +#include "BLI_rect.h" + #include "BKE_image.hh" #include "BKE_lib_id.hh" #include "BKE_node.hh" @@ -17,8 +19,6 @@ #include "eevee_instance.hh" -#include "draw_debug.hh" - namespace blender::eevee { /* -------------------------------------------------------------------- */ diff --git a/source/blender/draw/engines/eevee_next/eevee_lookdev.hh b/source/blender/draw/engines/eevee_next/eevee_lookdev.hh index f5540e78ec1f..77e4b91953b7 100644 --- a/source/blender/draw/engines/eevee_next/eevee_lookdev.hh +++ b/source/blender/draw/engines/eevee_next/eevee_lookdev.hh @@ -11,13 +11,34 @@ #pragma once +#include + +#include "DNA_image_types.h" +#include "DNA_vec_types.h" #include "DNA_world_types.h" +#include "BLI_math_vector_types.hh" + +#include "DRW_gpu_wrapper.hh" + +#include "draw_manager.hh" +#include "draw_pass.hh" + +struct bNode; +struct bNodeSocketValueFloat; +struct View3D; + namespace blender::eevee { class Instance; class LookdevView; +using blender::draw::Framebuffer; +using blender::draw::PassSimple; +using blender::draw::ResourceHandle; +using blender::draw::Texture; +using blender::draw::View; + /* -------------------------------------------------------------------- */ /** \name Parameters * diff --git a/source/blender/draw/engines/eevee_next/eevee_pipeline.hh b/source/blender/draw/engines/eevee_next/eevee_pipeline.hh index 3690b2644683..f5c11ade8647 100644 --- a/source/blender/draw/engines/eevee_next/eevee_pipeline.hh +++ b/source/blender/draw/engines/eevee_next/eevee_pipeline.hh @@ -21,6 +21,8 @@ #include "eevee_raytrace.hh" #include "eevee_subsurface.hh" +struct Camera; + namespace blender::eevee { class Instance; diff --git a/source/blender/draw/engines/eevee_next/eevee_view.cc b/source/blender/draw/engines/eevee_next/eevee_view.cc index c65b26c0c54d..5d8fb5473514 100644 --- a/source/blender/draw/engines/eevee_next/eevee_view.cc +++ b/source/blender/draw/engines/eevee_next/eevee_view.cc @@ -215,8 +215,8 @@ void ShadingView::update_view() float4x4 winmat = main_view_.winmat(); if (film.scaling_factor_get() > 1) { - /* This whole section ensures that the render target pixel grid will match the film pixel pixel - * grid. Otherwise the weight computation inside the film accumulation will be wrong. */ + /* This whole section ensures that the render target pixel grid will match the film pixel grid. + * Otherwise the weight computation inside the film accumulation will be wrong. */ float left, right, bottom, top, near, far; projmat_dimensions(winmat.ptr(), &left, &right, &bottom, &top, &near, &far); diff --git a/source/blender/draw/engines/eevee_next/eevee_view.hh b/source/blender/draw/engines/eevee_next/eevee_view.hh index 4930b19c0de1..f27574264020 100644 --- a/source/blender/draw/engines/eevee_next/eevee_view.hh +++ b/source/blender/draw/engines/eevee_next/eevee_view.hh @@ -19,7 +19,9 @@ #include "DRW_render.hh" #include "eevee_camera.hh" +#include "eevee_depth_of_field.hh" #include "eevee_pipeline.hh" +#include "eevee_renderbuffers.hh" #include "eevee_shader.hh" #include "eevee_velocity.hh" diff --git a/source/blender/draw/engines/eevee_next/eevee_volume.hh b/source/blender/draw/engines/eevee_next/eevee_volume.hh index 0044a69f7ce8..f8f00a141b1a 100644 --- a/source/blender/draw/engines/eevee_next/eevee_volume.hh +++ b/source/blender/draw/engines/eevee_next/eevee_volume.hh @@ -36,7 +36,11 @@ #pragma once #include "BLI_set.hh" + +#include "DRW_gpu_wrapper.hh" + #include "eevee_shader_shared.hh" +#include "eevee_sync.hh" namespace blender::eevee { diff --git a/source/blender/draw/engines/eevee_next/eevee_world.hh b/source/blender/draw/engines/eevee_next/eevee_world.hh index b81488833fac..34476949c99e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_world.hh +++ b/source/blender/draw/engines/eevee_next/eevee_world.hh @@ -14,6 +14,11 @@ #include "DNA_world_types.h" #include "eevee_lookdev.hh" +#include "eevee_sync.hh" + +struct bNodeTree; +struct bNodeSocketValueRGBA; +struct UniformBuffer; namespace blender::eevee { diff --git a/source/blender/draw/engines/external/external_engine.h b/source/blender/draw/engines/external/external_engine.h index 9e708e33396b..5fb54eecd499 100644 --- a/source/blender/draw/engines/external/external_engine.h +++ b/source/blender/draw/engines/external/external_engine.h @@ -12,6 +12,9 @@ extern "C" { #endif +struct DrawEngineType; +struct RenderEngineType; + extern DrawEngineType draw_engine_external_type; extern RenderEngineType DRW_engine_viewport_external_type; diff --git a/source/blender/draw/engines/image/image_engine.h b/source/blender/draw/engines/image/image_engine.h index 6b59e08b47d6..5ff434accbd5 100644 --- a/source/blender/draw/engines/image/image_engine.h +++ b/source/blender/draw/engines/image/image_engine.h @@ -12,6 +12,8 @@ extern "C" { #endif +struct DrawEngineType; + extern DrawEngineType draw_engine_image_type; #ifdef __cplusplus diff --git a/source/blender/draw/engines/image/image_shader_params.hh b/source/blender/draw/engines/image/image_shader_params.hh index 6961c462cce8..516401dc3549 100644 --- a/source/blender/draw/engines/image/image_shader_params.hh +++ b/source/blender/draw/engines/image/image_shader_params.hh @@ -12,6 +12,8 @@ #include "DNA_image_types.h" #include "DNA_scene_types.h" +#include "BLI_math_vector.h" + #include "IMB_imbuf_types.hh" #include "BKE_image.hh" diff --git a/source/blender/draw/engines/image/image_space.hh b/source/blender/draw/engines/image/image_space.hh index b14a702d8dde..24d1beabde2b 100644 --- a/source/blender/draw/engines/image/image_space.hh +++ b/source/blender/draw/engines/image/image_space.hh @@ -8,6 +8,12 @@ #pragma once +struct ARegion; +struct ImBuf; +struct Image; +struct ImageUser; +struct Main; + namespace blender::image_engine { struct ShaderParameters; diff --git a/source/blender/draw/engines/image/image_space_image.hh b/source/blender/draw/engines/image/image_space_image.hh index de4c11e5d11e..f357766ce2c1 100644 --- a/source/blender/draw/engines/image/image_space_image.hh +++ b/source/blender/draw/engines/image/image_space_image.hh @@ -10,6 +10,8 @@ #include "ED_image.hh" +#include "DNA_screen_types.h" + #include "image_private.hh" namespace blender::image_engine { diff --git a/source/blender/draw/engines/image/image_space_node.hh b/source/blender/draw/engines/image/image_space_node.hh index 5390949a8fc8..b8e2af2165f0 100644 --- a/source/blender/draw/engines/image/image_space_node.hh +++ b/source/blender/draw/engines/image/image_space_node.hh @@ -8,6 +8,9 @@ #pragma once +#include "DNA_screen_types.h" +#include "DNA_space_types.h" + #include "image_private.hh" namespace blender::image_engine { diff --git a/source/blender/draw/engines/image/image_usage.hh b/source/blender/draw/engines/image/image_usage.hh index 80450ba2e8b9..a249e790597a 100644 --- a/source/blender/draw/engines/image/image_usage.hh +++ b/source/blender/draw/engines/image/image_usage.hh @@ -8,6 +8,11 @@ #pragma once +#include + +#include "DNA_color_types.h" +#include "DNA_image_types.h" + namespace blender::image_engine { /** diff --git a/source/blender/draw/engines/overlay/overlay_engine.h b/source/blender/draw/engines/overlay/overlay_engine.h index 83a785f94d2f..c58487db92cd 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.h +++ b/source/blender/draw/engines/overlay/overlay_engine.h @@ -12,6 +12,8 @@ extern "C" { #endif +struct DrawEngineType; + extern DrawEngineType draw_engine_overlay_next_type; #ifdef __cplusplus diff --git a/source/blender/draw/engines/overlay/overlay_next_armature.hh b/source/blender/draw/engines/overlay/overlay_next_armature.hh index 143a20257647..124f74f18e6d 100644 --- a/source/blender/draw/engines/overlay/overlay_next_armature.hh +++ b/source/blender/draw/engines/overlay/overlay_next_armature.hh @@ -56,6 +56,7 @@ class Armatures : Overlay { PassSimple::Sub *shape_outline = nullptr; /* Custom bone wire-frame. */ PassSimple::Sub *shape_wire = nullptr; + PassSimple::Sub *shape_wire_strip = nullptr; /* Envelopes. */ PassSimple::Sub *envelope_fill = nullptr; PassSimple::Sub *envelope_outline = nullptr; @@ -102,6 +103,7 @@ class Armatures : Overlay { Map> custom_shape_fill; Map> custom_shape_outline; Map> custom_shape_wire; + Map> custom_shape_wire_strip; BoneInstanceBuf &custom_shape_fill_get_buffer(gpu::Batch *geom) { @@ -119,9 +121,16 @@ class Armatures : Overlay { BoneInstanceBuf &custom_shape_wire_get_buffer(gpu::Batch *geom) { - return *custom_shape_wire.lookup_or_add_cb(geom, [this]() { - return std::make_unique(this->selection_type_, "CustomBoneWire"); - }); + if (geom->prim_type == GPU_PRIM_LINE_STRIP) { + return *custom_shape_wire_strip.lookup_or_add_cb(geom, [this]() { + return std::make_unique(this->selection_type_, "CustomBoneWireStrip"); + }); + } + else { + return *custom_shape_wire.lookup_or_add_cb(geom, [this]() { + return std::make_unique(this->selection_type_, "CustomBoneWire"); + }); + } } BoneBuffers(const SelectionType selection_type) : selection_type_(selection_type){}; @@ -295,6 +304,27 @@ class Armatures : Overlay { else { transparent_.shape_wire = opaque_.shape_wire; } + + { + auto &sub = armature_ps_.sub("opaque.shape_wire_strip"); + sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count); + sub.shader_set(res.shaders.armature_shape_wire_strip.get()); + sub.push_constant("alpha", 1.0f); + sub.push_constant("do_smooth_wire", do_smooth_wire); + opaque_.shape_wire_strip = ⊂ + } + if (use_wire_alpha) { + auto &sub = armature_ps_.sub("transparent.shape_wire_strip"); + sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count); + sub.shader_set(res.shaders.armature_shape_wire_strip.get()); + sub.bind_texture("depthTex", depth_tex); + sub.push_constant("alpha", wire_alpha * 0.6f); + sub.push_constant("do_smooth_wire", do_smooth_wire); + transparent_.shape_wire_strip = ⊂ + } + else { + transparent_.shape_wire_strip = opaque_.shape_wire_strip; + } } /* Degrees of freedom. */ { @@ -427,6 +457,7 @@ class Armatures : Overlay { bb.custom_shape_fill.clear(); bb.custom_shape_outline.clear(); bb.custom_shape_wire.clear(); + bb.custom_shape_wire_strip.clear(); }; shape_instance_bufs_begin_sync(transparent_); @@ -573,6 +604,9 @@ class Armatures : Overlay { for (CustomShapeBuf item : bb.custom_shape_wire.items()) { item.value->end_sync(*bb.shape_wire, item.key, GPU_PRIM_TRIS, 2); } + for (CustomShapeBuf item : bb.custom_shape_wire_strip.items()) { + item.value->end_sync(*bb.shape_wire_strip, item.key, GPU_PRIM_TRIS, 2); + } }; end_sync(transparent_); diff --git a/source/blender/draw/engines/overlay/overlay_next_camera.hh b/source/blender/draw/engines/overlay/overlay_next_camera.hh index 0556c27a13d7..7e0f52167f0d 100644 --- a/source/blender/draw/engines/overlay/overlay_next_camera.hh +++ b/source/blender/draw/engines/overlay/overlay_next_camera.hh @@ -279,7 +279,10 @@ class Cameras : Overlay { } Object *ob = ob_ref.object; - CameraInstanceData data(ob->object_to_world(), res.object_wire_color(ob_ref, state)); + float4x4 mat = ob->object_to_world(); + /* Normalize matrix scale. */ + mat.view<3, 3>() = math::normalize(mat.view<3, 3>()); + CameraInstanceData data(mat, res.object_wire_color(ob_ref, state)); const View3D *v3d = state.v3d; const Scene *scene = state.scene; @@ -298,7 +301,7 @@ class Cameras : Overlay { const bool is_selection_camera_stereo = is_select && is_camera_view && is_multiview && is_stereo3d_view; - float3 scale = math::to_scale(data.matrix); + float3 scale = math::to_scale(ob->object_to_world()); /* BKE_camera_multiview_model_matrix already accounts for scale, don't do it here. */ if (is_selection_camera_stereo) { scale = float3(1.0f); diff --git a/source/blender/draw/engines/overlay/overlay_next_facing.hh b/source/blender/draw/engines/overlay/overlay_next_facing.hh index 02fdb3610f73..a6143a4190b9 100644 --- a/source/blender/draw/engines/overlay/overlay_next_facing.hh +++ b/source/blender/draw/engines/overlay/overlay_next_facing.hh @@ -10,6 +10,8 @@ #include "BKE_paint.hh" +#include "draw_sculpt.hh" + #include "overlay_next_base.hh" namespace blender::draw::overlay { diff --git a/source/blender/draw/engines/overlay/overlay_next_mesh.hh b/source/blender/draw/engines/overlay/overlay_next_mesh.hh index 246f410ce9a1..e264bbabe6bd 100644 --- a/source/blender/draw/engines/overlay/overlay_next_mesh.hh +++ b/source/blender/draw/engines/overlay/overlay_next_mesh.hh @@ -349,7 +349,7 @@ class Meshes : Overlay { edit_mesh_skin_roots_ps_.draw_expand(geom, GPU_PRIM_LINES, 32, 1, res_handle); } if (state.show_text && (state.overlay.edit_flag & overlay_edit_text)) { - DRW_text_edit_mesh_measure_stats(state.region, state.v3d, ob, &state.scene->unit, state.dt); + DRW_text_edit_mesh_measure_stats(state.region, state.v3d, ob, state.scene->unit, state.dt); } } diff --git a/source/blender/draw/engines/overlay/overlay_next_mode_transfer.hh b/source/blender/draw/engines/overlay/overlay_next_mode_transfer.hh index 2cda267a149b..39b2d62597d9 100644 --- a/source/blender/draw/engines/overlay/overlay_next_mode_transfer.hh +++ b/source/blender/draw/engines/overlay/overlay_next_mode_transfer.hh @@ -10,6 +10,8 @@ #include "BKE_paint.hh" +#include "draw_sculpt.hh" + #include "overlay_next_base.hh" namespace blender::draw::overlay { diff --git a/source/blender/draw/engines/overlay/overlay_next_prepass.hh b/source/blender/draw/engines/overlay/overlay_next_prepass.hh index 21f167bffa41..583920828f74 100644 --- a/source/blender/draw/engines/overlay/overlay_next_prepass.hh +++ b/source/blender/draw/engines/overlay/overlay_next_prepass.hh @@ -169,10 +169,19 @@ class Prepass : Overlay { void sculpt_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res) { ResourceHandle handle = manager.resource_handle_for_sculpt(ob_ref); - select::ID select_id = res.select_id(ob_ref); for (SculptBatch &batch : sculpt_batches_get(ob_ref.object, SCULPT_BATCH_DEFAULT)) { - mesh_ps_->draw(batch.batch, handle, select_id.get()); + select::ID select_id = use_material_slot_selection_ ? + res.select_id(ob_ref, (batch.material_slot + 1) << 16) : + res.select_id(ob_ref); + + if (res.is_selection()) { + /* Conservative shader needs expanded draw-call. */ + mesh_ps_->draw_expand(batch.batch, GPU_PRIM_TRIS, 1, 1, handle, select_id.get()); + } + else { + mesh_ps_->draw(batch.batch, handle, select_id.get()); + } } } diff --git a/source/blender/draw/engines/overlay/overlay_next_private.hh b/source/blender/draw/engines/overlay/overlay_next_private.hh index 1136d87c753b..081bc05769e4 100644 --- a/source/blender/draw/engines/overlay/overlay_next_private.hh +++ b/source/blender/draw/engines/overlay/overlay_next_private.hh @@ -439,6 +439,7 @@ class ShaderModule { ShaderPtr armature_shape_outline = shader_selectable("overlay_armature_shape_outline"); ShaderPtr armature_shape_fill = shader_selectable("overlay_armature_shape_solid"); ShaderPtr armature_shape_wire = shader_selectable("overlay_armature_shape_wire"); + ShaderPtr armature_shape_wire_strip = shader_selectable("overlay_armature_shape_wire_strip"); ShaderPtr armature_sphere_outline = shader_selectable("overlay_armature_sphere_outline"); ShaderPtr armature_sphere_fill = shader_selectable("overlay_armature_sphere_solid"); ShaderPtr armature_stick = shader_selectable("overlay_armature_stick"); diff --git a/source/blender/draw/engines/overlay/overlay_next_sculpt.hh b/source/blender/draw/engines/overlay/overlay_next_sculpt.hh index 770be8f2ef03..f552a90b7737 100644 --- a/source/blender/draw/engines/overlay/overlay_next_sculpt.hh +++ b/source/blender/draw/engines/overlay/overlay_next_sculpt.hh @@ -19,6 +19,7 @@ #include "bmesh.hh" #include "draw_cache_impl.hh" +#include "draw_sculpt.hh" #include "overlay_next_base.hh" diff --git a/source/blender/draw/engines/overlay/overlay_next_wireframe.hh b/source/blender/draw/engines/overlay/overlay_next_wireframe.hh index 874e75d54f66..255cc860a489 100644 --- a/source/blender/draw/engines/overlay/overlay_next_wireframe.hh +++ b/source/blender/draw/engines/overlay/overlay_next_wireframe.hh @@ -12,6 +12,7 @@ #include "DNA_volume_types.h" #include "draw_common.hh" +#include "draw_sculpt.hh" #include "overlay_next_base.hh" #include "overlay_next_mesh.hh" diff --git a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh index 64937ac53d48..f747f8f14e59 100644 --- a/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh +++ b/source/blender/draw/engines/overlay/shaders/infos/overlay_armature_info.hh @@ -146,6 +146,14 @@ GPU_SHADER_CREATE_END() OVERLAY_INFO_VARIATIONS(overlay_armature_shape_wire) +GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_strip) +DO_STATIC_COMPILATION() +ADDITIONAL_INFO(overlay_armature_shape_wire) +DEFINE("FROM_LINE_STRIP") +GPU_SHADER_CREATE_END() + +OVERLAY_INFO_VARIATIONS(overlay_armature_shape_wire_strip) + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_wire_vert.glsl index d2ce69acdeb8..d299dc33b10d 100644 --- a/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/overlay_armature_shape_wire_vert.glsl @@ -157,8 +157,12 @@ void main() { select_id_set(in_select_buf[gl_InstanceID]); - /* Line primitive. */ +/* Line primitive. */ +#ifdef FROM_LINE_STRIP + const uint input_primitive_vertex_count = 1u; +#else const uint input_primitive_vertex_count = 2u; +#endif /* Triangle list primitive. */ const uint ouput_primitive_vertex_count = 3u; const uint ouput_primitive_count = 2u; @@ -180,11 +184,22 @@ void main() mat4 inst_obmat = data_buf[gl_InstanceID]; mat4x4 inst_matrix = inst_obmat; - VertIn vert_in[input_primitive_vertex_count]; +#ifdef FROM_LINE_STRIP + uint32_t RESTART_INDEX = gpu_index_16bit ? 0xFFFF : 0xFFFFFFFF; + if (gpu_index_load(in_primitive_first_vertex + 0u) == RESTART_INDEX || + gpu_index_load(in_primitive_first_vertex + 1u) == RESTART_INDEX) + { + /* Discard. */ + gl_Position = vec4(NAN_FLT); + return; + } +#endif + + VertIn vert_in[2]; vert_in[0] = input_assembly(in_primitive_first_vertex + 0u, inst_matrix); vert_in[1] = input_assembly(in_primitive_first_vertex + 1u, inst_matrix); - VertOut vert_out[input_primitive_vertex_count]; + VertOut vert_out[2]; vert_out[0] = vertex_main(vert_in[0]); vert_out[1] = vertex_main(vert_in[1]); diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl index 6046e9ac598c..6364b1658aec 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl @@ -5,7 +5,7 @@ /** * Extrude shadow casters along their silhouette edge. * Manifold meshes only generate one quad per silhouette edge. - * Non-Manifold meshes generate one quad on their non manifold edges (border edges) and and two + * Non-Manifold meshes generate one quad on their non manifold edges (border edges) and two * quad on their silhouette edge (non-border edges) which we consider "manifold". * * This shader uses line adjacency primitive to know the geometric normals of neighbor faces. diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc index d0ac4ab0bf82..9d37a76219d3 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.cc +++ b/source/blender/draw/engines/workbench/workbench_engine.cc @@ -2,6 +2,10 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_rect.h" + +#include "DNA_fluid_types.h" + #include "BKE_editmesh.hh" #include "BKE_modifier.hh" #include "BKE_object.hh" @@ -9,11 +13,14 @@ #include "BKE_paint_bvh.hh" #include "BKE_particle.h" #include "BKE_report.hh" + #include "DEG_depsgraph_query.hh" -#include "DNA_fluid_types.h" + #include "ED_paint.hh" #include "ED_view3d.hh" + #include "GPU_capabilities.hh" + #include "IMB_imbuf_types.hh" #include "draw_common.hh" diff --git a/source/blender/draw/engines/workbench/workbench_engine.h b/source/blender/draw/engines/workbench/workbench_engine.h index 1955ffc6fc42..db1c143d9016 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.h +++ b/source/blender/draw/engines/workbench/workbench_engine.h @@ -12,6 +12,8 @@ extern "C" { #endif +struct RenderEngineType; + extern RenderEngineType DRW_engine_viewport_workbench_type; #ifdef __cplusplus diff --git a/source/blender/draw/intern/draw_debug.hh b/source/blender/draw/intern/draw_debug.hh index 00813fc99021..a935c0dc5beb 100644 --- a/source/blender/draw/intern/draw_debug.hh +++ b/source/blender/draw/intern/draw_debug.hh @@ -16,7 +16,6 @@ #pragma once #include "BLI_math_vector_types.hh" -#include "BLI_string_ref.hh" #include "BLI_vector.hh" #include "DNA_object_types.h" #include "DRW_gpu_wrapper.hh" diff --git a/source/blender/draw/intern/draw_instance_data.hh b/source/blender/draw/intern/draw_instance_data.hh index 584ef3f4dc0e..1179dd3755cc 100644 --- a/source/blender/draw/intern/draw_instance_data.hh +++ b/source/blender/draw/intern/draw_instance_data.hh @@ -8,11 +8,8 @@ #pragma once -#include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" -#include "GPU_batch.hh" - #define MAX_INSTANCE_DATA_SIZE 64 /* Can be adjusted for more */ #define DRW_BUFFER_VERTS_CHUNK 128 diff --git a/source/blender/draw/intern/draw_manager.hh b/source/blender/draw/intern/draw_manager.hh index 59f666d5a3a1..55e980bfae00 100644 --- a/source/blender/draw/intern/draw_manager.hh +++ b/source/blender/draw/intern/draw_manager.hh @@ -20,11 +20,9 @@ #include "GPU_material.hh" #include "draw_resource.hh" -#include "draw_sculpt.hh" #include "draw_view.hh" #include -#include namespace blender::draw { diff --git a/source/blender/draw/intern/draw_manager_c.hh b/source/blender/draw/intern/draw_manager_c.hh index 122e60993d89..2f154c8e6f54 100644 --- a/source/blender/draw/intern/draw_manager_c.hh +++ b/source/blender/draw/intern/draw_manager_c.hh @@ -13,9 +13,6 @@ #include "DRW_engine.hh" #include "DRW_render.hh" -#include "BLI_assert.h" -#include "BLI_linklist.h" -#include "BLI_memblock.h" #include "BLI_task.h" #include "BLI_threads.h" diff --git a/source/blender/draw/intern/draw_manager_text.cc b/source/blender/draw/intern/draw_manager_text.cc index e211fb9e7832..286615dcbfa9 100644 --- a/source/blender/draw/intern/draw_manager_text.cc +++ b/source/blender/draw/intern/draw_manager_text.cc @@ -259,7 +259,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, View3D *v3d) void DRW_text_edit_mesh_measure_stats(const ARegion *region, const View3D *v3d, const Object *ob, - const UnitSettings *unit, + const UnitSettings &unit, DRWTextStore *dt) { /* Do not use ascii when using non-default unit system, some unit chars are utf8 (micro, square, @@ -277,7 +277,7 @@ void DRW_text_edit_mesh_measure_stats(const ARegion *region, char numstr[32]; /* Stores the measurement display text here */ const char *conv_float; /* Use a float conversion matching the grid size */ blender::uchar4 col = {0, 0, 0, 255}; /* color of the text to draw */ - const float grid = unit->system ? unit->scale_length : v3d->grid; + const float grid = unit.system ? unit.scale_length : v3d->grid; const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0; const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0; blender::float4x4 clip_planes; @@ -362,16 +362,11 @@ void DRW_text_edit_mesh_measure_stats(const ARegion *region, v2 = ob->object_to_world().view<3, 3>() * v2; } - const size_t numstr_len = unit->system ? - BKE_unit_value_as_string(numstr, - sizeof(numstr), - len_v3v3(v1, v2) * - unit->scale_length, - 3, - B_UNIT_LENGTH, - unit, - false) : - SNPRINTF_RLEN(numstr, conv_float, len_v3v3(v1, v2)); + const size_t numstr_len = + unit.system ? + BKE_unit_value_as_string_scaled( + numstr, sizeof(numstr), len_v3v3(v1, v2), 3, B_UNIT_LENGTH, unit, false) : + SNPRINTF_RLEN(numstr, conv_float, len_v3v3(v1, v2)); DRW_text_cache_add(dt, co, numstr, numstr_len, 0, edge_tex_sep, txt_flag, col); } @@ -380,7 +375,7 @@ void DRW_text_edit_mesh_measure_stats(const ARegion *region, } if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_ANG) { - const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS); + const bool is_rad = (unit.system_rotation == USER_UNIT_ROT_RADIANS); BMEdge *eed; UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGEANG, col); @@ -502,16 +497,10 @@ void DRW_text_edit_mesh_measure_stats(const ARegion *region, vmid *= 1.0f / float(n); vmid = blender::math::transform_point(ob->object_to_world(), vmid); - const size_t numstr_len = unit->system ? - BKE_unit_value_as_string( - numstr, - sizeof(numstr), - double(area * unit->scale_length * unit->scale_length), - 3, - B_UNIT_AREA, - unit, - false) : - SNPRINTF_RLEN(numstr, conv_float, area); + const size_t numstr_len = + unit.system ? BKE_unit_value_as_string_scaled( + numstr, sizeof(numstr), area, 3, B_UNIT_AREA, unit, false) : + SNPRINTF_RLEN(numstr, conv_float, area); DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, 0, txt_flag, col); } @@ -521,7 +510,7 @@ void DRW_text_edit_mesh_measure_stats(const ARegion *region, if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_ANG) { BMFace *efa; - const bool is_rad = (unit->system_rotation == USER_UNIT_ROT_RADIANS); + const bool is_rad = (unit.system_rotation == USER_UNIT_ROT_RADIANS); UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); diff --git a/source/blender/draw/intern/draw_manager_text.hh b/source/blender/draw/intern/draw_manager_text.hh index d58faf573352..73838b82cbe3 100644 --- a/source/blender/draw/intern/draw_manager_text.hh +++ b/source/blender/draw/intern/draw_manager_text.hh @@ -38,7 +38,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, View3D *v3d); void DRW_text_edit_mesh_measure_stats(const ARegion *region, const View3D *v3d, const Object *ob, - const UnitSettings *unit, + const UnitSettings &unit, DRWTextStore *dt = DRW_text_cache_ensure()); enum { diff --git a/source/blender/draw/intern/draw_view.hh b/source/blender/draw/intern/draw_view.hh index 1a5097289dc2..c6a869707b9c 100644 --- a/source/blender/draw/intern/draw_view.hh +++ b/source/blender/draw/intern/draw_view.hh @@ -19,7 +19,6 @@ #include "DNA_view3d_types.h" #include "DRW_gpu_wrapper.hh" -#include "DRW_render.hh" #include "GPU_matrix.hh" #include "draw_shader_shared.hh" diff --git a/source/blender/draw/intern/draw_view_data.hh b/source/blender/draw/intern/draw_view_data.hh index 2ebdd8b85228..0d1d39ccbfc9 100644 --- a/source/blender/draw/intern/draw_view_data.hh +++ b/source/blender/draw/intern/draw_view_data.hh @@ -18,10 +18,13 @@ class TextureFromPool; } // namespace blender::draw struct DRWPass; -struct DRWTextStore; struct DRWRegisteredDrawEngine; +struct DRWTextStore; struct DrawEngineType; +struct GPUFrameBuffer; +struct GPUTexture; struct GPUViewport; +struct ListBase; /* NOTE: these structs are only here for reading the actual lists from the engine. * The actual length of them is stored in a ViewportEngineData_Info. @@ -103,7 +106,7 @@ DRWViewData *DRW_view_data_create(ListBase *engine_types); void DRW_view_data_free(DRWViewData *view_data); /* Returns a TextureFromPool stored in the given view data for the pass identified by the given - * pass name. Engines should call call this function for each of the passes needed by the viewport + * pass name. Engines should call this function for each of the passes needed by the viewport * compositor in every redraw, then it should allocate the texture and write the pass data to it. * The texture should cover the entire viewport. */ blender::draw::TextureFromPool &DRW_view_data_pass_texture_get(DRWViewData *view_data, diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc index bb93e2034bc7..98933db57ad0 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc @@ -9,6 +9,7 @@ #include "MEM_guardedalloc.h" #include "BLI_jitter_2d.h" +#include "BLI_map.hh" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_ordered_edge.hh" diff --git a/source/blender/editors/animation/anim_deps.cc b/source/blender/editors/animation/anim_deps.cc index bf6d07541031..63ca67a90337 100644 --- a/source/blender/editors/animation/anim_deps.cc +++ b/source/blender/editors/animation/anim_deps.cc @@ -182,23 +182,23 @@ static void animchan_sync_fcurve_scene(bAnimListElem *ale) BLI_assert(GS(owner_id->name) == ID_SCE); Scene *scene = (Scene *)owner_id; FCurve *fcu = (FCurve *)ale->data; - Strip *seq = nullptr; + Strip *strip = nullptr; /* Only affect if F-Curve involves sequence_editor.sequences. */ - char seq_name[sizeof(seq->name)]; - if (!BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", seq_name, sizeof(seq_name))) { + char strip_name[sizeof(strip->name)]; + if (!BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", strip_name, sizeof(strip_name))) { return; } /* Check if this strip is selected. */ Editing *ed = SEQ_editing_get(scene); - seq = SEQ_get_sequence_by_name(ed->seqbasep, seq_name, false); - if (seq == nullptr) { + strip = SEQ_get_sequence_by_name(ed->seqbasep, strip_name, false); + if (strip == nullptr) { return; } /* update selection status */ - if (seq->flag & SELECT) { + if (strip->flag & SELECT) { fcu->flag |= FCURVE_SELECTED; } else { diff --git a/source/blender/editors/animation/anim_filter.cc b/source/blender/editors/animation/anim_filter.cc index 3e6cc2358f9e..9413d3856b01 100644 --- a/source/blender/editors/animation/anim_filter.cc +++ b/source/blender/editors/animation/anim_filter.cc @@ -183,9 +183,9 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction) { /* TODO: other methods to get the mask. */ #if 0 - Strip *seq = SEQ_select_active_get(ac->scene); + Strip *strip = SEQ_select_active_get(ac->scene); MovieClip *clip = ac->scene->clip; - struct Mask *mask = seq ? seq->mask : nullptr; + struct Mask *mask = strip ? strip->mask : nullptr; #endif /* update scene-pointer (no need to check for pinning yet, as not implemented) */ @@ -1010,23 +1010,23 @@ static bool skip_fcurve_selected_data(bAnimContext *ac, } else if (GS(owner_id->name) == ID_SCE) { Scene *scene = (Scene *)owner_id; - Strip *seq = nullptr; - char seq_name[sizeof(seq->name)]; + Strip *strip = nullptr; + char strip_name[sizeof(strip->name)]; /* Only consider if F-Curve involves `sequence_editor.sequences`. */ if (fcu->rna_path && - BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", seq_name, sizeof(seq_name))) + BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", strip_name, sizeof(strip_name))) { /* Get strip name, and check if this strip is selected. */ Editing *ed = SEQ_editing_get(scene); if (ed) { - seq = SEQ_get_sequence_by_name(ed->seqbasep, seq_name, false); + strip = SEQ_get_sequence_by_name(ed->seqbasep, strip_name, false); } /* Can only add this F-Curve if it is selected. */ if (ac->ads->filterflag & ADS_FILTER_ONLYSEL) { - /* NOTE(@ideasman42): The `seq == nullptr` check doesn't look right + /* NOTE(@ideasman42): The `strip == nullptr` check doesn't look right * (compared to other checks in this function which skip data that can't be found). * * This is done since the search for sequence strips doesn't use a global lookup: @@ -1041,11 +1041,11 @@ static bool skip_fcurve_selected_data(bAnimContext *ac, * If this is an important difference, the nullptr case could perform a global lookup, * only returning `true` if the sequence strip exists elsewhere * (ignoring its selection state). */ - if (seq == nullptr) { + if (strip == nullptr) { return true; } - if ((seq->flag & SELECT) == 0) { + if ((strip->flag & SELECT) == 0) { return true; } } diff --git a/source/blender/editors/animation/anim_intern.hh b/source/blender/editors/animation/anim_intern.hh index 99f559b322da..d16ea53de8f1 100644 --- a/source/blender/editors/animation/anim_intern.hh +++ b/source/blender/editors/animation/anim_intern.hh @@ -9,6 +9,7 @@ #pragma once struct ListBase; +struct wmOperatorType; /* size of string buffers used for animation channel displayed names */ #define ANIM_CHAN_NAME_SIZE 256 diff --git a/source/blender/editors/animation/anim_markers.cc b/source/blender/editors/animation/anim_markers.cc index ff430ef68553..81e98bcc063f 100644 --- a/source/blender/editors/animation/anim_markers.cc +++ b/source/blender/editors/animation/anim_markers.cc @@ -857,7 +857,7 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op) } if (hasNumInput(&mm->num)) { - outputNumInput(&mm->num, str_ofs, &scene->unit); + outputNumInput(&mm->num, str_ofs, scene->unit); } else if (use_time) { SNPRINTF(str_ofs, "%.2f", FRA2TIME(ofs)); diff --git a/source/blender/editors/animation/anim_ops.cc b/source/blender/editors/animation/anim_ops.cc index 9070bd5a4ccc..41286e3de48c 100644 --- a/source/blender/editors/animation/anim_ops.cc +++ b/source/blender/editors/animation/anim_ops.cc @@ -118,11 +118,13 @@ static int seq_frame_apply_snap(bContext *C, Scene *scene, const int timeline_fr int best_frame = 0; int best_distance = MAXFRAME; - for (Strip *seq : SEQ_query_all_strips(seqbase)) { + for (Strip *strip : SEQ_query_all_strips(seqbase)) { seq_frame_snap_update_best( - SEQ_time_left_handle_frame_get(scene, seq), timeline_frame, &best_frame, &best_distance); - seq_frame_snap_update_best( - SEQ_time_right_handle_frame_get(scene, seq), timeline_frame, &best_frame, &best_distance); + SEQ_time_left_handle_frame_get(scene, strip), timeline_frame, &best_frame, &best_distance); + seq_frame_snap_update_best(SEQ_time_right_handle_frame_get(scene, strip), + timeline_frame, + &best_frame, + &best_distance); } if (best_distance < seq_snap_threshold_get_frame_distance(C)) { diff --git a/source/blender/editors/armature/armature_intern.hh b/source/blender/editors/armature/armature_intern.hh index 77ab14b96624..e052f9173670 100644 --- a/source/blender/editors/armature/armature_intern.hh +++ b/source/blender/editors/armature/armature_intern.hh @@ -8,17 +8,22 @@ #pragma once -struct bArmature; +#include "DNA_listBase.h" + +#include "BLI_span.hh" + struct Base; -struct bContext; struct Bone; -struct bPoseChannel; struct EditBone; struct GPUSelectResult; +struct IDProperty; struct LinkData; struct ListBase; struct Object; struct Scene; +struct bArmature; +struct bContext; +struct bPoseChannel; struct wmOperatorType; /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/armature/pose_slide.cc b/source/blender/editors/armature/pose_slide.cc index e245578736b5..cc08b23f7670 100644 --- a/source/blender/editors/armature/pose_slide.cc +++ b/source/blender/editors/armature/pose_slide.cc @@ -967,7 +967,7 @@ static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso) Scene *scene = pso->scene; char str_offs[NUM_STR_REP_LEN]; - outputNumInput(&pso->num, str_offs, &scene->unit); + outputNumInput(&pso->num, str_offs, scene->unit); SNPRINTF(status_str, "%s: %s | %s", mode_str, str_offs, limits_str); } diff --git a/source/blender/editors/asset/ED_asset_filter.hh b/source/blender/editors/asset/ED_asset_filter.hh index 9f1770ea17ff..d064f15946af 100644 --- a/source/blender/editors/asset/ED_asset_filter.hh +++ b/source/blender/editors/asset/ED_asset_filter.hh @@ -10,6 +10,8 @@ #pragma once +#include "DNA_listBase.h" + #include "BLI_function_ref.hh" #include "BLI_multi_value_map.hh" #include "BLI_vector.hh" @@ -18,6 +20,7 @@ #include "AS_asset_catalog_tree.hh" struct AssetLibraryReference; +struct AssetMetaData; struct bContext; namespace blender::asset_system { class AssetLibrary; diff --git a/source/blender/editors/asset/ED_asset_handle.hh b/source/blender/editors/asset/ED_asset_handle.hh index d7927db2063e..2ba12bd4c288 100644 --- a/source/blender/editors/asset/ED_asset_handle.hh +++ b/source/blender/editors/asset/ED_asset_handle.hh @@ -14,11 +14,8 @@ #pragma once -#include "DNA_ID_enums.h" #include "DNA_asset_types.h" -#include "RNA_types.hh" - struct AssetHandle; namespace blender::asset_system { class AssetRepresentation; diff --git a/source/blender/editors/asset/ED_asset_import.hh b/source/blender/editors/asset/ED_asset_import.hh index f496589f0101..8c4d634aea7c 100644 --- a/source/blender/editors/asset/ED_asset_import.hh +++ b/source/blender/editors/asset/ED_asset_import.hh @@ -8,8 +8,6 @@ #pragma once -#include "DNA_ID_enums.h" - struct ID; struct Main; namespace blender::asset_system { diff --git a/source/blender/editors/asset/ED_asset_library.hh b/source/blender/editors/asset/ED_asset_library.hh index c604ae148009..6566c907c25d 100644 --- a/source/blender/editors/asset/ED_asset_library.hh +++ b/source/blender/editors/asset/ED_asset_library.hh @@ -10,6 +10,8 @@ #include "DNA_asset_types.h" +struct EnumPropertyItem; + namespace blender::ed::asset { /** diff --git a/source/blender/editors/asset/ED_asset_list.hh b/source/blender/editors/asset/ED_asset_list.hh index bb723f384107..7252ba9dc631 100644 --- a/source/blender/editors/asset/ED_asset_list.hh +++ b/source/blender/editors/asset/ED_asset_list.hh @@ -8,8 +8,6 @@ #pragma once -#include - #include "BLI_function_ref.hh" struct AssetHandle; diff --git a/source/blender/editors/asset/ED_asset_shelf.hh b/source/blender/editors/asset/ED_asset_shelf.hh index 10063fc0c9e7..4a92e0505c99 100644 --- a/source/blender/editors/asset/ED_asset_shelf.hh +++ b/source/blender/editors/asset/ED_asset_shelf.hh @@ -15,12 +15,14 @@ struct ARegionType; struct AssetShelf; struct AssetShelfSettings; struct AssetShelfType; -struct bContext; -struct bContextDataResult; struct BlendDataReader; struct BlendWriter; struct Main; struct RegionPollParams; +struct ScrArea; +struct bContext; +struct bContextDataResult; +struct wmRegionListenerParams; struct wmRegionMessageSubscribeParams; struct wmWindowManager; diff --git a/source/blender/editors/curve/curve_intern.hh b/source/blender/editors/curve/curve_intern.hh index 77a33a3c0a24..c7d5e40a03ec 100644 --- a/source/blender/editors/curve/curve_intern.hh +++ b/source/blender/editors/curve/curve_intern.hh @@ -8,12 +8,21 @@ #pragma once +#include "BLI_sys_types.h" + /* internal exports only */ +struct BPoint; +struct Base; +struct BezTriple; +struct Curve; struct EditNurb; struct GHash; struct ListBase; +struct Nurb; struct Object; +struct View3D; struct ViewContext; +struct wmKeyConfig; struct wmKeyMap; struct wmOperatorType; diff --git a/source/blender/editors/curve/editfont.cc b/source/blender/editors/curve/editfont.cc index 041d6e4c94ae..1ab2053b8a08 100644 --- a/source/blender/editors/curve/editfont.cc +++ b/source/blender/editors/curve/editfont.cc @@ -1293,6 +1293,34 @@ static const EnumPropertyItem move_type_items[] = { {0, nullptr, 0, nullptr, nullptr}, }; +/** + * Implement standard behavior from GUI text editing fields (including Blender's UI) + * where horizontal motion drops the selection and places the cursor at the selection bounds + * (based on the motion direction) instead of moving the cursor. + */ +static bool move_cursor_drop_select(Object *obedit, int dir) +{ + int selstart, selend; + if (!BKE_vfont_select_get(obedit, &selstart, &selend)) { + return false; + } + + Curve *cu = static_cast(obedit->data); + EditFont *ef = cu->editfont; + if (dir == -1) { + ef->pos = selstart; + } + else if (dir == 1) { + ef->pos = selend + 1; + } + else { + BLI_assert_unreachable(); + } + + /* The caller must clear the selection. */ + return true; +} + static int move_cursor(bContext *C, int type, const bool select) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -1346,33 +1374,53 @@ static int move_cursor(bContext *C, int type, const bool select) break; case PREV_WORD: { - int pos = ef->pos; - BLI_str_cursor_step_utf32( - ef->textbuf, ef->len, &pos, STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, true); - ef->pos = pos; - cursmove = FO_CURS; + if ((select == false) && move_cursor_drop_select(obedit, -1)) { + cursmove = FO_CURS; + } + else { + int pos = ef->pos; + BLI_str_cursor_step_utf32( + ef->textbuf, ef->len, &pos, STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, true); + ef->pos = pos; + cursmove = FO_CURS; + } break; } case NEXT_WORD: { - int pos = ef->pos; - BLI_str_cursor_step_utf32( - ef->textbuf, ef->len, &pos, STRCUR_DIR_NEXT, STRCUR_JUMP_DELIM, true); - ef->pos = pos; - cursmove = FO_CURS; + if ((select == false) && move_cursor_drop_select(obedit, 1)) { + cursmove = FO_CURS; + } + else { + int pos = ef->pos; + BLI_str_cursor_step_utf32( + ef->textbuf, ef->len, &pos, STRCUR_DIR_NEXT, STRCUR_JUMP_DELIM, true); + ef->pos = pos; + cursmove = FO_CURS; + } break; } - case PREV_CHAR: - BLI_str_cursor_step_prev_utf32(ef->textbuf, ef->len, &ef->pos); - cursmove = FO_CURS; + case PREV_CHAR: { + if ((select == false) && move_cursor_drop_select(obedit, -1)) { + cursmove = FO_CURS; + } + else { + BLI_str_cursor_step_prev_utf32(ef->textbuf, ef->len, &ef->pos); + cursmove = FO_CURS; + } break; - - case NEXT_CHAR: - BLI_str_cursor_step_next_utf32(ef->textbuf, ef->len, &ef->pos); - cursmove = FO_CURS; + } + case NEXT_CHAR: { + if ((select == false) && move_cursor_drop_select(obedit, 1)) { + cursmove = FO_CURS; + } + else { + BLI_str_cursor_step_next_utf32(ef->textbuf, ef->len, &ef->pos); + cursmove = FO_CURS; + } break; - + } case PREV_LINE: cursmove = FO_CURSUP; break; diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc index aa2f6499c3e6..043fa54f1b5a 100644 --- a/source/blender/editors/curves/intern/curves_add.cc +++ b/source/blender/editors/curves/intern/curves_add.cc @@ -87,7 +87,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob) bNode *group_output = bke::node_add_static_node(&C, ntree, NODE_GROUP_OUTPUT); bNode *deform_node = bke::node_add_static_node(&C, ntree, GEO_NODE_DEFORM_CURVES_ON_SURFACE); - ED_node_tree_propagate_change(&C, bmain, nmd.node_group); + ED_node_tree_propagate_change(bmain, nmd.node_group); bke::node_add_link(ntree, group_input, @@ -104,7 +104,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob) group_output->location[0] = 200; deform_node->location[0] = 0; - ED_node_tree_propagate_change(&C, bmain, nmd.node_group); + ED_node_tree_propagate_change(bmain, nmd.node_group); } bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int points_per_curve) diff --git a/source/blender/editors/geometry/node_group_operator.cc b/source/blender/editors/geometry/node_group_operator.cc index 7c269eaa8629..d462030cc7fe 100644 --- a/source/blender/editors/geometry/node_group_operator.cc +++ b/source/blender/editors/geometry/node_group_operator.cc @@ -35,6 +35,7 @@ #include "BKE_mesh_wrapper.hh" #include "BKE_node_runtime.hh" #include "BKE_object.hh" +#include "BKE_paint.hh" #include "BKE_pointcloud.hh" #include "BKE_report.hh" #include "BKE_scene.hh" @@ -73,7 +74,6 @@ #include "AS_asset_catalog_tree.hh" #include "AS_asset_library.hh" #include "AS_asset_representation.hh" -#include "BKE_paint.hh" #include "geometry_intern.hh" @@ -408,7 +408,9 @@ static void replace_inputs_evaluated_data_blocks( { IDP_foreach_property(&properties, IDP_TYPE_FILTER_ID, [&](IDProperty *property) { if (ID *id = IDP_Id(property)) { - property->data.pointer = const_cast(depsgraphs.get_evaluated_id(*id)); + if (ID_TYPE_USE_COPY_ON_EVAL(GS(id->name))) { + property->data.pointer = const_cast(depsgraphs.get_evaluated_id(*id)); + } } }); } diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.hh b/source/blender/editors/gizmo_library/gizmo_library_intern.hh index 617f62714b5d..b887f8186c56 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.hh +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.hh @@ -10,7 +10,9 @@ #include "gizmo_geometry.h" +struct IDProperty; struct bContext; +struct wmGizmo; struct wmGizmoProperty; #define DIAL_RESOLUTION 48 diff --git a/source/blender/editors/gpencil_legacy/gpencil_intern.hh b/source/blender/editors/gpencil_legacy/gpencil_intern.hh index 35001826ca43..7d9446a50697 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_intern.hh +++ b/source/blender/editors/gpencil_legacy/gpencil_intern.hh @@ -10,8 +10,6 @@ #include "DNA_vec_types.h" -#include "ED_numinput.hh" - #define DEPTH_INVALID 1.0f /* internal exports only */ @@ -34,6 +32,10 @@ struct wmOperatorType; struct wmWindow; struct Depsgraph; +struct Object; +struct ScrArea; +struct ListBase; +struct bGPDlayer; struct EnumPropertyItem; struct PointerRNA; diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc index 95f038ac351a..a58c542572c8 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_edit.cc @@ -389,7 +389,7 @@ static void GREASE_PENCIL_OT_stroke_simplify(wmOperatorType *ot) ot->description = "Simplify selected strokes"; ot->exec = grease_pencil_stroke_simplify_exec; - ot->poll = editable_grease_pencil_point_selection_poll; + ot->poll = editable_grease_pencil_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2894,20 +2894,16 @@ static bke::CurvesGeometry extrude_grease_pencil_curves(const bke::CurvesGeometr selection.span.copy_from(dst_selected.as_span()); selection.finish(); - /* Cyclic attribute : newly created curves cannot be cyclic. - * NOTE: if the cyclic attribute is single and false, it can be kept this way. - */ - if (src_cyclic.get_if_single().value_or(true)) { - dst.cyclic_for_write().drop_front(old_curves_num).fill(false); - } - bke::gather_attributes(src_attributes, bke::AttrDomain::Curve, bke::AttrDomain::Curve, - bke::attribute_filter_from_skip_ref({"cyclic"}), + {}, dst_to_src_curves, dst_attributes); + /* Cyclic attribute : newly created curves cannot be cyclic. */ + dst.cyclic_for_write().drop_front(old_curves_num).fill(false); + bke::gather_attributes(src_attributes, bke::AttrDomain::Point, bke::AttrDomain::Point, diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_join_selection.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_join_selection.cc index 05246b4b8511..307b7caecd6d 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_join_selection.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_join_selection.cc @@ -373,7 +373,7 @@ void remove_selected_points_in_active_layer(Span ranges_selected, mask_content.extend(range_content); } - /* remove_points requires the the indices in the mask to be sorted */ + /* remove_points requires the indices in the mask to be sorted */ std::sort(mask_content.begin(), mask_content.end()); IndexMask mask = IndexMask::from_indices(mask_content.as_span(), memory); diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_layers.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_layers.cc index 4b740e35cf61..57310c7a2571 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_layers.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_layers.cc @@ -216,89 +216,6 @@ static void GREASE_PENCIL_OT_layer_remove(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static const EnumPropertyItem prop_layer_reorder_location[] = { - {LAYER_REORDER_ABOVE, "ABOVE", 0, "Above", ""}, - {LAYER_REORDER_BELOW, "BELOW", 0, "Below", ""}, - {0, nullptr, 0, nullptr, nullptr}, -}; - -static int grease_pencil_layer_reorder_exec(bContext *C, wmOperator *op) -{ - using namespace blender::bke::greasepencil; - Object *object = CTX_data_active_object(C); - GreasePencil &grease_pencil = *static_cast(object->data); - - if (!grease_pencil.has_active_layer()) { - return OPERATOR_CANCELLED; - } - - int target_layer_name_length; - char *target_layer_name = RNA_string_get_alloc( - op->ptr, "target_layer_name", nullptr, 0, &target_layer_name_length); - const int reorder_location = RNA_enum_get(op->ptr, "location"); - - TreeNode *target_node = grease_pencil.find_node_by_name(target_layer_name); - if (!target_node || !target_node->is_layer()) { - MEM_SAFE_FREE(target_layer_name); - return OPERATOR_CANCELLED; - } - - Layer &active_layer = *grease_pencil.get_active_layer(); - switch (reorder_location) { - case LAYER_REORDER_ABOVE: { - /* NOTE: The layers are stored from bottom to top, so inserting above (visually), means - * inserting the link after the target. */ - grease_pencil.move_node_after(active_layer.as_node(), *target_node); - break; - } - case LAYER_REORDER_BELOW: { - /* NOTE: The layers are stored from bottom to top, so inserting below (visually), means - * inserting the link before the target. */ - grease_pencil.move_node_before(active_layer.as_node(), *target_node); - break; - } - default: - BLI_assert_unreachable(); - } - - MEM_SAFE_FREE(target_layer_name); - - DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil); - - WM_msg_publish_rna_prop( - CTX_wm_message_bus(C), &grease_pencil.id, &grease_pencil, GreasePencilv3, layers); - WM_msg_publish_rna_prop( - CTX_wm_message_bus(C), &grease_pencil.id, &grease_pencil, GreasePencilv3, layer_groups); - - return OPERATOR_FINISHED; -} - -static void GREASE_PENCIL_OT_layer_reorder(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Reorder Layer"; - ot->idname = "GREASE_PENCIL_OT_layer_reorder"; - ot->description = "Reorder the active Grease Pencil layer"; - - /* callbacks */ - ot->exec = grease_pencil_layer_reorder_exec; - ot->poll = grease_pencil_context_poll; - - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - PropertyRNA *prop = RNA_def_string(ot->srna, - "target_layer_name", - "Layer", - INT16_MAX, - "Target Name", - "Name of the target layer"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - - RNA_def_enum( - ot->srna, "location", prop_layer_reorder_location, LAYER_REORDER_ABOVE, "Location", ""); -} - enum class LayerMoveDirection : int8_t { Up = -1, Down = 1 }; static const EnumPropertyItem enum_layer_move_direction[] = { @@ -1237,7 +1154,6 @@ void ED_operatortypes_grease_pencil_layers() using namespace blender::ed::greasepencil; WM_operatortype_append(GREASE_PENCIL_OT_layer_add); WM_operatortype_append(GREASE_PENCIL_OT_layer_remove); - WM_operatortype_append(GREASE_PENCIL_OT_layer_reorder); WM_operatortype_append(GREASE_PENCIL_OT_layer_move); WM_operatortype_append(GREASE_PENCIL_OT_layer_active); WM_operatortype_append(GREASE_PENCIL_OT_layer_hide); diff --git a/source/blender/editors/include/ED_armature.hh b/source/blender/editors/include/ED_armature.hh index dae012b9f716..6c1ac05bd435 100644 --- a/source/blender/editors/include/ED_armature.hh +++ b/source/blender/editors/include/ED_armature.hh @@ -9,7 +9,6 @@ #pragma once #include "BLI_compiler_attrs.h" -#include "BLI_listbase.h" #include "BLI_span.hh" struct Base; diff --git a/source/blender/editors/include/ED_asset.hh b/source/blender/editors/include/ED_asset.hh index b68b28c1a45e..c90ddd6a5e83 100644 --- a/source/blender/editors/include/ED_asset.hh +++ b/source/blender/editors/include/ED_asset.hh @@ -14,18 +14,18 @@ /* Barely anything here. Just general editor level functions. Actual asset level code is in * dedicated headers. */ -#include "../asset/ED_asset_catalog.hh" -#include "../asset/ED_asset_handle.hh" -#include "../asset/ED_asset_library.hh" -#include "../asset/ED_asset_list.hh" -#include "../asset/ED_asset_mark_clear.hh" -#include "../asset/ED_asset_temp_id_consumer.hh" -#include "../asset/ED_asset_type.hh" - -#include "../asset/ED_asset_catalog.hh" -#include "../asset/ED_asset_filter.hh" -#include "../asset/ED_asset_import.hh" -#include "../asset/ED_asset_list.hh" +#include "../asset/ED_asset_catalog.hh" // IWYU pragma: export +#include "../asset/ED_asset_handle.hh" // IWYU pragma: export +#include "../asset/ED_asset_library.hh" // IWYU pragma: export +#include "../asset/ED_asset_list.hh" // IWYU pragma: export +#include "../asset/ED_asset_mark_clear.hh" // IWYU pragma: export +#include "../asset/ED_asset_temp_id_consumer.hh" // IWYU pragma: export +#include "../asset/ED_asset_type.hh" // IWYU pragma: export + +#include "../asset/ED_asset_catalog.hh" // IWYU pragma: export +#include "../asset/ED_asset_filter.hh" // IWYU pragma: export +#include "../asset/ED_asset_import.hh" // IWYU pragma: export +#include "../asset/ED_asset_list.hh" // IWYU pragma: export namespace blender::ed::asset { diff --git a/source/blender/editors/include/ED_asset_menu_utils.hh b/source/blender/editors/include/ED_asset_menu_utils.hh index bd32906af1b6..6ced59e2b8c6 100644 --- a/source/blender/editors/include/ED_asset_menu_utils.hh +++ b/source/blender/editors/include/ED_asset_menu_utils.hh @@ -15,6 +15,7 @@ #include "RNA_types.hh" struct uiLayout; +struct AssetWeakReference; namespace blender::asset_system { class AssetCatalogTreeItem; diff --git a/source/blender/editors/include/ED_curve.hh b/source/blender/editors/include/ED_curve.hh index 98272ffc5c16..917fee7f0d57 100644 --- a/source/blender/editors/include/ED_curve.hh +++ b/source/blender/editors/include/ED_curve.hh @@ -8,6 +8,8 @@ #pragma once +#include "BLI_span.hh" + struct BPoint; struct Base; struct BezTriple; diff --git a/source/blender/editors/include/ED_curves.hh b/source/blender/editors/include/ED_curves.hh index d09a498c8552..a9121d069eec 100644 --- a/source/blender/editors/include/ED_curves.hh +++ b/source/blender/editors/include/ED_curves.hh @@ -54,7 +54,7 @@ float (*point_normals_array_create(const Curves *curves_id))[3]; Span get_curves_selection_attribute_names(const bke::CurvesGeometry &curves); /** - * Get get writable positions per selection attribute for given curve. + * Get writable positions per selection attribute for given curve. */ Vector> get_curves_positions_for_write(bke::CurvesGeometry &curves); diff --git a/source/blender/editors/include/ED_grease_pencil.hh b/source/blender/editors/include/ED_grease_pencil.hh index 23480499af22..abc0101ef789 100644 --- a/source/blender/editors/include/ED_grease_pencil.hh +++ b/source/blender/editors/include/ED_grease_pencil.hh @@ -11,10 +11,10 @@ #include "BKE_grease_pencil.hh" #include "BKE_attribute_filter.hh" -#include "BLI_generic_span.hh" #include "BLI_index_mask_fwd.hh" #include "BLI_math_matrix_types.hh" #include "BLI_set.hh" +#include "BLI_task.hh" #include "ED_keyframes_edit.hh" #include "ED_select_utils.hh" diff --git a/source/blender/editors/include/ED_id_management.hh b/source/blender/editors/include/ED_id_management.hh index ac3288614431..7a6d34b380ff 100644 --- a/source/blender/editors/include/ED_id_management.hh +++ b/source/blender/editors/include/ED_id_management.hh @@ -8,7 +8,6 @@ #pragma once -#include "BLI_compiler_attrs.h" #include "BLI_string_ref.hh" struct ID; diff --git a/source/blender/editors/include/ED_info.hh b/source/blender/editors/include/ED_info.hh index 6602acca0fcf..e385dfd38c57 100644 --- a/source/blender/editors/include/ED_info.hh +++ b/source/blender/editors/include/ED_info.hh @@ -9,6 +9,9 @@ #pragma once struct Main; +struct Scene; +struct View3D; +struct ViewLayer; struct wmWindowManager; /* `info_stats.cc` */ diff --git a/source/blender/editors/include/ED_keyframing.hh b/source/blender/editors/include/ED_keyframing.hh index 941286baa18c..f4626809c91d 100644 --- a/source/blender/editors/include/ED_keyframing.hh +++ b/source/blender/editors/include/ED_keyframing.hh @@ -8,7 +8,6 @@ #pragma once -#include "BLI_vector.hh" #include "DNA_anim_types.h" #include "RNA_types.hh" diff --git a/source/blender/editors/include/ED_markers.hh b/source/blender/editors/include/ED_markers.hh index f72735d1cdae..65609603ab6b 100644 --- a/source/blender/editors/include/ED_markers.hh +++ b/source/blender/editors/include/ED_markers.hh @@ -8,6 +8,7 @@ #pragma once +struct ListBase; struct Scene; struct ScrArea; struct TimeMarker; diff --git a/source/blender/editors/include/ED_mask.hh b/source/blender/editors/include/ED_mask.hh index bedeb79db726..c1b33df3e26e 100644 --- a/source/blender/editors/include/ED_mask.hh +++ b/source/blender/editors/include/ED_mask.hh @@ -10,10 +10,13 @@ #include "DNA_mask_types.h" +struct ARegion; struct Depsgraph; struct KeyframeEditData; struct MaskLayer; struct MaskLayerShape; +struct Scene; +struct ScrArea; struct bContext; struct wmKeyConfig; diff --git a/source/blender/editors/include/ED_mesh.hh b/source/blender/editors/include/ED_mesh.hh index ccc99c4243e3..4b7479539343 100644 --- a/source/blender/editors/include/ED_mesh.hh +++ b/source/blender/editors/include/ED_mesh.hh @@ -25,6 +25,7 @@ struct BMeshNormalsUpdate_Params; struct Base; struct Depsgraph; struct KeyBlock; +struct Main; struct MDeformVert; struct Mesh; struct Object; diff --git a/source/blender/editors/include/ED_node_c.hh b/source/blender/editors/include/ED_node_c.hh index 121753a95621..a6edd95bc5a9 100644 --- a/source/blender/editors/include/ED_node_c.hh +++ b/source/blender/editors/include/ED_node_c.hh @@ -109,14 +109,13 @@ void ED_node_set_active( * Additionally, this will send notifiers and tag the depsgraph based on the changes. Depsgraph * relation updates have to be triggered by the caller. * - * \param C: Context if available. This can be null. * \param bmain: Main whose data-blocks should be updated based on the changes. * \param ntree: Under some circumstances the caller knows that only one node tree has * changed since the last update. In this case the function may be able to skip scanning #bmain * for other things that have to be changed. It may still scan #bmain if the interface of the * node tree has changed. */ -void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *ntree); +void ED_node_tree_propagate_change(Main *bmain, bNodeTree *ntree); /** * \param scene_owner: is the owner of the job, diff --git a/source/blender/editors/include/ED_node_preview.hh b/source/blender/editors/include/ED_node_preview.hh index 65146fd6d66d..1584b9a43d6c 100644 --- a/source/blender/editors/include/ED_node_preview.hh +++ b/source/blender/editors/include/ED_node_preview.hh @@ -4,15 +4,20 @@ #pragma once +#include "BLI_map.hh" + #include "RE_pipeline.h" #include "IMB_imbuf.hh" #include "DNA_material_types.h" +struct ImBuf; +struct SpaceNode; struct bContext; +struct bNode; struct bNodeTree; -struct ImBuf; +struct wmWindowManager; struct Render; namespace blender::ed::space_node { diff --git a/source/blender/editors/include/ED_numinput.hh b/source/blender/editors/include/ED_numinput.hh index 5b281abbe3d1..f66267f7aa38 100644 --- a/source/blender/editors/include/ED_numinput.hh +++ b/source/blender/editors/include/ED_numinput.hh @@ -11,6 +11,7 @@ #define NUM_STR_REP_LEN 64 #define NUM_MAX_ELEMENTS 3 +struct bContext; struct wmEvent; struct UnitSettings; @@ -80,7 +81,7 @@ void initNumInput(NumInput *n); /** * \param str: Must be NUM_STR_REP_LEN * (idx_max + 1) length. */ -void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings); +void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings); bool hasNumInput(const NumInput *n); /** * \warning \a vec must be set beforehand otherwise we risk uninitialized vars. @@ -94,7 +95,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event); bool user_string_to_number(bContext *C, const char *str, - const UnitSettings *unit, + const UnitSettings &unit, int type, double *r_value, bool use_single_line_error, diff --git a/source/blender/editors/include/ED_object_vgroup.hh b/source/blender/editors/include/ED_object_vgroup.hh index d09267dafd0d..f19f07a68403 100644 --- a/source/blender/editors/include/ED_object_vgroup.hh +++ b/source/blender/editors/include/ED_object_vgroup.hh @@ -8,15 +8,15 @@ #pragma once -#include "BLI_compiler_attrs.h" - -struct bDeformGroup; struct EnumPropertyItem; struct ID; struct MDeformVert; struct Object; struct PointerRNA; struct PropertyRNA; +struct SpaceNode; +struct bContext; +struct bDeformGroup; #define WEIGHT_REPLACE 1 #define WEIGHT_ADD 2 diff --git a/source/blender/editors/include/ED_paint.hh b/source/blender/editors/include/ED_paint.hh index 3b162b20377d..87a8cbd3cd5d 100644 --- a/source/blender/editors/include/ED_paint.hh +++ b/source/blender/editors/include/ED_paint.hh @@ -10,6 +10,8 @@ #include "DNA_view3d_enums.h" +#include + enum class PaintMode : int8_t; struct bContext; struct bToolRef; @@ -18,6 +20,7 @@ struct Image; struct ImageUser; struct ImBuf; struct Main; +struct Object; struct PaintModeSettings; struct PaintTileMap; struct ReportList; diff --git a/source/blender/editors/include/ED_particle.hh b/source/blender/editors/include/ED_particle.hh index 69cb1d4c1a45..07145a94c190 100644 --- a/source/blender/editors/include/ED_particle.hh +++ b/source/blender/editors/include/ED_particle.hh @@ -10,6 +10,7 @@ #include "BLI_math_vector_types.hh" +struct Depsgraph; struct Object; struct PTCacheEdit; struct ParticleEditSettings; diff --git a/source/blender/editors/include/ED_physics.hh b/source/blender/editors/include/ED_physics.hh index 5eba2ab3b6bb..ec713c79e824 100644 --- a/source/blender/editors/include/ED_physics.hh +++ b/source/blender/editors/include/ED_physics.hh @@ -10,6 +10,7 @@ struct bContext; struct Depsgraph; +struct Main; struct Object; struct ReportList; struct Scene; diff --git a/source/blender/editors/include/ED_screen.hh b/source/blender/editors/include/ED_screen.hh index cfbdfa76950c..56abdfd1d877 100644 --- a/source/blender/editors/include/ED_screen.hh +++ b/source/blender/editors/include/ED_screen.hh @@ -10,12 +10,8 @@ #include "DNA_screen_types.h" #include "DNA_space_types.h" -#include "DNA_view2d_types.h" -#include "DNA_view3d_types.h" #include "DNA_workspace_types.h" -#include "DNA_object_enums.h" - #include "WM_types.hh" #include "BLI_compiler_attrs.h" diff --git a/source/blender/editors/include/ED_screen_types.hh b/source/blender/editors/include/ED_screen_types.hh index 9c281043e965..c28979cb18da 100644 --- a/source/blender/editors/include/ED_screen_types.hh +++ b/source/blender/editors/include/ED_screen_types.hh @@ -8,7 +8,7 @@ #pragma once -#include "BLI_rect.h" +#include "DNA_vec_types.h" struct ARegion; diff --git a/source/blender/editors/include/ED_sculpt.hh b/source/blender/editors/include/ED_sculpt.hh index 0960fd26c9f5..2a3536822bfe 100644 --- a/source/blender/editors/include/ED_sculpt.hh +++ b/source/blender/editors/include/ED_sculpt.hh @@ -8,12 +8,16 @@ #pragma once +struct Depsgraph; +struct Main; +struct Mesh; struct Object; struct ReportList; +struct Scene; struct UndoType; struct bContext; -struct wmOperator; struct wmKeyConfig; +struct wmOperator; namespace blender::ed::sculpt_paint { diff --git a/source/blender/editors/include/ED_select_utils.hh b/source/blender/editors/include/ED_select_utils.hh index 134dc6f6d0d2..8955daff05cb 100644 --- a/source/blender/editors/include/ED_select_utils.hh +++ b/source/blender/editors/include/ED_select_utils.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" struct KDTree_1d; diff --git a/source/blender/editors/include/ED_sequencer.hh b/source/blender/editors/include/ED_sequencer.hh index 0bee032bef0a..10f16eb06ac2 100644 --- a/source/blender/editors/include/ED_sequencer.hh +++ b/source/blender/editors/include/ED_sequencer.hh @@ -29,7 +29,7 @@ struct StripSelection { eSeqHandle handle = SEQ_HANDLE_NONE; }; -void ED_sequencer_select_sequence_single(Scene *scene, Strip *seq, bool deselect_all); +void ED_sequencer_select_sequence_single(Scene *scene, Strip *strip, bool deselect_all); /** * Iterates over a scene's sequences and deselects all of them. * @@ -74,5 +74,5 @@ blender::VectorSet ED_sequencer_selected_strips_from_context(bContext * StripSelection ED_sequencer_pick_strip_and_handle(const struct Scene *scene, const View2D *v2d, float mouse_co[2]); -bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *seq, const View2D *v2d); -bool ED_sequencer_handle_is_selected(const Strip *seq, eSeqHandle handle); +bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *strip, const View2D *v2d); +bool ED_sequencer_handle_is_selected(const Strip *strip, eSeqHandle handle); diff --git a/source/blender/editors/include/ED_space_api.hh b/source/blender/editors/include/ED_space_api.hh index b738c54f298a..237235bcf1f3 100644 --- a/source/blender/editors/include/ED_space_api.hh +++ b/source/blender/editors/include/ED_space_api.hh @@ -8,6 +8,7 @@ #pragma once +struct ARegion; struct ARegionType; struct bContext; diff --git a/source/blender/editors/include/ED_time_scrub_ui.hh b/source/blender/editors/include/ED_time_scrub_ui.hh index 30cf826f2104..031cae241825 100644 --- a/source/blender/editors/include/ED_time_scrub_ui.hh +++ b/source/blender/editors/include/ED_time_scrub_ui.hh @@ -8,10 +8,13 @@ #pragma once +struct ARegion; +struct Scene; +struct ScrArea; struct bContext; struct bDopeSheet; -struct wmEvent; struct rcti; +struct wmEvent; struct wmWindow; void ED_time_scrub_draw_current_frame(const ARegion *region, diff --git a/source/blender/editors/include/ED_undo.hh b/source/blender/editors/include/ED_undo.hh index bdd7cfbb5d27..75b9bbc051f4 100644 --- a/source/blender/editors/include/ED_undo.hh +++ b/source/blender/editors/include/ED_undo.hh @@ -8,15 +8,15 @@ #pragma once -#include "BLI_compiler_attrs.h" #include "BLI_sys_types.h" #include "BLI_vector.hh" struct Base; struct CLG_LogRef; +struct ID; +struct MemFile; struct Object; struct Scene; -struct MemFile; struct UndoStack; struct ViewLayer; struct bContext; diff --git a/source/blender/editors/include/ED_util.hh b/source/blender/editors/include/ED_util.hh index c1af7e70d6cb..d47008eb68ec 100644 --- a/source/blender/editors/include/ED_util.hh +++ b/source/blender/editors/include/ED_util.hh @@ -8,7 +8,6 @@ #pragma once -#include "BLI_compiler_attrs.h" #include "WM_types.hh" struct Main; diff --git a/source/blender/editors/include/ED_util_imbuf.hh b/source/blender/editors/include/ED_util_imbuf.hh index af34cac4b1ef..e1953b7bd5c5 100644 --- a/source/blender/editors/include/ED_util_imbuf.hh +++ b/source/blender/editors/include/ED_util_imbuf.hh @@ -8,9 +8,6 @@ #pragma once -#include "BLI_compiler_attrs.h" -#include "BLI_sys_types.h" - struct ARegion; struct bContext; struct wmEvent; diff --git a/source/blender/editors/include/ED_uvedit.hh b/source/blender/editors/include/ED_uvedit.hh index f1891a08181b..4ed505ecb640 100644 --- a/source/blender/editors/include/ED_uvedit.hh +++ b/source/blender/editors/include/ED_uvedit.hh @@ -8,6 +8,8 @@ #pragma once +#include "BLI_function_ref.hh" + #include "BKE_customdata.hh" struct ARegion; @@ -18,6 +20,7 @@ struct BMLoop; struct BMesh; struct Image; struct ImageUser; +struct ListBase; struct Main; struct Object; struct Scene; diff --git a/source/blender/editors/include/UI_icons.hh b/source/blender/editors/include/UI_icons.hh index c7ad8e26a74e..c496cf7bcca6 100644 --- a/source/blender/editors/include/UI_icons.hh +++ b/source/blender/editors/include/UI_icons.hh @@ -905,15 +905,15 @@ DEF_ICON_VECTOR(COLLECTION_COLOR_06) DEF_ICON_VECTOR(COLLECTION_COLOR_07) DEF_ICON_VECTOR(COLLECTION_COLOR_08) -DEF_ICON_VECTOR(SEQUENCE_COLOR_01) -DEF_ICON_VECTOR(SEQUENCE_COLOR_02) -DEF_ICON_VECTOR(SEQUENCE_COLOR_03) -DEF_ICON_VECTOR(SEQUENCE_COLOR_04) -DEF_ICON_VECTOR(SEQUENCE_COLOR_05) -DEF_ICON_VECTOR(SEQUENCE_COLOR_06) -DEF_ICON_VECTOR(SEQUENCE_COLOR_07) -DEF_ICON_VECTOR(SEQUENCE_COLOR_08) -DEF_ICON_VECTOR(SEQUENCE_COLOR_09) +DEF_ICON_VECTOR(STRIP_COLOR_01) +DEF_ICON_VECTOR(STRIP_COLOR_02) +DEF_ICON_VECTOR(STRIP_COLOR_03) +DEF_ICON_VECTOR(STRIP_COLOR_04) +DEF_ICON_VECTOR(STRIP_COLOR_05) +DEF_ICON_VECTOR(STRIP_COLOR_06) +DEF_ICON_VECTOR(STRIP_COLOR_07) +DEF_ICON_VECTOR(STRIP_COLOR_08) +DEF_ICON_VECTOR(STRIP_COLOR_09) DEF_ICON_VECTOR(LIBRARY_DATA_INDIRECT) DEF_ICON_VECTOR(LIBRARY_DATA_OVERRIDE_NONEDITABLE) diff --git a/source/blender/editors/include/UI_interface.hh b/source/blender/editors/include/UI_interface.hh index 728d832ebc08..a9fd02c97490 100644 --- a/source/blender/editors/include/UI_interface.hh +++ b/source/blender/editors/include/UI_interface.hh @@ -17,7 +17,7 @@ #include "UI_resources.hh" -#include "UI_interface_c.hh" +#include "UI_interface_c.hh" // IWYU pragma: export namespace blender::nodes::geo_eval_log { struct GeometryAttributeInfo; diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index aeafe2d767cb..08858688e93c 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -58,13 +58,35 @@ set(SRC templates/interface_template_asset_view.cc templates/interface_template_attribute_search.cc templates/interface_template_bone_collection_tree.cc + templates/interface_template_cache_file.cc + templates/interface_template_color_management.cc + templates/interface_template_color_picker.cc + templates/interface_template_color_ramp.cc + templates/interface_template_constraint.cc + templates/interface_template_curve_mapping.cc + templates/interface_template_curve_profile.cc + templates/interface_template_component_menu.cc + templates/interface_template_event.cc templates/interface_template_grease_pencil_layer_tree.cc + templates/interface_template_icon.cc + templates/interface_template_id.cc + templates/interface_template_keymap.cc + templates/interface_template_layers.cc templates/interface_template_light_linking.cc templates/interface_template_list.cc + templates/interface_template_modifiers.cc templates/interface_template_node_inputs.cc templates/interface_template_node_tree_interface.cc + templates/interface_template_operator_property.cc + templates/interface_template_preview.cc + templates/interface_template_recent_files.cc + templates/interface_template_running_jobs.cc + templates/interface_template_scopes.cc + templates/interface_template_search.cc templates/interface_template_search_menu.cc templates/interface_template_search_operator.cc + templates/interface_template_shader_fx.cc + templates/interface_template_status.cc templates/interface_templates.cc interface_undo.cc interface_utils.cc @@ -82,6 +104,7 @@ set(SRC views/tree_view.cc eyedroppers/eyedropper_intern.hh + templates/interface_templates_intern.hh interface_intern.hh regions/interface_regions_intern.hh view2d_intern.hh diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_depth.cc b/source/blender/editors/interface/eyedroppers/eyedropper_depth.cc index 3e430eb12899..17a46fabb01b 100644 --- a/source/blender/editors/interface/eyedroppers/eyedropper_depth.cc +++ b/source/blender/editors/interface/eyedroppers/eyedropper_depth.cc @@ -285,7 +285,7 @@ static void depthdropper_depth_sample_pt(bContext *C, double(*r_depth), 4, B_UNIT_LENGTH, - &scene->unit, + scene->unit, false); } else { diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh b/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh index 3594f6a43a8d..fd00ec11b353 100644 --- a/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh +++ b/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh @@ -10,6 +10,12 @@ #pragma once +struct ScrArea; +struct bContext; +struct uiBut; +struct wmEvent; +struct wmWindow; + /* `interface_eyedropper.cc` */ void eyedropper_draw_cursor_text_window(const wmWindow *window, const char *name); diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index e45ba9a72610..d72cf949bd8d 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -3066,12 +3066,12 @@ static double ui_get_but_scale_unit(uiBut *but, double value) const UnitSettings *unit = but->block->unit; const int unit_type = UI_but_unit_type_get(but); - /* Time unit is a bit special, not handled by BKE_scene_unit_scale() for now. */ + /* Time unit is a bit special, not handled by #BKE_unit_value_scale() for now. */ if (unit_type == PROP_UNIT_TIME) { /* WARNING: using evil_C :| */ Scene *scene = CTX_data_scene(static_cast(but->block->evil_C)); return FRA2TIME(value); } - return BKE_scene_unit_scale(unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value); + return BKE_unit_value_scale(*unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value); } void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t str_maxncpy) @@ -3124,7 +3124,7 @@ static void ui_get_but_string_unit( ui_get_but_scale_unit(but, value), precision, RNA_SUBTYPE_UNIT_VALUE(unit_type), - unit, + *unit, pad); } @@ -3362,7 +3362,7 @@ static bool ui_number_from_string_units( bContext *C, const char *str, const int unit_type, const UnitSettings *unit, double *r_value) { char *error = nullptr; - const bool ok = user_string_to_number(C, str, unit, unit_type, r_value, true, &error); + const bool ok = user_string_to_number(C, str, *unit, unit_type, r_value, true, &error); if (error) { ReportList *reports = CTX_wm_reports(C); BKE_reportf(reports, RPT_ERROR, "%s: %s", UI_NUMBER_EVAL_ERROR_PREFIX, error); diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index b9520f4cb5b5..27830f8f0d29 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -5728,7 +5728,7 @@ static void ui_numedit_set_active(uiBut *but) if ((but->flag & UI_SELECT) == 0) { if ((but->drawflag & UI_BUT_HOVER_LEFT) || (but->drawflag & UI_BUT_HOVER_RIGHT)) { if (data->changed_cursor) { - data->window->tag_cursor_refresh = true; + ED_region_cursor_set(data->window, data->area, data->region); data->changed_cursor = false; } } @@ -9199,7 +9199,7 @@ static void button_activate_exit( #endif if (data->changed_cursor) { - win->tag_cursor_refresh = true; + ED_region_cursor_set(data->window, data->area, data->region); } /* redraw and refresh (for popups) */ diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index 9005f3240b9e..b27006dd45ec 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -436,15 +436,15 @@ static void vicon_strip_color_draw( vicon_strip_color_draw(color, x, y, w, h, alpha); \ } -DEF_ICON_STRIP_COLOR_DRAW(01, SEQUENCE_COLOR_01); -DEF_ICON_STRIP_COLOR_DRAW(02, SEQUENCE_COLOR_02); -DEF_ICON_STRIP_COLOR_DRAW(03, SEQUENCE_COLOR_03); -DEF_ICON_STRIP_COLOR_DRAW(04, SEQUENCE_COLOR_04); -DEF_ICON_STRIP_COLOR_DRAW(05, SEQUENCE_COLOR_05); -DEF_ICON_STRIP_COLOR_DRAW(06, SEQUENCE_COLOR_06); -DEF_ICON_STRIP_COLOR_DRAW(07, SEQUENCE_COLOR_07); -DEF_ICON_STRIP_COLOR_DRAW(08, SEQUENCE_COLOR_08); -DEF_ICON_STRIP_COLOR_DRAW(09, SEQUENCE_COLOR_09); +DEF_ICON_STRIP_COLOR_DRAW(01, STRIP_COLOR_01); +DEF_ICON_STRIP_COLOR_DRAW(02, STRIP_COLOR_02); +DEF_ICON_STRIP_COLOR_DRAW(03, STRIP_COLOR_03); +DEF_ICON_STRIP_COLOR_DRAW(04, STRIP_COLOR_04); +DEF_ICON_STRIP_COLOR_DRAW(05, STRIP_COLOR_05); +DEF_ICON_STRIP_COLOR_DRAW(06, STRIP_COLOR_06); +DEF_ICON_STRIP_COLOR_DRAW(07, STRIP_COLOR_07); +DEF_ICON_STRIP_COLOR_DRAW(08, STRIP_COLOR_08); +DEF_ICON_STRIP_COLOR_DRAW(09, STRIP_COLOR_09); # undef DEF_ICON_STRIP_COLOR_DRAW @@ -861,15 +861,15 @@ static void init_internal_icons() def_internal_vicon(ICON_COLLECTION_COLOR_07, vicon_collection_color_draw_07); def_internal_vicon(ICON_COLLECTION_COLOR_08, vicon_collection_color_draw_08); - def_internal_vicon(ICON_SEQUENCE_COLOR_01, vicon_strip_color_draw_01); - def_internal_vicon(ICON_SEQUENCE_COLOR_02, vicon_strip_color_draw_02); - def_internal_vicon(ICON_SEQUENCE_COLOR_03, vicon_strip_color_draw_03); - def_internal_vicon(ICON_SEQUENCE_COLOR_04, vicon_strip_color_draw_04); - def_internal_vicon(ICON_SEQUENCE_COLOR_05, vicon_strip_color_draw_05); - def_internal_vicon(ICON_SEQUENCE_COLOR_06, vicon_strip_color_draw_06); - def_internal_vicon(ICON_SEQUENCE_COLOR_07, vicon_strip_color_draw_07); - def_internal_vicon(ICON_SEQUENCE_COLOR_08, vicon_strip_color_draw_08); - def_internal_vicon(ICON_SEQUENCE_COLOR_09, vicon_strip_color_draw_09); + def_internal_vicon(ICON_STRIP_COLOR_01, vicon_strip_color_draw_01); + def_internal_vicon(ICON_STRIP_COLOR_02, vicon_strip_color_draw_02); + def_internal_vicon(ICON_STRIP_COLOR_03, vicon_strip_color_draw_03); + def_internal_vicon(ICON_STRIP_COLOR_04, vicon_strip_color_draw_04); + def_internal_vicon(ICON_STRIP_COLOR_05, vicon_strip_color_draw_05); + def_internal_vicon(ICON_STRIP_COLOR_06, vicon_strip_color_draw_06); + def_internal_vicon(ICON_STRIP_COLOR_07, vicon_strip_color_draw_07); + def_internal_vicon(ICON_STRIP_COLOR_08, vicon_strip_color_draw_08); + def_internal_vicon(ICON_STRIP_COLOR_09, vicon_strip_color_draw_09); def_internal_vicon(ICON_LIBRARY_DATA_INDIRECT, vicon_strip_color_draw_library_data_indirect); def_internal_vicon(ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE, diff --git a/source/blender/editors/interface/regions/interface_regions_intern.hh b/source/blender/editors/interface/regions/interface_regions_intern.hh index aa189d62de89..34673c6d3657 100644 --- a/source/blender/editors/interface/regions/interface_regions_intern.hh +++ b/source/blender/editors/interface/regions/interface_regions_intern.hh @@ -12,6 +12,10 @@ #include "BLI_string_ref.hh" +struct ARegion; +struct bContext; +struct bScreen; + /* interface_region_menu_popup.cc */ uint ui_popup_menu_hash(blender::StringRef str); diff --git a/source/blender/editors/interface/templates/interface_template_cache_file.cc b/source/blender/editors/interface/templates/interface_template_cache_file.cc new file mode 100644 index 000000000000..b5a41cb1a022 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_cache_file.cc @@ -0,0 +1,270 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string.h" +#include "BLI_string_ref.hh" + +#include "BKE_context.hh" +#include "BKE_scene.hh" +#include "BKE_screen.hh" + +#include "BLT_translation.hh" + +#include "DNA_cachefile_types.h" +#include "DNA_space_types.h" + +#include "DEG_depsgraph_query.hh" + +#include "RE_engine.h" + +#include "RNA_access.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRefNull; + +void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) +{ + if (RNA_pointer_is_null(fileptr)) { + return; + } + + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ + uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); + + uiItemR(layout, fileptr, "velocity_name", UI_ITEM_NONE, std::nullopt, ICON_NONE); + uiItemR(layout, fileptr, "velocity_unit", UI_ITEM_NONE, std::nullopt, ICON_NONE); +} + +void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerRNA *fileptr) +{ + if (RNA_pointer_is_null(fileptr)) { + return; + } + + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ + uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); + + uiLayout *row, *sub; + + /* Only enable render procedural option if the active engine supports it. */ + const RenderEngineType *engine_type = CTX_data_engine_type(C); + + Scene *scene = CTX_data_scene(C); + const bool engine_supports_procedural = RE_engine_supports_alembic_procedural(engine_type, + scene); + CacheFile *cache_file = static_cast(fileptr->data); + CacheFile *cache_file_eval = reinterpret_cast( + DEG_get_evaluated_id(CTX_data_depsgraph_pointer(C), &cache_file->id)); + bool is_alembic = cache_file_eval->type == CACHEFILE_TYPE_ALEMBIC; + + if (!is_alembic) { + row = uiLayoutRow(layout, false); + uiItemL(row, RPT_("Only Alembic Procedurals supported"), ICON_INFO); + } + else if (!engine_supports_procedural) { + row = uiLayoutRow(layout, false); + /* For Cycles, verify that experimental features are enabled. */ + if (BKE_scene_uses_cycles(scene) && !BKE_scene_uses_cycles_experimental_features(scene)) { + uiItemL( + row, + RPT_( + "The Cycles Alembic Procedural is only available with the experimental feature set"), + ICON_INFO); + } + else { + uiItemL( + row, RPT_("The active render engine does not have an Alembic Procedural"), ICON_INFO); + } + } + + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, is_alembic && engine_supports_procedural); + uiItemR(row, fileptr, "use_render_procedural", UI_ITEM_NONE, std::nullopt, ICON_NONE); + + const bool use_render_procedural = RNA_boolean_get(fileptr, "use_render_procedural"); + const bool use_prefetch = RNA_boolean_get(fileptr, "use_prefetch"); + + row = uiLayoutRow(layout, false); + uiLayoutSetEnabled(row, use_render_procedural); + uiItemR(row, fileptr, "use_prefetch", UI_ITEM_NONE, std::nullopt, ICON_NONE); + + sub = uiLayoutRow(layout, false); + uiLayoutSetEnabled(sub, use_prefetch && use_render_procedural); + uiItemR(sub, fileptr, "prefetch_cache_size", UI_ITEM_NONE, std::nullopt, ICON_NONE); +} + +void uiTemplateCacheFileTimeSettings(uiLayout *layout, PointerRNA *fileptr) +{ + if (RNA_pointer_is_null(fileptr)) { + return; + } + + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ + uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); + + uiLayout *row, *sub, *subsub; + + row = uiLayoutRow(layout, false); + uiItemR(row, fileptr, "is_sequence", UI_ITEM_NONE, std::nullopt, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Override Frame")); + sub = uiLayoutRow(row, true); + uiLayoutSetPropDecorate(sub, false); + uiItemR(sub, fileptr, "override_frame", UI_ITEM_NONE, "", ICON_NONE); + subsub = uiLayoutRow(sub, true); + uiLayoutSetActive(subsub, RNA_boolean_get(fileptr, "override_frame")); + uiItemR(subsub, fileptr, "frame", UI_ITEM_NONE, "", ICON_NONE); + uiItemDecoratorR(row, fileptr, "frame", 0); + + row = uiLayoutRow(layout, false); + uiItemR(row, fileptr, "frame_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE); + uiLayoutSetActive(row, !RNA_boolean_get(fileptr, "is_sequence")); +} + +static void cache_file_layer_item(uiList * /*ui_list*/, + const bContext * /*C*/, + uiLayout *layout, + PointerRNA * /*dataptr*/, + PointerRNA *itemptr, + int /*icon*/, + PointerRNA * /*active_dataptr*/, + const char * /*active_propname*/, + int /*index*/, + int /*flt_flag*/) +{ + uiLayout *row = uiLayoutRow(layout, true); + uiItemR(row, itemptr, "hide_layer", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(row, itemptr, "filepath", UI_ITEM_R_NO_BG, "", ICON_NONE); +} + +uiListType *UI_UL_cache_file_layers() +{ + uiListType *list_type = (uiListType *)MEM_callocN(sizeof(*list_type), __func__); + + STRNCPY(list_type->idname, "UI_UL_cache_file_layers"); + list_type->draw_item = cache_file_layer_item; + + return list_type; +} + +void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA *fileptr) +{ + if (RNA_pointer_is_null(fileptr)) { + return; + } + + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ + uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); + + uiLayout *row = uiLayoutRow(layout, false); + uiLayout *col = uiLayoutColumn(row, true); + + uiTemplateList(col, + (bContext *)C, + "UI_UL_cache_file_layers", + "cache_file_layers", + fileptr, + "layers", + fileptr, + "active_index", + "", + 1, + 5, + UILST_LAYOUT_DEFAULT, + 1, + UI_TEMPLATE_LIST_FLAG_NONE); + + col = uiLayoutColumn(row, true); + uiItemO(col, "", ICON_ADD, "cachefile.layer_add"); + uiItemO(col, "", ICON_REMOVE, "cachefile.layer_remove"); + + CacheFile *file = static_cast(fileptr->data); + if (BLI_listbase_count(&file->layers) > 1) { + uiItemS_ex(col, 1.0f); + uiItemO(col, "", ICON_TRIA_UP, "cachefile.layer_move"); + uiItemO(col, "", ICON_TRIA_DOWN, "cachefile.layer_move"); + } +} + +bool uiTemplateCacheFilePointer(PointerRNA *ptr, + const StringRefNull propname, + PointerRNA *r_file_ptr) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop) { + printf("%s: property not found: %s.%s\n", + __func__, + RNA_struct_identifier(ptr->type), + propname.c_str()); + return false; + } + + if (RNA_property_type(prop) != PROP_POINTER) { + printf("%s: expected pointer property for %s.%s\n", + __func__, + RNA_struct_identifier(ptr->type), + propname.c_str()); + return false; + } + + *r_file_ptr = RNA_property_pointer_get(ptr, prop); + return true; +} + +void uiTemplateCacheFile(uiLayout *layout, + const bContext *C, + PointerRNA *ptr, + const StringRefNull propname) +{ + if (!ptr->data) { + return; + } + + PointerRNA fileptr; + if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) { + return; + } + + CacheFile *file = static_cast(fileptr.data); + + uiLayoutSetContextPointer(layout, "edit_cachefile", &fileptr); + + uiTemplateID(layout, C, ptr, propname, nullptr, "CACHEFILE_OT_open", nullptr); + + if (!file) { + return; + } + + SpaceProperties *sbuts = CTX_wm_space_properties(C); + + uiLayout *row, *sub; + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRow(layout, true); + uiItemR(row, &fileptr, "filepath", UI_ITEM_NONE, std::nullopt, ICON_NONE); + sub = uiLayoutRow(row, true); + uiItemO(sub, "", ICON_FILE_REFRESH, "cachefile.reload"); + + if (sbuts->mainb == BCONTEXT_CONSTRAINT) { + row = uiLayoutRow(layout, false); + uiItemR(row, &fileptr, "scale", UI_ITEM_NONE, IFACE_("Manual Scale"), ICON_NONE); + } + + /* TODO: unused for now, so no need to expose. */ +#if 0 + row = uiLayoutRow(layout, false); + uiItemR(row, &fileptr, "forward_axis", UI_ITEM_NONE, IFACE_("Forward Axis"), ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemR(row, &fileptr, "up_axis", UI_ITEM_NONE, IFACE_("Up Axis"), ICON_NONE); +#endif +} diff --git a/source/blender/editors/interface/templates/interface_template_color_management.cc b/source/blender/editors/interface/templates/interface_template_color_management.cc new file mode 100644 index 000000000000..2b43a97a8ba8 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_color_management.cc @@ -0,0 +1,82 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "RNA_access.hh" + +#include "UI_interface.hh" + +using blender::StringRefNull; + +void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop) { + printf("%s: property not found: %s.%s\n", + __func__, + RNA_struct_identifier(ptr->type), + propname.c_str()); + return; + } + + PointerRNA colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop); + + uiItemR( + layout, &colorspace_settings_ptr, "name", UI_ITEM_NONE, IFACE_("Color Space"), ICON_NONE); +} + +void uiTemplateColormanagedViewSettings(uiLayout *layout, + bContext * /*C*/, + PointerRNA *ptr, + const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop) { + printf("%s: property not found: %s.%s\n", + __func__, + RNA_struct_identifier(ptr->type), + propname.c_str()); + return; + } + + PointerRNA view_transform_ptr = RNA_property_pointer_get(ptr, prop); + ColorManagedViewSettings *view_settings = static_cast( + view_transform_ptr.data); + + uiLayout *col = uiLayoutColumn(layout, false); + uiItemR(col, &view_transform_ptr, "view_transform", UI_ITEM_NONE, IFACE_("View"), ICON_NONE); + uiItemR(col, &view_transform_ptr, "look", UI_ITEM_NONE, IFACE_("Look"), ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &view_transform_ptr, "exposure", UI_ITEM_NONE, std::nullopt, ICON_NONE); + uiItemR(col, &view_transform_ptr, "gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &view_transform_ptr, "use_curve_mapping", UI_ITEM_NONE, std::nullopt, ICON_NONE); + if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) { + uiTemplateCurveMapping( + col, &view_transform_ptr, "curve_mapping", 'c', true, false, false, false); + } + + col = uiLayoutColumn(layout, false); + uiItemR(col, &view_transform_ptr, "use_white_balance", UI_ITEM_NONE, std::nullopt, ICON_NONE); + if (view_settings->flag & COLORMANAGE_VIEW_USE_WHITE_BALANCE) { + uiItemR(col, + &view_transform_ptr, + "white_balance_temperature", + UI_ITEM_NONE, + std::nullopt, + ICON_NONE); + uiItemR(col, &view_transform_ptr, "white_balance_tint", UI_ITEM_NONE, std::nullopt, ICON_NONE); + } +} diff --git a/source/blender/editors/interface/templates/interface_template_color_picker.cc b/source/blender/editors/interface/templates/interface_template_color_picker.cc new file mode 100644 index 000000000000..fd647905ce54 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_color_picker.cc @@ -0,0 +1,369 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_math_vector.h" +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "DNA_brush_types.h" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRefNull; + +#define WHEEL_SIZE (5 * U.widget_unit) + +void uiTemplateColorPicker(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + bool value_slider, + bool lock, + bool lock_luminosity, + bool cubic) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + uiBlock *block = uiLayoutGetBlock(layout); + ColorPicker *cpicker = ui_block_colorpicker_create(block); + + if (!prop) { + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + float softmin, softmax, step, precision; + RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); + + uiLayout *col = uiLayoutColumn(layout, true); + uiLayout *row = uiLayoutRow(col, true); + + uiBut *but = nullptr; + uiButHSVCube *hsv_but; + switch (U.color_picker_type) { + case USER_CP_SQUARE_SV: + case USER_CP_SQUARE_HS: + case USER_CP_SQUARE_HV: + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + 0, + 0, + WHEEL_SIZE, + WHEEL_SIZE, + ptr, + prop, + -1, + 0.0, + 0.0, + ""); + switch (U.color_picker_type) { + case USER_CP_SQUARE_SV: + hsv_but->gradient_type = UI_GRAD_SV; + break; + case USER_CP_SQUARE_HS: + hsv_but->gradient_type = UI_GRAD_HS; + break; + case USER_CP_SQUARE_HV: + hsv_but->gradient_type = UI_GRAD_HV; + break; + } + but = hsv_but; + break; + + /* user default */ + case USER_CP_CIRCLE_HSV: + case USER_CP_CIRCLE_HSL: + default: + but = uiDefButR_prop(block, + UI_BTYPE_HSVCIRCLE, + 0, + "", + 0, + 0, + WHEEL_SIZE, + WHEEL_SIZE, + ptr, + prop, + -1, + 0.0, + 0.0, + ""); + break; + } + + but->custom_data = cpicker; + + cpicker->use_color_lock = lock; + cpicker->use_color_cubic = cubic; + cpicker->use_luminosity_lock = lock_luminosity; + + if (lock_luminosity) { + float color[4]; /* in case of alpha */ + RNA_property_float_get_array(ptr, prop, color); + cpicker->luminosity_lock_value = len_v3(color); + } + + if (value_slider) { + switch (U.color_picker_type) { + case USER_CP_CIRCLE_HSL: + uiItemS(row); + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + WHEEL_SIZE + 6, + 0, + 14 * UI_SCALE_FAC, + WHEEL_SIZE, + ptr, + prop, + -1, + softmin, + softmax, + ""); + hsv_but->gradient_type = UI_GRAD_L_ALT; + break; + case USER_CP_SQUARE_SV: + uiItemS(col); + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + 0, + 4, + WHEEL_SIZE, + 18 * UI_SCALE_FAC, + ptr, + prop, + -1, + softmin, + softmax, + ""); + hsv_but->gradient_type = eButGradientType(UI_GRAD_SV + 3); + break; + case USER_CP_SQUARE_HS: + uiItemS(col); + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + 0, + 4, + WHEEL_SIZE, + 18 * UI_SCALE_FAC, + ptr, + prop, + -1, + softmin, + softmax, + ""); + hsv_but->gradient_type = eButGradientType(UI_GRAD_HS + 3); + break; + case USER_CP_SQUARE_HV: + uiItemS(col); + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + 0, + 4, + WHEEL_SIZE, + 18 * UI_SCALE_FAC, + ptr, + prop, + -1, + softmin, + softmax, + ""); + hsv_but->gradient_type = eButGradientType(UI_GRAD_HV + 3); + break; + + /* user default */ + case USER_CP_CIRCLE_HSV: + default: + uiItemS(row); + hsv_but = (uiButHSVCube *)uiDefButR_prop(block, + UI_BTYPE_HSVCUBE, + 0, + "", + WHEEL_SIZE + 6, + 0, + 14 * UI_SCALE_FAC, + WHEEL_SIZE, + ptr, + prop, + -1, + softmin, + softmax, + ""); + hsv_but->gradient_type = UI_GRAD_V_ALT; + break; + } + + hsv_but->custom_data = cpicker; + } +} + +static void ui_template_palette_menu(bContext * /*C*/, uiLayout *layout, void * /*but_p*/) +{ + uiLayout *row; + + uiItemL(layout, IFACE_("Sort By:"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiItemEnumO_value(row, IFACE_("Hue"), ICON_NONE, "PALETTE_OT_sort", "type", 1); + row = uiLayoutRow(layout, false); + uiItemEnumO_value(row, IFACE_("Saturation"), ICON_NONE, "PALETTE_OT_sort", "type", 2); + row = uiLayoutRow(layout, false); + uiItemEnumO_value(row, IFACE_("Value"), ICON_NONE, "PALETTE_OT_sort", "type", 3); + row = uiLayoutRow(layout, false); + uiItemEnumO_value(row, IFACE_("Luminance"), ICON_NONE, "PALETTE_OT_sort", "type", 4); +} + +void uiTemplatePalette(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + bool /*colors*/) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + uiBut *but = nullptr; + + const int cols_per_row = std::max(uiLayoutGetWidth(layout) / UI_UNIT_X, 1); + + if (!prop) { + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Palette)) { + return; + } + + uiBlock *block = uiLayoutGetBlock(layout); + + Palette *palette = static_cast(cptr.data); + + uiLayout *col = uiLayoutColumn(layout, true); + uiLayoutRow(col, true); + uiDefIconButO(block, + UI_BTYPE_BUT, + "PALETTE_OT_color_add", + WM_OP_INVOKE_DEFAULT, + ICON_ADD, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + uiDefIconButO(block, + UI_BTYPE_BUT, + "PALETTE_OT_color_delete", + WM_OP_INVOKE_DEFAULT, + ICON_REMOVE, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + if (palette->colors.first != nullptr) { + but = uiDefIconButO(block, + UI_BTYPE_BUT, + "PALETTE_OT_color_move", + WM_OP_INVOKE_DEFAULT, + ICON_TRIA_UP, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + UI_but_operator_ptr_ensure(but); + RNA_enum_set(but->opptr, "type", -1); + + but = uiDefIconButO(block, + UI_BTYPE_BUT, + "PALETTE_OT_color_move", + WM_OP_INVOKE_DEFAULT, + ICON_TRIA_DOWN, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + UI_but_operator_ptr_ensure(but); + RNA_enum_set(but->opptr, "type", 1); + + /* Menu. */ + uiDefIconMenuBut( + block, ui_template_palette_menu, nullptr, ICON_SORTSIZE, 0, 0, UI_UNIT_X, UI_UNIT_Y, ""); + } + + col = uiLayoutColumn(layout, true); + uiLayoutRow(col, true); + + int row_cols = 0, col_id = 0; + LISTBASE_FOREACH (PaletteColor *, color, &palette->colors) { + if (row_cols >= cols_per_row) { + uiLayoutRow(col, true); + row_cols = 0; + } + + PointerRNA color_ptr = RNA_pointer_create(&palette->id, &RNA_PaletteColor, color); + uiButColor *color_but = (uiButColor *)uiDefButR(block, + UI_BTYPE_COLOR, + 0, + "", + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + &color_ptr, + "color", + -1, + 0.0, + 1.0, + ""); + color_but->is_pallete_color = true; + color_but->palette_color_index = col_id; + row_cols++; + col_id++; + } +} + +void uiTemplateCryptoPicker(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + int icon) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop) { + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + uiBlock *block = uiLayoutGetBlock(layout); + + uiBut *but = uiDefIconButO(block, + UI_BTYPE_BUT, + "UI_OT_eyedropper_color", + WM_OP_INVOKE_DEFAULT, + icon, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + RNA_property_ui_description(prop)); + but->rnapoin = *ptr; + but->rnaprop = prop; + but->rnaindex = -1; +} diff --git a/source/blender/editors/interface/templates/interface_template_color_ramp.cc b/source/blender/editors/interface/templates/interface_template_color_ramp.cc new file mode 100644 index 000000000000..1002ea58f1ec --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_color_ramp.cc @@ -0,0 +1,421 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_colorband.hh" +#include "BKE_context.hh" + +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "DNA_texture_types.h" + +#include "ED_screen.hh" +#include "ED_undo.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +using blender::StringRefNull; + +static void colorband_flip(bContext *C, ColorBand *coba) +{ + CBData data_tmp[MAXCOLORBAND]; + + for (int a = 0; a < coba->tot; a++) { + data_tmp[a] = coba->data[coba->tot - (a + 1)]; + } + for (int a = 0; a < coba->tot; a++) { + data_tmp[a].pos = 1.0f - data_tmp[a].pos; + coba->data[a] = data_tmp[a]; + } + + /* May as well flip the `cur`. */ + coba->cur = coba->tot - (coba->cur + 1); + + ED_undo_push(C, "Flip Color Ramp"); +} + +static void colorband_distribute(bContext *C, ColorBand *coba, bool evenly) +{ + if (coba->tot > 1) { + const int tot = evenly ? coba->tot - 1 : coba->tot; + const float gap = 1.0f / tot; + float pos = 0.0f; + for (int a = 0; a < coba->tot; a++) { + coba->data[a].pos = pos; + pos += gap; + } + ED_undo_push(C, evenly ? "Distribute Stops Evenly" : "Distribute Stops from Left"); + } +} + +static uiBlock *colorband_tools_fn(bContext *C, ARegion *region, void *cb_v) +{ + RNAUpdateCb &cb = *static_cast(cb_v); + const uiStyle *style = UI_style_get_dpi(); + PointerRNA coba_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); + ColorBand *coba = static_cast(coba_ptr.data); + short yco = 0; + const short menuwidth = 10 * UI_UNIT_X; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS_PULLDOWN); + + uiLayout *layout = UI_block_layout(block, + UI_LAYOUT_VERTICAL, + UI_LAYOUT_MENU, + 0, + 0, + UI_MENU_WIDTH_MIN, + 0, + UI_MENU_PADDING, + style); + UI_block_layout_set_current(block, layout); + { + uiLayoutSetContextPointer(layout, "color_ramp", &coba_ptr); + } + + /* We could move these to operators, + * although this isn't important unless we want to assign key shortcuts to them. */ + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_ARROW_LEFTRIGHT, + IFACE_("Flip Color Ramp"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [coba, cb](bContext &C) { + colorband_flip(&C, coba); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Distribute Stops from Left"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [coba, cb](bContext &C) { + colorband_distribute(&C, coba, false); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Distribute Stops Evenly"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [coba, cb](bContext &C) { + colorband_distribute(&C, coba, true); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + + uiItemS(layout); + + uiItemO(layout, IFACE_("Eyedropper"), ICON_EYEDROPPER, "UI_OT_eyedropper_colorramp"); + + uiItemS(layout); + + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_LOOP_BACK, + IFACE_("Reset Color Ramp"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [coba, cb](bContext &C) { + BKE_colorband_init(coba, true); + ED_undo_push(&C, "Reset Color Ramp"); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + + UI_block_direction_set(block, UI_DIR_DOWN); + UI_block_bounds_set_text(block, 3.0f * UI_UNIT_X); + + return block; +} + +static void colorband_add(bContext &C, const RNAUpdateCb &cb, ColorBand &coba) +{ + float pos = 0.5f; + + if (coba.tot > 1) { + if (coba.cur > 0) { + pos = (coba.data[coba.cur - 1].pos + coba.data[coba.cur].pos) * 0.5f; + } + else { + pos = (coba.data[coba.cur + 1].pos + coba.data[coba.cur].pos) * 0.5f; + } + } + + if (BKE_colorband_element_add(&coba, pos)) { + rna_update_cb(C, cb); + ED_undo_push(&C, "Add Color Ramp Stop"); + } +} + +static void colorband_update_cb(bContext * /*C*/, void *bt_v, void *coba_v) +{ + uiBut *bt = static_cast(bt_v); + ColorBand *coba = static_cast(coba_v); + + /* Sneaky update here, we need to sort the color-band points to be in order, + * however the RNA pointer then is wrong, so we update it */ + BKE_colorband_update_sort(coba); + bt->rnapoin.data = coba->data + coba->cur; +} + +static void colorband_buttons_layout(uiLayout *layout, + uiBlock *block, + ColorBand *coba, + const rctf *butr, + const RNAUpdateCb &cb, + int expand) +{ + uiBut *bt; + const float unit = BLI_rctf_size_x(butr) / 14.0f; + const float xs = butr->xmin; + const float ys = butr->ymin; + + PointerRNA ptr = RNA_pointer_create(cb.ptr.owner_id, &RNA_ColorRamp, coba); + + uiLayout *split = uiLayoutSplit(layout, 0.4f, false); + + UI_block_emboss_set(block, UI_EMBOSS_NONE); + UI_block_align_begin(block); + uiLayout *row = uiLayoutRow(split, false); + + bt = uiDefIconTextBut(block, + UI_BTYPE_BUT, + 0, + ICON_ADD, + "", + 0, + 0, + 2.0f * unit, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Add a new color stop to the color ramp")); + UI_but_func_set(bt, [coba, cb](bContext &C) { colorband_add(C, cb, *coba); }); + + bt = uiDefIconTextBut(block, + UI_BTYPE_BUT, + 0, + ICON_REMOVE, + "", + xs + 2.0f * unit, + ys + UI_UNIT_Y, + 2.0f * unit, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Delete the active position")); + UI_but_func_set(bt, [coba, cb](bContext &C) { + if (BKE_colorband_element_remove(coba, coba->cur)) { + rna_update_cb(C, cb); + ED_undo_push(&C, "Delete Color Ramp Stop"); + } + }); + + RNAUpdateCb *tools_cb = MEM_new(__func__, cb); + bt = uiDefIconBlockBut(block, + colorband_tools_fn, + tools_cb, + 0, + ICON_DOWNARROW_HLT, + xs + 4.0f * unit, + ys + UI_UNIT_Y, + 2.0f * unit, + UI_UNIT_Y, + TIP_("Tools")); + /* Pass ownership of `tools_cb` to the button. */ + UI_but_funcN_set( + bt, + [](bContext *, void *, void *) {}, + tools_cb, + nullptr, + but_func_argN_free, + but_func_argN_copy); + + UI_block_align_end(block); + UI_block_emboss_set(block, UI_EMBOSS); + + row = uiLayoutRow(split, false); + + UI_block_align_begin(block); + uiItemR(row, &ptr, "color_mode", UI_ITEM_NONE, "", ICON_NONE); + if (ELEM(coba->color_mode, COLBAND_BLEND_HSV, COLBAND_BLEND_HSL)) { + uiItemR(row, &ptr, "hue_interpolation", UI_ITEM_NONE, "", ICON_NONE); + } + else { /* COLBAND_BLEND_RGB */ + uiItemR(row, &ptr, "interpolation", UI_ITEM_NONE, "", ICON_NONE); + } + UI_block_align_end(block); + + row = uiLayoutRow(layout, false); + + bt = uiDefBut( + block, UI_BTYPE_COLORBAND, 0, "", xs, ys, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, ""); + bt->rnapoin = cb.ptr; + bt->rnaprop = cb.prop; + UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); + + row = uiLayoutRow(layout, false); + + if (coba->tot) { + CBData *cbd = coba->data + coba->cur; + + ptr = RNA_pointer_create(cb.ptr.owner_id, &RNA_ColorRampElement, cbd); + + if (!expand) { + split = uiLayoutSplit(layout, 0.3f, false); + + row = uiLayoutRow(split, false); + bt = uiDefButS(block, + UI_BTYPE_NUM, + 0, + "", + 0, + 0, + 5.0f * UI_UNIT_X, + UI_UNIT_Y, + &coba->cur, + 0.0, + float(std::max(0, coba->tot - 1)), + TIP_("Choose active color stop")); + UI_but_number_step_size_set(bt, 1); + + row = uiLayoutRow(split, false); + uiItemR(row, &ptr, "position", UI_ITEM_NONE, IFACE_("Pos"), ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemR(row, &ptr, "color", UI_ITEM_NONE, "", ICON_NONE); + } + else { + split = uiLayoutSplit(layout, 0.5f, false); + uiLayout *subsplit = uiLayoutSplit(split, 0.35f, false); + + row = uiLayoutRow(subsplit, false); + bt = uiDefButS(block, + UI_BTYPE_NUM, + 0, + "", + 0, + 0, + 5.0f * UI_UNIT_X, + UI_UNIT_Y, + &coba->cur, + 0.0, + float(std::max(0, coba->tot - 1)), + TIP_("Choose active color stop")); + UI_but_number_step_size_set(bt, 1); + + row = uiLayoutRow(subsplit, false); + uiItemR(row, &ptr, "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), ICON_NONE); + + row = uiLayoutRow(split, false); + uiItemR(row, &ptr, "color", UI_ITEM_NONE, "", ICON_NONE); + } + + /* Some special (rather awkward) treatment to update UI state on certain property changes. */ + LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) { + if (but->rnapoin.data != ptr.data) { + continue; + } + if (!but->rnaprop) { + continue; + } + + const char *prop_identifier = RNA_property_identifier(but->rnaprop); + if (STREQ(prop_identifier, "position")) { + UI_but_func_set(but, colorband_update_cb, but, coba); + } + + if (STREQ(prop_identifier, "color")) { + UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); + } + } + } +} + +void uiTemplateColorRamp(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + bool expand) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + return; + } + + const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp)) { + return; + } + + rctf rect; + rect.xmin = 0; + rect.xmax = 10.0f * UI_UNIT_X; + rect.ymin = 0; + rect.ymax = 19.5f * UI_UNIT_X; + + uiBlock *block = uiLayoutAbsoluteBlock(layout); + + ID *id = cptr.owner_id; + UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); + + colorband_buttons_layout( + layout, block, static_cast(cptr.data), &rect, RNAUpdateCb{*ptr, prop}, expand); + + UI_block_lock_clear(block); +} diff --git a/source/blender/editors/interface/templates/interface_template_component_menu.cc b/source/blender/editors/interface/templates/interface_template_component_menu.cc new file mode 100644 index 000000000000..f3111379ef01 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_component_menu.cc @@ -0,0 +1,80 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string.h" +#include "BLI_string_ref.hh" + +#include "RNA_access.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRef; +using blender::StringRefNull; + +struct ComponentMenuArgs { + PointerRNA ptr; + char propname[64]; /* XXX arbitrary */ +}; +/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ +static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v) +{ + ComponentMenuArgs *args = (ComponentMenuArgs *)args_v; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN); + + uiLayout *layout = uiLayoutColumn(UI_block_layout(block, + UI_LAYOUT_VERTICAL, + UI_LAYOUT_PANEL, + 0, + 0, + UI_UNIT_X * 6, + UI_UNIT_Y, + 0, + UI_style_get()), + false); + + uiItemR(layout, &args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE); + + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); + UI_block_direction_set(block, UI_DIR_DOWN); + + return block; +} +void uiTemplateComponentMenu(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + const StringRef name) +{ + ComponentMenuArgs *args = MEM_new(__func__); + + args->ptr = *ptr; + STRNCPY(args->propname, propname.c_str()); + + uiBlock *block = uiLayoutGetBlock(layout); + UI_block_align_begin(block); + + uiBut *but = uiDefBlockButN(block, + component_menu, + args, + name, + 0, + 0, + UI_UNIT_X * 6, + UI_UNIT_Y, + "", + but_func_argN_free, + but_func_argN_copy); + /* set rna directly, uiDefBlockButN doesn't do this */ + but->rnapoin = *ptr; + but->rnaprop = RNA_struct_find_property(ptr, propname.c_str()); + but->rnaindex = 0; + + UI_block_align_end(block); +} diff --git a/source/blender/editors/interface/templates/interface_template_constraint.cc b/source/blender/editors/interface/templates/interface_template_constraint.cc new file mode 100644 index 000000000000..d3abcb7486a3 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_constraint.cc @@ -0,0 +1,357 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + * + * Template for building the panel layout for the active object or bone's constraints. + */ + +#include "BKE_constraint.h" +#include "BKE_context.hh" +#include "BKE_screen.hh" + +#include "BLI_string_utils.hh" + +#include "BLT_translation.hh" + +#include "DNA_constraint_types.h" + +#include "ED_object.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +static void constraint_active_func(bContext * /*C*/, void *ob_v, void *con_v) +{ + blender::ed::object::constraint_active_set(static_cast(ob_v), + static_cast(con_v)); +} + +static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v) +{ + PointerRNA op_ptr; + uiLayout *row; + bConstraint *con = (bConstraint *)con_v; + + Object *ob = blender::ed::object::context_active_object(C); + + PointerRNA ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); + uiLayoutSetContextPointer(layout, "constraint", &ptr); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + + uiLayoutSetUnitsX(layout, 4.0f); + + /* Apply. */ + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + ICON_CHECKMARK, + "CONSTRAINT_OT_apply"); + + /* Duplicate. */ + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE, + "CONSTRAINT_OT_copy"); + + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), + 0, + "CONSTRAINT_OT_copy_to_selected"); + + uiItemS(layout); + + /* Move to first. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "CONSTRAINT_OT_move_to_index", + IFACE_("Move to First"), + ICON_TRIA_UP, + nullptr, + WM_OP_INVOKE_DEFAULT, + UI_ITEM_NONE, + &op_ptr); + RNA_int_set(&op_ptr, "index", 0); + if (!con->prev) { + uiLayoutSetEnabled(row, false); + } + + /* Move to last. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "CONSTRAINT_OT_move_to_index", + IFACE_("Move to Last"), + ICON_TRIA_DOWN, + nullptr, + WM_OP_INVOKE_DEFAULT, + UI_ITEM_NONE, + &op_ptr); + ListBase *constraint_list = blender::ed::object::constraint_list_from_constraint( + ob, con, nullptr); + RNA_int_set(&op_ptr, "index", BLI_listbase_count(constraint_list) - 1); + if (!con->next) { + uiLayoutSetEnabled(row, false); + } +} + +/* -------------------------------------------------------------------- */ +/** \name Constraint Header Template + * \{ */ + +static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *con) +{ + /* unless button has its own callback, it adds this callback to button */ + uiBlock *block = uiLayoutGetBlock(layout); + UI_block_func_set(block, constraint_active_func, ob, con); + + PointerRNA ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); + + if (block->panel) { + UI_panel_context_pointer_set(block->panel, "constraint", &ptr); + } + else { + uiLayoutSetContextPointer(layout, "constraint", &ptr); + } + + /* Constraint type icon. */ + uiLayout *sub = uiLayoutRow(layout, false); + uiLayoutSetEmboss(sub, UI_EMBOSS); + uiLayoutSetRedAlert(sub, (con->flag & CONSTRAINT_DISABLE)); + uiItemL(sub, "", RNA_struct_ui_icon(ptr.type)); + + UI_block_emboss_set(block, UI_EMBOSS); + + uiLayout *row = uiLayoutRow(layout, true); + + uiItemR(row, &ptr, "name", UI_ITEM_NONE, "", ICON_NONE); + + /* Enabled eye icon. */ + uiItemR(row, &ptr, "enabled", UI_ITEM_NONE, "", ICON_NONE); + + /* Extra operators menu. */ + uiItemMenuF(row, "", ICON_DOWNARROW_HLT, constraint_ops_extra_draw, con); + + /* Close 'button' - emboss calls here disable drawing of 'button' behind X */ + sub = uiLayoutRow(row, false); + uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); + uiLayoutSetOperatorContext(sub, WM_OP_INVOKE_DEFAULT); + uiItemO(sub, "", ICON_X, "CONSTRAINT_OT_delete"); + + /* Some extra padding at the end, so the 'x' icon isn't too close to drag button. */ + uiItemS(layout); + + /* clear any locks set up for proxies/lib-linking */ + UI_block_lock_clear(block); +} + +void uiTemplateConstraintHeader(uiLayout *layout, PointerRNA *ptr) +{ + /* verify we have valid data */ + if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) { + RNA_warning("Expected constraint on object"); + return; + } + + Object *ob = (Object *)ptr->owner_id; + bConstraint *con = static_cast(ptr->data); + + if (!ob || !(GS(ob->id.name) == ID_OB)) { + RNA_warning("Expected constraint on object"); + return; + } + + UI_block_lock_set(uiLayoutGetBlock(layout), (ob && !ID_IS_EDITABLE(ob)), ERROR_LIBDATA_MESSAGE); + + draw_constraint_header(layout, ob, con); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Constraints Template + * + * Template for building the panel layout for the active object or bone's constraints. + * \{ */ + +/** For building the panel UI for constraints. */ +#define CONSTRAINT_TYPE_PANEL_PREFIX "OBJECT_PT_" +#define CONSTRAINT_BONE_TYPE_PANEL_PREFIX "BONE_PT_" + +/** + * Check if the panel's ID starts with 'BONE', meaning it is a bone constraint. + */ +static bool constraint_panel_is_bone(Panel *panel) +{ + return (panel->panelname[0] == 'B') && (panel->panelname[1] == 'O') && + (panel->panelname[2] == 'N') && (panel->panelname[3] == 'E'); +} + +/** + * Move a constraint to the index it's moved to after a drag and drop. + */ +static void constraint_reorder(bContext *C, Panel *panel, int new_index) +{ + const bool constraint_from_bone = constraint_panel_is_bone(panel); + + PointerRNA *con_ptr = UI_panel_custom_data_get(panel); + bConstraint *con = (bConstraint *)con_ptr->data; + + PointerRNA props_ptr; + wmOperatorType *ot = WM_operatortype_find("CONSTRAINT_OT_move_to_index", false); + WM_operator_properties_create_ptr(&props_ptr, ot); + RNA_string_set(&props_ptr, "constraint", con->name); + RNA_int_set(&props_ptr, "index", new_index); + /* Set owner to #EDIT_CONSTRAINT_OWNER_OBJECT or #EDIT_CONSTRAINT_OWNER_BONE. */ + RNA_enum_set(&props_ptr, "owner", constraint_from_bone ? 1 : 0); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, nullptr); + WM_operator_properties_free(&props_ptr); +} + +/** + * Get the expand flag from the active constraint to use for the panel. + */ +static short get_constraint_expand_flag(const bContext * /*C*/, Panel *panel) +{ + PointerRNA *con_ptr = UI_panel_custom_data_get(panel); + bConstraint *con = (bConstraint *)con_ptr->data; + + return con->ui_expand_flag; +} + +/** + * Save the expand flag for the panel and sub-panels to the constraint. + */ +static void set_constraint_expand_flag(const bContext * /*C*/, Panel *panel, short expand_flag) +{ + PointerRNA *con_ptr = UI_panel_custom_data_get(panel); + bConstraint *con = (bConstraint *)con_ptr->data; + con->ui_expand_flag = expand_flag; +} + +/** + * Function with void * argument for #uiListPanelIDFromDataFunc. + * + * \note Constraint panel types are assumed to be named with the struct name field + * concatenated to the defined prefix. + */ +static void object_constraint_panel_id(void *md_link, char *r_idname) +{ + bConstraint *con = (bConstraint *)md_link; + const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); + + /* Cannot get TypeInfo for invalid/legacy constraints. */ + if (cti == nullptr) { + return; + } + BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_TYPE_PANEL_PREFIX, cti->struct_name); +} + +static void bone_constraint_panel_id(void *md_link, char *r_idname) +{ + bConstraint *con = (bConstraint *)md_link; + const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); + + /* Cannot get TypeInfo for invalid/legacy constraints. */ + if (cti == nullptr) { + return; + } + BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_BONE_TYPE_PANEL_PREFIX, cti->struct_name); +} + +void uiTemplateConstraints(uiLayout * /*layout*/, bContext *C, bool use_bone_constraints) +{ + ARegion *region = CTX_wm_region(C); + + Object *ob = blender::ed::object::context_active_object(C); + ListBase *constraints = {nullptr}; + if (use_bone_constraints) { + constraints = blender::ed::object::pose_constraint_list(C); + } + else if (ob != nullptr) { + constraints = &ob->constraints; + } + + /* Switch between the bone panel ID function and the object panel ID function. */ + uiListPanelIDFromDataFunc panel_id_func = use_bone_constraints ? bone_constraint_panel_id : + object_constraint_panel_id; + + const bool panels_match = UI_panel_list_matches_data(region, constraints, panel_id_func); + + if (!panels_match) { + UI_panels_free_instanced(C, region); + for (bConstraint *con = + (constraints == nullptr) ? nullptr : static_cast(constraints->first); + con; + con = con->next) + { + /* Don't show invalid/legacy constraints. */ + if (con->type == CONSTRAINT_TYPE_NULL) { + continue; + } + /* Don't show temporary constraints (AutoIK and target-less IK constraints). */ + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { + bKinematicConstraint *data = static_cast(con->data); + if (data->flag & CONSTRAINT_IK_TEMP) { + continue; + } + } + + char panel_idname[MAX_NAME]; + panel_id_func(con, panel_idname); + + /* Create custom data RNA pointer. */ + PointerRNA *con_ptr = MEM_new(__func__); + *con_ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); + + Panel *new_panel = UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, con_ptr); + + if (new_panel) { + /* Set the list panel functionality function pointers since we don't do it with python. */ + new_panel->type->set_list_data_expand_flag = set_constraint_expand_flag; + new_panel->type->get_list_data_expand_flag = get_constraint_expand_flag; + new_panel->type->reorder = constraint_reorder; + } + } + } + else { + /* Assuming there's only one group of instanced panels, update the custom data pointers. */ + Panel *panel = static_cast(region->panels.first); + LISTBASE_FOREACH (bConstraint *, con, constraints) { + /* Don't show invalid/legacy constraints. */ + if (con->type == CONSTRAINT_TYPE_NULL) { + continue; + } + /* Don't show temporary constraints (AutoIK and target-less IK constraints). */ + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { + bKinematicConstraint *data = static_cast(con->data); + if (data->flag & CONSTRAINT_IK_TEMP) { + continue; + } + } + + /* Move to the next instanced panel corresponding to the next constraint. */ + while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { + panel = panel->next; + BLI_assert(panel != nullptr); /* There shouldn't be fewer panels than constraint panels. */ + } + + PointerRNA *con_ptr = MEM_new(__func__); + *con_ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); + UI_panel_custom_data_set(panel, con_ptr); + + panel = panel->next; + } + } +} + +#undef CONSTRAINT_TYPE_PANEL_PREFIX +#undef CONSTRAINT_BONE_TYPE_PANEL_PREFIX + +/** \} */ diff --git a/source/blender/editors/interface/templates/interface_template_curve_mapping.cc b/source/blender/editors/interface/templates/interface_template_curve_mapping.cc new file mode 100644 index 000000000000..4c05f0918388 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_curve_mapping.cc @@ -0,0 +1,807 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_colortools.hh" +#include "BKE_context.hh" + +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "ED_screen.hh" +#include "ED_undo.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +using blender::StringRefNull; + +static bool curvemap_can_zoom_out(CurveMapping *cumap) +{ + return BLI_rctf_size_x(&cumap->curr) < BLI_rctf_size_x(&cumap->clipr); +} + +static bool curvemap_can_zoom_in(CurveMapping *cumap) +{ + return BLI_rctf_size_x(&cumap->curr) > CURVE_ZOOM_MAX * BLI_rctf_size_x(&cumap->clipr); +} + +static void curvemap_buttons_zoom_in(bContext *C, CurveMapping *cumap) +{ + if (curvemap_can_zoom_in(cumap)) { + const float dx = 0.1154f * BLI_rctf_size_x(&cumap->curr); + cumap->curr.xmin += dx; + cumap->curr.xmax -= dx; + const float dy = 0.1154f * BLI_rctf_size_y(&cumap->curr); + cumap->curr.ymin += dy; + cumap->curr.ymax -= dy; + } + + ED_region_tag_redraw(CTX_wm_region(C)); +} + +static void curvemap_buttons_zoom_out(bContext *C, CurveMapping *cumap) +{ + float d, d1; + + if (curvemap_can_zoom_out(cumap)) { + d = d1 = 0.15f * BLI_rctf_size_x(&cumap->curr); + + if (cumap->flag & CUMA_DO_CLIP) { + if (cumap->curr.xmin - d < cumap->clipr.xmin) { + d1 = cumap->curr.xmin - cumap->clipr.xmin; + } + } + cumap->curr.xmin -= d1; + + d1 = d; + if (cumap->flag & CUMA_DO_CLIP) { + if (cumap->curr.xmax + d > cumap->clipr.xmax) { + d1 = -cumap->curr.xmax + cumap->clipr.xmax; + } + } + cumap->curr.xmax += d1; + + d = d1 = 0.15f * BLI_rctf_size_y(&cumap->curr); + + if (cumap->flag & CUMA_DO_CLIP) { + if (cumap->curr.ymin - d < cumap->clipr.ymin) { + d1 = cumap->curr.ymin - cumap->clipr.ymin; + } + } + cumap->curr.ymin -= d1; + + d1 = d; + if (cumap->flag & CUMA_DO_CLIP) { + if (cumap->curr.ymax + d > cumap->clipr.ymax) { + d1 = -cumap->curr.ymax + cumap->clipr.ymax; + } + } + cumap->curr.ymax += d1; + } + + ED_region_tag_redraw(CTX_wm_region(C)); +} + +/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ +static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v) +{ + CurveMapping *cumap = static_cast(cumap_v); + uiBut *bt; + const float width = 8 * UI_UNIT_X; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); + + bt = uiDefButBitI(block, + UI_BTYPE_CHECKBOX, + CUMA_DO_CLIP, + 1, + IFACE_("Use Clipping"), + 0, + 5 * UI_UNIT_Y, + width, + UI_UNIT_Y, + &cumap->flag, + 0.0, + 0.0, + ""); + UI_but_func_set(bt, [cumap](bContext & /*C*/) { BKE_curvemapping_changed(cumap, false); }); + + UI_block_align_begin(block); + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + IFACE_("Min X:"), + 0, + 4 * UI_UNIT_Y, + width, + UI_UNIT_Y, + &cumap->clipr.xmin, + -100.0, + cumap->clipr.xmax, + ""); + UI_but_number_step_size_set(bt, 10); + UI_but_number_precision_set(bt, 2); + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + IFACE_("Min Y:"), + 0, + 3 * UI_UNIT_Y, + width, + UI_UNIT_Y, + &cumap->clipr.ymin, + -100.0, + cumap->clipr.ymax, + ""); + UI_but_number_step_size_set(bt, 10); + UI_but_number_precision_set(bt, 2); + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + IFACE_("Max X:"), + 0, + 2 * UI_UNIT_Y, + width, + UI_UNIT_Y, + &cumap->clipr.xmax, + cumap->clipr.xmin, + 100.0, + ""); + UI_but_number_step_size_set(bt, 10); + UI_but_number_precision_set(bt, 2); + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + IFACE_("Max Y:"), + 0, + UI_UNIT_Y, + width, + UI_UNIT_Y, + &cumap->clipr.ymax, + cumap->clipr.ymin, + 100.0, + ""); + UI_but_number_step_size_set(bt, 10); + UI_but_number_precision_set(bt, 2); + + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); + UI_block_direction_set(block, UI_DIR_DOWN); + + return block; +} + +static uiBlock *curvemap_tools_func( + bContext *C, ARegion *region, RNAUpdateCb &cb, bool show_extend, int reset_mode) +{ + PointerRNA cumap_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); + CurveMapping *cumap = static_cast(cumap_ptr.data); + + short yco = 0; + const short menuwidth = 10 * UI_UNIT_X; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Reset View"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [cumap](bContext &C) { + BKE_curvemapping_reset_view(cumap); + ED_region_tag_redraw(CTX_wm_region(&C)); + }); + } + + if (show_extend && !(cumap->flag & CUMA_USE_WRAPPING)) { + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Extend Horizontal"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [cumap, cb](bContext &C) { + cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE; + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + ED_undo_push(&C, "CurveMap tools"); + ED_region_tag_redraw(CTX_wm_region(&C)); + }); + } + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Extend Extrapolated"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [cumap, cb](bContext &C) { + cumap->flag |= CUMA_EXTEND_EXTRAPOLATE; + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + ED_undo_push(&C, "CurveMap tools"); + ED_region_tag_redraw(CTX_wm_region(&C)); + }); + } + } + + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Reset Curve"), + 0, + yco -= UI_UNIT_Y, + menuwidth, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [cumap, cb, reset_mode](bContext &C) { + CurveMap *cuma = cumap->cm + cumap->cur; + BKE_curvemap_reset(cuma, &cumap->clipr, cumap->preset, reset_mode); + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + ED_undo_push(&C, "CurveMap tools"); + ED_region_tag_redraw(CTX_wm_region(&C)); + }); + } + + UI_block_direction_set(block, UI_DIR_DOWN); + UI_block_bounds_set_text(block, 3.0f * UI_UNIT_X); + + return block; +} + +static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cb_v) +{ + return curvemap_tools_func( + C, region, *static_cast(cb_v), true, CURVEMAP_SLOPE_POSITIVE); +} + +static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cb_v) +{ + return curvemap_tools_func( + C, region, *static_cast(cb_v), true, CURVEMAP_SLOPE_NEGATIVE); +} + +static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cb_v) +{ + return curvemap_tools_func( + C, region, *static_cast(cb_v), false, CURVEMAP_SLOPE_POSITIVE); +} + +static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cb_v) +{ + return curvemap_tools_func( + C, region, *static_cast(cb_v), false, CURVEMAP_SLOPE_POSITIVE); +} + +static void curvemap_buttons_redraw(bContext &C) +{ + ED_region_tag_redraw(CTX_wm_region(&C)); +} + +/** + * \note Still unsure how this call evolves. + * + * \param labeltype: Used for defining which curve-channels to show. + */ +static void curvemap_buttons_layout(uiLayout *layout, + PointerRNA *ptr, + char labeltype, + bool levels, + bool brush, + bool neg_slope, + bool tone, + const RNAUpdateCb &cb) +{ + CurveMapping *cumap = static_cast(ptr->data); + CurveMap *cm = &cumap->cm[cumap->cur]; + uiBut *bt; + const float dx = UI_UNIT_X; + eButGradientType bg = UI_GRAD_NONE; + + uiBlock *block = uiLayoutGetBlock(layout); + + UI_block_emboss_set(block, UI_EMBOSS); + + if (tone) { + uiLayout *split = uiLayoutSplit(layout, 0.0f, false); + uiItemR(uiLayoutRow(split, false), ptr, "tone", UI_ITEM_R_EXPAND, std::nullopt, ICON_NONE); + } + + /* curve chooser */ + uiLayout *row = uiLayoutRow(layout, false); + + if (labeltype == 'v') { + /* vector */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); + + if (cumap->cm[0].curve) { + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[1].curve) { + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[2].curve) { + bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, ""); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + } + else if (labeltype == 'c' && cumap->tone != CURVE_TONE_FILMLIKE) { + /* color */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); + + if (cumap->cm[3].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "C"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 3.0, + TIP_("Combined channels")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[0].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "R"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 0.0, + TIP_("Red channel")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[1].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "G"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 1.0, + TIP_("Green channel")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[2].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "B"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 2.0, + TIP_("Blue channel")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + } + else if (labeltype == 'h') { + /* HSV */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); + + if (cumap->cm[0].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + IFACE_("H"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 0.0, + TIP_("Hue level")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[1].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + IFACE_("S"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 1.0, + TIP_("Saturation level")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + if (cumap->cm[2].curve) { + bt = uiDefButI(block, + UI_BTYPE_ROW, + 0, + IFACE_("V"), + 0, + 0, + dx, + dx, + &cumap->cur, + 0.0, + 2.0, + TIP_("Value level")); + UI_but_func_set(bt, curvemap_buttons_redraw); + } + } + else { + uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT); + } + + if (labeltype == 'h') { + bg = UI_GRAD_H; + } + + /* operation buttons */ + /* (Right aligned) */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + + if (!(cumap->flag & CUMA_USE_WRAPPING)) { + /* Zoom in */ + bt = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_ZOOM_IN, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Zoom in")); + UI_but_func_set(bt, [cumap](bContext &C) { curvemap_buttons_zoom_in(&C, cumap); }); + if (!curvemap_can_zoom_in(cumap)) { + UI_but_disable(bt, ""); + } + + /* Zoom out */ + bt = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_ZOOM_OUT, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Zoom out")); + UI_but_func_set(bt, [cumap](bContext &C) { curvemap_buttons_zoom_out(&C, cumap); }); + if (!curvemap_can_zoom_out(cumap)) { + UI_but_disable(bt, ""); + } + + /* Clipping button. */ + const int icon = (cumap->flag & CUMA_DO_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT; + bt = uiDefIconBlockBut( + block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options")); + bt->drawflag &= ~UI_BUT_ICON_LEFT; + UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); + } + + RNAUpdateCb *tools_cb = MEM_new(__func__, cb); + if (brush && neg_slope) { + bt = uiDefIconBlockBut(block, + curvemap_brush_tools_negslope_func, + tools_cb, + 0, + ICON_NONE, + 0, + 0, + dx, + dx, + TIP_("Tools")); + } + else if (brush) { + bt = uiDefIconBlockBut( + block, curvemap_brush_tools_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); + } + else if (neg_slope) { + bt = uiDefIconBlockBut( + block, curvemap_tools_negslope_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); + } + else { + bt = uiDefIconBlockBut( + block, curvemap_tools_posslope_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); + } + /* Pass ownership of `tools_cb` to the button. */ + UI_but_funcN_set( + bt, + [](bContext *, void *, void *) {}, + tools_cb, + nullptr, + but_func_argN_free, + but_func_argN_copy); + + UI_block_funcN_set(block, + rna_update_cb, + MEM_new(__func__, cb), + nullptr, + but_func_argN_free, + but_func_argN_copy); + + /* Curve itself. */ + const int size = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X); + row = uiLayoutRow(layout, false); + uiButCurveMapping *curve_but = (uiButCurveMapping *)uiDefBut( + block, UI_BTYPE_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, ""); + curve_but->gradient_type = bg; + + /* Sliders for selected curve point. */ + int i; + CurveMapPoint *cmp = nullptr; + bool point_last_or_first = false; + for (i = 0; i < cm->totpoint; i++) { + if (cm->curve[i].flag & CUMA_SELECT) { + cmp = &cm->curve[i]; + break; + } + } + if (ELEM(i, 0, cm->totpoint - 1)) { + point_last_or_first = true; + } + + if (cmp) { + rctf bounds; + if (cumap->flag & CUMA_DO_CLIP) { + bounds = cumap->clipr; + } + else { + bounds.xmin = bounds.ymin = -1000.0; + bounds.xmax = bounds.ymax = 1000.0; + } + + UI_block_emboss_set(block, UI_EMBOSS); + + uiLayoutRow(layout, true); + + /* Curve handle buttons. */ + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 1, + ICON_HANDLE_AUTO, + 0, + UI_UNIT_Y, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + TIP_("Auto Handle")); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + CurveMap *cuma = cumap->cm + cumap->cur; + BKE_curvemap_handle_set(cuma, HD_AUTO); + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + }); + if (((cmp->flag & CUMA_HANDLE_AUTO_ANIM) == false) && + ((cmp->flag & CUMA_HANDLE_VECTOR) == false)) + { + bt->flag |= UI_SELECT_DRAW; + } + + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 1, + ICON_HANDLE_VECTOR, + 0, + UI_UNIT_Y, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + TIP_("Vector Handle")); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + CurveMap *cuma = cumap->cm + cumap->cur; + BKE_curvemap_handle_set(cuma, HD_VECT); + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + }); + if (cmp->flag & CUMA_HANDLE_VECTOR) { + bt->flag |= UI_SELECT_DRAW; + } + + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 1, + ICON_HANDLE_AUTOCLAMPED, + 0, + UI_UNIT_Y, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + TIP_("Auto Clamped")); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + CurveMap *cuma = cumap->cm + cumap->cur; + BKE_curvemap_handle_set(cuma, HD_AUTO_ANIM); + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + }); + if (cmp->flag & CUMA_HANDLE_AUTO_ANIM) { + bt->flag |= UI_SELECT_DRAW; + } + + /* Curve handle position */ + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + "X:", + 0, + 2 * UI_UNIT_Y, + UI_UNIT_X * 10, + UI_UNIT_Y, + &cmp->x, + bounds.xmin, + bounds.xmax, + ""); + UI_but_number_step_size_set(bt, 1); + UI_but_number_precision_set(bt, 5); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + BKE_curvemapping_changed(cumap, true); + rna_update_cb(C, cb); + }); + + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + "Y:", + 0, + 1 * UI_UNIT_Y, + UI_UNIT_X * 10, + UI_UNIT_Y, + &cmp->y, + bounds.ymin, + bounds.ymax, + ""); + UI_but_number_step_size_set(bt, 1); + UI_but_number_precision_set(bt, 5); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + BKE_curvemapping_changed(cumap, true); + rna_update_cb(C, cb); + }); + + /* Curve handle delete point */ + bt = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Delete points")); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + BKE_curvemap_remove(cumap->cm + cumap->cur, SELECT); + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + }); + if (point_last_or_first) { + UI_but_flag_enable(bt, UI_BUT_DISABLED); + } + } + + /* black/white levels */ + if (levels) { + uiLayout *split = uiLayoutSplit(layout, 0.0f, false); + uiItemR(uiLayoutColumn(split, false), + ptr, + "black_level", + UI_ITEM_R_EXPAND, + std::nullopt, + ICON_NONE); + uiItemR(uiLayoutColumn(split, false), + ptr, + "white_level", + UI_ITEM_R_EXPAND, + std::nullopt, + ICON_NONE); + + uiLayoutRow(layout, false); + bt = uiDefBut(block, + UI_BTYPE_BUT, + 0, + IFACE_("Reset"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + TIP_("Reset Black/White point and curves")); + UI_but_func_set(bt, [cumap, cb](bContext &C) { + cumap->preset = CURVE_PRESET_LINE; + for (int a = 0; a < CM_TOT; a++) { + BKE_curvemap_reset(cumap->cm + a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); + } + + cumap->black[0] = cumap->black[1] = cumap->black[2] = 0.0f; + cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f; + BKE_curvemapping_set_black_white(cumap, nullptr, nullptr); + + BKE_curvemapping_changed(cumap, false); + rna_update_cb(C, cb); + }); + } + + UI_block_funcN_set(block, nullptr, nullptr, nullptr); +} + +void uiTemplateCurveMapping(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + int type, + bool levels, + bool brush, + bool neg_slope, + bool tone) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + uiBlock *block = uiLayoutGetBlock(layout); + + if (!prop) { + RNA_warning( + "curve property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + if (RNA_property_type(prop) != PROP_POINTER) { + RNA_warning( + "curve is not a pointer: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping)) { + return; + } + + ID *id = cptr.owner_id; + UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); + + curvemap_buttons_layout( + layout, &cptr, type, levels, brush, neg_slope, tone, RNAUpdateCb{*ptr, prop}); + + UI_block_lock_clear(block); +} diff --git a/source/blender/editors/interface/templates/interface_template_curve_profile.cc b/source/blender/editors/interface/templates/interface_template_curve_profile.cc new file mode 100644 index 000000000000..e2590e16de9a --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_curve_profile.cc @@ -0,0 +1,545 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_context.hh" +#include "BKE_curveprofile.h" + +#include "BLI_rect.h" +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "ED_screen.hh" +#include "ED_undo.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +using blender::StringRef; +using blender::StringRefNull; + +static uiBlock *curve_profile_presets_fn(bContext *C, ARegion *region, void *cb_v) +{ + RNAUpdateCb &cb = *static_cast(cb_v); + PointerRNA profile_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); + CurveProfile *profile = static_cast(profile_ptr.data); + short yco = 0; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + + for (const auto &item : + {std::pair(IFACE_("Default"), PROF_PRESET_LINE), + std::pair(IFACE_("Support Loops"), PROF_PRESET_SUPPORTS), + std::pair(IFACE_("Cornice Molding"), PROF_PRESET_CORNICE), + std::pair(IFACE_("Crown Molding"), PROF_PRESET_CROWN), + std::pair(IFACE_("Steps"), PROF_PRESET_STEPS)}) + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + item.first, + 0, + yco -= UI_UNIT_Y, + 0, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + const eCurveProfilePresets preset = item.second; + UI_but_func_set(but, [profile, cb, preset](bContext &C) { + profile->preset = preset; + BKE_curveprofile_reset(profile); + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + ED_undo_push(&C, "Reset Curve Profile"); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + + UI_block_direction_set(block, UI_DIR_DOWN); + UI_block_bounds_set_text(block, int(3.0f * UI_UNIT_X)); + + return block; +} + +static uiBlock *curve_profile_tools_fn(bContext *C, ARegion *region, void *cb_v) +{ + RNAUpdateCb &cb = *static_cast(cb_v); + PointerRNA profile_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); + CurveProfile *profile = static_cast(profile_ptr.data); + short yco = 0; + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Reset View"), + 0, + yco -= UI_UNIT_Y, + 0, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [profile](bContext &C) { + BKE_curveprofile_reset_view(profile); + ED_region_tag_redraw(CTX_wm_region(&C)); + }); + } + { + uiBut *but = uiDefIconTextBut(block, + UI_BTYPE_BUT_MENU, + 1, + ICON_BLANK1, + IFACE_("Reset Curve"), + 0, + yco -= UI_UNIT_Y, + 0, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + ""); + UI_but_func_set(but, [profile, cb](bContext &C) { + BKE_curveprofile_reset(profile); + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + ED_undo_push(&C, "Reset Profile"); + ED_region_tag_redraw(CTX_wm_region(&C)); + rna_update_cb(C, cb); + }); + } + + UI_block_direction_set(block, UI_DIR_DOWN); + UI_block_bounds_set_text(block, int(3.0f * UI_UNIT_X)); + + return block; +} + +static bool curve_profile_can_zoom_in(CurveProfile *profile) +{ + return BLI_rctf_size_x(&profile->view_rect) > + CURVE_ZOOM_MAX * BLI_rctf_size_x(&profile->clip_rect); +} + +static bool curve_profile_can_zoom_out(CurveProfile *profile) +{ + return BLI_rctf_size_x(&profile->view_rect) < BLI_rctf_size_x(&profile->clip_rect); +} + +static void curve_profile_zoom_in(bContext *C, CurveProfile *profile) +{ + if (curve_profile_can_zoom_in(profile)) { + const float dx = 0.1154f * BLI_rctf_size_x(&profile->view_rect); + profile->view_rect.xmin += dx; + profile->view_rect.xmax -= dx; + const float dy = 0.1154f * BLI_rctf_size_y(&profile->view_rect); + profile->view_rect.ymin += dy; + profile->view_rect.ymax -= dy; + } + + ED_region_tag_redraw(CTX_wm_region(C)); +} + +static void curve_profile_zoom_out(bContext *C, CurveProfile *profile) +{ + if (curve_profile_can_zoom_out(profile)) { + float d = 0.15f * BLI_rctf_size_x(&profile->view_rect); + float d1 = d; + + if (profile->flag & PROF_USE_CLIP) { + if (profile->view_rect.xmin - d < profile->clip_rect.xmin) { + d1 = profile->view_rect.xmin - profile->clip_rect.xmin; + } + } + profile->view_rect.xmin -= d1; + + d1 = d; + if (profile->flag & PROF_USE_CLIP) { + if (profile->view_rect.xmax + d > profile->clip_rect.xmax) { + d1 = -profile->view_rect.xmax + profile->clip_rect.xmax; + } + } + profile->view_rect.xmax += d1; + + d = d1 = 0.15f * BLI_rctf_size_y(&profile->view_rect); + + if (profile->flag & PROF_USE_CLIP) { + if (profile->view_rect.ymin - d < profile->clip_rect.ymin) { + d1 = profile->view_rect.ymin - profile->clip_rect.ymin; + } + } + profile->view_rect.ymin -= d1; + + d1 = d; + if (profile->flag & PROF_USE_CLIP) { + if (profile->view_rect.ymax + d > profile->clip_rect.ymax) { + d1 = -profile->view_rect.ymax + profile->clip_rect.ymax; + } + } + profile->view_rect.ymax += d1; + } + + ED_region_tag_redraw(CTX_wm_region(C)); +} + +static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const RNAUpdateCb &cb) +{ + CurveProfile *profile = static_cast(ptr->data); + uiBut *bt; + + uiBlock *block = uiLayoutGetBlock(layout); + + UI_block_emboss_set(block, UI_EMBOSS); + + uiLayoutSetPropSep(layout, false); + + /* Preset selector */ + /* There is probably potential to use simpler "uiItemR" functions here, but automatic updating + * after a preset is selected would be more complicated. */ + uiLayout *row = uiLayoutRow(layout, true); + RNAUpdateCb *presets_cb = MEM_new(__func__, cb); + bt = uiDefBlockBut(block, + curve_profile_presets_fn, + presets_cb, + IFACE_("Preset"), + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + ""); + /* Pass ownership of `presets_cb` to the button. */ + UI_but_funcN_set( + bt, + [](bContext *, void *, void *) {}, + presets_cb, + nullptr, + but_func_argN_free, + but_func_argN_copy); + + /* Show a "re-apply" preset button when it has been changed from the preset. */ + if (profile->flag & PROF_DIRTY_PRESET) { + /* Only for dynamic presets. */ + if (ELEM(profile->preset, PROF_PRESET_STEPS, PROF_PRESET_SUPPORTS)) { + bt = uiDefIconTextBut(block, + UI_BTYPE_BUT, + 0, + ICON_NONE, + IFACE_("Apply Preset"), + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Reapply and update the preset, removing changes")); + UI_but_func_set(bt, [profile, cb](bContext &C) { + BKE_curveprofile_reset(profile); + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + rna_update_cb(C, cb); + }); + } + } + + row = uiLayoutRow(layout, false); + + /* (Left aligned) */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); + + /* Zoom in */ + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_ZOOM_IN, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Zoom in")); + UI_but_func_set(bt, [profile](bContext &C) { curve_profile_zoom_in(&C, profile); }); + if (!curve_profile_can_zoom_in(profile)) { + UI_but_disable(bt, ""); + } + + /* Zoom out */ + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_ZOOM_OUT, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Zoom out")); + UI_but_func_set(bt, [profile](bContext &C) { curve_profile_zoom_out(&C, profile); }); + if (!curve_profile_can_zoom_out(profile)) { + UI_but_disable(bt, ""); + } + + /* (Right aligned) */ + sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + + /* Flip path */ + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_ARROW_LEFTRIGHT, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Reverse Path")); + UI_but_func_set(bt, [profile, cb](bContext &C) { + BKE_curveprofile_reverse(profile); + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + rna_update_cb(C, cb); + }); + + /* Clipping toggle */ + const int icon = (profile->flag & PROF_USE_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT; + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + icon, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Toggle Profile Clipping")); + UI_but_func_set(bt, [profile, cb](bContext &C) { + profile->flag ^= PROF_USE_CLIP; + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + rna_update_cb(C, cb); + }); + + /* Reset view, reset curve */ + RNAUpdateCb *tools_cb = MEM_new(__func__, cb); + bt = uiDefIconBlockBut(block, + curve_profile_tools_fn, + tools_cb, + 0, + ICON_NONE, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + TIP_("Tools")); + /* Pass ownership of `presets_cb` to the button. */ + UI_but_funcN_set( + bt, + [](bContext *, void *, void *) {}, + tools_cb, + nullptr, + but_func_argN_free, + but_func_argN_copy); + + UI_block_funcN_set(block, + rna_update_cb, + MEM_new(__func__, cb), + nullptr, + but_func_argN_free, + but_func_argN_copy); + + /* The path itself */ + int path_width = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X); + path_width = min_ii(path_width, int(16.0f * UI_UNIT_X)); + const int path_height = path_width; + uiLayoutRow(layout, false); + uiDefBut(block, + UI_BTYPE_CURVEPROFILE, + 0, + "", + 0, + 0, + short(path_width), + short(path_height), + profile, + 0.0f, + 1.0f, + ""); + + /* Position sliders for (first) selected point */ + int i; + float *selection_x, *selection_y; + bool point_last_or_first = false; + CurveProfilePoint *point = nullptr; + for (i = 0; i < profile->path_len; i++) { + if (profile->path[i].flag & PROF_SELECT) { + point = &profile->path[i]; + selection_x = &point->x; + selection_y = &point->y; + break; + } + if (profile->path[i].flag & PROF_H1_SELECT) { + point = &profile->path[i]; + selection_x = &point->h1_loc[0]; + selection_y = &point->h1_loc[1]; + } + else if (profile->path[i].flag & PROF_H2_SELECT) { + point = &profile->path[i]; + selection_x = &point->h2_loc[0]; + selection_y = &point->h2_loc[1]; + } + } + if (ELEM(i, 0, profile->path_len - 1)) { + point_last_or_first = true; + } + + /* Selected point data */ + rctf bounds; + if (point) { + if (profile->flag & PROF_USE_CLIP) { + bounds = profile->clip_rect; + } + else { + bounds.xmin = bounds.ymin = -1000.0; + bounds.xmax = bounds.ymax = 1000.0; + } + + row = uiLayoutRow(layout, true); + + PointerRNA point_ptr = RNA_pointer_create(ptr->owner_id, &RNA_CurveProfilePoint, point); + PropertyRNA *prop_handle_type = RNA_struct_find_property(&point_ptr, "handle_type_1"); + uiItemFullR(row, + &point_ptr, + prop_handle_type, + RNA_NO_INDEX, + 0, + UI_ITEM_R_EXPAND | UI_ITEM_R_ICON_ONLY, + "", + ICON_NONE); + + /* Position */ + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + "X:", + 0, + 2 * UI_UNIT_Y, + UI_UNIT_X * 10, + UI_UNIT_Y, + selection_x, + bounds.xmin, + bounds.xmax, + ""); + UI_but_number_step_size_set(bt, 1); + UI_but_number_precision_set(bt, 5); + UI_but_func_set(bt, [profile, cb](bContext &C) { + BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); + rna_update_cb(C, cb); + }); + if (point_last_or_first) { + UI_but_flag_enable(bt, UI_BUT_DISABLED); + } + bt = uiDefButF(block, + UI_BTYPE_NUM, + 0, + "Y:", + 0, + 1 * UI_UNIT_Y, + UI_UNIT_X * 10, + UI_UNIT_Y, + selection_y, + bounds.ymin, + bounds.ymax, + ""); + UI_but_number_step_size_set(bt, 1); + UI_but_number_precision_set(bt, 5); + UI_but_func_set(bt, [profile, cb](bContext &C) { + BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); + rna_update_cb(C, cb); + }); + if (point_last_or_first) { + UI_but_flag_enable(bt, UI_BUT_DISABLED); + } + + /* Delete points */ + bt = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_X, + 0, + 0, + UI_UNIT_X, + UI_UNIT_X, + nullptr, + 0.0, + 0.0, + TIP_("Delete points")); + UI_but_func_set(bt, [profile, cb](bContext &C) { + BKE_curveprofile_remove_by_flag(profile, SELECT); + BKE_curveprofile_update(profile, PROF_UPDATE_NONE); + rna_update_cb(C, cb); + }); + if (point_last_or_first) { + UI_but_flag_enable(bt, UI_BUT_DISABLED); + } + } + + uiItemR(layout, ptr, "use_sample_straight_edges", UI_ITEM_NONE, std::nullopt, ICON_NONE); + uiItemR(layout, ptr, "use_sample_even_lengths", UI_ITEM_NONE, std::nullopt, ICON_NONE); + + UI_block_funcN_set(block, nullptr, nullptr, nullptr); +} + +void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + uiBlock *block = uiLayoutGetBlock(layout); + + if (!prop) { + RNA_warning("Curve Profile property not found: %s.%s", + RNA_struct_identifier(ptr->type), + propname.c_str()); + return; + } + + if (RNA_property_type(prop) != PROP_POINTER) { + RNA_warning("Curve Profile is not a pointer: %s.%s", + RNA_struct_identifier(ptr->type), + propname.c_str()); + return; + } + + PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveProfile)) { + return; + } + + ID *id = cptr.owner_id; + UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); + + CurveProfile_buttons_layout(layout, &cptr, RNAUpdateCb{*ptr, prop}); + + UI_block_lock_clear(block); +} diff --git a/source/blender/editors/interface/templates/interface_template_event.cc b/source/blender/editors/interface/templates/interface_template_event.cc new file mode 100644 index 000000000000..a3f1d9d5b827 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_event.cc @@ -0,0 +1,157 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string_ref.hh" + +#include "BLT_translation.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRefNull; + +static const wmKeyMapItem *keymap_item_from_enum_item(const wmKeyMap *keymap, + const EnumPropertyItem *item) +{ + if (item == nullptr) { + return nullptr; + } + + for (wmKeyMapItem *kmi = static_cast(keymap->items.first); kmi; kmi = kmi->next) + { + if (kmi->propvalue == item->value) { + return kmi; + } + } + + return nullptr; +} + +static bool keymap_item_can_collapse(const wmKeyMapItem *kmi_a, const wmKeyMapItem *kmi_b) +{ + return (kmi_a->shift == kmi_b->shift && kmi_a->ctrl == kmi_b->ctrl && kmi_a->alt == kmi_b->alt && + kmi_a->oskey == kmi_b->oskey); +} + +int uiTemplateStatusBarModalItem(uiLayout *layout, + const wmKeyMap *keymap, + const EnumPropertyItem *item) +{ + const wmKeyMapItem *kmi = keymap_item_from_enum_item(keymap, item); + if (kmi == nullptr) { + return 0; + } + + if (kmi->val == KM_RELEASE) { + /* Assume release events just disable something which was toggled on. */ + return 1; + } + + /* Try to merge some known XYZ items to save horizontal space. */ + const EnumPropertyItem *item_y = (item[1].identifier) ? item + 1 : nullptr; + const EnumPropertyItem *item_z = (item_y && item[2].identifier) ? item + 2 : nullptr; + const wmKeyMapItem *kmi_y = keymap_item_from_enum_item(keymap, item_y); + const wmKeyMapItem *kmi_z = keymap_item_from_enum_item(keymap, item_z); + + if (kmi_y && kmi_z && keymap_item_can_collapse(kmi, kmi_y) && + keymap_item_can_collapse(kmi_y, kmi_z)) + { + const char *xyz_label = nullptr; + + if (STREQ(item->identifier, "AXIS_X") && STREQ(item_y->identifier, "AXIS_Y") && + STREQ(item_z->identifier, "AXIS_Z")) + { + xyz_label = IFACE_("Axis"); + } + else if (STREQ(item->identifier, "PLANE_X") && STREQ(item_y->identifier, "PLANE_Y") && + STREQ(item_z->identifier, "PLANE_Z")) + { + xyz_label = IFACE_("Plane"); + } + + if (xyz_label) { + int icon_mod[4] = {0}; +#ifdef WITH_HEADLESS + int icon = 0; +#else + int icon = UI_icon_from_keymap_item(kmi, icon_mod); +#endif + for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) { + uiItemL(layout, "", icon_mod[j]); + } + uiItemL(layout, "", icon); + +#ifndef WITH_HEADLESS + icon = UI_icon_from_keymap_item(kmi_y, icon_mod); +#endif + uiItemL(layout, "", icon); + +#ifndef WITH_HEADLESS + icon = UI_icon_from_keymap_item(kmi_z, icon_mod); +#endif + uiItemL(layout, "", icon); + uiItemL(layout, xyz_label, ICON_NONE); + uiItemS_ex(layout, 0.7f); + return 3; + } + } + + /* Single item without merging. */ + return uiTemplateEventFromKeymapItem(layout, item->name, kmi, false) ? 1 : 0; +} + +bool uiTemplateEventFromKeymapItem(uiLayout *layout, + const StringRefNull text, + const wmKeyMapItem *kmi, + bool text_fallback) +{ + bool ok = false; + + int icon_mod[4]; +#ifdef WITH_HEADLESS + int icon = 0; +#else + const int icon = UI_icon_from_keymap_item(kmi, icon_mod); +#endif + if (icon != 0) { + for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) { + uiItemL(layout, "", icon_mod[j]); + const float offset = ui_event_icon_offset(icon_mod[j]); + if (offset != 0.0f) { + uiItemS_ex(layout, offset); + } + } + + /* Icon and text separately is closer together with aligned layout. */ + + uiItemL(layout, "", icon); + if (icon >= ICON_MOUSE_LMB && icon <= ICON_MOUSE_MMB_SCROLL) { + /* Negative space after narrow mice icons. */ + uiItemS_ex(layout, -0.5f); + } + + const float offset = ui_event_icon_offset(icon); + if (offset != 0.0f) { + uiItemS_ex(layout, offset); + } + + uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text.c_str()), ICON_NONE); + uiItemS_ex(layout, 0.7f); + ok = true; + } + else if (text_fallback) { + const char *event_text = WM_key_event_string(kmi->type, true); + uiItemL(layout, event_text, ICON_NONE); + uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text.c_str()), ICON_NONE); + uiItemS_ex(layout, 0.5f); + ok = true; + } + return ok; +} diff --git a/source/blender/editors/interface/templates/interface_template_icon.cc b/source/blender/editors/interface/templates/interface_template_icon.cc new file mode 100644 index 000000000000..f85831758944 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_icon.cc @@ -0,0 +1,169 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string_ref.hh" + +#include "RNA_access.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRefNull; + +struct IconViewMenuArgs { + PointerRNA ptr; + PropertyRNA *prop; + bool show_labels; + float icon_scale; +}; + +/* ID Search browse menu, open */ +static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_litem) +{ + static IconViewMenuArgs args; + + /* arg_litem is malloced, can be freed by parent button */ + args = *((IconViewMenuArgs *)arg_litem); + const int w = UI_UNIT_X * (args.icon_scale); + const int h = UI_UNIT_X * (args.icon_scale + args.show_labels); + + uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN); + UI_block_flag_enable(block, UI_BLOCK_LOOP); + UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); + + bool free; + const EnumPropertyItem *item; + RNA_property_enum_items(C, &args.ptr, args.prop, &item, nullptr, &free); + + for (int a = 0; item[a].identifier; a++) { + const int x = (a % 8) * w; + const int y = -(a / 8) * h; + + const int icon = item[a].icon; + const int value = item[a].value; + uiBut *but; + if (args.show_labels) { + but = uiDefIconTextButR_prop(block, + UI_BTYPE_ROW, + 0, + icon, + item[a].name, + x, + y, + w, + h, + &args.ptr, + args.prop, + -1, + 0, + value, + nullptr); + } + else { + but = uiDefIconButR_prop( + block, UI_BTYPE_ROW, 0, icon, x, y, w, h, &args.ptr, args.prop, -1, 0, value, nullptr); + } + ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); + } + + UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); + UI_block_direction_set(block, UI_DIR_DOWN); + + if (free) { + MEM_freeN((void *)item); + } + + return block; +} + +void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale) +{ + uiBlock *block = uiLayoutAbsoluteBlock(layout); + uiBut *but = uiDefIconBut(block, + UI_BTYPE_LABEL, + 0, + ICON_X, + 0, + 0, + UI_UNIT_X * icon_scale, + UI_UNIT_Y * icon_scale, + nullptr, + 0.0, + 0.0, + ""); + ui_def_but_icon(but, icon_value, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); +} + +void uiTemplateIconView(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + bool show_labels, + float icon_scale, + float icon_scale_popup) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_ENUM) { + RNA_warning("property of type Enum not found: %s.%s", + RNA_struct_identifier(ptr->type), + propname.c_str()); + return; + } + + uiBlock *block = uiLayoutAbsoluteBlock(layout); + + int tot_items; + bool free_items; + const EnumPropertyItem *items; + RNA_property_enum_items( + static_cast(block->evil_C), ptr, prop, &items, &tot_items, &free_items); + const int value = RNA_property_enum_get(ptr, prop); + int icon = ICON_NONE; + RNA_enum_icon_from_value(items, value, &icon); + + uiBut *but; + if (RNA_property_editable(ptr, prop)) { + IconViewMenuArgs *cb_args = MEM_new(__func__); + cb_args->ptr = *ptr; + cb_args->prop = prop; + cb_args->show_labels = show_labels; + cb_args->icon_scale = icon_scale_popup; + + but = uiDefBlockButN(block, + ui_icon_view_menu_cb, + cb_args, + "", + 0, + 0, + UI_UNIT_X * icon_scale, + UI_UNIT_Y * icon_scale, + "", + but_func_argN_free, + but_func_argN_copy); + } + else { + but = uiDefIconBut(block, + UI_BTYPE_LABEL, + 0, + ICON_X, + 0, + 0, + UI_UNIT_X * icon_scale, + UI_UNIT_Y * icon_scale, + nullptr, + 0.0, + 0.0, + ""); + } + + ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); + + if (free_items) { + MEM_freeN((void *)items); + } +} diff --git a/source/blender/editors/interface/templates/interface_template_id.cc b/source/blender/editors/interface/templates/interface_template_id.cc new file mode 100644 index 000000000000..ab8196c1a0bf --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_id.cc @@ -0,0 +1,1816 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_anim_data.hh" +#include "BKE_collection.hh" +#include "BKE_context.hh" +#include "BKE_idtype.hh" +#include "BKE_layer.hh" +#include "BKE_lib_id.hh" +#include "BKE_lib_override.hh" +#include "BKE_main.hh" +#include "BKE_packedFile.hh" + +#include "BLI_string.h" +#include "BLI_string_search.hh" + +#include "BLT_translation.hh" + +#include "DEG_depsgraph_query.hh" + +#include "DNA_collection_types.h" +#include "DNA_scene_types.h" +#include "DNA_workspace_types.h" + +#include "ED_id_management.hh" +#include "ED_node.hh" +#include "ED_object.hh" +#include "ED_undo.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "UI_string_search.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +using blender::StringRef; +using blender::StringRefNull; + +struct TemplateID { + PointerRNA ptr = {}; + PropertyRNA *prop = nullptr; + + ListBase *idlb = nullptr; + short idcode = 0; + short filter = 0; + int prv_rows = 0; + int prv_cols = 0; + bool preview = false; + float scale = 0.0f; +}; + +/* Search browse menu, assign. */ +static void template_ID_set_property_exec_fn(bContext *C, void *arg_template, void *item) +{ + TemplateID *template_ui = (TemplateID *)arg_template; + + /* ID */ + if (item) { + PointerRNA idptr = RNA_id_pointer_create(static_cast(item)); + RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); + RNA_property_update(C, &template_ui->ptr, template_ui->prop); + } +} + +static bool id_search_allows_id(TemplateID *template_ui, const int flag, ID *id, const char *query) +{ + ID *id_from = template_ui->ptr.owner_id; + + /* Do self check. */ + if ((flag & PROP_ID_SELF_CHECK) && id == id_from) { + return false; + } + + /* Use filter. */ + if (RNA_property_type(template_ui->prop) == PROP_POINTER) { + PointerRNA ptr = RNA_id_pointer_create(id); + if (RNA_property_pointer_poll(&template_ui->ptr, template_ui->prop, &ptr) == 0) { + return false; + } + } + + /* Hide dot prefixed data-blocks, but only if filter does not force them visible. */ + if (U.uiflag & USER_HIDE_DOT) { + if ((id->name[2] == '.') && (query[0] != '.')) { + return false; + } + } + + return true; +} + +static bool id_search_add(const bContext *C, TemplateID *template_ui, uiSearchItems *items, ID *id) +{ + /* +1 is needed because BKE_id_ui_prefix used 3 letter prefix + * followed by ID_NAME-2 characters from id->name + */ + char name_ui[MAX_ID_FULL_NAME_UI]; + int iconid = ui_id_icon_get(C, id, template_ui->preview); + const bool use_lib_prefix = template_ui->preview || iconid; + const bool has_sep_char = ID_IS_LINKED(id); + + /* When using previews, the library hint (linked, overridden, missing) is added with a + * character prefix, otherwise we can use a icon. */ + int name_prefix_offset; + BKE_id_full_name_ui_prefix_get(name_ui, id, use_lib_prefix, UI_SEP_CHAR, &name_prefix_offset); + if (!use_lib_prefix) { + iconid = UI_icon_from_library(id); + } + + if (!UI_search_item_add(items, + name_ui, + id, + iconid, + has_sep_char ? int(UI_BUT_HAS_SEP_CHAR) : 0, + name_prefix_offset)) + { + return false; + } + + return true; +} + +/* ID Search browse menu, do the search */ +static void id_search_cb(const bContext *C, + void *arg_template, + const char *str, + uiSearchItems *items, + const bool /*is_first*/) +{ + TemplateID *template_ui = (TemplateID *)arg_template; + ListBase *lb = template_ui->idlb; + const int flag = RNA_property_flag(template_ui->prop); + + blender::ui::string_search::StringSearch search; + + /* ID listbase */ + LISTBASE_FOREACH (ID *, id, lb) { + if (id_search_allows_id(template_ui, flag, id, str)) { + search.add(id->name + 2, id); + } + } + + const blender::Vector filtered_ids = search.query(str); + + for (ID *id : filtered_ids) { + if (!id_search_add(C, template_ui, items, id)) { + break; + } + } +} + +/** + * Use id tags for filtering. + */ +static void id_search_cb_tagged(const bContext *C, + void *arg_template, + const char *str, + uiSearchItems *items) +{ + TemplateID *template_ui = (TemplateID *)arg_template; + ListBase *lb = template_ui->idlb; + const int flag = RNA_property_flag(template_ui->prop); + + blender::string_search::StringSearch search{nullptr, + blender::string_search::MainWordsHeuristic::All}; + + /* ID listbase */ + LISTBASE_FOREACH (ID *, id, lb) { + if (id->tag & ID_TAG_DOIT) { + if (id_search_allows_id(template_ui, flag, id, str)) { + search.add(id->name + 2, id); + } + id->tag &= ~ID_TAG_DOIT; + } + } + + blender::Vector filtered_ids = search.query(str); + + for (ID *id : filtered_ids) { + if (!id_search_add(C, template_ui, items, id)) { + break; + } + } +} + +/** + * A version of 'id_search_cb' that lists scene objects. + */ +static void id_search_cb_objects_from_scene(const bContext *C, + void *arg_template, + const char *str, + uiSearchItems *items, + const bool /*is_first*/) +{ + TemplateID *template_ui = (TemplateID *)arg_template; + ListBase *lb = template_ui->idlb; + Scene *scene = nullptr; + ID *id_from = template_ui->ptr.owner_id; + + if (id_from && GS(id_from->name) == ID_SCE) { + scene = (Scene *)id_from; + } + else { + scene = CTX_data_scene(C); + } + + BKE_main_id_flag_listbase(lb, ID_TAG_DOIT, false); + + FOREACH_SCENE_OBJECT_BEGIN (scene, ob_iter) { + ob_iter->id.tag |= ID_TAG_DOIT; + } + FOREACH_SCENE_OBJECT_END; + id_search_cb_tagged(C, arg_template, str, items); +} + +static ARegion *template_ID_search_menu_item_tooltip( + bContext *C, ARegion *region, const rcti *item_rect, void * /*arg*/, void *active) +{ + ID *active_id = static_cast(active); + return UI_tooltip_create_from_search_item_generic(C, region, item_rect, active_id); +} + +/* ID Search browse menu, open */ +static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) +{ + static TemplateID template_ui; + PointerRNA active_item_ptr; + void (*id_search_update_fn)( + const bContext *, void *, const char *, uiSearchItems *, const bool) = id_search_cb; + + /* arg_litem is malloced, can be freed by parent button */ + template_ui = *((TemplateID *)arg_litem); + active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); + + if (template_ui.filter) { + /* Currently only used for objects. */ + if (template_ui.idcode == ID_OB) { + if (template_ui.filter == UI_TEMPLATE_ID_FILTER_AVAILABLE) { + id_search_update_fn = id_search_cb_objects_from_scene; + } + } + } + + return template_common_search_menu(C, + region, + id_search_update_fn, + &template_ui, + template_ID_set_property_exec_fn, + active_item_ptr.data, + template_ID_search_menu_item_tooltip, + template_ui.prv_rows, + template_ui.prv_cols, + template_ui.scale); +} + +static void template_id_cb(bContext *C, void *arg_litem, void *arg_event); + +void UI_context_active_but_prop_get_templateID(const bContext *C, + PointerRNA *r_ptr, + PropertyRNA **r_prop) +{ + uiBut *but = UI_context_active_but_get(C); + + *r_ptr = {}; + *r_prop = nullptr; + + if (but && (but->funcN == template_id_cb) && but->func_argN) { + TemplateID *template_ui = static_cast(but->func_argN); + *r_ptr = template_ui->ptr; + *r_prop = template_ui->prop; + } +} + +static void template_id_liboverride_hierarchy_collection_root_find_recursive( + Collection *collection, + const int parent_level, + Collection **r_collection_parent_best, + int *r_parent_level_best) +{ + if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY_REAL(collection)) { + return; + } + if (ID_IS_OVERRIDABLE_LIBRARY(collection) || ID_IS_OVERRIDE_LIBRARY_REAL(collection)) { + if (parent_level > *r_parent_level_best) { + *r_parent_level_best = parent_level; + *r_collection_parent_best = collection; + } + } + for (CollectionParent *iter = static_cast(collection->runtime.parents.first); + iter != nullptr; + iter = iter->next) + { + if (iter->collection->id.lib != collection->id.lib && ID_IS_LINKED(iter->collection)) { + continue; + } + template_id_liboverride_hierarchy_collection_root_find_recursive( + iter->collection, parent_level + 1, r_collection_parent_best, r_parent_level_best); + } +} + +static void template_id_liboverride_hierarchy_collections_tag_recursive( + Collection *root_collection, ID *target_id, const bool do_parents) +{ + root_collection->id.tag |= ID_TAG_DOIT; + + /* Tag all local parents of the root collection, so that usages of the root collection and other + * linked ones can be replaced by the local overrides in those parents too. */ + if (do_parents) { + for (CollectionParent *iter = + static_cast(root_collection->runtime.parents.first); + iter != nullptr; + iter = iter->next) + { + if (ID_IS_LINKED(iter->collection)) { + continue; + } + iter->collection->id.tag |= ID_TAG_DOIT; + } + } + + for (CollectionChild *iter = static_cast(root_collection->children.first); + iter != nullptr; + iter = iter->next) + { + if (ID_IS_LINKED(iter->collection) && iter->collection->id.lib != target_id->lib) { + continue; + } + if (GS(target_id->name) == ID_OB && + !BKE_collection_has_object_recursive(iter->collection, (Object *)target_id)) + { + continue; + } + if (GS(target_id->name) == ID_GR && + !BKE_collection_has_collection(iter->collection, (Collection *)target_id)) + { + continue; + } + template_id_liboverride_hierarchy_collections_tag_recursive( + iter->collection, target_id, false); + } +} + +ID *ui_template_id_liboverride_hierarchy_make( + bContext *C, Main *bmain, ID *owner_id, ID *id, const char **r_undo_push_label) +{ + const char *undo_push_label; + if (r_undo_push_label == nullptr) { + r_undo_push_label = &undo_push_label; + } + + /* If this is called on an already local override, 'toggle' between user-editable state, and + * system override with reset. */ + if (!ID_IS_LINKED(id) && ID_IS_OVERRIDE_LIBRARY(id)) { + if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) { + BKE_lib_override_library_get(bmain, id, nullptr, &id); + } + if (id->override_library->flag & LIBOVERRIDE_FLAG_SYSTEM_DEFINED) { + id->override_library->flag &= ~LIBOVERRIDE_FLAG_SYSTEM_DEFINED; + *r_undo_push_label = "Make Library Override Hierarchy Editable"; + } + else { + BKE_lib_override_library_id_reset(bmain, id, true); + *r_undo_push_label = "Clear Library Override Hierarchy"; + } + + WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, nullptr); + WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr); + return id; + } + + /* Attempt to perform a hierarchy override, based on contextual data available. + * NOTE: do not attempt to perform such hierarchy override at all cost, if there is not enough + * context, better to abort than create random overrides all over the place. */ + if (!ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(id)) { + WM_reportf(RPT_ERROR, "The data-block %s is not overridable", id->name); + return nullptr; + } + + Object *object_active = CTX_data_active_object(C); + if (object_active == nullptr && GS(owner_id->name) == ID_OB) { + object_active = (Object *)owner_id; + } + if (object_active != nullptr) { + if (ID_IS_LINKED(object_active)) { + if (object_active->id.lib != id->lib || !ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(object_active)) + { + /* The active object is from a different library than the overridden ID, or otherwise + * cannot be used in hierarchy. */ + object_active = nullptr; + } + } + else if (!ID_IS_OVERRIDE_LIBRARY_REAL(object_active)) { + /* Fully local object cannot be used in override hierarchy either. */ + object_active = nullptr; + } + } + + Collection *collection_active_context = CTX_data_collection(C); + Collection *collection_active = collection_active_context; + if (collection_active == nullptr && GS(owner_id->name) == ID_GR) { + collection_active = (Collection *)owner_id; + } + if (collection_active != nullptr) { + if (ID_IS_LINKED(collection_active)) { + if (collection_active->id.lib != id->lib || + !ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(collection_active)) + { + /* The active collection is from a different library than the overridden ID, or otherwise + * cannot be used in hierarchy. */ + collection_active = nullptr; + } + else { + int parent_level_best = -1; + Collection *collection_parent_best = nullptr; + template_id_liboverride_hierarchy_collection_root_find_recursive( + collection_active, 0, &collection_parent_best, &parent_level_best); + collection_active = collection_parent_best; + } + } + else if (!ID_IS_OVERRIDE_LIBRARY_REAL(collection_active)) { + /* Fully local collection cannot be used in override hierarchy either. */ + collection_active = nullptr; + } + } + if (collection_active == nullptr && object_active != nullptr && + (ID_IS_LINKED(object_active) || ID_IS_OVERRIDE_LIBRARY_REAL(object_active))) + { + /* If we failed to find a valid 'active' collection so far for our override hierarchy, but do + * have a valid 'active' object, try to find a collection from that object. */ + LISTBASE_FOREACH (Collection *, collection_iter, &bmain->collections) { + if (ID_IS_LINKED(collection_iter) && collection_iter->id.lib != id->lib) { + continue; + } + if (!ID_IS_OVERRIDE_LIBRARY_REAL(collection_iter)) { + continue; + } + if (!BKE_collection_has_object_recursive(collection_iter, object_active)) { + continue; + } + int parent_level_best = -1; + Collection *collection_parent_best = nullptr; + template_id_liboverride_hierarchy_collection_root_find_recursive( + collection_iter, 0, &collection_parent_best, &parent_level_best); + collection_active = collection_parent_best; + break; + } + } + + ID *id_override = nullptr; + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + switch (GS(id->name)) { + case ID_GR: + if (collection_active != nullptr && + BKE_collection_has_collection(collection_active, (Collection *)id)) + { + template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); + if (object_active != nullptr) { + object_active->id.tag |= ID_TAG_DOIT; + } + BKE_lib_override_library_create(bmain, + scene, + view_layer, + nullptr, + id, + &collection_active->id, + nullptr, + &id_override, + false); + } + else if (object_active != nullptr && !ID_IS_LINKED(object_active) && + &object_active->instance_collection->id == id) + { + object_active->id.tag |= ID_TAG_DOIT; + BKE_lib_override_library_create(bmain, + scene, + view_layer, + id->lib, + id, + &object_active->id, + &object_active->id, + &id_override, + false); + } + break; + case ID_OB: + if (collection_active != nullptr && + BKE_collection_has_object_recursive(collection_active, (Object *)id)) + { + template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); + if (object_active != nullptr) { + object_active->id.tag |= ID_TAG_DOIT; + } + BKE_lib_override_library_create(bmain, + scene, + view_layer, + nullptr, + id, + &collection_active->id, + nullptr, + &id_override, + false); + } + else { + if (object_active != nullptr) { + object_active->id.tag |= ID_TAG_DOIT; + } + BKE_lib_override_library_create( + bmain, scene, view_layer, nullptr, id, nullptr, nullptr, &id_override, false); + BKE_scene_collections_object_remove(bmain, scene, (Object *)id, true); + WM_event_add_notifier(C, NC_ID | NA_REMOVED, nullptr); + } + break; + case ID_ME: + case ID_CU_LEGACY: + case ID_MB: + case ID_LT: + case ID_LA: + case ID_CA: + case ID_SPK: + case ID_AR: + case ID_GD_LEGACY: + case ID_CV: + case ID_PT: + case ID_VO: + case ID_NT: /* Essentially geometry nodes from modifier currently. */ + if (object_active != nullptr) { + if (collection_active != nullptr && + BKE_collection_has_object_recursive(collection_active, object_active)) + { + template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); + object_active->id.tag |= ID_TAG_DOIT; + BKE_lib_override_library_create(bmain, + scene, + view_layer, + nullptr, + id, + &collection_active->id, + nullptr, + &id_override, + false); + } + else { + object_active->id.tag |= ID_TAG_DOIT; + BKE_lib_override_library_create(bmain, + scene, + view_layer, + nullptr, + id, + &object_active->id, + nullptr, + &id_override, + false); + } + } + else { + BKE_lib_override_library_create( + bmain, scene, view_layer, nullptr, id, id, nullptr, &id_override, false); + } + break; + case ID_MA: + case ID_TE: + case ID_IM: + WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); + break; + case ID_WO: + WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); + break; + case ID_PA: + WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); + break; + default: + WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); + break; + } + + if (id_override != nullptr) { + id_override->override_library->flag &= ~LIBOVERRIDE_FLAG_SYSTEM_DEFINED; + + /* Ensure that the hierarchy root of the newly overridden data is instantiated in the scene, in + * case it's a collection or object. */ + ID *hierarchy_root = id_override->override_library->hierarchy_root; + if (GS(hierarchy_root->name) == ID_OB) { + Object *object_hierarchy_root = reinterpret_cast(hierarchy_root); + if (!BKE_scene_has_object(scene, object_hierarchy_root)) { + if (!ID_IS_LINKED(collection_active_context)) { + BKE_collection_object_add(bmain, collection_active_context, object_hierarchy_root); + } + else { + BKE_collection_object_add(bmain, scene->master_collection, object_hierarchy_root); + } + } + } + else if (GS(hierarchy_root->name) == ID_GR) { + Collection *collection_hierarchy_root = reinterpret_cast(hierarchy_root); + if (!BKE_collection_has_collection(scene->master_collection, collection_hierarchy_root)) { + if (!ID_IS_LINKED(collection_active_context)) { + BKE_collection_child_add(bmain, collection_active_context, collection_hierarchy_root); + } + else { + BKE_collection_child_add(bmain, scene->master_collection, collection_hierarchy_root); + } + } + } + + *r_undo_push_label = "Make Library Override Hierarchy"; + + /* In theory we could rely on setting/updating the RNA ID pointer property (as done by calling + * code) to be enough. + * + * However, some rare ID pointers properties (like the 'active object in viewlayer' one used + * for the Object templateID in the Object properties) use notifiers that do not enforce a + * rebuild of outliner trees, leading to crashes. + * + * So for now, add some extra notifiers here. */ + WM_event_add_notifier(C, NC_ID | NA_ADDED, nullptr); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr); + } + return id_override; +} + +static void template_id_liboverride_hierarchy_make(bContext *C, + Main *bmain, + TemplateID *template_ui, + PointerRNA *idptr, + const char **r_undo_push_label) +{ + ID *id = static_cast(idptr->data); + ID *owner_id = template_ui->ptr.owner_id; + + ID *id_override = ui_template_id_liboverride_hierarchy_make( + C, bmain, owner_id, id, r_undo_push_label); + + if (id_override != nullptr) { + /* `idptr` is re-assigned to owner property to ensure proper updates etc. Here we also use it + * to ensure remapping of the owner property from the linked data to the newly created + * liboverride (note that in theory this remapping has already been done by code above), but + * only in case owner ID was already local ID (override or pure local data). + * + * Otherwise, owner ID will also have been overridden, and remapped already to use it's + * override of the data too. */ + if (!ID_IS_LINKED(owner_id)) { + *idptr = RNA_id_pointer_create(id_override); + } + } + else { + WM_reportf(RPT_ERROR, "The data-block %s could not be overridden", id->name); + } +} + +static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) +{ + TemplateID *template_ui = (TemplateID *)arg_litem; + PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); + ID *id = static_cast(idptr.data); + const int event = POINTER_AS_INT(arg_event); + const char *undo_push_label = nullptr; + + switch (event) { + case UI_ID_NOP: + /* Don't do anything, typically set for buttons that execute an operator instead. They may + * still assign the callback so the button can be identified as part of an ID-template. See + * #UI_context_active_but_prop_get_templateID(). */ + break; + case UI_ID_RENAME: + /* Only for the undo push. */ + undo_push_label = "Rename Data-Block"; + break; + case UI_ID_BROWSE: + case UI_ID_PIN: + RNA_warning("warning, id event %d shouldn't come here", event); + break; + case UI_ID_OPEN: + case UI_ID_ADD_NEW: + /* these call UI_context_active_but_prop_get_templateID */ + break; + case UI_ID_DELETE: + idptr = {}; + RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); + RNA_property_update(C, &template_ui->ptr, template_ui->prop); + + if (id && CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { + /* only way to force-remove data (on save) */ + id_us_clear_real(id); + id_fake_user_clear(id); + id->us = 0; + undo_push_label = "Delete Data-Block"; + } + else { + undo_push_label = "Unlink Data-Block"; + } + + break; + case UI_ID_FAKE_USER: + if (id) { + if (id->flag & ID_FLAG_FAKEUSER) { + id_us_plus(id); + } + else { + id_us_min(id); + } + undo_push_label = "Fake User"; + } + else { + return; + } + break; + case UI_ID_LOCAL: + if (id) { + Main *bmain = CTX_data_main(C); + if (CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { + template_id_liboverride_hierarchy_make(C, bmain, template_ui, &idptr, &undo_push_label); + } + else { + if (BKE_lib_id_make_local(bmain, id, LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR)) { + BKE_id_newptr_and_tag_clear(id); + + /* Reassign to get proper updates/notifiers. */ + idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); + undo_push_label = "Make Local"; + } + } + if (undo_push_label != nullptr) { + RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); + RNA_property_update(C, &template_ui->ptr, template_ui->prop); + } + } + break; + case UI_ID_OVERRIDE: + if (id && ID_IS_OVERRIDE_LIBRARY(id)) { + Main *bmain = CTX_data_main(C); + if (CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { + template_id_liboverride_hierarchy_make(C, bmain, template_ui, &idptr, &undo_push_label); + } + else { + BKE_lib_override_library_make_local(bmain, id); + /* Reassign to get proper updates/notifiers. */ + idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); + RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); + RNA_property_update(C, &template_ui->ptr, template_ui->prop); + undo_push_label = "Make Local"; + } + } + break; + case UI_ID_ALONE: + if (id) { + const bool do_scene_obj = ((GS(id->name) == ID_OB) && + (template_ui->ptr.type == &RNA_LayerObjects)); + + /* make copy */ + if (do_scene_obj) { + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + blender::ed::object::object_single_user_make(bmain, scene, (Object *)id); + WM_event_add_notifier(C, NC_WINDOW, nullptr); + DEG_relations_tag_update(bmain); + } + else { + Main *bmain = CTX_data_main(C); + id_single_user(C, id, &template_ui->ptr, template_ui->prop); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr); + DEG_relations_tag_update(bmain); + } + ED_node_tree_propagate_change(CTX_data_main(C), nullptr); + undo_push_label = "Make Single User"; + } + break; +#if 0 + case UI_ID_AUTO_NAME: + break; +#endif + } + + if (undo_push_label != nullptr) { + ED_undo_push(C, undo_push_label); + } +} + +static const char *template_id_browse_tip(const StructRNA *type) +{ + if (type) { + switch ((ID_Type)RNA_type_to_ID_code(type)) { + case ID_SCE: + return N_("Browse Scene to be linked"); + case ID_OB: + return N_("Browse Object to be linked"); + case ID_ME: + return N_("Browse Mesh Data to be linked"); + case ID_CU_LEGACY: + return N_("Browse Curve Data to be linked"); + case ID_MB: + return N_("Browse Metaball Data to be linked"); + case ID_MA: + return N_("Browse Material to be linked"); + case ID_TE: + return N_("Browse Texture to be linked"); + case ID_IM: + return N_("Browse Image to be linked"); + case ID_LS: + return N_("Browse Line Style Data to be linked"); + case ID_LT: + return N_("Browse Lattice Data to be linked"); + case ID_LA: + return N_("Browse Light Data to be linked"); + case ID_CA: + return N_("Browse Camera Data to be linked"); + case ID_WO: + return N_("Browse World Settings to be linked"); + case ID_SCR: + return N_("Choose Screen layout"); + case ID_TXT: + return N_("Browse Text to be linked"); + case ID_SPK: + return N_("Browse Speaker Data to be linked"); + case ID_SO: + return N_("Browse Sound to be linked"); + case ID_AR: + return N_("Browse Armature data to be linked"); + case ID_AC: + return N_("Browse Action to be linked"); + case ID_NT: + return N_("Browse Node Tree to be linked"); + case ID_BR: + return N_("Browse Brush to be linked"); + case ID_PA: + return N_("Browse Particle Settings to be linked"); + case ID_GD_LEGACY: + return N_("Browse Grease Pencil Data to be linked"); + case ID_MC: + return N_("Browse Movie Clip to be linked"); + case ID_MSK: + return N_("Browse Mask to be linked"); + case ID_PAL: + return N_("Browse Palette Data to be linked"); + case ID_PC: + return N_("Browse Paint Curve Data to be linked"); + case ID_CF: + return N_("Browse Cache Files to be linked"); + case ID_WS: + return N_("Browse Workspace to be linked"); + case ID_LP: + return N_("Browse LightProbe to be linked"); + case ID_CV: + return N_("Browse Curves Data to be linked"); + case ID_PT: + return N_("Browse Point Cloud Data to be linked"); + case ID_VO: + return N_("Browse Volume Data to be linked"); + case ID_GP: + return N_("Browse Grease Pencil v3 Data to be linked"); + + /* Use generic text. */ + case ID_LI: + case ID_IP: + case ID_KE: + case ID_VF: + case ID_GR: + case ID_WM: + break; + } + } + return N_("Browse ID data to be linked"); +} + +/** + * Add a superimposed extra icon to \a but, for workspace pinning. + * Rather ugly special handling, but this is really a special case at this point, nothing worth + * generalizing. + */ +static void template_id_workspace_pin_extra_icon(const TemplateID &template_ui, uiBut *but) +{ + if ((template_ui.idcode != ID_SCE) || (template_ui.ptr.type != &RNA_Window)) { + return; + } + + const wmWindow *win = static_cast(template_ui.ptr.data); + const WorkSpace *workspace = WM_window_get_active_workspace(win); + UI_but_extra_operator_icon_add(but, + "WORKSPACE_OT_scene_pin_toggle", + WM_OP_INVOKE_DEFAULT, + (workspace->flags & WORKSPACE_USE_PIN_SCENE) ? ICON_PINNED : + ICON_UNPINNED); +} + +/** + * \return a type-based i18n context, needed e.g. by "New" button. + * In most languages, this adjective takes different form based on gender of type name... + */ +#ifdef WITH_INTERNATIONAL +static const char *template_id_context(StructRNA *type) +{ + if (type) { + return BKE_idtype_idcode_to_translation_context(RNA_type_to_ID_code(type)); + } + return BLT_I18NCONTEXT_DEFAULT; +} +#else +# define template_id_context(type) 0 +#endif + +static uiBut *template_id_def_new_but(uiBlock *block, + const ID *id, + const TemplateID &template_ui, + StructRNA *type, + const char *const newop, + const bool editable, + const bool id_open, + const bool use_tab_but, + int but_height) +{ + ID *idfrom = template_ui.ptr.owner_id; + uiBut *but; + const int but_type = use_tab_but ? UI_BTYPE_TAB : UI_BTYPE_BUT; + + /* i18n markup, does nothing! */ + BLT_I18N_MSGID_MULTI_CTXT("New", + BLT_I18NCONTEXT_DEFAULT, + BLT_I18NCONTEXT_ID_ACTION, + BLT_I18NCONTEXT_ID_ARMATURE, + BLT_I18NCONTEXT_ID_BRUSH, + BLT_I18NCONTEXT_ID_CAMERA, + BLT_I18NCONTEXT_ID_CURVES, + BLT_I18NCONTEXT_ID_CURVE_LEGACY, + BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, + BLT_I18NCONTEXT_ID_GPENCIL, + BLT_I18NCONTEXT_ID_IMAGE, + BLT_I18NCONTEXT_ID_LATTICE, + BLT_I18NCONTEXT_ID_LIGHT, + BLT_I18NCONTEXT_ID_LIGHTPROBE, + BLT_I18NCONTEXT_ID_MASK, + BLT_I18NCONTEXT_ID_MATERIAL, + BLT_I18NCONTEXT_ID_MESH, ); + BLT_I18N_MSGID_MULTI_CTXT("New", + BLT_I18NCONTEXT_ID_METABALL, + BLT_I18NCONTEXT_ID_NODETREE, + BLT_I18NCONTEXT_ID_OBJECT, + BLT_I18NCONTEXT_ID_PAINTCURVE, + BLT_I18NCONTEXT_ID_PALETTE, + BLT_I18NCONTEXT_ID_PARTICLESETTINGS, + BLT_I18NCONTEXT_ID_POINTCLOUD, + BLT_I18NCONTEXT_ID_SCENE, + BLT_I18NCONTEXT_ID_SCREEN, + BLT_I18NCONTEXT_ID_SOUND, + BLT_I18NCONTEXT_ID_SPEAKER, + BLT_I18NCONTEXT_ID_TEXT, + BLT_I18NCONTEXT_ID_TEXTURE, + BLT_I18NCONTEXT_ID_VOLUME, + BLT_I18NCONTEXT_ID_WORKSPACE, + BLT_I18NCONTEXT_ID_WORLD, ); + /* NOTE: BLT_I18N_MSGID_MULTI_CTXT takes a maximum number of parameters, + * check the definition to see if a new call must be added when the limit + * is exceeded. */ + + const char *button_text = (id) ? "" : CTX_IFACE_(template_id_context(type), "New"); + const int icon = (id && !use_tab_but) ? ICON_DUPLICATE : ICON_ADD; + const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; + + int w = id ? UI_UNIT_X : id_open ? UI_UNIT_X * 3 : UI_UNIT_X * 6; + if (!id) { + w = std::max(UI_fontstyle_string_width(fstyle, button_text) + int(UI_UNIT_X * 1.5f), w); + } + + if (newop) { + but = uiDefIconTextButO(block, + but_type, + newop, + WM_OP_INVOKE_DEFAULT, + icon, + button_text, + 0, + 0, + w, + but_height, + nullptr); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_ADD_NEW), + but_func_argN_free, + but_func_argN_copy); + } + else { + but = uiDefIconTextBut( + block, but_type, 0, icon, button_text, 0, 0, w, but_height, nullptr, 0, 0, nullptr); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_ADD_NEW), + but_func_argN_free, + but_func_argN_copy); + } + + if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + +#ifndef WITH_INTERNATIONAL + UNUSED_VARS(type); +#endif + + return but; +} + +static void template_ID(const bContext *C, + uiLayout *layout, + TemplateID &template_ui, + StructRNA *type, + int flag, + const char *newop, + const char *openop, + const char *unlinkop, + const std::optional text, + const bool live_icon, + const bool hide_buttons) +{ + uiBut *but; + const bool editable = RNA_property_editable(&template_ui.ptr, template_ui.prop); + const bool use_previews = template_ui.preview = (flag & UI_ID_PREVIEWS) != 0; + + PointerRNA idptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); + ID *id = static_cast(idptr.data); + ID *idfrom = template_ui.ptr.owner_id; + // lb = template_ui->idlb; + + /* Allow operators to take the ID from context. */ + uiLayoutSetContextPointer(layout, "id", &idptr); + + uiBlock *block = uiLayoutGetBlock(layout); + UI_block_align_begin(block); + + if (idptr.type) { + type = idptr.type; + } + + if (text && !text->is_empty()) { + /* Add label respecting the separated layout property split state. */ + uiItemL_respect_property_split(layout, *text, ICON_NONE); + } + + if (flag & UI_ID_BROWSE) { + template_add_button_search_menu(C, + layout, + block, + &template_ui.ptr, + template_ui.prop, + id_search_menu, + MEM_new(__func__, template_ui), + TIP_(template_id_browse_tip(type)), + use_previews, + editable, + live_icon, + but_func_argN_free, + but_func_argN_copy); + } + + /* text button with name */ + if (id) { + char name[UI_MAX_NAME_STR]; + const bool user_alert = (id->us <= 0); + + int width = template_search_textbut_width(&idptr, RNA_struct_find_property(&idptr, "name")); + + if ((template_ui.idcode == ID_SCE) && (template_ui.ptr.type == &RNA_Window)) { + /* More room needed for "pin" icon. */ + width += UI_UNIT_X; + } + + const int height = template_search_textbut_height(); + + // text_idbutton(id, name); + name[0] = '\0'; + but = uiDefButR(block, + UI_BTYPE_TEXT, + 0, + name, + 0, + 0, + width, + height, + &idptr, + "name", + -1, + 0, + 0, + RNA_struct_ui_description(type)); + /* Handle undo through the #template_id_cb set below. Default undo handling from the button + * code (see #ui_apply_but_undo) would not work here, as the new name is not yet applied to the + * ID. */ + UI_but_flag_disable(but, UI_BUT_UNDO); + Main *bmain = CTX_data_main(C); + UI_but_func_rename_full_set( + but, [bmain, id](std::string &new_name) { ED_id_rename(*bmain, *id, new_name); }); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_RENAME), + but_func_argN_free, + but_func_argN_copy); + if (user_alert) { + UI_but_flag_enable(but, UI_BUT_REDALERT); + } + + template_id_workspace_pin_extra_icon(template_ui, but); + + if (!hide_buttons && !(idfrom && ID_IS_LINKED(idfrom))) { + if (ID_IS_LINKED(id)) { + const bool disabled = !BKE_idtype_idcode_is_localizable(GS(id->name)); + if (id->tag & ID_TAG_INDIRECT) { + but = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_LIBRARY_DATA_INDIRECT, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Indirect library data-block, cannot be made local, " + "Shift + Click to create a library override hierarchy")); + } + else { + but = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_LIBRARY_DATA_DIRECT, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Direct linked library data-block, click to make local, " + "Shift + Click to create a library override")); + } + if (disabled) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + else { + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_LOCAL), + but_func_argN_free, + but_func_argN_copy); + } + } + else if (ID_IS_OVERRIDE_LIBRARY(id)) { + but = uiDefIconBut( + block, + UI_BTYPE_BUT, + 0, + ICON_LIBRARY_DATA_OVERRIDE, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Library override of linked data-block, click to make fully local, " + "Shift + Click to clear the library override and toggle if it can be edited")); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_OVERRIDE), + but_func_argN_free, + but_func_argN_copy); + } + } + + if ((ID_REAL_USERS(id) > 1) && (hide_buttons == false)) { + char numstr[32]; + short numstr_len; + + numstr_len = SNPRINTF_RLEN(numstr, "%d", ID_REAL_USERS(id)); + + but = uiDefBut( + block, + UI_BTYPE_BUT, + 0, + numstr, + 0, + 0, + numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Display number of users of this data (click to make a single-user copy)")); + but->flag |= UI_BUT_UNDO; + + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_ALONE), + but_func_argN_free, + but_func_argN_copy); + if (!BKE_id_copy_is_allowed(id) || (idfrom && !ID_IS_EDITABLE(idfrom)) || (!editable) || + /* object in editmode - don't change data */ + (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) + { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + } + + if (user_alert) { + UI_but_flag_enable(but, UI_BUT_REDALERT); + } + + if (!ID_IS_LINKED(id)) { + if (ID_IS_ASSET(id)) { + uiDefIconButO(block, + /* Using `_N` version allows us to get the 'active' state by default. */ + UI_BTYPE_ICON_TOGGLE_N, + "ASSET_OT_clear_single", + WM_OP_INVOKE_DEFAULT, + /* 'active' state of a toggle button uses icon + 1, so to get proper asset + * icon we need to pass its value - 1 here. */ + ICON_ASSET_MANAGER - 1, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + } + else if (!ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS) && (hide_buttons == false)) + { + uiDefIconButR(block, + UI_BTYPE_ICON_TOGGLE, + 0, + ICON_FAKE_USER_OFF, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + &idptr, + "use_fake_user", + -1, + 0, + 0, + nullptr); + } + } + } + + if ((flag & UI_ID_ADD_NEW) && (hide_buttons == false)) { + template_id_def_new_but( + block, id, template_ui, type, newop, editable, flag & UI_ID_OPEN, false, UI_UNIT_X); + } + + /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. + * Only for images, sound and fonts */ + if (id && BKE_packedfile_id_check(id)) { + but = uiDefIconButO(block, + UI_BTYPE_BUT, + "FILE_OT_unpack_item", + WM_OP_INVOKE_REGION_WIN, + ICON_PACKAGE, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + TIP_("Packed File, click to unpack")); + UI_but_operator_ptr_ensure(but); + + RNA_string_set(but->opptr, "id_name", id->name + 2); + RNA_int_set(but->opptr, "id_type", GS(id->name)); + + if (!ID_IS_EDITABLE(id)) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + } + else if (flag & UI_ID_OPEN) { + const char *button_text = (id) ? "" : IFACE_("Open"); + const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; + + int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; + if (!id) { + w = std::max(UI_fontstyle_string_width(fstyle, button_text) + int(UI_UNIT_X * 1.5f), w); + } + + if (openop) { + but = uiDefIconTextButO(block, + UI_BTYPE_BUT, + openop, + WM_OP_INVOKE_DEFAULT, + ICON_FILEBROWSER, + (id) ? "" : IFACE_("Open"), + 0, + 0, + w, + UI_UNIT_Y, + nullptr); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_OPEN), + but_func_argN_free, + but_func_argN_copy); + } + else { + but = uiDefIconTextBut(block, + UI_BTYPE_BUT, + 0, + ICON_FILEBROWSER, + (id) ? "" : IFACE_("Open"), + 0, + 0, + w, + UI_UNIT_Y, + nullptr, + 0, + 0, + nullptr); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_OPEN), + but_func_argN_free, + but_func_argN_copy); + } + + if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + } + + /* delete button */ + /* don't use RNA_property_is_unlink here */ + if (id && (flag & UI_ID_DELETE) && (hide_buttons == false)) { + /* allow unlink if 'unlinkop' is passed, even when 'PROP_NEVER_UNLINK' is set */ + but = nullptr; + + if (unlinkop) { + but = uiDefIconButO(block, + UI_BTYPE_BUT, + unlinkop, + WM_OP_INVOKE_DEFAULT, + ICON_X, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + /* so we can access the template from operators, font unlinking needs this */ + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_NOP), + but_func_argN_free, + but_func_argN_copy); + } + else { + if ((RNA_property_flag(template_ui.prop) & PROP_NEVER_UNLINK) == 0) { + but = uiDefIconBut( + block, + UI_BTYPE_BUT, + 0, + ICON_X, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0, + 0, + TIP_("Unlink data-block " + "(Shift + Click to set users to zero, data will then not be saved)")); + UI_but_funcN_set(but, + template_id_cb, + MEM_new(__func__, template_ui), + POINTER_FROM_INT(UI_ID_DELETE), + but_func_argN_free, + but_func_argN_copy); + + if (RNA_property_flag(template_ui.prop) & PROP_NEVER_NULL) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + } + } + + if (but) { + if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { + UI_but_flag_enable(but, UI_BUT_DISABLED); + } + } + } + + if (template_ui.idcode == ID_TE) { + uiTemplateTextureShow(layout, C, &template_ui.ptr, template_ui.prop); + } + UI_block_align_end(block); +} + +ID *UI_context_active_but_get_tab_ID(bContext *C) +{ + uiBut *but = UI_context_active_but_get(C); + + if (but && but->type == UI_BTYPE_TAB) { + return static_cast(but->custom_data); + } + return nullptr; +} + +static void template_ID_tabs(const bContext *C, + uiLayout *layout, + TemplateID &template_id, + StructRNA *type, + int flag, + const char *newop, + const char *menu) +{ + const ARegion *region = CTX_wm_region(C); + const PointerRNA active_ptr = RNA_property_pointer_get(&template_id.ptr, template_id.prop); + MenuType *mt = menu ? WM_menutype_find(menu, false) : nullptr; + + const int but_align = ui_but_align_opposite_to_area_align_get(region); + const int but_height = UI_UNIT_Y * 1.1; + + uiBlock *block = uiLayoutGetBlock(layout); + const uiStyle *style = UI_style_get_dpi(); + + for (ID *id : BKE_id_ordered_list(template_id.idlb)) { + const int name_width = UI_fontstyle_string_width(&style->widget, id->name + 2); + const int but_width = name_width + UI_UNIT_X; + + uiButTab *tab = (uiButTab *)uiDefButR_prop(block, + UI_BTYPE_TAB, + 0, + id->name + 2, + 0, + 0, + but_width, + but_height, + &template_id.ptr, + template_id.prop, + 0, + 0.0f, + sizeof(id->name) - 2, + ""); + UI_but_funcN_set(tab, + template_ID_set_property_exec_fn, + MEM_new(__func__, template_id), + id, + but_func_argN_free, + but_func_argN_copy); + UI_but_drag_set_id(tab, id); + tab->custom_data = (void *)id; + tab->menu = mt; + + UI_but_drawflag_enable(tab, but_align); + } + + if (flag & UI_ID_ADD_NEW) { + const bool editable = RNA_property_editable(&template_id.ptr, template_id.prop); + uiBut *but; + + if (active_ptr.type) { + type = active_ptr.type; + } + + but = template_id_def_new_but(block, + static_cast(active_ptr.data), + template_id, + type, + newop, + editable, + flag & UI_ID_OPEN, + true, + but_height); + UI_but_drawflag_enable(but, but_align); + } +} + +static void ui_template_id(uiLayout *layout, + const bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + const char *newop, + const char *openop, + const char *unlinkop, + /* Only respected by tabs (use_tabs). */ + const char *menu, + const std::optional text, + int flag, + int prv_rows, + int prv_cols, + int filter, + bool use_tabs, + float scale, + const bool live_icon, + const bool hide_buttons) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + RNA_warning( + "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + TemplateID template_ui = {}; + template_ui.ptr = *ptr; + template_ui.prop = prop; + template_ui.prv_rows = prv_rows; + template_ui.prv_cols = prv_cols; + template_ui.scale = scale; + + if ((flag & UI_ID_PIN) == 0) { + template_ui.filter = filter; + } + else { + template_ui.filter = 0; + } + + if (newop) { + flag |= UI_ID_ADD_NEW; + } + if (openop) { + flag |= UI_ID_OPEN; + } + + StructRNA *type = RNA_property_pointer_type(ptr, prop); + short idcode = RNA_type_to_ID_code(type); + template_ui.idcode = idcode; + template_ui.idlb = which_libbase(CTX_data_main(C), idcode); + + /* create UI elements for this template + * - template_ID makes a copy of the template data and assigns it to the relevant buttons + */ + if (template_ui.idlb) { + if (use_tabs) { + layout = uiLayoutRow(layout, true); + template_ID_tabs(C, layout, template_ui, type, flag, newop, menu); + } + else { + layout = uiLayoutRow(layout, true); + template_ID(C, + layout, + template_ui, + type, + flag, + newop, + openop, + unlinkop, + text, + live_icon, + hide_buttons); + } + } +} + +void uiTemplateID(uiLayout *layout, + const bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + const char *newop, + const char *openop, + const char *unlinkop, + int filter, + const bool live_icon, + const std::optional text) +{ + ui_template_id(layout, + C, + ptr, + propname, + newop, + openop, + unlinkop, + nullptr, + text, + UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, + 0, + 0, + filter, + false, + 1.0f, + live_icon, + false); +} + +void uiTemplateAction(uiLayout *layout, + const bContext *C, + ID *id, + const char *newop, + const char *unlinkop, + const std::optional text) +{ + if (!id_can_have_animdata(id)) { + RNA_warning("Cannot show Action selector for non-animatable ID: %s", id->name + 2); + return; + } + + PropertyRNA *adt_action_prop = RNA_struct_type_find_property(&RNA_AnimData, "action"); + BLI_assert(adt_action_prop); + BLI_assert(RNA_property_type(adt_action_prop) == PROP_POINTER); + + /* Construct a pointer with the animated ID as owner, even when `adt` may be `nullptr`. + * This way it is possible to use this RNA pointer to get/set `adt->action`, as that RNA property + * has a `getter` & `setter` that only need the owner ID and are null-safe regarding the `adt` + * itself. */ + AnimData *adt = BKE_animdata_from_id(id); + PointerRNA adt_ptr = RNA_pointer_create(id, &RNA_AnimData, adt); + + TemplateID template_ui = {}; + template_ui.ptr = adt_ptr; + template_ui.prop = adt_action_prop; + template_ui.prv_rows = 0; + template_ui.prv_cols = 0; + template_ui.scale = 1.0f; + template_ui.filter = UI_TEMPLATE_ID_FILTER_ALL; + + int flag = UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE; + if (newop) { + flag |= UI_ID_ADD_NEW; + } + + template_ui.idcode = ID_AC; + template_ui.idlb = which_libbase(CTX_data_main(C), ID_AC); + BLI_assert(template_ui.idlb); + + uiLayout *row = uiLayoutRow(layout, true); + template_ID( + C, row, template_ui, &RNA_Action, flag, newop, nullptr, unlinkop, text, false, false); +} + +void uiTemplateIDBrowse(uiLayout *layout, + bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + const char *newop, + const char *openop, + const char *unlinkop, + int filter, + const char *text) +{ + ui_template_id(layout, + C, + ptr, + propname, + newop, + openop, + unlinkop, + nullptr, + text, + UI_ID_BROWSE | UI_ID_RENAME, + 0, + 0, + filter, + false, + 1.0f, + false, + false); +} + +void uiTemplateIDPreview(uiLayout *layout, + bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + const char *newop, + const char *openop, + const char *unlinkop, + int rows, + int cols, + int filter, + const bool hide_buttons) +{ + ui_template_id(layout, + C, + ptr, + propname, + newop, + openop, + unlinkop, + nullptr, + nullptr, + UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, + rows, + cols, + filter, + false, + 1.0f, + false, + hide_buttons); +} + +void uiTemplateGpencilColorPreview(uiLayout *layout, + bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + int rows, + int cols, + float scale, + int filter) +{ + ui_template_id(layout, + C, + ptr, + propname, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + UI_ID_BROWSE | UI_ID_PREVIEWS | UI_ID_DELETE, + rows, + cols, + filter, + false, + scale < 0.5f ? 0.5f : scale, + false, + false); +} + +void uiTemplateIDTabs(uiLayout *layout, + bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + const char *newop, + const char *menu, + int filter) +{ + ui_template_id(layout, + C, + ptr, + propname, + newop, + nullptr, + nullptr, + menu, + nullptr, + UI_ID_BROWSE | UI_ID_RENAME, + 0, + 0, + filter, + true, + 1.0f, + false, + false); +} + +void uiTemplateAnyID(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + const StringRefNull proptypename, + const std::optional text) +{ + /* get properties... */ + PropertyRNA *propID = RNA_struct_find_property(ptr, propname.c_str()); + PropertyRNA *propType = RNA_struct_find_property(ptr, proptypename.c_str()); + + if (!propID || RNA_property_type(propID) != PROP_POINTER) { + RNA_warning( + "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + if (!propType || RNA_property_type(propType) != PROP_ENUM) { + RNA_warning("pointer-type property not found: %s.%s", + RNA_struct_identifier(ptr->type), + proptypename.c_str()); + return; + } + + /* Start drawing UI Elements using standard defines */ + + /* NOTE: split amount here needs to be synced with normal labels */ + uiLayout *split = uiLayoutSplit(layout, 0.33f, false); + + /* FIRST PART ................................................ */ + uiLayout *row = uiLayoutRow(split, false); + + /* Label - either use the provided text, or will become "ID-Block:" */ + if (text) { + if (!text->is_empty()) { + uiItemL(row, *text, ICON_NONE); + } + } + else { + uiItemL(row, IFACE_("ID-Block:"), ICON_NONE); + } + + /* SECOND PART ................................................ */ + row = uiLayoutRow(split, true); + + /* ID-Type Selector - just have a menu of icons */ + + /* HACK: special group just for the enum, + * otherwise we get ugly layout with text included too... */ + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); + + uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + + /* ID-Block Selector - just use pointer widget... */ + + /* HACK: special group to counteract the effects of the previous enum, + * which now pushes everything too far right. */ + sub = uiLayoutRow(row, true); + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); + + uiItemFullR(sub, ptr, propID, 0, 0, UI_ITEM_NONE, "", ICON_NONE); +} diff --git a/source/blender/editors/interface/templates/interface_template_keymap.cc b/source/blender/editors/interface/templates/interface_template_keymap.cc new file mode 100644 index 000000000000..2e8253128fea --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_keymap.cc @@ -0,0 +1,103 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_context.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +static void keymap_item_modified(bContext * /*C*/, void *kmi_p, void * /*unused*/) +{ + wmKeyMapItem *kmi = (wmKeyMapItem *)kmi_p; + WM_keyconfig_update_tag(nullptr, kmi); + U.runtime.is_dirty = true; +} + +static void template_keymap_item_properties(uiLayout *layout, const char *title, PointerRNA *ptr) +{ + uiItemS(layout); + + if (title) { + uiItemL(layout, title, ICON_NONE); + } + + uiLayout *flow = uiLayoutColumnFlow(layout, 2, false); + + RNA_STRUCT_BEGIN_SKIP_RNA_TYPE (ptr, prop) { + const bool is_set = RNA_property_is_set(ptr, prop); + uiBut *but; + + /* recurse for nested properties */ + if (RNA_property_type(prop) == PROP_POINTER) { + PointerRNA propptr = RNA_property_pointer_get(ptr, prop); + + if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) { + const char *name = RNA_property_ui_name(prop); + template_keymap_item_properties(layout, name, &propptr); + continue; + } + } + + uiLayout *box = uiLayoutBox(flow); + uiLayoutSetActive(box, is_set); + uiLayout *row = uiLayoutRow(box, false); + + /* property value */ + uiItemFullR(row, ptr, prop, -1, 0, UI_ITEM_NONE, std::nullopt, ICON_NONE); + + if (is_set) { + /* unset operator */ + uiBlock *block = uiLayoutGetBlock(row); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + but = uiDefIconButO(block, + UI_BTYPE_BUT, + "UI_OT_unset_property_button", + WM_OP_EXEC_DEFAULT, + ICON_X, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr); + but->rnapoin = *ptr; + but->rnaprop = prop; + UI_block_emboss_set(block, UI_EMBOSS); + } + } + RNA_STRUCT_END; +} + +void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr) +{ + PointerRNA propptr = RNA_pointer_get(ptr, "properties"); + + if (propptr.data) { + uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); + + WM_operator_properties_sanitize(&propptr, false); + template_keymap_item_properties(layout, nullptr, &propptr); + + /* attach callbacks to compensate for missing properties update, + * we don't know which keymap (item) is being modified there */ + for (; but; but = but->next) { + /* operator buttons may store props for use (file selector, #36492) */ + if (but->rnaprop) { + UI_but_func_set(but, keymap_item_modified, ptr->data, nullptr); + + /* Otherwise the keymap will be re-generated which we're trying to edit, + * see: #47685 */ + UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY); + } + } + } +} diff --git a/source/blender/editors/interface/templates/interface_template_layers.cc b/source/blender/editors/interface/templates/interface_template_layers.cc new file mode 100644 index 000000000000..3ae6bafeac1b --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_layers.cc @@ -0,0 +1,113 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_context.hh" + +#include "BLI_string_ref.hh" + +#include "RNA_access.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +using blender::StringRefNull; + +static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) +{ + uiBut *but = static_cast(arg1); + const int cur = POINTER_AS_INT(arg2); + wmWindow *win = CTX_wm_window(C); + const bool shift = win->eventstate->modifier & KM_SHIFT; + + if (!shift) { + const int tot = RNA_property_array_length(&but->rnapoin, but->rnaprop); + + /* Normally clicking only selects one layer */ + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, true); + for (int i = 0; i < tot; i++) { + if (i != cur) { + RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, false); + } + } + } + + /* view3d layer change should update depsgraph (invisible object changed maybe) */ + /* see `view3d_header.cc` */ +} + +void uiTemplateLayers(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + PointerRNA *used_ptr, + const char *used_propname, + int active_layer) +{ + const int cols_per_group = 5; + + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + if (!prop) { + RNA_warning( + "layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return; + } + + /* the number of layers determines the way we group them + * - we want 2 rows only (for now) + * - The number of columns (cols) is the total number of buttons per row the 'remainder' + * is added to this, as it will be ok to have first row slightly wider if need be. + * - For now, only split into groups if group will have at least 5 items. + */ + const int layers = RNA_property_array_length(ptr, prop); + const int cols = (layers / 2) + (layers % 2); + const int groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group); + + PropertyRNA *used_prop = nullptr; + if (used_ptr && used_propname) { + used_prop = RNA_struct_find_property(used_ptr, used_propname); + if (!used_prop) { + RNA_warning("used layers property not found: %s.%s", + RNA_struct_identifier(ptr->type), + used_propname); + return; + } + + if (RNA_property_array_length(used_ptr, used_prop) < layers) { + used_prop = nullptr; + } + } + + /* layers are laid out going across rows, with the columns being divided into groups */ + + for (int group = 0; group < groups; group++) { + uiLayout *uCol = uiLayoutColumn(layout, true); + + for (int row = 0; row < 2; row++) { + uiLayout *uRow = uiLayoutRow(uCol, true); + uiBlock *block = uiLayoutGetBlock(uRow); + int layer = groups * cols_per_group * row + cols_per_group * group; + + /* add layers as toggle buts */ + for (int col = 0; (col < cols_per_group) && (layer < layers); col++, layer++) { + int icon = 0; + const int butlay = 1 << layer; + + if (active_layer & butlay) { + icon = ICON_LAYER_ACTIVE; + } + else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer)) { + icon = ICON_LAYER_USED; + } + + uiBut *but = uiDefAutoButR( + block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2); + UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(layer)); + but->type = UI_BTYPE_TOGGLE; + } + } + } +} diff --git a/source/blender/editors/interface/templates/interface_template_modifiers.cc b/source/blender/editors/interface/templates/interface_template_modifiers.cc new file mode 100644 index 000000000000..c99f7eee32e7 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_modifiers.cc @@ -0,0 +1,80 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + * + * Template for building the panel layout for the active object's modifiers. + */ + +#include "BKE_context.hh" +#include "BKE_modifier.hh" +#include "BKE_screen.hh" + +#include "BLI_listbase.h" + +#include "ED_object.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" + +static void modifier_panel_id(void *md_link, char *r_name) +{ + ModifierData *md = (ModifierData *)md_link; + BKE_modifier_type_panel_id(ModifierType(md->type), r_name); +} + +void uiTemplateModifiers(uiLayout * /*layout*/, bContext *C) +{ + ARegion *region = CTX_wm_region(C); + + Object *ob = blender::ed::object::context_active_object(C); + ListBase *modifiers = &ob->modifiers; + + const bool panels_match = UI_panel_list_matches_data(region, modifiers, modifier_panel_id); + + if (!panels_match) { + UI_panels_free_instanced(C, region); + LISTBASE_FOREACH (ModifierData *, md, modifiers) { + const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type)); + if (mti->panel_register == nullptr) { + continue; + } + + char panel_idname[MAX_NAME]; + modifier_panel_id(md, panel_idname); + + /* Create custom data RNA pointer. */ + PointerRNA *md_ptr = MEM_new(__func__); + *md_ptr = RNA_pointer_create(&ob->id, &RNA_Modifier, md); + + UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, md_ptr); + } + } + else { + /* Assuming there's only one group of instanced panels, update the custom data pointers. */ + Panel *panel = static_cast(region->panels.first); + LISTBASE_FOREACH (ModifierData *, md, modifiers) { + const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type)); + if (mti->panel_register == nullptr) { + continue; + } + + /* Move to the next instanced panel corresponding to the next modifier. */ + while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { + panel = panel->next; + BLI_assert(panel != + nullptr); /* There shouldn't be fewer panels than modifiers with UIs. */ + } + + PointerRNA *md_ptr = MEM_new(__func__); + *md_ptr = RNA_pointer_create(&ob->id, &RNA_Modifier, md); + UI_panel_custom_data_set(panel, md_ptr); + + panel = panel->next; + } + } +} diff --git a/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc b/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc index f33eeb069d72..33796f97262b 100644 --- a/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc +++ b/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc @@ -157,7 +157,7 @@ class NodeSocketViewItem : public BasicTreeViewItem { socket_.name = BLI_strdup(new_name.c_str()); nodetree_.tree_interface.tag_items_changed(); - ED_node_tree_propagate_change(&C, CTX_data_main(&C), &nodetree_); + ED_node_tree_propagate_change(CTX_data_main(&C), &nodetree_); ED_undo_push(&const_cast(C), new_name.c_str()); return true; } @@ -217,7 +217,7 @@ class NodePanelViewItem : public BasicTreeViewItem { panel_.name = BLI_strdup(new_name.c_str()); nodetree_.tree_interface.tag_items_changed(); - ED_node_tree_propagate_change(&C, CTX_data_main(&C), &nodetree_); + ED_node_tree_propagate_change(CTX_data_main(&C), &nodetree_); return true; } StringRef get_rename_string() const override @@ -395,7 +395,7 @@ bool NodeSocketDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const interface.move_item_to_parent(*drag_item, parent, index); /* General update */ - ED_node_tree_propagate_change(C, CTX_data_main(C), &nodetree); + ED_node_tree_propagate_change(CTX_data_main(C), &nodetree); ED_undo_push(C, "Insert node group item"); return true; } @@ -485,7 +485,7 @@ bool NodePanelDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const interface.move_item_to_parent(*drag_item, parent, index); /* General update */ - ED_node_tree_propagate_change(C, CTX_data_main(C), &nodetree); + ED_node_tree_propagate_change(CTX_data_main(C), &nodetree); ED_undo_push(C, "Insert node group item"); return true; } diff --git a/source/blender/editors/interface/templates/interface_template_operator_property.cc b/source/blender/editors/interface/templates/interface_template_operator_property.cc new file mode 100644 index 000000000000..9779cdb58e65 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_operator_property.cc @@ -0,0 +1,478 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_context.hh" +#include "BKE_file_handler.hh" +#include "BKE_idprop.hh" +#include "BKE_screen.hh" + +#include "BLI_string.h" + +#include "BLT_translation.hh" + +#include "DNA_collection_types.h" + +#include "ED_undo.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +/* we may want to make this optional, disable for now. */ +// #define USE_OP_RESET_BUT + +struct uiTemplateOperatorPropertyPollParam { + const bContext *C; + wmOperator *op; + short flag; +}; + +#ifdef USE_OP_RESET_BUT +static void ui_layout_operator_buts__reset_cb(bContext * /*C*/, void *op_pt, void * /*arg_dummy2*/) +{ + WM_operator_properties_reset((wmOperator *)op_pt); +} +#endif + +static bool ui_layout_operator_buts_poll_property(PointerRNA * /*ptr*/, + PropertyRNA *prop, + void *user_data) +{ + uiTemplateOperatorPropertyPollParam *params = static_cast( + user_data); + + if ((params->flag & UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED) && + (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED)) + { + return false; + } + return params->op->type->poll_property(params->C, params->op, prop); +} + +static eAutoPropButsReturn template_operator_property_buts_draw_single( + const bContext *C, + wmOperator *op, + uiLayout *layout, + const eButLabelAlign label_align, + int layout_flags) +{ + uiBlock *block = uiLayoutGetBlock(layout); + eAutoPropButsReturn return_info = eAutoPropButsReturn(0); + + if (!op->properties) { + op->properties = blender::bke::idprop::create_group("wmOperatorProperties").release(); + } + + /* poll() on this operator may still fail, + * at the moment there is no nice feedback when this happens just fails silently. */ + if (!WM_operator_repeat_check(C, op)) { + UI_block_lock_set(block, true, N_("Operator cannot redo")); + return return_info; + } + + /* useful for macros where only one of the steps can't be re-done */ + UI_block_lock_clear(block); + + if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) { + uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE); + } + + /* menu */ + if ((op->type->flag & OPTYPE_PRESET) && !(layout_flags & UI_TEMPLATE_OP_PROPS_HIDE_PRESETS)) { + /* XXX, no simple way to get WM_MT_operator_presets.bl_label + * from python! Label remains the same always! */ + PointerRNA op_ptr; + uiLayout *row; + + UI_block_set_active_operator(block, op, false); + + row = uiLayoutRow(layout, true); + uiItemM(row, "WM_MT_operator_presets", std::nullopt, ICON_NONE); + + wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false); + uiItemFullO_ptr(row, ot, "", ICON_ADD, nullptr, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE, &op_ptr); + RNA_string_set(&op_ptr, "operator", op->type->idname); + + uiItemFullO_ptr( + row, ot, "", ICON_REMOVE, nullptr, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE, &op_ptr); + RNA_string_set(&op_ptr, "operator", op->type->idname); + RNA_boolean_set(&op_ptr, "remove_active", true); + } + + if (op->type->ui) { + op->layout = layout; + op->type->ui((bContext *)C, op); + op->layout = nullptr; + + /* #UI_LAYOUT_OP_SHOW_EMPTY ignored. retun_info is ignored too. + * We could allow #wmOperatorType.ui callback to return this, but not needed right now. */ + } + else { + wmWindowManager *wm = CTX_wm_manager(C); + uiTemplateOperatorPropertyPollParam user_data{}; + user_data.C = C; + user_data.op = op; + user_data.flag = layout_flags; + const bool use_prop_split = (layout_flags & UI_TEMPLATE_OP_PROPS_NO_SPLIT_LAYOUT) == 0; + + PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties); + + uiLayoutSetPropSep(layout, use_prop_split); + uiLayoutSetPropDecorate(layout, false); + + /* main draw call */ + return_info = uiDefAutoButsRNA( + layout, + &ptr, + op->type->poll_property ? ui_layout_operator_buts_poll_property : nullptr, + op->type->poll_property ? &user_data : nullptr, + op->type->prop, + label_align, + (layout_flags & UI_TEMPLATE_OP_PROPS_COMPACT)); + + if ((return_info & UI_PROP_BUTS_NONE_ADDED) && + (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) + { + uiItemL(layout, IFACE_("No Properties"), ICON_NONE); + } + } + +#ifdef USE_OP_RESET_BUT + /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled + * but this is not so important if this button is drawn in those cases + * (which isn't all that likely anyway) - campbell */ + if (op->properties->len) { + uiBut *but; + uiLayout *col; /* needed to avoid alignment errors with previous buttons */ + + col = uiLayoutColumn(layout, false); + block = uiLayoutGetBlock(col); + but = uiDefIconTextBut(block, + UI_BTYPE_BUT, + 0, + ICON_FILE_REFRESH, + IFACE_("Reset"), + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0, + 0.0, + 0.0, + 0.0, + TIP_("Reset operator defaults")); + UI_but_func_set(but, ui_layout_operator_buts__reset_cb, op, nullptr); + } +#endif + + /* set various special settings for buttons */ + + /* Only do this if we're not refreshing an existing UI. */ + if (block->oldblock == nullptr) { + const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0; + + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { + /* no undo for buttons for operator redo panels */ + UI_but_flag_disable(but, UI_BUT_UNDO); + + /* only for popups, see #36109. */ + + /* if button is operator's default property, and a text-field, enable focus for it + * - this is used for allowing operators with popups to rename stuff with fewer clicks + */ + if (is_popup) { + if ((but->rnaprop == op->type->prop) && ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM)) { + UI_but_focus_on_enter_event(CTX_wm_window(C), but); + } + } + } + } + + return return_info; +} + +static void template_operator_property_buts_draw_recursive(const bContext *C, + wmOperator *op, + uiLayout *layout, + const eButLabelAlign label_align, + int layout_flags, + bool *r_has_advanced) +{ + if (op->type->flag & OPTYPE_MACRO) { + LISTBASE_FOREACH (wmOperator *, macro_op, &op->macro) { + template_operator_property_buts_draw_recursive( + C, macro_op, layout, label_align, layout_flags, r_has_advanced); + } + } + else { + /* Might want to make label_align adjustable somehow. */ + eAutoPropButsReturn return_info = template_operator_property_buts_draw_single( + C, op, layout, label_align, layout_flags); + if (return_info & UI_PROP_BUTS_ANY_FAILED_CHECK) { + if (r_has_advanced) { + *r_has_advanced = true; + } + } + } +} + +static bool ui_layout_operator_properties_only_booleans(const bContext *C, + wmWindowManager *wm, + wmOperator *op, + int layout_flags) +{ + if (op->type->flag & OPTYPE_MACRO) { + LISTBASE_FOREACH (wmOperator *, macro_op, &op->macro) { + if (!ui_layout_operator_properties_only_booleans(C, wm, macro_op, layout_flags)) { + return false; + } + } + } + else { + uiTemplateOperatorPropertyPollParam user_data{}; + user_data.C = C; + user_data.op = op; + user_data.flag = layout_flags; + + PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties); + + bool all_booleans = true; + RNA_STRUCT_BEGIN (&ptr, prop) { + if (RNA_property_flag(prop) & PROP_HIDDEN) { + continue; + } + if (op->type->poll_property && + !ui_layout_operator_buts_poll_property(&ptr, prop, &user_data)) + { + continue; + } + if (RNA_property_type(prop) != PROP_BOOLEAN) { + all_booleans = false; + break; + } + } + RNA_STRUCT_END; + if (all_booleans == false) { + return false; + } + } + + return true; +} + +void uiTemplateOperatorPropertyButs( + const bContext *C, uiLayout *layout, wmOperator *op, eButLabelAlign label_align, short flag) +{ + wmWindowManager *wm = CTX_wm_manager(C); + + /* If there are only checkbox items, don't use split layout by default. It looks weird if the + * check-boxes only use half the width. */ + if (ui_layout_operator_properties_only_booleans(C, wm, op, flag)) { + flag |= UI_TEMPLATE_OP_PROPS_NO_SPLIT_LAYOUT; + } + + template_operator_property_buts_draw_recursive(C, op, layout, label_align, flag, nullptr); +} + +void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C) +{ + wmOperator *op = WM_operator_last_redo(C); + uiBlock *block = uiLayoutGetBlock(layout); + + if (op == nullptr) { + return; + } + + /* Disable for now, doesn't fit well in popover. */ +#if 0 + /* Repeat button with operator name as text. */ + uiItemFullO(layout, + "SCREEN_OT_repeat_last", + WM_operatortype_name(op->type, op->ptr), + ICON_NONE, + nullptr, + WM_OP_INVOKE_DEFAULT, + 0, + nullptr); +#endif + + if (WM_operator_repeat_check(C, op)) { + int layout_flags = 0; + if (block->panel == nullptr) { + layout_flags = UI_TEMPLATE_OP_PROPS_SHOW_TITLE; + } +#if 0 + bool has_advanced = false; +#endif + + UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op); + template_operator_property_buts_draw_recursive( + C, op, layout, UI_BUT_LABEL_ALIGN_NONE, layout_flags, nullptr /* &has_advanced */); + /* Warning! this leaves the handle function for any other users of this block. */ + +#if 0 + if (has_advanced) { + uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last"); + } +#endif + } +} + +static wmOperator *minimal_operator_create(wmOperatorType *ot, PointerRNA *properties) +{ + /* Copied from #wm_operator_create. + * Create a slimmed down operator suitable only for UI drawing. */ + wmOperator *op = MEM_cnew(ot->rna_ext.srna ? __func__ : ot->idname); + STRNCPY(op->idname, ot->idname); + op->type = ot; + + /* Initialize properties but do not assume ownership of them. + * This "minimal" operator owns nothing. */ + op->ptr = MEM_new("wmOperatorPtrRNA"); + op->properties = static_cast(properties->data); + *op->ptr = *properties; + + return op; +} + +static void draw_export_controls( + bContext *C, uiLayout *layout, const std::string &label, int index, bool valid) +{ + uiItemL(layout, label, ICON_NONE); + if (valid) { + uiLayout *row = uiLayoutRow(layout, false); + uiLayoutSetEmboss(row, UI_EMBOSS_NONE); + uiItemPopoverPanel(row, C, "WM_PT_operator_presets", "", ICON_PRESET); + uiItemIntO(row, "", ICON_EXPORT, "COLLECTION_OT_exporter_export", "index", index); + } +} + +static void draw_export_properties(bContext *C, + uiLayout *layout, + wmOperator *op, + const std::string &filename) +{ + uiLayout *col = uiLayoutColumn(layout, false); + + uiLayoutSetPropSep(col, true); + uiLayoutSetPropDecorate(col, false); + + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath"); + std::string placeholder = "//" + filename; + uiItemFullR(col, + op->ptr, + prop, + RNA_NO_INDEX, + 0, + UI_ITEM_NONE, + std::nullopt, + ICON_NONE, + placeholder.c_str()); + + template_operator_property_buts_draw_single( + C, op, layout, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_HIDE_PRESETS); +} + +static void draw_exporter_item(uiList * /*ui_list*/, + const bContext * /*C*/, + uiLayout *layout, + PointerRNA * /*idataptr*/, + PointerRNA *itemptr, + int /*icon*/, + PointerRNA * /*active_dataptr*/, + const char * /*active_propname*/, + int /*index*/, + int /*flt_flag*/) +{ + uiLayout *row = uiLayoutRow(layout, false); + uiLayoutSetEmboss(row, UI_EMBOSS_NONE); + uiItemR(row, itemptr, "name", UI_ITEM_NONE, "", ICON_NONE); +} + +void uiTemplateCollectionExporters(uiLayout *layout, bContext *C) +{ + Collection *collection = CTX_data_collection(C); + ListBase *exporters = &collection->exporters; + const int index = collection->active_exporter_index; + + /* Register the exporter list type on first use. */ + static const uiListType *exporter_item_list = []() { + uiListType *lt = MEM_cnew(__func__); + STRNCPY(lt->idname, "COLLECTION_UL_exporter_list"); + lt->draw_item = draw_exporter_item; + WM_uilisttype_add(lt); + return lt; + }(); + + /* Draw exporter list and controls. */ + PointerRNA collection_ptr = RNA_pointer_create(&collection->id, &RNA_Collection, collection); + uiLayout *row = uiLayoutRow(layout, false); + uiTemplateList(row, + C, + exporter_item_list->idname, + "", + &collection_ptr, + "exporters", + &collection_ptr, + "active_exporter_index", + nullptr, + 3, + 5, + UILST_LAYOUT_DEFAULT, + 1, + UI_TEMPLATE_LIST_FLAG_NONE); + + uiLayout *col = uiLayoutColumn(row, true); + uiItemM(col, "COLLECTION_MT_exporter_add", "", ICON_ADD); + uiItemIntO(col, "", ICON_REMOVE, "COLLECTION_OT_exporter_remove", "index", index); + + col = uiLayoutColumn(layout, true); + uiItemO(col, std::nullopt, ICON_EXPORT, "COLLECTION_OT_export_all"); + uiLayoutSetEnabled(col, !BLI_listbase_is_empty(exporters)); + + /* Draw the active exporter. */ + CollectionExport *data = (CollectionExport *)BLI_findlink(exporters, index); + if (!data) { + return; + } + + using namespace blender; + PointerRNA exporter_ptr = RNA_pointer_create(&collection->id, &RNA_CollectionExport, data); + PanelLayout panel = uiLayoutPanelProp(C, layout, &exporter_ptr, "is_open"); + + bke::FileHandlerType *fh = bke::file_handler_find(data->fh_idname); + if (!fh) { + std::string label = std::string(IFACE_("Undefined")) + " " + data->fh_idname; + draw_export_controls(C, panel.header, label, index, false); + return; + } + + wmOperatorType *ot = WM_operatortype_find(fh->export_operator, false); + if (!ot) { + std::string label = std::string(IFACE_("Undefined")) + " " + fh->export_operator; + draw_export_controls(C, panel.header, label, index, false); + return; + } + + /* Assign temporary operator to uiBlock, which takes ownership. */ + PointerRNA properties = RNA_pointer_create(&collection->id, ot->srna, data->export_properties); + wmOperator *op = minimal_operator_create(ot, &properties); + UI_block_set_active_operator(uiLayoutGetBlock(panel.header), op, true); + + /* Draw panel header and contents. */ + std::string label(fh->label); + draw_export_controls(C, panel.header, label, index, true); + if (panel.body) { + draw_export_properties(C, panel.body, op, fh->get_default_filename(collection->id.name + 2)); + } +} diff --git a/source/blender/editors/interface/templates/interface_template_preview.cc b/source/blender/editors/interface/templates/interface_template_preview.cc new file mode 100644 index 000000000000..a6441c9ad510 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_preview.cc @@ -0,0 +1,266 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BKE_context.hh" +#include "BKE_idtype.hh" +#include "BKE_linestyle.h" +#include "BKE_scene.hh" + +#include "BLI_string.h" + +#include "BLT_translation.hh" + +#include "DNA_light_types.h" +#include "DNA_material_types.h" +#include "DNA_world_types.h" + +#include "ED_render.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" + +#define B_MATPRV 1 + +static void do_preview_buttons(bContext *C, void *arg, int event) +{ + switch (event) { + case B_MATPRV: + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, arg); + break; + } +} + +void uiTemplatePreview(uiLayout *layout, + bContext *C, + ID *id, + bool show_buttons, + ID *parent, + MTex *slot, + const char *preview_id) +{ + Material *ma = nullptr; + Tex *tex = (Tex *)id; + short *pr_texture = nullptr; + + char _preview_id[sizeof(uiPreview::preview_id)]; + + if (id && !ELEM(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA, ID_LS)) { + RNA_warning("Expected ID of type material, texture, light, world or line style"); + return; + } + + /* decide what to render */ + ID *pid = id; + ID *pparent = nullptr; + + if (id && (GS(id->name) == ID_TE)) { + if (parent && (GS(parent->name) == ID_MA)) { + pr_texture = &((Material *)parent)->pr_texture; + } + else if (parent && (GS(parent->name) == ID_WO)) { + pr_texture = &((World *)parent)->pr_texture; + } + else if (parent && (GS(parent->name) == ID_LA)) { + pr_texture = &((Light *)parent)->pr_texture; + } + else if (parent && (GS(parent->name) == ID_LS)) { + pr_texture = &((FreestyleLineStyle *)parent)->pr_texture; + } + + if (pr_texture) { + if (*pr_texture == TEX_PR_OTHER) { + pid = parent; + } + else if (*pr_texture == TEX_PR_BOTH) { + pparent = parent; + } + } + } + + if (!preview_id || (preview_id[0] == '\0')) { + /* If no identifier given, generate one from ID type. */ + SNPRINTF(_preview_id, "uiPreview_%s", BKE_idtype_idcode_to_name(GS(id->name))); + preview_id = _preview_id; + } + + /* Find or add the uiPreview to the current Region. */ + ARegion *region = CTX_wm_region(C); + uiPreview *ui_preview = static_cast( + BLI_findstring(®ion->ui_previews, preview_id, offsetof(uiPreview, preview_id))); + + if (!ui_preview) { + ui_preview = MEM_cnew(__func__); + STRNCPY(ui_preview->preview_id, preview_id); + ui_preview->height = short(UI_UNIT_Y * 7.6f); + ui_preview->id_session_uid = pid->session_uid; + ui_preview->tag = UI_PREVIEW_TAG_DIRTY; + BLI_addtail(®ion->ui_previews, ui_preview); + } + else if (ui_preview->id_session_uid != pid->session_uid) { + ui_preview->id_session_uid = pid->session_uid; + ui_preview->tag |= UI_PREVIEW_TAG_DIRTY; + } + + if (ui_preview->height < UI_UNIT_Y) { + ui_preview->height = UI_UNIT_Y; + } + else if (ui_preview->height > UI_UNIT_Y * 50) { /* Rather high upper limit, yet not insane! */ + ui_preview->height = UI_UNIT_Y * 50; + } + + /* layout */ + uiBlock *block = uiLayoutGetBlock(layout); + uiLayout *row = uiLayoutRow(layout, false); + uiLayout *col = uiLayoutColumn(row, false); + uiLayoutSetKeepAspect(col, true); + + /* add preview */ + uiDefBut( + block, UI_BTYPE_EXTRA, 0, "", 0, 0, UI_UNIT_X * 10, ui_preview->height, pid, 0.0, 0.0, ""); + UI_but_func_drawextra_set(block, + [pid, pparent, slot, ui_preview](const bContext *C, rcti *rect) { + ED_preview_draw(C, pid, pparent, slot, ui_preview, rect); + }); + UI_block_func_handle_set(block, do_preview_buttons, nullptr); + + uiDefIconButS(block, + UI_BTYPE_GRIP, + 0, + ICON_GRIP, + 0, + 0, + UI_UNIT_X * 10, + short(UI_UNIT_Y * 0.3f), + &ui_preview->height, + UI_UNIT_Y, + UI_UNIT_Y * 50.0f, + ""); + + /* add buttons */ + if (pid && show_buttons) { + if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) { + if (GS(pid->name) == ID_MA) { + ma = (Material *)pid; + } + else { + ma = (Material *)pparent; + } + + /* Create RNA Pointer */ + PointerRNA material_ptr = RNA_pointer_create(&ma->id, &RNA_Material, ma); + + col = uiLayoutColumn(row, true); + uiLayoutSetScaleX(col, 1.5); + uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE); + + /* EEVEE preview file has baked lighting so use_preview_world has no effect, + * just hide the option until this feature is supported. */ + if (!BKE_scene_uses_blender_eevee(CTX_data_scene(C))) { + uiItemS(col); + uiItemR(col, &material_ptr, "use_preview_world", UI_ITEM_NONE, "", ICON_WORLD); + } + } + + if (pr_texture) { + /* Create RNA Pointer */ + PointerRNA texture_ptr = RNA_pointer_create(id, &RNA_Texture, tex); + + uiLayoutRow(layout, true); + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + IFACE_("Texture"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_TEXTURE, + ""); + if (GS(parent->name) == ID_MA) { + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + IFACE_("Material"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_OTHER, + ""); + } + else if (GS(parent->name) == ID_LA) { + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_OTHER, + ""); + } + else if (GS(parent->name) == ID_WO) { + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + CTX_IFACE_(BLT_I18NCONTEXT_ID_WORLD, "World"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_OTHER, + ""); + } + else if (GS(parent->name) == ID_LS) { + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + IFACE_("Line Style"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_OTHER, + ""); + } + uiDefButS(block, + UI_BTYPE_ROW, + B_MATPRV, + IFACE_("Both"), + 0, + 0, + UI_UNIT_X * 10, + UI_UNIT_Y, + pr_texture, + 10, + TEX_PR_BOTH, + ""); + + /* Alpha button for texture preview */ + if (*pr_texture != TEX_PR_OTHER) { + row = uiLayoutRow(layout, false); + uiItemR(row, &texture_ptr, "use_preview_alpha", UI_ITEM_NONE, std::nullopt, ICON_NONE); + } + } + } +} diff --git a/source/blender/editors/interface/templates/interface_template_recent_files.cc b/source/blender/editors/interface/templates/interface_template_recent_files.cc new file mode 100644 index 000000000000..79957ad9a717 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_recent_files.cc @@ -0,0 +1,157 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include + +#include "BLI_fileops.h" +#include "BLI_path_utils.hh" +#include "BLI_string.h" + +#include "BLO_readfile.hh" + +#include "BLT_translation.hh" + +#include "BKE_blendfile.hh" +#include "BKE_global.hh" +#include "BKE_main.hh" + +#include "IMB_imbuf.hh" +#include "IMB_metadata.hh" +#include "IMB_thumbs.hh" + +#include "RNA_access.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +static void uiTemplateRecentFiles_tooltip_func(bContext & /*C*/, uiTooltipData &tip, void *argN) +{ + char *path = (char *)argN; + + /* File name and path. */ + char dirname[FILE_MAX]; + char filename[FILE_MAX]; + BLI_path_split_dir_file(path, dirname, sizeof(dirname), filename, sizeof(filename)); + UI_tooltip_text_field_add(tip, filename, {}, UI_TIP_STYLE_HEADER, UI_TIP_LC_NORMAL); + UI_tooltip_text_field_add(tip, dirname, {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); + + UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); + + if (!BLI_exists(path)) { + UI_tooltip_text_field_add(tip, N_("File Not Found"), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_ALERT); + return; + } + + /* Blender version. */ + char version_str[128] = {0}; + /* Load the thumbnail from cache if existing, but don't create if not. */ + ImBuf *thumb = IMB_thumb_read(path, THB_LARGE); + if (thumb) { + /* Look for version in existing thumbnail if available. */ + IMB_metadata_get_field( + thumb->metadata, "Thumb::Blender::Version", version_str, sizeof(version_str)); + } + + eFileAttributes attributes = BLI_file_attributes(path); + if (!version_str[0] && !(attributes & FILE_ATTR_OFFLINE)) { + /* Load Blender version directly from the file. */ + short version = BLO_version_from_file(path); + if (version != 0) { + SNPRINTF(version_str, "%d.%01d", version / 100, version % 100); + } + } + + if (version_str[0]) { + UI_tooltip_text_field_add( + tip, fmt::format("Blender {}", version_str), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); + UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); + } + + BLI_stat_t status; + if (BLI_stat(path, &status) != -1) { + char date_str[FILELIST_DIRENTRY_DATE_LEN], time_st[FILELIST_DIRENTRY_TIME_LEN]; + bool is_today, is_yesterday; + std::string day_string; + BLI_filelist_entry_datetime_to_string( + nullptr, int64_t(status.st_mtime), false, time_st, date_str, &is_today, &is_yesterday); + if (is_today || is_yesterday) { + day_string = (is_today ? N_("Today") : N_("Yesterday")) + std::string(" "); + } + UI_tooltip_text_field_add(tip, + fmt::format("{}: {}{}{}", + N_("Modified"), + day_string, + (is_today || is_yesterday) ? "" : date_str, + (is_today || is_yesterday) ? time_st : ""), + {}, + UI_TIP_STYLE_NORMAL, + UI_TIP_LC_NORMAL); + + if (status.st_size > 0) { + char size[16]; + BLI_filelist_entry_size_to_string(nullptr, status.st_size, false, size); + UI_tooltip_text_field_add( + tip, fmt::format("{}: {}", N_("Size"), size), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); + } + } + + if (!thumb) { + /* try to load from the blend file itself. */ + BlendThumbnail *data = BLO_thumbnail_from_file(path); + thumb = BKE_main_thumbnail_to_imbuf(nullptr, data); + if (data) { + MEM_freeN(data); + } + } + + if (thumb) { + UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); + UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); + + uiTooltipImage image_data; + float scale = (72.0f * UI_SCALE_FAC) / float(std::max(thumb->x, thumb->y)); + image_data.ibuf = thumb; + image_data.width = short(float(thumb->x) * scale); + image_data.height = short(float(thumb->y) * scale); + image_data.border = true; + image_data.background = uiTooltipImageBackground::Checkerboard_Themed; + image_data.premultiplied = true; + UI_tooltip_image_field_add(tip, image_data); + IMB_freeImBuf(thumb); + } +} + +int uiTemplateRecentFiles(uiLayout *layout, int rows) +{ + int i = 0; + LISTBASE_FOREACH_INDEX (RecentFile *, recent, &G.recent_files, i) { + if (i >= rows) { + break; + } + + const char *filename = BLI_path_basename(recent->filepath); + PointerRNA ptr; + uiItemFullO(layout, + "WM_OT_open_mainfile", + filename, + BKE_blendfile_extension_check(filename) ? ICON_FILE_BLEND : ICON_FILE_BACKUP, + nullptr, + WM_OP_INVOKE_DEFAULT, + UI_ITEM_NONE, + &ptr); + RNA_string_set(&ptr, "filepath", recent->filepath); + RNA_boolean_set(&ptr, "display_file_selector", false); + + uiBlock *block = uiLayoutGetBlock(layout); + uiBut *but = ui_but_last(block); + UI_but_func_tooltip_custom_set( + but, uiTemplateRecentFiles_tooltip_func, BLI_strdup(recent->filepath), MEM_freeN); + } + + return i; +} diff --git a/source/blender/editors/interface/templates/interface_template_running_jobs.cc b/source/blender/editors/interface/templates/interface_template_running_jobs.cc new file mode 100644 index 000000000000..d6fa8498ea86 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_running_jobs.cc @@ -0,0 +1,321 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include + +#include "BKE_context.hh" +#include "BKE_global.hh" +#include "BKE_main.hh" + +#include "BLI_string.h" +#include "BLI_time.h" + +#include "BLI_timecode.h" +#include "BLT_translation.hh" + +#include "ED_screen.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +#define B_STOPRENDER 1 +#define B_STOPCAST 2 +#define B_STOPANIM 3 +#define B_STOPCOMPO 4 +#define B_STOPSEQ 5 +#define B_STOPCLIP 6 +#define B_STOPFILE 7 +#define B_STOPOTHER 8 + +static void do_running_jobs(bContext *C, void * /*arg*/, int event) +{ + switch (event) { + case B_STOPRENDER: + G.is_break = true; + break; + case B_STOPCAST: + WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_wm_screen(C)); + break; + case B_STOPANIM: + WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, nullptr, nullptr); + break; + case B_STOPCOMPO: + WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); + break; + case B_STOPSEQ: + WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); + break; + case B_STOPCLIP: + WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); + break; + case B_STOPFILE: + WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); + break; + case B_STOPOTHER: + G.is_break = true; + break; + } +} + +struct ProgressTooltip_Store { + wmWindowManager *wm; + void *owner; +}; + +static std::string progress_tooltip_func(bContext * /*C*/, void *argN, const char * /*tip*/) +{ + ProgressTooltip_Store *arg = static_cast(argN); + wmWindowManager *wm = arg->wm; + void *owner = arg->owner; + + const float progress = WM_jobs_progress(wm, owner); + + /* create tooltip text and associate it with the job */ + char elapsed_str[32]; + char remaining_str[32] = "Unknown"; + const double elapsed = BLI_time_now_seconds() - WM_jobs_starttime(wm, owner); + BLI_timecode_string_from_time_simple(elapsed_str, sizeof(elapsed_str), elapsed); + + if (progress) { + const double remaining = (elapsed / double(progress)) - elapsed; + BLI_timecode_string_from_time_simple(remaining_str, sizeof(remaining_str), remaining); + } + + return fmt::format( + "Time Remaining: {}\n" + "Time Elapsed: {}", + remaining_str, + elapsed_str); +} + +void uiTemplateRunningJobs(uiLayout *layout, bContext *C) +{ + Main *bmain = CTX_data_main(C); + wmWindowManager *wm = CTX_wm_manager(C); + ScrArea *area = CTX_wm_area(C); + void *owner = nullptr; + int handle_event, icon = 0; + const char *op_name = nullptr; + const char *op_description = nullptr; + + uiBlock *block = uiLayoutGetBlock(layout); + UI_block_layout_set_current(block, layout); + + UI_block_func_handle_set(block, do_running_jobs, nullptr); + + /* another scene can be rendering too, for example via compositor */ + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) { + handle_event = B_STOPOTHER; + icon = ICON_NONE; + owner = scene; + } + else { + continue; + } + + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PROXY)) { + handle_event = B_STOPSEQ; + icon = ICON_SEQUENCE; + owner = scene; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PREVIEW)) { + handle_event = B_STOPSEQ; + icon = ICON_SEQUENCE; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) { + handle_event = B_STOPSEQ; + icon = ICON_SEQUENCE; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) { + handle_event = B_STOPCLIP; + icon = ICON_TRACKER; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_PREFETCH)) { + handle_event = B_STOPCLIP; + icon = ICON_TRACKER; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_TRACK_MARKERS)) { + handle_event = B_STOPCLIP; + icon = ICON_TRACKER; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) { + handle_event = B_STOPCLIP; + icon = ICON_TRACKER; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_FILESEL_READDIR) || + WM_jobs_test(wm, scene, WM_JOB_TYPE_ASSET_LIBRARY_LOAD)) + { + handle_event = B_STOPFILE; + icon = ICON_FILEBROWSER; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) { + handle_event = B_STOPRENDER; + icon = ICON_SCENE; + if (U.render_display_type != USER_RENDER_DISPLAY_NONE) { + op_name = "RENDER_OT_view_show"; + op_description = "Show the render window"; + } + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) { + handle_event = B_STOPCOMPO; + icon = ICON_RENDERLAYERS; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) || + WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) + { + /* Skip bake jobs in compositor to avoid compo header displaying + * progress bar which is not being updated (bake jobs only need + * to update NC_IMAGE context. + */ + if (area->spacetype != SPACE_NODE) { + handle_event = B_STOPOTHER; + icon = ICON_IMAGE; + break; + } + continue; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) { + handle_event = B_STOPOTHER; + icon = ICON_MOD_DYNAMICPAINT; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) { + handle_event = B_STOPOTHER; + icon = ICON_PHYSICS; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) { + handle_event = B_STOPOTHER; + icon = ICON_MOD_FLUIDSIM; + break; + } + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) { + handle_event = B_STOPOTHER; + icon = ICON_MOD_OCEAN; + break; + } + } + + if (owner) { + const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; + const bool active = !(G.is_break || WM_jobs_is_stopped(wm, owner)); + + uiLayout *row = uiLayoutRow(layout, false); + block = uiLayoutGetBlock(row); + + /* get percentage done and set it as the UI text */ + const float progress = WM_jobs_progress(wm, owner); + char text[8]; + SNPRINTF(text, "%d%%", int(progress * 100)); + + const char *name = active ? WM_jobs_name(wm, owner) : "Canceling..."; + + /* job icon as a button */ + if (op_name) { + uiDefIconButO(block, + UI_BTYPE_BUT, + op_name, + WM_OP_INVOKE_DEFAULT, + icon, + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + TIP_(op_description)); + } + + /* job name and icon if not previously set */ + const int textwidth = UI_fontstyle_string_width(fstyle, name); + uiDefIconTextBut(block, + UI_BTYPE_LABEL, + 0, + op_name ? 0 : icon, + name, + 0, + 0, + textwidth + UI_UNIT_X * 1.5f, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + ""); + + /* stick progress bar and cancel button together */ + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, active); + block = uiLayoutGetBlock(row); + + { + ProgressTooltip_Store *tip_arg = static_cast( + MEM_mallocN(sizeof(*tip_arg), __func__)); + tip_arg->wm = wm; + tip_arg->owner = owner; + uiButProgress *but_progress = (uiButProgress *)uiDefIconTextBut(block, + UI_BTYPE_PROGRESS, + 0, + ICON_NONE, + text, + UI_UNIT_X, + 0, + UI_UNIT_X * 6.0f, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + nullptr); + + but_progress->progress_factor = progress; + UI_but_func_tooltip_set(but_progress, progress_tooltip_func, tip_arg, MEM_freeN); + } + + if (!wm->runtime->is_interface_locked) { + uiDefIconTextBut(block, + UI_BTYPE_BUT, + handle_event, + ICON_PANEL_CLOSE, + "", + 0, + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + TIP_("Stop this job")); + } + } + + if (ED_screen_animation_no_scrub(wm)) { + uiDefIconTextBut(block, + UI_BTYPE_BUT, + B_STOPANIM, + ICON_CANCEL, + IFACE_("Anim Player"), + 0, + 0, + UI_UNIT_X * 5.0f, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + TIP_("Stop animation playback")); + } +} diff --git a/source/blender/editors/interface/templates/interface_template_scopes.cc b/source/blender/editors/interface/templates/interface_template_scopes.cc new file mode 100644 index 000000000000..085b1ded4f25 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_scopes.cc @@ -0,0 +1,179 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string_ref.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" + +using blender::StringRefNull; + +/* -------------------------------------------------------------------- */ +/** \name Histogram Template + * \{ */ + +void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + return; + } + + const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram)) { + return; + } + Histogram *hist = (Histogram *)cptr.data; + + if (hist->height < UI_UNIT_Y) { + hist->height = UI_UNIT_Y; + } + else if (hist->height > UI_UNIT_Y * 20) { + hist->height = UI_UNIT_Y * 20; + } + + uiLayout *col = uiLayoutColumn(layout, true); + uiBlock *block = uiLayoutGetBlock(col); + + uiDefBut(block, UI_BTYPE_HISTOGRAM, 0, "", 0, 0, UI_UNIT_X * 10, hist->height, hist, 0, 0, ""); + + /* Resize grip. */ + uiDefIconButI(block, + UI_BTYPE_GRIP, + 0, + ICON_GRIP, + 0, + 0, + UI_UNIT_X * 10, + short(UI_UNIT_Y * 0.3f), + &hist->height, + UI_UNIT_Y, + UI_UNIT_Y * 20.0f, + ""); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Waveform Template + * \{ */ + +void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + return; + } + + const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes)) { + return; + } + Scopes *scopes = (Scopes *)cptr.data; + + uiLayout *col = uiLayoutColumn(layout, true); + uiBlock *block = uiLayoutGetBlock(col); + + if (scopes->wavefrm_height < UI_UNIT_Y) { + scopes->wavefrm_height = UI_UNIT_Y; + } + else if (scopes->wavefrm_height > UI_UNIT_Y * 20) { + scopes->wavefrm_height = UI_UNIT_Y * 20; + } + + uiDefBut(block, + UI_BTYPE_WAVEFORM, + 0, + "", + 0, + 0, + UI_UNIT_X * 10, + scopes->wavefrm_height, + scopes, + 0, + 0, + ""); + + /* Resize grip. */ + uiDefIconButI(block, + UI_BTYPE_GRIP, + 0, + ICON_GRIP, + 0, + 0, + UI_UNIT_X * 10, + short(UI_UNIT_Y * 0.3f), + &scopes->wavefrm_height, + UI_UNIT_Y, + UI_UNIT_Y * 20.0f, + ""); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Vector-Scope Template + * \{ */ + +void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) +{ + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + return; + } + + const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); + if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes)) { + return; + } + Scopes *scopes = (Scopes *)cptr.data; + + if (scopes->vecscope_height < UI_UNIT_Y) { + scopes->vecscope_height = UI_UNIT_Y; + } + else if (scopes->vecscope_height > UI_UNIT_Y * 20) { + scopes->vecscope_height = UI_UNIT_Y * 20; + } + + uiLayout *col = uiLayoutColumn(layout, true); + uiBlock *block = uiLayoutGetBlock(col); + + uiDefBut(block, + UI_BTYPE_VECTORSCOPE, + 0, + "", + 0, + 0, + UI_UNIT_X * 10, + scopes->vecscope_height, + scopes, + 0, + 0, + ""); + + /* Resize grip. */ + uiDefIconButI(block, + UI_BTYPE_GRIP, + 0, + ICON_GRIP, + 0, + 0, + UI_UNIT_X * 10, + short(UI_UNIT_Y * 0.3f), + &scopes->vecscope_height, + UI_UNIT_Y, + UI_UNIT_Y * 20.0f, + ""); +} + +/** \} */ diff --git a/source/blender/editors/interface/templates/interface_template_search.cc b/source/blender/editors/interface/templates/interface_template_search.cc new file mode 100644 index 000000000000..66280cfad524 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_search.cc @@ -0,0 +1,274 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include "BLI_string_ref.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" +#include "interface_templates_intern.hh" + +using blender::StringRef; +using blender::StringRefNull; + +struct TemplateSearch { + uiRNACollectionSearch search_data; + + bool use_previews; + int preview_rows, preview_cols; +}; + +static void template_search_exec_fn(bContext *C, void *arg_template, void *item) +{ + TemplateSearch *template_search = static_cast(arg_template); + uiRNACollectionSearch *coll_search = &template_search->search_data; + StructRNA *type = RNA_property_pointer_type(&coll_search->target_ptr, coll_search->target_prop); + + PointerRNA item_ptr = RNA_pointer_create(nullptr, type, item); + RNA_property_pointer_set(&coll_search->target_ptr, coll_search->target_prop, item_ptr, nullptr); + RNA_property_update(C, &coll_search->target_ptr, coll_search->target_prop); +} + +static uiBlock *template_search_menu(bContext *C, ARegion *region, void *arg_template) +{ + static TemplateSearch template_search; + + /* arg_template is malloced, can be freed by parent button */ + template_search = *((TemplateSearch *)arg_template); + PointerRNA active_ptr = RNA_property_pointer_get(&template_search.search_data.target_ptr, + template_search.search_data.target_prop); + + return template_common_search_menu(C, + region, + ui_rna_collection_search_update_fn, + &template_search, + template_search_exec_fn, + active_ptr.data, + nullptr, + template_search.preview_rows, + template_search.preview_cols, + 1.0f); +} + +static void template_search_add_button_searchmenu(const bContext *C, + uiLayout *layout, + uiBlock *block, + TemplateSearch &template_search, + const bool editable, + const bool live_icon) +{ + const char *ui_description = RNA_property_ui_description( + template_search.search_data.target_prop); + + template_add_button_search_menu(C, + layout, + block, + &template_search.search_data.target_ptr, + template_search.search_data.target_prop, + template_search_menu, + MEM_new(__func__, template_search), + ui_description, + template_search.use_previews, + editable, + live_icon, + but_func_argN_free, + but_func_argN_copy); +} + +static void template_search_add_button_name(uiBlock *block, + PointerRNA *active_ptr, + const StructRNA *type) +{ + /* Skip text button without an active item. */ + if (active_ptr->data == nullptr) { + return; + } + + PropertyRNA *name_prop; + if (type == &RNA_ActionSlot) { + name_prop = RNA_struct_find_property(active_ptr, "name_display"); + } + else { + name_prop = RNA_struct_name_property(type); + } + + const int width = template_search_textbut_width(active_ptr, name_prop); + const int height = template_search_textbut_height(); + uiDefAutoButR(block, active_ptr, name_prop, 0, "", ICON_NONE, 0, 0, width, height); +} + +static void template_search_add_button_operator(uiBlock *block, + const char *const operator_name, + const wmOperatorCallContext opcontext, + const int icon, + const bool editable) +{ + if (!operator_name) { + return; + } + + uiBut *but = uiDefIconButO( + block, UI_BTYPE_BUT, operator_name, opcontext, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, nullptr); + + if (!editable) { + UI_but_drawflag_enable(but, UI_BUT_DISABLED); + } +} + +static void template_search_buttons(const bContext *C, + uiLayout *layout, + TemplateSearch &template_search, + const char *newop, + const char *unlinkop, + const std::optional text) +{ + uiBlock *block = uiLayoutGetBlock(layout); + uiRNACollectionSearch *search_data = &template_search.search_data; + const StructRNA *type = RNA_property_pointer_type(&search_data->target_ptr, + search_data->target_prop); + const bool editable = RNA_property_editable(&search_data->target_ptr, search_data->target_prop); + PointerRNA active_ptr = RNA_property_pointer_get(&search_data->target_ptr, + search_data->target_prop); + + if (active_ptr.type) { + /* can only get correct type when there is an active item */ + type = active_ptr.type; + } + + uiLayout *row = uiLayoutRow(layout, true); + UI_block_align_begin(block); + + uiLayout *decorator_layout = nullptr; + if (text && !text->is_empty()) { + /* Add label respecting the separated layout property split state. */ + decorator_layout = uiItemL_respect_property_split(row, *text, ICON_NONE); + } + + template_search_add_button_searchmenu(C, row, block, template_search, editable, false); + template_search_add_button_name(block, &active_ptr, type); + template_search_add_button_operator( + block, newop, WM_OP_INVOKE_DEFAULT, ICON_DUPLICATE, editable); + template_search_add_button_operator(block, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, editable); + + UI_block_align_end(block); + + if (decorator_layout) { + uiItemDecoratorR(decorator_layout, nullptr, "", RNA_NO_INDEX); + } +} + +static PropertyRNA *template_search_get_searchprop(PointerRNA *targetptr, + PropertyRNA *targetprop, + PointerRNA *searchptr, + const char *const searchpropname) +{ + PropertyRNA *searchprop; + + if (searchptr && !searchptr->data) { + searchptr = nullptr; + } + + if (!searchptr && !searchpropname) { + /* both nullptr means we don't use a custom rna collection to search in */ + } + else if (!searchptr && searchpropname) { + RNA_warning("searchpropname defined (%s) but searchptr is missing", searchpropname); + } + else if (searchptr && !searchpropname) { + RNA_warning("searchptr defined (%s) but searchpropname is missing", + RNA_struct_identifier(searchptr->type)); + } + else if (!(searchprop = RNA_struct_find_property(searchptr, searchpropname))) { + RNA_warning("search collection property not found: %s.%s", + RNA_struct_identifier(searchptr->type), + searchpropname); + } + else if (RNA_property_type(searchprop) != PROP_COLLECTION) { + RNA_warning("search collection property is not a collection type: %s.%s", + RNA_struct_identifier(searchptr->type), + searchpropname); + } + /* check if searchprop has same type as targetprop */ + else if (RNA_property_pointer_type(searchptr, searchprop) != + RNA_property_pointer_type(targetptr, targetprop)) + { + RNA_warning("search collection items from %s.%s are not of type %s", + RNA_struct_identifier(searchptr->type), + searchpropname, + RNA_struct_identifier(RNA_property_pointer_type(targetptr, targetprop))); + } + else { + return searchprop; + } + + return nullptr; +} + +static bool template_search_setup(TemplateSearch &template_search, + PointerRNA *ptr, + const StringRefNull propname, + PointerRNA *searchptr, + const char *const searchpropname) +{ + template_search = {}; + PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); + + if (!prop || RNA_property_type(prop) != PROP_POINTER) { + RNA_warning( + "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); + return false; + } + PropertyRNA *searchprop = template_search_get_searchprop(ptr, prop, searchptr, searchpropname); + + template_search.search_data.target_ptr = *ptr; + template_search.search_data.target_prop = prop; + template_search.search_data.search_ptr = *searchptr; + template_search.search_data.search_prop = searchprop; + + return true; +} + +void uiTemplateSearch(uiLayout *layout, + const bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + PointerRNA *searchptr, + const char *searchpropname, + const char *newop, + const char *unlinkop, + const std::optional text) +{ + TemplateSearch template_search; + if (template_search_setup(template_search, ptr, propname, searchptr, searchpropname)) { + template_search_buttons(C, layout, template_search, newop, unlinkop, text); + } +} + +void uiTemplateSearchPreview(uiLayout *layout, + bContext *C, + PointerRNA *ptr, + const StringRefNull propname, + PointerRNA *searchptr, + const char *searchpropname, + const char *newop, + const char *unlinkop, + const int rows, + const int cols, + const std::optional text) +{ + TemplateSearch template_search; + if (template_search_setup(template_search, ptr, propname, searchptr, searchpropname)) { + template_search.use_previews = true; + template_search.preview_rows = rows; + template_search.preview_cols = cols; + + template_search_buttons(C, layout, template_search, newop, unlinkop, text); + } +} diff --git a/source/blender/editors/interface/templates/interface_template_shader_fx.cc b/source/blender/editors/interface/templates/interface_template_shader_fx.cc new file mode 100644 index 000000000000..79b63aef3bef --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_shader_fx.cc @@ -0,0 +1,74 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + * + * Template for building the panel layout for the active object's grease pencil shader effects. + */ + +#include "BKE_screen.hh" +#include "BKE_shader_fx.h" + +#include "ED_object.hh" + +#include "RNA_access.hh" +#include "RNA_prototypes.hh" + +#include "UI_interface.hh" + +/** + * Function with void * argument for #uiListPanelIDFromDataFunc. + */ +static void shaderfx_panel_id(void *fx_v, char *r_idname) +{ + ShaderFxData *fx = (ShaderFxData *)fx_v; + BKE_shaderfxType_panel_id(ShaderFxType(fx->type), r_idname); +} + +void uiTemplateShaderFx(uiLayout * /*layout*/, bContext *C) +{ + ARegion *region = CTX_wm_region(C); + Object *ob = blender::ed::object::context_active_object(C); + ListBase *shaderfx = &ob->shader_fx; + + const bool panels_match = UI_panel_list_matches_data(region, shaderfx, shaderfx_panel_id); + + if (!panels_match) { + UI_panels_free_instanced(C, region); + LISTBASE_FOREACH (ShaderFxData *, fx, shaderfx) { + char panel_idname[MAX_NAME]; + shaderfx_panel_id(fx, panel_idname); + + /* Create custom data RNA pointer. */ + PointerRNA *fx_ptr = MEM_new(__func__); + *fx_ptr = RNA_pointer_create(&ob->id, &RNA_ShaderFx, fx); + + UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, fx_ptr); + } + } + else { + /* Assuming there's only one group of instanced panels, update the custom data pointers. */ + Panel *panel = static_cast(region->panels.first); + LISTBASE_FOREACH (ShaderFxData *, fx, shaderfx) { + const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(ShaderFxType(fx->type)); + if (fxi->panel_register == nullptr) { + continue; + } + + /* Move to the next instanced panel corresponding to the next modifier. */ + while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { + panel = panel->next; + BLI_assert(panel != + nullptr); /* There shouldn't be fewer panels than modifiers with UIs. */ + } + + PointerRNA *fx_ptr = MEM_new(__func__); + *fx_ptr = RNA_pointer_create(&ob->id, &RNA_ShaderFx, fx); + UI_panel_custom_data_set(panel, fx_ptr); + + panel = panel->next; + } + } +} diff --git a/source/blender/editors/interface/templates/interface_template_status.cc b/source/blender/editors/interface/templates/interface_template_status.cc new file mode 100644 index 000000000000..a40c6c79a632 --- /dev/null +++ b/source/blender/editors/interface/templates/interface_template_status.cc @@ -0,0 +1,495 @@ +/* SPDX-FileCopyrightText: 2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + */ + +#include + +#include "BKE_blender_version.h" +#include "BKE_context.hh" +#include "BKE_global.hh" +#include "BKE_main.hh" +#include "BKE_report.hh" +#include "BKE_screen.hh" +#include "BKE_workspace.hh" + +#include "BLI_math_vector.h" +#include "BLI_string.h" + +#include "BLF_api.hh" +#include "BLT_translation.hh" + +#include "DNA_space_types.h" +#include "DNA_workspace_types.h" + +#include "ED_info.hh" +#include "ED_screen_types.hh" + +#include "WM_api.hh" + +#include "UI_interface.hh" +#include "interface_intern.hh" + +/* Maximum width for a Status Bar report */ +#define REPORT_BANNER_MAX_WIDTH (800.0f * UI_SCALE_FAC) + +void uiTemplateReportsBanner(uiLayout *layout, bContext *C) +{ + ReportList *reports = CTX_wm_reports(C); + Report *report = BKE_reports_last_displayable(reports); + const uiStyle *style = UI_style_get(); + + uiBut *but; + + /* if the report display has timed out, don't show */ + if (!reports->reporttimer) { + return; + } + + ReportTimerInfo *rti = (ReportTimerInfo *)reports->reporttimer->customdata; + + if (!rti || rti->widthfac == 0.0f || !report) { + return; + } + + uiLayout *ui_abs = uiLayoutAbsolute(layout, false); + uiBlock *block = uiLayoutGetBlock(ui_abs); + eUIEmbossType previous_emboss = UI_block_emboss_get(block); + + uchar report_icon_color[4]; + uchar report_text_color[4]; + + UI_GetThemeColorType4ubv( + UI_icon_colorid_from_report_type(report->type), SPACE_INFO, report_icon_color); + UI_GetThemeColorType4ubv( + UI_text_colorid_from_report_type(report->type), SPACE_INFO, report_text_color); + report_text_color[3] = 255; /* This theme color is RGB only, so have to set alpha here. */ + + if (rti->flash_progress <= 1.0) { + /* Flash report briefly according to progress through fade-out duration. */ + const int brighten_amount = int(32 * (1.0f - rti->flash_progress)); + add_v3_uchar_clamped(report_icon_color, brighten_amount); + } + + UI_fontstyle_set(&style->widget); + int width = BLF_width(style->widget.uifont_id, report->message, report->len); + width = min_ii(width, int(REPORT_BANNER_MAX_WIDTH)); + width = min_ii(int(rti->widthfac * width), width); + width = max_ii(width, 10 * UI_SCALE_FAC); + + UI_block_align_begin(block); + + /* Background for icon. */ + but = uiDefBut(block, + UI_BTYPE_ROUNDBOX, + 0, + "", + 0, + 0, + UI_UNIT_X + (6 * UI_SCALE_FAC), + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + ""); + /* #UI_BTYPE_ROUNDBOX's background color is set in `but->col`. */ + copy_v4_v4_uchar(but->col, report_icon_color); + + /* Background for the rest of the message. */ + but = uiDefBut(block, + UI_BTYPE_ROUNDBOX, + 0, + "", + UI_UNIT_X + (6 * UI_SCALE_FAC), + 0, + UI_UNIT_X + width, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + ""); + /* Use icon background at low opacity to highlight, but still contrasting with area TH_TEXT. */ + copy_v3_v3_uchar(but->col, report_icon_color); + but->col[3] = 64; + + UI_block_align_end(block); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + + /* The report icon itself. */ + but = uiDefIconButO(block, + UI_BTYPE_BUT, + "SCREEN_OT_info_log_show", + WM_OP_INVOKE_REGION_WIN, + UI_icon_from_report_type(report->type), + (3 * UI_SCALE_FAC), + 0, + UI_UNIT_X, + UI_UNIT_Y, + TIP_("Click to open the info editor")); + copy_v4_v4_uchar(but->col, report_text_color); + + /* The report message. */ + but = uiDefButO(block, + UI_BTYPE_BUT, + "SCREEN_OT_info_log_show", + WM_OP_INVOKE_REGION_WIN, + report->message, + UI_UNIT_X, + 0, + width + UI_UNIT_X, + UI_UNIT_Y, + TIP_("Show in Info Log")); + + UI_block_emboss_set(block, previous_emboss); +} + +static bool uiTemplateInputStatusAzone(uiLayout *layout, const AZone *az, const ARegion *region) +{ + if (az->type == AZONE_AREA) { + uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemL(layout, IFACE_("Split/Dock"), ICON_NONE); + uiItemS_ex(layout, 0.7f); + uiItemL(layout, "", ICON_EVENT_SHIFT); + uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemL(layout, IFACE_("Duplicate into Window"), ICON_NONE); + uiItemS_ex(layout, 0.7f); + uiItemL(layout, "", ICON_EVENT_CTRL); + uiItemS_ex(layout, 1.5f); + uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemL(layout, IFACE_("Swap Areas"), ICON_NONE); + return true; + } + + if (az->type == AZONE_REGION) { + uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemL(layout, + (region->runtime->visible) ? IFACE_("Resize Region") : IFACE_("Show Hidden Region"), + ICON_NONE); + return true; + } + + return false; +} + +void uiTemplateInputStatus(uiLayout *layout, bContext *C) +{ + wmWindow *win = CTX_wm_window(C); + WorkSpace *workspace = CTX_wm_workspace(C); + + /* Workspace status text has priority. */ + if (!workspace->runtime->status.is_empty()) { + uiLayout *row = uiLayoutRow(layout, true); + for (const blender::bke::WorkSpaceStatusItem &item : workspace->runtime->status) { + if (item.space_factor != 0.0f) { + uiItemS_ex(row, item.space_factor); + } + else { + uiBut *but = uiItemL_ex(row, item.text, item.icon, false, false); + if (item.inverted) { + but->drawflag |= UI_BUT_ICON_INVERT; + } + const float offset = ui_event_icon_offset(item.icon); + if (offset != 0.0f) { + uiItemS_ex(row, offset); + } + } + } + return; + } + + if (WM_window_modal_keymap_status_draw(C, win, layout)) { + return; + } + + bScreen *screen = CTX_wm_screen(C); + ARegion *region = screen->active_region; + uiLayout *row = uiLayoutRow(layout, true); + + if (region == nullptr) { + /* Check if over an action zone. */ + LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) { + LISTBASE_FOREACH (AZone *, az, &area_iter->actionzones) { + if (BLI_rcti_isect_pt_v(&az->rect, win->eventstate->xy)) { + region = az->region; + if (uiTemplateInputStatusAzone(row, az, region)) { + return; + } + break; + } + } + } + } + + if (!region) { + /* On a gap between editors. */ + uiItemL(row, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemL(row, IFACE_("Resize"), ICON_NONE); + uiItemS_ex(row, 0.7f); + uiItemL(row, nullptr, ICON_MOUSE_RMB); + uiItemS_ex(row, -0.5f); + uiItemL(row, IFACE_("Options"), ICON_NONE); + return; + } + + /* Otherwise should cursor keymap status. */ + for (int i = 0; i < 3; i++) { + uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); + + const char *msg = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, + WM_window_cursor_keymap_status_get(win, i, 0)); + const char *msg_drag = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, + WM_window_cursor_keymap_status_get(win, i, 1)); + + if (msg) { + uiItemL(row, "", (ICON_MOUSE_LMB + i)); + uiItemS_ex(row, -0.5f); + uiItemL(row, msg, ICON_NONE); + uiItemS_ex(row, 0.7f); + } + + if (msg_drag) { + uiItemL(row, "", (ICON_MOUSE_LMB_DRAG + i)); + uiItemL(row, msg_drag, ICON_NONE); + uiItemS_ex(row, 0.7f); + } + } +} + +static std::string ui_template_status_tooltip(bContext *C, void * /*argN*/, const char * /*tip*/) +{ + Main *bmain = CTX_data_main(C); + std::string tooltip_message = ""; + + if (bmain->has_forward_compatibility_issues) { + char writer_ver_str[12]; + BKE_blender_version_blendfile_string_from_values( + writer_ver_str, sizeof(writer_ver_str), bmain->versionfile, -1); + tooltip_message += fmt::format( + fmt::runtime(RPT_("File saved by newer Blender\n({}), expect loss of data")), + writer_ver_str); + } + if (bmain->is_asset_edit_file) { + if (!tooltip_message.empty()) { + tooltip_message += "\n\n"; + } + tooltip_message += RPT_( + "This file is managed by the Blender asset system and cannot be overridden"); + } + + return tooltip_message; +} + +void uiTemplateStatusInfo(uiLayout *layout, bContext *C) +{ + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + uiLayout *row = uiLayoutRow(layout, true); + + const char *status_info_txt = ED_info_statusbar_string_ex( + bmain, scene, view_layer, (U.statusbar_flag & ~STATUSBAR_SHOW_VERSION)); + /* True when the status is populated (delimiters required for following items). */ + bool has_status_info = false; + + if (status_info_txt[0]) { + uiItemL(row, status_info_txt, ICON_NONE); + has_status_info = true; + } + + if (U.statusbar_flag & STATUSBAR_SHOW_EXTENSIONS_UPDATES) { + wmWindowManager *wm = CTX_wm_manager(C); + + /* Special case, always show an alert for any blocked extensions. */ + if (wm->extensions_blocked > 0) { + if (has_status_info) { + uiItemS_ex(row, -0.5f); + uiItemL(row, "|", ICON_NONE); + uiItemS_ex(row, -0.5f); + } + uiLayoutSetEmboss(row, UI_EMBOSS_NONE); + /* This operator also works fine for blocked extensions. */ + uiItemO(row, "", ICON_ERROR, "EXTENSIONS_OT_userpref_show_for_update"); + uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); + uchar color[4]; + UI_GetThemeColor4ubv(TH_TEXT, color); + copy_v4_v4_uchar(but->col, color); + + BLI_str_format_integer_unit(but->icon_overlay_text.text, wm->extensions_blocked); + UI_but_icon_indicator_color_set(but, color); + + uiItemS_ex(row, 1.0f); + has_status_info = true; + } + + if ((G.f & G_FLAG_INTERNET_ALLOW) == 0) { + if (has_status_info) { + uiItemS_ex(row, -0.5f); + uiItemL(row, "|", ICON_NONE); + uiItemS_ex(row, -0.5f); + } + + if ((G.f & G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE) != 0) { + uiItemL(row, "", ICON_INTERNET_OFFLINE); + } + else { + uiLayoutSetEmboss(row, UI_EMBOSS_NONE); + uiItemO(row, "", ICON_INTERNET_OFFLINE, "EXTENSIONS_OT_userpref_show_online"); + uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); + uchar color[4]; + UI_GetThemeColor4ubv(TH_TEXT, color); + copy_v4_v4_uchar(but->col, color); + } + + uiItemS_ex(row, 1.0f); + has_status_info = true; + } + else if ((wm->extensions_updates > 0) || + (wm->extensions_updates == WM_EXTENSIONS_UPDATE_CHECKING)) + { + int icon = ICON_INTERNET; + if (wm->extensions_updates == WM_EXTENSIONS_UPDATE_CHECKING) { + icon = ICON_UV_SYNC_SELECT; + } + + if (has_status_info) { + uiItemS_ex(row, -0.5f); + uiItemL(row, "|", ICON_NONE); + uiItemS_ex(row, -0.5f); + } + uiLayoutSetEmboss(row, UI_EMBOSS_NONE); + uiItemO(row, "", icon, "EXTENSIONS_OT_userpref_show_for_update"); + uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); + uchar color[4]; + UI_GetThemeColor4ubv(TH_TEXT, color); + copy_v4_v4_uchar(but->col, color); + + if (wm->extensions_updates > 0) { + BLI_str_format_integer_unit(but->icon_overlay_text.text, wm->extensions_updates); + UI_but_icon_indicator_color_set(but, color); + } + + uiItemS_ex(row, 1.0f); + has_status_info = true; + } + } + + if (!BKE_main_has_issues(bmain)) { + if (U.statusbar_flag & STATUSBAR_SHOW_VERSION) { + if (has_status_info) { + uiItemS_ex(row, -0.5f); + uiItemL(row, "|", ICON_NONE); + uiItemS_ex(row, -0.5f); + } + const char *status_info_d_txt = ED_info_statusbar_string_ex( + bmain, scene, view_layer, STATUSBAR_SHOW_VERSION); + uiItemL(row, status_info_d_txt, ICON_NONE); + } + return; + } + + blender::StringRefNull version_string = ED_info_statusbar_string_ex( + bmain, scene, view_layer, STATUSBAR_SHOW_VERSION); + blender::StringRefNull warning_message; + + /* Blender version part is shown as warning area when there are forward compatibility issues with + * currently loaded .blend file. */ + if (bmain->has_forward_compatibility_issues) { + warning_message = version_string; + } + else { + /* For other issues, still show the version if enabled. */ + if (U.statusbar_flag & STATUSBAR_SHOW_VERSION) { + uiItemL(layout, version_string, ICON_NONE); + } + } + + const uiStyle *style = UI_style_get(); + uiLayout *ui_abs = uiLayoutAbsolute(layout, false); + uiBlock *block = uiLayoutGetBlock(ui_abs); + eUIEmbossType previous_emboss = UI_block_emboss_get(block); + + UI_fontstyle_set(&style->widget); + const int width = max_ii( + int(BLF_width(style->widget.uifont_id, warning_message.c_str(), warning_message.size())), + int(10 * UI_SCALE_FAC)); + + UI_block_align_begin(block); + + /* Background for icon. */ + uiBut *but = uiDefBut(block, + UI_BTYPE_ROUNDBOX, + 0, + "", + 0, + 0, + UI_UNIT_X + (6 * UI_SCALE_FAC), + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + ""); + /*# UI_BTYPE_ROUNDBOX's background color is set in `but->col`. */ + UI_GetThemeColorType4ubv(TH_INFO_WARNING, SPACE_INFO, but->col); + + if (!warning_message.is_empty()) { + /* Background for the rest of the message. */ + but = uiDefBut(block, + UI_BTYPE_ROUNDBOX, + 0, + "", + UI_UNIT_X + (6 * UI_SCALE_FAC), + 0, + UI_UNIT_X + width, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + ""); + + /* Use icon background at low opacity to highlight, but still contrasting with area TH_TEXT. */ + UI_GetThemeColorType4ubv(TH_INFO_WARNING, SPACE_INFO, but->col); + but->col[3] = 64; + } + + UI_block_align_end(block); + UI_block_emboss_set(block, UI_EMBOSS_NONE); + + /* The warning icon itself. */ + but = uiDefIconBut(block, + UI_BTYPE_BUT, + 0, + ICON_ERROR, + int(3 * UI_SCALE_FAC), + 0, + UI_UNIT_X, + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + nullptr); + UI_but_func_tooltip_set(but, ui_template_status_tooltip, nullptr, nullptr); + UI_GetThemeColorType4ubv(TH_INFO_WARNING_TEXT, SPACE_INFO, but->col); + but->col[3] = 255; /* This theme color is RBG only, so have to set alpha here. */ + + /* The warning message, if any. */ + if (!warning_message.is_empty()) { + but = uiDefBut(block, + UI_BTYPE_BUT, + 0, + warning_message.c_str(), + UI_UNIT_X, + 0, + short(width + UI_UNIT_X), + UI_UNIT_Y, + nullptr, + 0.0f, + 0.0f, + nullptr); + UI_but_func_tooltip_set(but, ui_template_status_tooltip, nullptr, nullptr); + } + + UI_block_emboss_set(block, previous_emboss); +} diff --git a/source/blender/editors/interface/templates/interface_templates.cc b/source/blender/editors/interface/templates/interface_templates.cc index 20aa84b3d769..dca3ee5d5001 100644 --- a/source/blender/editors/interface/templates/interface_templates.cc +++ b/source/blender/editors/interface/templates/interface_templates.cc @@ -6,136 +6,26 @@ * \ingroup edinterface */ -#include -#include -#include -#include -#include - -#include - -#include "MEM_guardedalloc.h" - -#include "DNA_anim_types.h" -#include "DNA_brush_types.h" -#include "DNA_cachefile_types.h" -#include "DNA_collection_types.h" -#include "DNA_constraint_types.h" -#include "DNA_curveprofile_types.h" -#include "DNA_gpencil_modifier_types.h" -#include "DNA_node_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_shader_fx_types.h" -#include "DNA_texture_types.h" - -#include "BLI_fileops.h" -#include "BLI_listbase.h" -#include "BLI_math_color.h" -#include "BLI_math_vector.h" -#include "BLI_path_utils.hh" -#include "BLI_rect.h" -#include "BLI_string.h" -#include "BLI_string_ref.hh" -#include "BLI_string_utils.hh" -#include "BLI_time.h" -#include "BLI_timecode.h" -#include "BLI_utildefines.h" - -#include "BLF_api.hh" -#include "BLT_translation.hh" - -#include "BKE_anim_data.hh" -#include "BKE_blender_version.h" -#include "BKE_blendfile.hh" -#include "BKE_colorband.hh" -#include "BKE_colortools.hh" -#include "BKE_constraint.h" -#include "BKE_context.hh" -#include "BKE_curveprofile.h" -#include "BKE_file_handler.hh" -#include "BKE_global.hh" -#include "BKE_idprop.hh" -#include "BKE_idtype.hh" -#include "BKE_layer.hh" -#include "BKE_lib_id.hh" -#include "BKE_lib_override.hh" -#include "BKE_linestyle.h" -#include "BKE_main.hh" -#include "BKE_modifier.hh" -#include "BKE_packedFile.hh" -#include "BKE_report.hh" -#include "BKE_sca.hh" -#include "BKE_scene.hh" #include "BKE_screen.hh" -#include "BKE_shader_fx.h" -#include "BKE_workspace.hh" - -#include "BLO_readfile.hh" -#include "DEG_depsgraph.hh" -#include "DEG_depsgraph_build.hh" -#include "DEG_depsgraph_query.hh" +#include "BLI_string_ref.hh" #include "ED_fileselect.hh" -#include "ED_id_management.hh" -#include "ED_info.hh" -#include "ED_node.hh" -#include "ED_object.hh" -#include "ED_render.hh" #include "ED_screen.hh" -#include "ED_screen_types.hh" -#include "ED_undo.hh" - -#include "IMB_imbuf.hh" -#include "IMB_imbuf_types.hh" -#include "IMB_metadata.hh" -#include "IMB_thumbs.hh" - -#include "RE_engine.h" #include "RNA_access.hh" -#include "RNA_prototypes.hh" - -#include "WM_api.hh" -#include "WM_types.hh" #include "UI_interface.hh" -#include "UI_interface_icons.hh" -#include "UI_string_search.hh" #include "interface_intern.hh" +#include "interface_templates_intern.hh" -using blender::StringRef; using blender::StringRefNull; -using blender::Vector; - -/* we may want to make this optional, disable for now. */ -// #define USE_OP_RESET_BUT - -/* defines for templateID/TemplateSearch */ -#define TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH (UI_UNIT_X * 4) -#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y - -/* Maximum width for a Status Bar report */ -#define REPORT_BANNER_MAX_WIDTH (800.0f * UI_SCALE_FAC) - -/* -------------------------------------------------------------------- */ -/** \name Header Template - * \{ */ - -void uiTemplateHeader(uiLayout *layout, bContext *C) -{ - uiBlock *block = uiLayoutAbsoluteBlock(layout); - ED_area_header_switchbutton(C, block, 0); -} - -/** \} */ /* -------------------------------------------------------------------- */ /** \name Search Menu Helpers * \{ */ -static int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop) +int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop) { char str[UI_MAX_DRAW_STR]; int buf_len = 0; @@ -157,7 +47,7 @@ static int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop estimated_width, TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH, TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH * 4); } -static int template_search_textbut_height() +int template_search_textbut_height() { return TEMPLATE_SEARCH_TEXTBUT_HEIGHT; } @@ -165,19 +55,19 @@ static int template_search_textbut_height() /** * Add a block button for the search menu for templateID and templateSearch. */ -static void template_add_button_search_menu(const bContext *C, - uiLayout *layout, - uiBlock *block, - PointerRNA *ptr, - PropertyRNA *prop, - uiBlockCreateFunc block_func, - void *block_argN, - const char *const tip, - const bool use_previews, - const bool editable, - const bool live_icon, - uiButArgNFree func_argN_free_fn = MEM_freeN, - uiButArgNCopy func_argN_copy_fn = MEM_dupallocN) +void template_add_button_search_menu(const bContext *C, + uiLayout *layout, + uiBlock *block, + PointerRNA *ptr, + PropertyRNA *prop, + uiBlockCreateFunc block_func, + void *block_argN, + const char *const tip, + const bool use_previews, + const bool editable, + const bool live_icon, + uiButArgNFree func_argN_free_fn, + uiButArgNCopy func_argN_copy_fn) { const PointerRNA active_ptr = RNA_property_pointer_get(ptr, prop); ID *id = (active_ptr.data && RNA_struct_is_ID(active_ptr.type)) ? @@ -263,16 +153,16 @@ static void template_add_button_search_menu(const bContext *C, } } -static uiBlock *template_common_search_menu(const bContext *C, - ARegion *region, - uiButSearchUpdateFn search_update_fn, - void *search_arg, - uiButHandleFunc search_exec_fn, - void *active_item, - uiButSearchTooltipFn item_tooltip_fn, - const int preview_rows, - const int preview_cols, - float scale) +uiBlock *template_common_search_menu(const bContext *C, + ARegion *region, + uiButSearchUpdateFn search_update_fn, + void *search_arg, + uiButHandleFunc search_exec_fn, + void *active_item, + uiButSearchTooltipFn item_tooltip_fn, + const int preview_rows, + const int preview_cols, + float scale) { static char search[256]; wmWindow *win = CTX_wm_window(C); @@ -349,7387 +239,66 @@ static uiBlock *template_common_search_menu(const bContext *C, /** \} */ /* -------------------------------------------------------------------- */ -/** \name Search Callbacks +/** \name Header Template * \{ */ -struct TemplateID { - PointerRNA ptr = {}; - PropertyRNA *prop = nullptr; - - ListBase *idlb = nullptr; - short idcode = 0; - short filter = 0; - int prv_rows = 0; - int prv_cols = 0; - bool preview = false; - float scale = 0.0f; -}; - -/* Search browse menu, assign. */ -static void template_ID_set_property_exec_fn(bContext *C, void *arg_template, void *item) -{ - TemplateID *template_ui = (TemplateID *)arg_template; - - /* ID */ - if (item) { - PointerRNA idptr = RNA_id_pointer_create(static_cast(item)); - RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); - RNA_property_update(C, &template_ui->ptr, template_ui->prop); - } -} - -static bool id_search_allows_id(TemplateID *template_ui, const int flag, ID *id, const char *query) -{ - ID *id_from = template_ui->ptr.owner_id; - - /* Do self check. */ - if ((flag & PROP_ID_SELF_CHECK) && id == id_from) { - return false; - } - - /* Use filter. */ - if (RNA_property_type(template_ui->prop) == PROP_POINTER) { - PointerRNA ptr = RNA_id_pointer_create(id); - if (RNA_property_pointer_poll(&template_ui->ptr, template_ui->prop, &ptr) == 0) { - return false; - } - } - - /* Hide dot prefixed data-blocks, but only if filter does not force them visible. */ - if (U.uiflag & USER_HIDE_DOT) { - if ((id->name[2] == '.') && (query[0] != '.')) { - return false; - } - } - - return true; -} - -static bool id_search_add(const bContext *C, TemplateID *template_ui, uiSearchItems *items, ID *id) -{ - /* +1 is needed because BKE_id_ui_prefix used 3 letter prefix - * followed by ID_NAME-2 characters from id->name - */ - char name_ui[MAX_ID_FULL_NAME_UI]; - int iconid = ui_id_icon_get(C, id, template_ui->preview); - const bool use_lib_prefix = template_ui->preview || iconid; - const bool has_sep_char = ID_IS_LINKED(id); - - /* When using previews, the library hint (linked, overridden, missing) is added with a - * character prefix, otherwise we can use a icon. */ - int name_prefix_offset; - BKE_id_full_name_ui_prefix_get(name_ui, id, use_lib_prefix, UI_SEP_CHAR, &name_prefix_offset); - if (!use_lib_prefix) { - iconid = UI_icon_from_library(id); - } - - if (!UI_search_item_add(items, - name_ui, - id, - iconid, - has_sep_char ? int(UI_BUT_HAS_SEP_CHAR) : 0, - name_prefix_offset)) - { - return false; - } - - return true; -} - -/* ID Search browse menu, do the search */ -static void id_search_cb(const bContext *C, - void *arg_template, - const char *str, - uiSearchItems *items, - const bool /*is_first*/) -{ - TemplateID *template_ui = (TemplateID *)arg_template; - ListBase *lb = template_ui->idlb; - const int flag = RNA_property_flag(template_ui->prop); - - blender::ui::string_search::StringSearch search; - - /* ID listbase */ - LISTBASE_FOREACH (ID *, id, lb) { - if (id_search_allows_id(template_ui, flag, id, str)) { - search.add(id->name + 2, id); - } - } - - const blender::Vector filtered_ids = search.query(str); - - for (ID *id : filtered_ids) { - if (!id_search_add(C, template_ui, items, id)) { - break; - } - } -} - -/** - * Use id tags for filtering. - */ -static void id_search_cb_tagged(const bContext *C, - void *arg_template, - const char *str, - uiSearchItems *items) -{ - TemplateID *template_ui = (TemplateID *)arg_template; - ListBase *lb = template_ui->idlb; - const int flag = RNA_property_flag(template_ui->prop); - - blender::string_search::StringSearch search{nullptr, - blender::string_search::MainWordsHeuristic::All}; - - /* ID listbase */ - LISTBASE_FOREACH (ID *, id, lb) { - if (id->tag & ID_TAG_DOIT) { - if (id_search_allows_id(template_ui, flag, id, str)) { - search.add(id->name + 2, id); - } - id->tag &= ~ID_TAG_DOIT; - } - } - - blender::Vector filtered_ids = search.query(str); - - for (ID *id : filtered_ids) { - if (!id_search_add(C, template_ui, items, id)) { - break; - } - } -} - -/** - * A version of 'id_search_cb' that lists scene objects. - */ -static void id_search_cb_objects_from_scene(const bContext *C, - void *arg_template, - const char *str, - uiSearchItems *items, - const bool /*is_first*/) -{ - TemplateID *template_ui = (TemplateID *)arg_template; - ListBase *lb = template_ui->idlb; - Scene *scene = nullptr; - ID *id_from = template_ui->ptr.owner_id; - - if (id_from && GS(id_from->name) == ID_SCE) { - scene = (Scene *)id_from; - } - else { - scene = CTX_data_scene(C); - } - - BKE_main_id_flag_listbase(lb, ID_TAG_DOIT, false); - - FOREACH_SCENE_OBJECT_BEGIN (scene, ob_iter) { - ob_iter->id.tag |= ID_TAG_DOIT; - } - FOREACH_SCENE_OBJECT_END; - id_search_cb_tagged(C, arg_template, str, items); -} - -static ARegion *template_ID_search_menu_item_tooltip( - bContext *C, ARegion *region, const rcti *item_rect, void * /*arg*/, void *active) -{ - ID *active_id = static_cast(active); - return UI_tooltip_create_from_search_item_generic(C, region, item_rect, active_id); -} - -/* ID Search browse menu, open */ -static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) +void uiTemplateHeader(uiLayout *layout, bContext *C) { - static TemplateID template_ui; - PointerRNA active_item_ptr; - void (*id_search_update_fn)( - const bContext *, void *, const char *, uiSearchItems *, const bool) = id_search_cb; - - /* arg_litem is malloced, can be freed by parent button */ - template_ui = *((TemplateID *)arg_litem); - active_item_ptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); - - if (template_ui.filter) { - /* Currently only used for objects. */ - if (template_ui.idcode == ID_OB) { - if (template_ui.filter == UI_TEMPLATE_ID_FILTER_AVAILABLE) { - id_search_update_fn = id_search_cb_objects_from_scene; - } - } - } - - return template_common_search_menu(C, - region, - id_search_update_fn, - &template_ui, - template_ID_set_property_exec_fn, - active_item_ptr.data, - template_ID_search_menu_item_tooltip, - template_ui.prv_rows, - template_ui.prv_cols, - template_ui.scale); + uiBlock *block = uiLayoutAbsoluteBlock(layout); + ED_area_header_switchbutton(C, block, 0); } /** \} */ /* -------------------------------------------------------------------- */ -/** \name ID Template +/** \name RNA Path Builder Template * \{ */ -static void template_id_cb(bContext *C, void *arg_litem, void *arg_event); - -void UI_context_active_but_prop_get_templateID(const bContext *C, - PointerRNA *r_ptr, - PropertyRNA **r_prop) -{ - uiBut *but = UI_context_active_but_get(C); - - *r_ptr = {}; - *r_prop = nullptr; - - if (but && (but->funcN == template_id_cb) && but->func_argN) { - TemplateID *template_ui = static_cast(but->func_argN); - *r_ptr = template_ui->ptr; - *r_prop = template_ui->prop; - } -} - -static void template_id_liboverride_hierarchy_collection_root_find_recursive( - Collection *collection, - const int parent_level, - Collection **r_collection_parent_best, - int *r_parent_level_best) +void uiTemplatePathBuilder(uiLayout *layout, + PointerRNA *ptr, + const StringRefNull propname, + PointerRNA * /*root_ptr*/, + const std::optional text) { - if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY_REAL(collection)) { + /* check that properties are valid */ + PropertyRNA *propPath = RNA_struct_find_property(ptr, propname.c_str()); + if (!propPath || RNA_property_type(propPath) != PROP_STRING) { + RNA_warning( + "path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); return; } - if (ID_IS_OVERRIDABLE_LIBRARY(collection) || ID_IS_OVERRIDE_LIBRARY_REAL(collection)) { - if (parent_level > *r_parent_level_best) { - *r_parent_level_best = parent_level; - *r_collection_parent_best = collection; - } - } - for (CollectionParent *iter = static_cast(collection->runtime.parents.first); - iter != nullptr; - iter = iter->next) - { - if (iter->collection->id.lib != collection->id.lib && ID_IS_LINKED(iter->collection)) { - continue; - } - template_id_liboverride_hierarchy_collection_root_find_recursive( - iter->collection, parent_level + 1, r_collection_parent_best, r_parent_level_best); - } -} - -static void template_id_liboverride_hierarchy_collections_tag_recursive( - Collection *root_collection, ID *target_id, const bool do_parents) -{ - root_collection->id.tag |= ID_TAG_DOIT; - - /* Tag all local parents of the root collection, so that usages of the root collection and other - * linked ones can be replaced by the local overrides in those parents too. */ - if (do_parents) { - for (CollectionParent *iter = - static_cast(root_collection->runtime.parents.first); - iter != nullptr; - iter = iter->next) - { - if (ID_IS_LINKED(iter->collection)) { - continue; - } - iter->collection->id.tag |= ID_TAG_DOIT; - } - } - - for (CollectionChild *iter = static_cast(root_collection->children.first); - iter != nullptr; - iter = iter->next) - { - if (ID_IS_LINKED(iter->collection) && iter->collection->id.lib != target_id->lib) { - continue; - } - if (GS(target_id->name) == ID_OB && - !BKE_collection_has_object_recursive(iter->collection, (Object *)target_id)) - { - continue; - } - if (GS(target_id->name) == ID_GR && - !BKE_collection_has_collection(iter->collection, (Collection *)target_id)) - { - continue; - } - template_id_liboverride_hierarchy_collections_tag_recursive( - iter->collection, target_id, false); - } -} - -ID *ui_template_id_liboverride_hierarchy_make( - bContext *C, Main *bmain, ID *owner_id, ID *id, const char **r_undo_push_label) -{ - const char *undo_push_label; - if (r_undo_push_label == nullptr) { - r_undo_push_label = &undo_push_label; - } - - /* If this is called on an already local override, 'toggle' between user-editable state, and - * system override with reset. */ - if (!ID_IS_LINKED(id) && ID_IS_OVERRIDE_LIBRARY(id)) { - if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) { - BKE_lib_override_library_get(bmain, id, nullptr, &id); - } - if (id->override_library->flag & LIBOVERRIDE_FLAG_SYSTEM_DEFINED) { - id->override_library->flag &= ~LIBOVERRIDE_FLAG_SYSTEM_DEFINED; - *r_undo_push_label = "Make Library Override Hierarchy Editable"; - } - else { - BKE_lib_override_library_id_reset(bmain, id, true); - *r_undo_push_label = "Clear Library Override Hierarchy"; - } - - WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, nullptr); - WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr); - return id; - } - - /* Attempt to perform a hierarchy override, based on contextual data available. - * NOTE: do not attempt to perform such hierarchy override at all cost, if there is not enough - * context, better to abort than create random overrides all over the place. */ - if (!ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(id)) { - WM_reportf(RPT_ERROR, "The data-block %s is not overridable", id->name); - return nullptr; - } - - Object *object_active = CTX_data_active_object(C); - if (object_active == nullptr && GS(owner_id->name) == ID_OB) { - object_active = (Object *)owner_id; - } - if (object_active != nullptr) { - if (ID_IS_LINKED(object_active)) { - if (object_active->id.lib != id->lib || !ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(object_active)) - { - /* The active object is from a different library than the overridden ID, or otherwise - * cannot be used in hierarchy. */ - object_active = nullptr; - } - } - else if (!ID_IS_OVERRIDE_LIBRARY_REAL(object_active)) { - /* Fully local object cannot be used in override hierarchy either. */ - object_active = nullptr; - } - } - - Collection *collection_active_context = CTX_data_collection(C); - Collection *collection_active = collection_active_context; - if (collection_active == nullptr && GS(owner_id->name) == ID_GR) { - collection_active = (Collection *)owner_id; - } - if (collection_active != nullptr) { - if (ID_IS_LINKED(collection_active)) { - if (collection_active->id.lib != id->lib || - !ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(collection_active)) - { - /* The active collection is from a different library than the overridden ID, or otherwise - * cannot be used in hierarchy. */ - collection_active = nullptr; - } - else { - int parent_level_best = -1; - Collection *collection_parent_best = nullptr; - template_id_liboverride_hierarchy_collection_root_find_recursive( - collection_active, 0, &collection_parent_best, &parent_level_best); - collection_active = collection_parent_best; - } - } - else if (!ID_IS_OVERRIDE_LIBRARY_REAL(collection_active)) { - /* Fully local collection cannot be used in override hierarchy either. */ - collection_active = nullptr; - } - } - if (collection_active == nullptr && object_active != nullptr && - (ID_IS_LINKED(object_active) || ID_IS_OVERRIDE_LIBRARY_REAL(object_active))) - { - /* If we failed to find a valid 'active' collection so far for our override hierarchy, but do - * have a valid 'active' object, try to find a collection from that object. */ - LISTBASE_FOREACH (Collection *, collection_iter, &bmain->collections) { - if (ID_IS_LINKED(collection_iter) && collection_iter->id.lib != id->lib) { - continue; - } - if (!ID_IS_OVERRIDE_LIBRARY_REAL(collection_iter)) { - continue; - } - if (!BKE_collection_has_object_recursive(collection_iter, object_active)) { - continue; - } - int parent_level_best = -1; - Collection *collection_parent_best = nullptr; - template_id_liboverride_hierarchy_collection_root_find_recursive( - collection_iter, 0, &collection_parent_best, &parent_level_best); - collection_active = collection_parent_best; - break; - } - } - - ID *id_override = nullptr; - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - switch (GS(id->name)) { - case ID_GR: - if (collection_active != nullptr && - BKE_collection_has_collection(collection_active, (Collection *)id)) - { - template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); - if (object_active != nullptr) { - object_active->id.tag |= ID_TAG_DOIT; - } - BKE_lib_override_library_create(bmain, - scene, - view_layer, - nullptr, - id, - &collection_active->id, - nullptr, - &id_override, - false); - } - else if (object_active != nullptr && !ID_IS_LINKED(object_active) && - &object_active->instance_collection->id == id) - { - object_active->id.tag |= ID_TAG_DOIT; - BKE_lib_override_library_create(bmain, - scene, - view_layer, - id->lib, - id, - &object_active->id, - &object_active->id, - &id_override, - false); - } - break; - case ID_OB: - if (collection_active != nullptr && - BKE_collection_has_object_recursive(collection_active, (Object *)id)) - { - template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); - if (object_active != nullptr) { - object_active->id.tag |= ID_TAG_DOIT; - } - BKE_lib_override_library_create(bmain, - scene, - view_layer, - nullptr, - id, - &collection_active->id, - nullptr, - &id_override, - false); - } - else { - if (object_active != nullptr) { - object_active->id.tag |= ID_TAG_DOIT; - } - BKE_lib_override_library_create( - bmain, scene, view_layer, nullptr, id, nullptr, nullptr, &id_override, false); - BKE_scene_collections_object_remove(bmain, scene, (Object *)id, true); - WM_event_add_notifier(C, NC_ID | NA_REMOVED, nullptr); - } - break; - case ID_ME: - case ID_CU_LEGACY: - case ID_MB: - case ID_LT: - case ID_LA: - case ID_CA: - case ID_SPK: - case ID_AR: - case ID_GD_LEGACY: - case ID_CV: - case ID_PT: - case ID_VO: - case ID_NT: /* Essentially geometry nodes from modifier currently. */ - if (object_active != nullptr) { - if (collection_active != nullptr && - BKE_collection_has_object_recursive(collection_active, object_active)) - { - template_id_liboverride_hierarchy_collections_tag_recursive(collection_active, id, true); - object_active->id.tag |= ID_TAG_DOIT; - BKE_lib_override_library_create(bmain, - scene, - view_layer, - nullptr, - id, - &collection_active->id, - nullptr, - &id_override, - false); - } - else { - object_active->id.tag |= ID_TAG_DOIT; - BKE_lib_override_library_create(bmain, - scene, - view_layer, - nullptr, - id, - &object_active->id, - nullptr, - &id_override, - false); - } - } - else { - BKE_lib_override_library_create( - bmain, scene, view_layer, nullptr, id, id, nullptr, &id_override, false); - } - break; - case ID_MA: - case ID_TE: - case ID_IM: - WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); - break; - case ID_WO: - WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); - break; - case ID_PA: - WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); - break; - default: - WM_reportf(RPT_WARNING, "The type of data-block %s is not yet implemented", id->name); - break; - } - - if (id_override != nullptr) { - id_override->override_library->flag &= ~LIBOVERRIDE_FLAG_SYSTEM_DEFINED; - - /* Ensure that the hierarchy root of the newly overridden data is instantiated in the scene, in - * case it's a collection or object. */ - ID *hierarchy_root = id_override->override_library->hierarchy_root; - if (GS(hierarchy_root->name) == ID_OB) { - Object *object_hierarchy_root = reinterpret_cast(hierarchy_root); - if (!BKE_scene_has_object(scene, object_hierarchy_root)) { - if (!ID_IS_LINKED(collection_active_context)) { - BKE_collection_object_add(bmain, collection_active_context, object_hierarchy_root); - } - else { - BKE_collection_object_add(bmain, scene->master_collection, object_hierarchy_root); - } - } - } - else if (GS(hierarchy_root->name) == ID_GR) { - Collection *collection_hierarchy_root = reinterpret_cast(hierarchy_root); - if (!BKE_collection_has_collection(scene->master_collection, collection_hierarchy_root)) { - if (!ID_IS_LINKED(collection_active_context)) { - BKE_collection_child_add(bmain, collection_active_context, collection_hierarchy_root); - } - else { - BKE_collection_child_add(bmain, scene->master_collection, collection_hierarchy_root); - } - } - } - - *r_undo_push_label = "Make Library Override Hierarchy"; - - /* In theory we could rely on setting/updating the RNA ID pointer property (as done by calling - * code) to be enough. - * - * However, some rare ID pointers properties (like the 'active object in viewlayer' one used - * for the Object templateID in the Object properties) use notifiers that do not enforce a - * rebuild of outliner trees, leading to crashes. - * - * So for now, add some extra notifiers here. */ - WM_event_add_notifier(C, NC_ID | NA_ADDED, nullptr); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr); - } - return id_override; -} - -static void template_id_liboverride_hierarchy_make(bContext *C, - Main *bmain, - TemplateID *template_ui, - PointerRNA *idptr, - const char **r_undo_push_label) -{ - ID *id = static_cast(idptr->data); - ID *owner_id = template_ui->ptr.owner_id; - - ID *id_override = ui_template_id_liboverride_hierarchy_make( - C, bmain, owner_id, id, r_undo_push_label); - - if (id_override != nullptr) { - /* `idptr` is re-assigned to owner property to ensure proper updates etc. Here we also use it - * to ensure remapping of the owner property from the linked data to the newly created - * liboverride (note that in theory this remapping has already been done by code above), but - * only in case owner ID was already local ID (override or pure local data). - * - * Otherwise, owner ID will also have been overridden, and remapped already to use it's - * override of the data too. */ - if (!ID_IS_LINKED(owner_id)) { - *idptr = RNA_id_pointer_create(id_override); - } - } - else { - WM_reportf(RPT_ERROR, "The data-block %s could not be overridden", id->name); - } -} - -static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) -{ - TemplateID *template_ui = (TemplateID *)arg_litem; - PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); - ID *id = static_cast(idptr.data); - const int event = POINTER_AS_INT(arg_event); - const char *undo_push_label = nullptr; - - switch (event) { - case UI_ID_NOP: - /* Don't do anything, typically set for buttons that execute an operator instead. They may - * still assign the callback so the button can be identified as part of an ID-template. See - * #UI_context_active_but_prop_get_templateID(). */ - break; - case UI_ID_RENAME: - /* Only for the undo push. */ - undo_push_label = "Rename Data-Block"; - break; - case UI_ID_BROWSE: - case UI_ID_PIN: - RNA_warning("warning, id event %d shouldn't come here", event); - break; - case UI_ID_OPEN: - case UI_ID_ADD_NEW: - /* these call UI_context_active_but_prop_get_templateID */ - break; - case UI_ID_DELETE: - idptr = {}; - RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); - RNA_property_update(C, &template_ui->ptr, template_ui->prop); - - if (id && CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { - /* only way to force-remove data (on save) */ - id_us_clear_real(id); - id_fake_user_clear(id); - id->us = 0; - undo_push_label = "Delete Data-Block"; - } - else { - undo_push_label = "Unlink Data-Block"; - } - - break; - case UI_ID_FAKE_USER: - if (id) { - if (id->flag & ID_FLAG_FAKEUSER) { - id_us_plus(id); - } - else { - id_us_min(id); - } - undo_push_label = "Fake User"; - } - else { - return; - } - break; - case UI_ID_LOCAL: - if (id) { - Main *bmain = CTX_data_main(C); - if (CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { - template_id_liboverride_hierarchy_make(C, bmain, template_ui, &idptr, &undo_push_label); - } - else { - if (BKE_lib_id_make_local(bmain, id, LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR)) { - BKE_id_newptr_and_tag_clear(id); - - /* Reassign to get proper updates/notifiers. */ - idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); - undo_push_label = "Make Local"; - } - } - if (undo_push_label != nullptr) { - RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); - RNA_property_update(C, &template_ui->ptr, template_ui->prop); - } - } - break; - case UI_ID_OVERRIDE: - if (id && ID_IS_OVERRIDE_LIBRARY(id)) { - Main *bmain = CTX_data_main(C); - if (CTX_wm_window(C)->eventstate->modifier & KM_SHIFT) { - template_id_liboverride_hierarchy_make(C, bmain, template_ui, &idptr, &undo_push_label); - } - else { - BKE_lib_override_library_make_local(bmain, id); - /* Reassign to get proper updates/notifiers. */ - idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); - RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, nullptr); - RNA_property_update(C, &template_ui->ptr, template_ui->prop); - undo_push_label = "Make Local"; - } - } - break; - case UI_ID_ALONE: - if (id) { - const bool do_scene_obj = ((GS(id->name) == ID_OB) && - (template_ui->ptr.type == &RNA_LayerObjects)); - - /* make copy */ - if (do_scene_obj) { - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); - blender::ed::object::object_single_user_make(bmain, scene, (Object *)id); - WM_event_add_notifier(C, NC_WINDOW, nullptr); - DEG_relations_tag_update(bmain); - } - else { - Main *bmain = CTX_data_main(C); - id_single_user(C, id, &template_ui->ptr, template_ui->prop); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr); - DEG_relations_tag_update(bmain); - } - ED_node_tree_propagate_change(C, CTX_data_main(C), nullptr); - undo_push_label = "Make Single User"; - } - break; -#if 0 - case UI_ID_AUTO_NAME: - break; -#endif - } - - if (undo_push_label != nullptr) { - ED_undo_push(C, undo_push_label); - } -} - -static const char *template_id_browse_tip(const StructRNA *type) -{ - if (type) { - switch ((ID_Type)RNA_type_to_ID_code(type)) { - case ID_SCE: - return N_("Browse Scene to be linked"); - case ID_OB: - return N_("Browse Object to be linked"); - case ID_ME: - return N_("Browse Mesh Data to be linked"); - case ID_CU_LEGACY: - return N_("Browse Curve Data to be linked"); - case ID_MB: - return N_("Browse Metaball Data to be linked"); - case ID_MA: - return N_("Browse Material to be linked"); - case ID_TE: - return N_("Browse Texture to be linked"); - case ID_IM: - return N_("Browse Image to be linked"); - case ID_LS: - return N_("Browse Line Style Data to be linked"); - case ID_LT: - return N_("Browse Lattice Data to be linked"); - case ID_LA: - return N_("Browse Light Data to be linked"); - case ID_CA: - return N_("Browse Camera Data to be linked"); - case ID_WO: - return N_("Browse World Settings to be linked"); - case ID_SCR: - return N_("Choose Screen layout"); - case ID_TXT: - return N_("Browse Text to be linked"); - case ID_SPK: - return N_("Browse Speaker Data to be linked"); - case ID_SO: - return N_("Browse Sound to be linked"); - case ID_AR: - return N_("Browse Armature data to be linked"); - case ID_AC: - return N_("Browse Action to be linked"); - case ID_NT: - return N_("Browse Node Tree to be linked"); - case ID_BR: - return N_("Browse Brush to be linked"); - case ID_PA: - return N_("Browse Particle Settings to be linked"); - case ID_GD_LEGACY: - return N_("Browse Grease Pencil Data to be linked"); - case ID_MC: - return N_("Browse Movie Clip to be linked"); - case ID_MSK: - return N_("Browse Mask to be linked"); - case ID_PAL: - return N_("Browse Palette Data to be linked"); - case ID_PC: - return N_("Browse Paint Curve Data to be linked"); - case ID_CF: - return N_("Browse Cache Files to be linked"); - case ID_WS: - return N_("Browse Workspace to be linked"); - case ID_LP: - return N_("Browse LightProbe to be linked"); - case ID_CV: - return N_("Browse Curves Data to be linked"); - case ID_PT: - return N_("Browse Point Cloud Data to be linked"); - case ID_VO: - return N_("Browse Volume Data to be linked"); - case ID_GP: - return N_("Browse Grease Pencil v3 Data to be linked"); - - /* Use generic text. */ - case ID_LI: - case ID_IP: - case ID_KE: - case ID_VF: - case ID_GR: - case ID_WM: - break; - } - } - return N_("Browse ID data to be linked"); -} -/** - * Add a superimposed extra icon to \a but, for workspace pinning. - * Rather ugly special handling, but this is really a special case at this point, nothing worth - * generalizing. - */ -static void template_id_workspace_pin_extra_icon(const TemplateID &template_ui, uiBut *but) -{ - if ((template_ui.idcode != ID_SCE) || (template_ui.ptr.type != &RNA_Window)) { - return; - } + /* Start drawing UI Elements using standard defines */ + uiLayout *row = uiLayoutRow(layout, true); - const wmWindow *win = static_cast(template_ui.ptr.data); - const WorkSpace *workspace = WM_window_get_active_workspace(win); - UI_but_extra_operator_icon_add(but, - "WORKSPACE_OT_scene_pin_toggle", - WM_OP_INVOKE_DEFAULT, - (workspace->flags & WORKSPACE_USE_PIN_SCENE) ? ICON_PINNED : - ICON_UNPINNED); -} + /* Path (existing string) Widget */ + uiItemR(row, ptr, propname, UI_ITEM_NONE, text, ICON_RNA); -/** - * \return a type-based i18n context, needed e.g. by "New" button. - * In most languages, this adjective takes different form based on gender of type name... - */ -#ifdef WITH_INTERNATIONAL -static const char *template_id_context(StructRNA *type) -{ - if (type) { - return BKE_idtype_idcode_to_translation_context(RNA_type_to_ID_code(type)); - } - return BLT_I18NCONTEXT_DEFAULT; + /* TODO: attach something to this to make allow + * searching of nested properties to 'build' the path */ } -#else -# define template_id_context(type) 0 -#endif - -static uiBut *template_id_def_new_but(uiBlock *block, - const ID *id, - const TemplateID &template_ui, - StructRNA *type, - const char *const newop, - const bool editable, - const bool id_open, - const bool use_tab_but, - int but_height) -{ - ID *idfrom = template_ui.ptr.owner_id; - uiBut *but; - const int but_type = use_tab_but ? UI_BTYPE_TAB : UI_BTYPE_BUT; - - /* i18n markup, does nothing! */ - BLT_I18N_MSGID_MULTI_CTXT("New", - BLT_I18NCONTEXT_DEFAULT, - BLT_I18NCONTEXT_ID_ACTION, - BLT_I18NCONTEXT_ID_ARMATURE, - BLT_I18NCONTEXT_ID_BRUSH, - BLT_I18NCONTEXT_ID_CAMERA, - BLT_I18NCONTEXT_ID_CURVES, - BLT_I18NCONTEXT_ID_CURVE_LEGACY, - BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, - BLT_I18NCONTEXT_ID_GPENCIL, - BLT_I18NCONTEXT_ID_IMAGE, - BLT_I18NCONTEXT_ID_LATTICE, - BLT_I18NCONTEXT_ID_LIGHT, - BLT_I18NCONTEXT_ID_LIGHTPROBE, - BLT_I18NCONTEXT_ID_MASK, - BLT_I18NCONTEXT_ID_MATERIAL, - BLT_I18NCONTEXT_ID_MESH, ); - BLT_I18N_MSGID_MULTI_CTXT("New", - BLT_I18NCONTEXT_ID_METABALL, - BLT_I18NCONTEXT_ID_NODETREE, - BLT_I18NCONTEXT_ID_OBJECT, - BLT_I18NCONTEXT_ID_PAINTCURVE, - BLT_I18NCONTEXT_ID_PALETTE, - BLT_I18NCONTEXT_ID_PARTICLESETTINGS, - BLT_I18NCONTEXT_ID_POINTCLOUD, - BLT_I18NCONTEXT_ID_SCENE, - BLT_I18NCONTEXT_ID_SCREEN, - BLT_I18NCONTEXT_ID_SOUND, - BLT_I18NCONTEXT_ID_SPEAKER, - BLT_I18NCONTEXT_ID_TEXT, - BLT_I18NCONTEXT_ID_TEXTURE, - BLT_I18NCONTEXT_ID_VOLUME, - BLT_I18NCONTEXT_ID_WORKSPACE, - BLT_I18NCONTEXT_ID_WORLD, ); - /* NOTE: BLT_I18N_MSGID_MULTI_CTXT takes a maximum number of parameters, - * check the definition to see if a new call must be added when the limit - * is exceeded. */ - - const char *button_text = (id) ? "" : CTX_IFACE_(template_id_context(type), "New"); - const int icon = (id && !use_tab_but) ? ICON_DUPLICATE : ICON_ADD; - const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - - int w = id ? UI_UNIT_X : id_open ? UI_UNIT_X * 3 : UI_UNIT_X * 6; - if (!id) { - w = std::max(UI_fontstyle_string_width(fstyle, button_text) + int(UI_UNIT_X * 1.5f), w); - } - - if (newop) { - but = uiDefIconTextButO(block, - but_type, - newop, - WM_OP_INVOKE_DEFAULT, - icon, - button_text, - 0, - 0, - w, - but_height, - nullptr); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_ADD_NEW), - but_func_argN_free, - but_func_argN_copy); - } - else { - but = uiDefIconTextBut( - block, but_type, 0, icon, button_text, 0, 0, w, but_height, nullptr, 0, 0, nullptr); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_ADD_NEW), - but_func_argN_free, - but_func_argN_copy); - } - - if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } -#ifndef WITH_INTERNATIONAL - UNUSED_VARS(type); -#endif +/** \} */ - return but; -} +/* -------------------------------------------------------------------- */ +/** \name Node Socket Icon Template + * \{ */ -static void template_ID(const bContext *C, - uiLayout *layout, - TemplateID &template_ui, - StructRNA *type, - int flag, - const char *newop, - const char *openop, - const char *unlinkop, - const std::optional text, - const bool live_icon, - const bool hide_buttons) +void uiTemplateNodeSocket(uiLayout *layout, bContext * /*C*/, const float color[4]) { - uiBut *but; - const bool editable = RNA_property_editable(&template_ui.ptr, template_ui.prop); - const bool use_previews = template_ui.preview = (flag & UI_ID_PREVIEWS) != 0; - - PointerRNA idptr = RNA_property_pointer_get(&template_ui.ptr, template_ui.prop); - ID *id = static_cast(idptr.data); - ID *idfrom = template_ui.ptr.owner_id; - // lb = template_ui->idlb; - - /* Allow operators to take the ID from context. */ - uiLayoutSetContextPointer(layout, "id", &idptr); - uiBlock *block = uiLayoutGetBlock(layout); UI_block_align_begin(block); - if (idptr.type) { - type = idptr.type; - } - - if (text && !text->is_empty()) { - /* Add label respecting the separated layout property split state. */ - uiItemL_respect_property_split(layout, *text, ICON_NONE); - } - - if (flag & UI_ID_BROWSE) { - template_add_button_search_menu(C, - layout, - block, - &template_ui.ptr, - template_ui.prop, - id_search_menu, - MEM_new(__func__, template_ui), - TIP_(template_id_browse_tip(type)), - use_previews, - editable, - live_icon, - but_func_argN_free, - but_func_argN_copy); - } - - /* text button with name */ - if (id) { - char name[UI_MAX_NAME_STR]; - const bool user_alert = (id->us <= 0); - - int width = template_search_textbut_width(&idptr, RNA_struct_find_property(&idptr, "name")); - - if ((template_ui.idcode == ID_SCE) && (template_ui.ptr.type == &RNA_Window)) { - /* More room needed for "pin" icon. */ - width += UI_UNIT_X; - } - - const int height = template_search_textbut_height(); - - // text_idbutton(id, name); - name[0] = '\0'; - but = uiDefButR(block, - UI_BTYPE_TEXT, - 0, - name, - 0, - 0, - width, - height, - &idptr, - "name", - -1, - 0, - 0, - RNA_struct_ui_description(type)); - /* Handle undo through the #template_id_cb set below. Default undo handling from the button - * code (see #ui_apply_but_undo) would not work here, as the new name is not yet applied to the - * ID. */ - UI_but_flag_disable(but, UI_BUT_UNDO); - Main *bmain = CTX_data_main(C); - UI_but_func_rename_full_set( - but, [bmain, id](std::string &new_name) { ED_id_rename(*bmain, *id, new_name); }); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_RENAME), - but_func_argN_free, - but_func_argN_copy); - if (user_alert) { - UI_but_flag_enable(but, UI_BUT_REDALERT); - } - - template_id_workspace_pin_extra_icon(template_ui, but); - - if (!hide_buttons && !(idfrom && ID_IS_LINKED(idfrom))) { - if (ID_IS_LINKED(id)) { - const bool disabled = !BKE_idtype_idcode_is_localizable(GS(id->name)); - if (id->tag & ID_TAG_INDIRECT) { - but = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_LIBRARY_DATA_INDIRECT, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Indirect library data-block, cannot be made local, " - "Shift + Click to create a library override hierarchy")); - } - else { - but = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_LIBRARY_DATA_DIRECT, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Direct linked library data-block, click to make local, " - "Shift + Click to create a library override")); - } - if (disabled) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - else { - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_LOCAL), - but_func_argN_free, - but_func_argN_copy); - } - } - else if (ID_IS_OVERRIDE_LIBRARY(id)) { - but = uiDefIconBut( - block, - UI_BTYPE_BUT, - 0, - ICON_LIBRARY_DATA_OVERRIDE, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Library override of linked data-block, click to make fully local, " - "Shift + Click to clear the library override and toggle if it can be edited")); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_OVERRIDE), - but_func_argN_free, - but_func_argN_copy); - } - } - - if ((ID_REAL_USERS(id) > 1) && (hide_buttons == false)) { - char numstr[32]; - short numstr_len; - - numstr_len = SNPRINTF_RLEN(numstr, "%d", ID_REAL_USERS(id)); - - but = uiDefBut( - block, - UI_BTYPE_BUT, - 0, - numstr, - 0, - 0, - numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Display number of users of this data (click to make a single-user copy)")); - but->flag |= UI_BUT_UNDO; - - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_ALONE), - but_func_argN_free, - but_func_argN_copy); - if (!BKE_id_copy_is_allowed(id) || (idfrom && !ID_IS_EDITABLE(idfrom)) || (!editable) || - /* object in editmode - don't change data */ - (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) - { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - } - - if (user_alert) { - UI_but_flag_enable(but, UI_BUT_REDALERT); - } - - if (!ID_IS_LINKED(id)) { - if (ID_IS_ASSET(id)) { - uiDefIconButO(block, - /* Using `_N` version allows us to get the 'active' state by default. */ - UI_BTYPE_ICON_TOGGLE_N, - "ASSET_OT_clear_single", - WM_OP_INVOKE_DEFAULT, - /* 'active' state of a toggle button uses icon + 1, so to get proper asset - * icon we need to pass its value - 1 here. */ - ICON_ASSET_MANAGER - 1, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - } - else if (!ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS) && (hide_buttons == false)) - { - uiDefIconButR(block, - UI_BTYPE_ICON_TOGGLE, - 0, - ICON_FAKE_USER_OFF, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - &idptr, - "use_fake_user", - -1, - 0, - 0, - nullptr); - } - } - } - - if ((flag & UI_ID_ADD_NEW) && (hide_buttons == false)) { - template_id_def_new_but( - block, id, template_ui, type, newop, editable, flag & UI_ID_OPEN, false, UI_UNIT_X); - } - - /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. - * Only for images, sound and fonts */ - if (id && BKE_packedfile_id_check(id)) { - but = uiDefIconButO(block, - UI_BTYPE_BUT, - "FILE_OT_unpack_item", - WM_OP_INVOKE_REGION_WIN, - ICON_PACKAGE, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - TIP_("Packed File, click to unpack")); - UI_but_operator_ptr_ensure(but); - - RNA_string_set(but->opptr, "id_name", id->name + 2); - RNA_int_set(but->opptr, "id_type", GS(id->name)); - - if (!ID_IS_EDITABLE(id)) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - } - else if (flag & UI_ID_OPEN) { - const char *button_text = (id) ? "" : IFACE_("Open"); - const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - - int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; - if (!id) { - w = std::max(UI_fontstyle_string_width(fstyle, button_text) + int(UI_UNIT_X * 1.5f), w); - } - - if (openop) { - but = uiDefIconTextButO(block, - UI_BTYPE_BUT, - openop, - WM_OP_INVOKE_DEFAULT, - ICON_FILEBROWSER, - (id) ? "" : IFACE_("Open"), - 0, - 0, - w, - UI_UNIT_Y, - nullptr); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_OPEN), - but_func_argN_free, - but_func_argN_copy); - } - else { - but = uiDefIconTextBut(block, - UI_BTYPE_BUT, - 0, - ICON_FILEBROWSER, - (id) ? "" : IFACE_("Open"), - 0, - 0, - w, - UI_UNIT_Y, - nullptr, - 0, - 0, - nullptr); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_OPEN), - but_func_argN_free, - but_func_argN_copy); - } - - if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - } - - /* delete button */ - /* don't use RNA_property_is_unlink here */ - if (id && (flag & UI_ID_DELETE) && (hide_buttons == false)) { - /* allow unlink if 'unlinkop' is passed, even when 'PROP_NEVER_UNLINK' is set */ - but = nullptr; - - if (unlinkop) { - but = uiDefIconButO(block, - UI_BTYPE_BUT, - unlinkop, - WM_OP_INVOKE_DEFAULT, - ICON_X, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - /* so we can access the template from operators, font unlinking needs this */ - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_NOP), - but_func_argN_free, - but_func_argN_copy); - } - else { - if ((RNA_property_flag(template_ui.prop) & PROP_NEVER_UNLINK) == 0) { - but = uiDefIconBut( - block, - UI_BTYPE_BUT, - 0, - ICON_X, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Unlink data-block " - "(Shift + Click to set users to zero, data will then not be saved)")); - UI_but_funcN_set(but, - template_id_cb, - MEM_new(__func__, template_ui), - POINTER_FROM_INT(UI_ID_DELETE), - but_func_argN_free, - but_func_argN_copy); - - if (RNA_property_flag(template_ui.prop) & PROP_NEVER_NULL) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - } - } - - if (but) { - if ((idfrom && !ID_IS_EDITABLE(idfrom)) || !editable) { - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - } - } - - if (template_ui.idcode == ID_TE) { - uiTemplateTextureShow(layout, C, &template_ui.ptr, template_ui.prop); - } - UI_block_align_end(block); -} - -ID *UI_context_active_but_get_tab_ID(bContext *C) -{ - uiBut *but = UI_context_active_but_get(C); - - if (but && but->type == UI_BTYPE_TAB) { - return static_cast(but->custom_data); - } - return nullptr; -} - -static void template_ID_tabs(const bContext *C, - uiLayout *layout, - TemplateID &template_id, - StructRNA *type, - int flag, - const char *newop, - const char *menu) -{ - const ARegion *region = CTX_wm_region(C); - const PointerRNA active_ptr = RNA_property_pointer_get(&template_id.ptr, template_id.prop); - MenuType *mt = menu ? WM_menutype_find(menu, false) : nullptr; - - const int but_align = ui_but_align_opposite_to_area_align_get(region); - const int but_height = UI_UNIT_Y * 1.1; - - uiBlock *block = uiLayoutGetBlock(layout); - const uiStyle *style = UI_style_get_dpi(); - - for (ID *id : BKE_id_ordered_list(template_id.idlb)) { - const int name_width = UI_fontstyle_string_width(&style->widget, id->name + 2); - const int but_width = name_width + UI_UNIT_X; - - uiButTab *tab = (uiButTab *)uiDefButR_prop(block, - UI_BTYPE_TAB, - 0, - id->name + 2, - 0, - 0, - but_width, - but_height, - &template_id.ptr, - template_id.prop, - 0, - 0.0f, - sizeof(id->name) - 2, - ""); - UI_but_funcN_set(tab, - template_ID_set_property_exec_fn, - MEM_new(__func__, template_id), - id, - but_func_argN_free, - but_func_argN_copy); - UI_but_drag_set_id(tab, id); - tab->custom_data = (void *)id; - tab->menu = mt; - - UI_but_drawflag_enable(tab, but_align); - } - - if (flag & UI_ID_ADD_NEW) { - const bool editable = RNA_property_editable(&template_id.ptr, template_id.prop); - uiBut *but; - - if (active_ptr.type) { - type = active_ptr.type; - } - - but = template_id_def_new_but(block, - static_cast(active_ptr.data), - template_id, - type, - newop, - editable, - flag & UI_ID_OPEN, - true, - but_height); - UI_but_drawflag_enable(but, but_align); - } -} - -static void ui_template_id(uiLayout *layout, - const bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - const char *newop, - const char *openop, - const char *unlinkop, - /* Only respected by tabs (use_tabs). */ - const char *menu, - const std::optional text, - int flag, - int prv_rows, - int prv_cols, - int filter, - bool use_tabs, - float scale, - const bool live_icon, - const bool hide_buttons) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - RNA_warning( - "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - TemplateID template_ui = {}; - template_ui.ptr = *ptr; - template_ui.prop = prop; - template_ui.prv_rows = prv_rows; - template_ui.prv_cols = prv_cols; - template_ui.scale = scale; - - if ((flag & UI_ID_PIN) == 0) { - template_ui.filter = filter; - } - else { - template_ui.filter = 0; - } - - if (newop) { - flag |= UI_ID_ADD_NEW; - } - if (openop) { - flag |= UI_ID_OPEN; - } - - StructRNA *type = RNA_property_pointer_type(ptr, prop); - short idcode = RNA_type_to_ID_code(type); - template_ui.idcode = idcode; - template_ui.idlb = which_libbase(CTX_data_main(C), idcode); - - /* create UI elements for this template - * - template_ID makes a copy of the template data and assigns it to the relevant buttons - */ - if (template_ui.idlb) { - if (use_tabs) { - layout = uiLayoutRow(layout, true); - template_ID_tabs(C, layout, template_ui, type, flag, newop, menu); - } - else { - layout = uiLayoutRow(layout, true); - template_ID(C, - layout, - template_ui, - type, - flag, - newop, - openop, - unlinkop, - text, - live_icon, - hide_buttons); - } - } -} - -void uiTemplateID(uiLayout *layout, - const bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - const char *newop, - const char *openop, - const char *unlinkop, - int filter, - const bool live_icon, - const std::optional text) -{ - ui_template_id(layout, - C, - ptr, - propname, - newop, - openop, - unlinkop, - nullptr, - text, - UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, - 0, - 0, - filter, - false, - 1.0f, - live_icon, - false); -} - -void uiTemplateAction(uiLayout *layout, - const bContext *C, - ID *id, - const char *newop, - const char *unlinkop, - const std::optional text) -{ - if (!id_can_have_animdata(id)) { - RNA_warning("Cannot show Action selector for non-animatable ID: %s", id->name + 2); - return; - } - - PropertyRNA *adt_action_prop = RNA_struct_type_find_property(&RNA_AnimData, "action"); - BLI_assert(adt_action_prop); - BLI_assert(RNA_property_type(adt_action_prop) == PROP_POINTER); - - /* Construct a pointer with the animated ID as owner, even when `adt` may be `nullptr`. - * This way it is possible to use this RNA pointer to get/set `adt->action`, as that RNA property - * has a `getter` & `setter` that only need the owner ID and are null-safe regarding the `adt` - * itself. */ - AnimData *adt = BKE_animdata_from_id(id); - PointerRNA adt_ptr = RNA_pointer_create(id, &RNA_AnimData, adt); - - TemplateID template_ui = {}; - template_ui.ptr = adt_ptr; - template_ui.prop = adt_action_prop; - template_ui.prv_rows = 0; - template_ui.prv_cols = 0; - template_ui.scale = 1.0f; - template_ui.filter = UI_TEMPLATE_ID_FILTER_ALL; - - int flag = UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE; - if (newop) { - flag |= UI_ID_ADD_NEW; - } - - template_ui.idcode = ID_AC; - template_ui.idlb = which_libbase(CTX_data_main(C), ID_AC); - BLI_assert(template_ui.idlb); - - uiLayout *row = uiLayoutRow(layout, true); - template_ID( - C, row, template_ui, &RNA_Action, flag, newop, nullptr, unlinkop, text, false, false); -} - -void uiTemplateIDBrowse(uiLayout *layout, - bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - const char *newop, - const char *openop, - const char *unlinkop, - int filter, - const char *text) -{ - ui_template_id(layout, - C, - ptr, - propname, - newop, - openop, - unlinkop, - nullptr, - text, - UI_ID_BROWSE | UI_ID_RENAME, - 0, - 0, - filter, - false, - 1.0f, - false, - false); -} - -void uiTemplateIDPreview(uiLayout *layout, - bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - const char *newop, - const char *openop, - const char *unlinkop, - int rows, - int cols, - int filter, - const bool hide_buttons) -{ - ui_template_id(layout, - C, - ptr, - propname, - newop, - openop, - unlinkop, - nullptr, - nullptr, - UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, - rows, - cols, - filter, - false, - 1.0f, - false, - hide_buttons); -} - -void uiTemplateGpencilColorPreview(uiLayout *layout, - bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - int rows, - int cols, - float scale, - int filter) -{ - ui_template_id(layout, - C, - ptr, - propname, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - UI_ID_BROWSE | UI_ID_PREVIEWS | UI_ID_DELETE, - rows, - cols, - filter, - false, - scale < 0.5f ? 0.5f : scale, - false, - false); -} - -void uiTemplateIDTabs(uiLayout *layout, - bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - const char *newop, - const char *menu, - int filter) -{ - ui_template_id(layout, - C, - ptr, - propname, - newop, - nullptr, - nullptr, - menu, - nullptr, - UI_ID_BROWSE | UI_ID_RENAME, - 0, - 0, - filter, - true, - 1.0f, - false, - false); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name ID Chooser Template - * \{ */ - -void uiTemplateAnyID(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - const StringRefNull proptypename, - const std::optional text) -{ - /* get properties... */ - PropertyRNA *propID = RNA_struct_find_property(ptr, propname.c_str()); - PropertyRNA *propType = RNA_struct_find_property(ptr, proptypename.c_str()); - - if (!propID || RNA_property_type(propID) != PROP_POINTER) { - RNA_warning( - "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - if (!propType || RNA_property_type(propType) != PROP_ENUM) { - RNA_warning("pointer-type property not found: %s.%s", - RNA_struct_identifier(ptr->type), - proptypename.c_str()); - return; - } - - /* Start drawing UI Elements using standard defines */ - - /* NOTE: split amount here needs to be synced with normal labels */ - uiLayout *split = uiLayoutSplit(layout, 0.33f, false); - - /* FIRST PART ................................................ */ - uiLayout *row = uiLayoutRow(split, false); - - /* Label - either use the provided text, or will become "ID-Block:" */ - if (text) { - if (!text->is_empty()) { - uiItemL(row, *text, ICON_NONE); - } - } - else { - uiItemL(row, IFACE_("ID-Block:"), ICON_NONE); - } - - /* SECOND PART ................................................ */ - row = uiLayoutRow(split, true); - - /* ID-Type Selector - just have a menu of icons */ - - /* HACK: special group just for the enum, - * otherwise we get ugly layout with text included too... */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - - /* ID-Block Selector - just use pointer widget... */ - - /* HACK: special group to counteract the effects of the previous enum, - * which now pushes everything too far right. */ - sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); - - uiItemFullR(sub, ptr, propID, 0, 0, UI_ITEM_NONE, "", ICON_NONE); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Search Template - * \{ */ - -struct TemplateSearch { - uiRNACollectionSearch search_data; - - bool use_previews; - int preview_rows, preview_cols; -}; - -static void template_search_exec_fn(bContext *C, void *arg_template, void *item) -{ - TemplateSearch *template_search = static_cast(arg_template); - uiRNACollectionSearch *coll_search = &template_search->search_data; - StructRNA *type = RNA_property_pointer_type(&coll_search->target_ptr, coll_search->target_prop); - - PointerRNA item_ptr = RNA_pointer_create(nullptr, type, item); - RNA_property_pointer_set(&coll_search->target_ptr, coll_search->target_prop, item_ptr, nullptr); - RNA_property_update(C, &coll_search->target_ptr, coll_search->target_prop); -} - -static uiBlock *template_search_menu(bContext *C, ARegion *region, void *arg_template) -{ - static TemplateSearch template_search; - - /* arg_template is malloced, can be freed by parent button */ - template_search = *((TemplateSearch *)arg_template); - PointerRNA active_ptr = RNA_property_pointer_get(&template_search.search_data.target_ptr, - template_search.search_data.target_prop); - - return template_common_search_menu(C, - region, - ui_rna_collection_search_update_fn, - &template_search, - template_search_exec_fn, - active_ptr.data, - nullptr, - template_search.preview_rows, - template_search.preview_cols, - 1.0f); -} - -static void template_search_add_button_searchmenu(const bContext *C, - uiLayout *layout, - uiBlock *block, - TemplateSearch &template_search, - const bool editable, - const bool live_icon) -{ - const char *ui_description = RNA_property_ui_description( - template_search.search_data.target_prop); - - template_add_button_search_menu(C, - layout, - block, - &template_search.search_data.target_ptr, - template_search.search_data.target_prop, - template_search_menu, - MEM_new(__func__, template_search), - ui_description, - template_search.use_previews, - editable, - live_icon, - but_func_argN_free, - but_func_argN_copy); -} - -static void template_search_add_button_name(uiBlock *block, - PointerRNA *active_ptr, - const StructRNA *type) -{ - /* Skip text button without an active item. */ - if (active_ptr->data == nullptr) { - return; - } - - PropertyRNA *name_prop; - if (type == &RNA_ActionSlot) { - name_prop = RNA_struct_find_property(active_ptr, "name_display"); - } - else { - name_prop = RNA_struct_name_property(type); - } - - const int width = template_search_textbut_width(active_ptr, name_prop); - const int height = template_search_textbut_height(); - uiDefAutoButR(block, active_ptr, name_prop, 0, "", ICON_NONE, 0, 0, width, height); -} - -static void template_search_add_button_operator(uiBlock *block, - const char *const operator_name, - const wmOperatorCallContext opcontext, - const int icon, - const bool editable) -{ - if (!operator_name) { - return; - } - - uiBut *but = uiDefIconButO( - block, UI_BTYPE_BUT, operator_name, opcontext, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, nullptr); - - if (!editable) { - UI_but_drawflag_enable(but, UI_BUT_DISABLED); - } -} - -static void template_search_buttons(const bContext *C, - uiLayout *layout, - TemplateSearch &template_search, - const char *newop, - const char *unlinkop, - const std::optional text) -{ - uiBlock *block = uiLayoutGetBlock(layout); - uiRNACollectionSearch *search_data = &template_search.search_data; - const StructRNA *type = RNA_property_pointer_type(&search_data->target_ptr, - search_data->target_prop); - const bool editable = RNA_property_editable(&search_data->target_ptr, search_data->target_prop); - PointerRNA active_ptr = RNA_property_pointer_get(&search_data->target_ptr, - search_data->target_prop); - - if (active_ptr.type) { - /* can only get correct type when there is an active item */ - type = active_ptr.type; - } - - uiLayout *row = uiLayoutRow(layout, true); - UI_block_align_begin(block); - - uiLayout *decorator_layout = nullptr; - if (text && !text->is_empty()) { - /* Add label respecting the separated layout property split state. */ - decorator_layout = uiItemL_respect_property_split(row, *text, ICON_NONE); - } - - template_search_add_button_searchmenu(C, row, block, template_search, editable, false); - template_search_add_button_name(block, &active_ptr, type); - template_search_add_button_operator( - block, newop, WM_OP_INVOKE_DEFAULT, ICON_DUPLICATE, editable); - template_search_add_button_operator(block, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, editable); - - UI_block_align_end(block); - - if (decorator_layout) { - uiItemDecoratorR(decorator_layout, nullptr, "", RNA_NO_INDEX); - } -} - -static PropertyRNA *template_search_get_searchprop(PointerRNA *targetptr, - PropertyRNA *targetprop, - PointerRNA *searchptr, - const char *const searchpropname) -{ - PropertyRNA *searchprop; - - if (searchptr && !searchptr->data) { - searchptr = nullptr; - } - - if (!searchptr && !searchpropname) { - /* both nullptr means we don't use a custom rna collection to search in */ - } - else if (!searchptr && searchpropname) { - RNA_warning("searchpropname defined (%s) but searchptr is missing", searchpropname); - } - else if (searchptr && !searchpropname) { - RNA_warning("searchptr defined (%s) but searchpropname is missing", - RNA_struct_identifier(searchptr->type)); - } - else if (!(searchprop = RNA_struct_find_property(searchptr, searchpropname))) { - RNA_warning("search collection property not found: %s.%s", - RNA_struct_identifier(searchptr->type), - searchpropname); - } - else if (RNA_property_type(searchprop) != PROP_COLLECTION) { - RNA_warning("search collection property is not a collection type: %s.%s", - RNA_struct_identifier(searchptr->type), - searchpropname); - } - /* check if searchprop has same type as targetprop */ - else if (RNA_property_pointer_type(searchptr, searchprop) != - RNA_property_pointer_type(targetptr, targetprop)) - { - RNA_warning("search collection items from %s.%s are not of type %s", - RNA_struct_identifier(searchptr->type), - searchpropname, - RNA_struct_identifier(RNA_property_pointer_type(targetptr, targetprop))); - } - else { - return searchprop; - } - - return nullptr; -} - -static bool template_search_setup(TemplateSearch &template_search, - PointerRNA *ptr, - const StringRefNull propname, - PointerRNA *searchptr, - const char *const searchpropname) -{ - template_search = {}; - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - RNA_warning( - "pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return false; - } - PropertyRNA *searchprop = template_search_get_searchprop(ptr, prop, searchptr, searchpropname); - - template_search.search_data.target_ptr = *ptr; - template_search.search_data.target_prop = prop; - template_search.search_data.search_ptr = *searchptr; - template_search.search_data.search_prop = searchprop; - - return true; -} - -void uiTemplateSearch(uiLayout *layout, - const bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - PointerRNA *searchptr, - const char *searchpropname, - const char *newop, - const char *unlinkop, - const std::optional text) -{ - TemplateSearch template_search; - if (template_search_setup(template_search, ptr, propname, searchptr, searchpropname)) { - template_search_buttons(C, layout, template_search, newop, unlinkop, text); - } -} - -void uiTemplateSearchPreview(uiLayout *layout, - bContext *C, - PointerRNA *ptr, - const StringRefNull propname, - PointerRNA *searchptr, - const char *searchpropname, - const char *newop, - const char *unlinkop, - const int rows, - const int cols, - const std::optional text) -{ - TemplateSearch template_search; - if (template_search_setup(template_search, ptr, propname, searchptr, searchpropname)) { - template_search.use_previews = true; - template_search.preview_rows = rows; - template_search.preview_cols = cols; - - template_search_buttons(C, layout, template_search, newop, unlinkop, text); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name RNA Path Builder Template - * \{ */ - -/* ---------- */ - -void uiTemplatePathBuilder(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - PointerRNA * /*root_ptr*/, - const std::optional text) -{ - /* check that properties are valid */ - PropertyRNA *propPath = RNA_struct_find_property(ptr, propname.c_str()); - if (!propPath || RNA_property_type(propPath) != PROP_STRING) { - RNA_warning( - "path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - /* Start drawing UI Elements using standard defines */ - uiLayout *row = uiLayoutRow(layout, true); - - /* Path (existing string) Widget */ - uiItemR(row, ptr, propname, UI_ITEM_NONE, text, ICON_RNA); - - /* TODO: attach something to this to make allow - * searching of nested properties to 'build' the path */ -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Modifiers Template - * - * Template for building the panel layout for the active object's modifiers. - * \{ */ - -static void modifier_panel_id(void *md_link, char *r_name) -{ - ModifierData *md = (ModifierData *)md_link; - BKE_modifier_type_panel_id(ModifierType(md->type), r_name); -} - -void uiTemplateModifiers(uiLayout * /*layout*/, bContext *C) -{ - ARegion *region = CTX_wm_region(C); - - Object *ob = blender::ed::object::context_active_object(C); - ListBase *modifiers = &ob->modifiers; - - const bool panels_match = UI_panel_list_matches_data(region, modifiers, modifier_panel_id); - - if (!panels_match) { - UI_panels_free_instanced(C, region); - LISTBASE_FOREACH (ModifierData *, md, modifiers) { - const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type)); - if (mti->panel_register == nullptr) { - continue; - } - - char panel_idname[MAX_NAME]; - modifier_panel_id(md, panel_idname); - - /* Create custom data RNA pointer. */ - PointerRNA *md_ptr = MEM_new(__func__); - *md_ptr = RNA_pointer_create(&ob->id, &RNA_Modifier, md); - - UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, md_ptr); - } - } - else { - /* Assuming there's only one group of instanced panels, update the custom data pointers. */ - Panel *panel = static_cast(region->panels.first); - LISTBASE_FOREACH (ModifierData *, md, modifiers) { - const ModifierTypeInfo *mti = BKE_modifier_get_info(ModifierType(md->type)); - if (mti->panel_register == nullptr) { - continue; - } - - /* Move to the next instanced panel corresponding to the next modifier. */ - while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { - panel = panel->next; - BLI_assert(panel != - nullptr); /* There shouldn't be fewer panels than modifiers with UIs. */ - } - - PointerRNA *md_ptr = MEM_new(__func__); - *md_ptr = RNA_pointer_create(&ob->id, &RNA_Modifier, md); - UI_panel_custom_data_set(panel, md_ptr); - - panel = panel->next; - } - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Constraints Template - * - * Template for building the panel layout for the active object or bone's constraints. - * \{ */ - -/** For building the panel UI for constraints. */ -#define CONSTRAINT_TYPE_PANEL_PREFIX "OBJECT_PT_" -#define CONSTRAINT_BONE_TYPE_PANEL_PREFIX "BONE_PT_" - -/** - * Check if the panel's ID starts with 'BONE', meaning it is a bone constraint. - */ -static bool constraint_panel_is_bone(Panel *panel) -{ - return (panel->panelname[0] == 'B') && (panel->panelname[1] == 'O') && - (panel->panelname[2] == 'N') && (panel->panelname[3] == 'E'); -} - -/** - * Move a constraint to the index it's moved to after a drag and drop. - */ -static void constraint_reorder(bContext *C, Panel *panel, int new_index) -{ - const bool constraint_from_bone = constraint_panel_is_bone(panel); - - PointerRNA *con_ptr = UI_panel_custom_data_get(panel); - bConstraint *con = (bConstraint *)con_ptr->data; - - PointerRNA props_ptr; - wmOperatorType *ot = WM_operatortype_find("CONSTRAINT_OT_move_to_index", false); - WM_operator_properties_create_ptr(&props_ptr, ot); - RNA_string_set(&props_ptr, "constraint", con->name); - RNA_int_set(&props_ptr, "index", new_index); - /* Set owner to #EDIT_CONSTRAINT_OWNER_OBJECT or #EDIT_CONSTRAINT_OWNER_BONE. */ - RNA_enum_set(&props_ptr, "owner", constraint_from_bone ? 1 : 0); - WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr, nullptr); - WM_operator_properties_free(&props_ptr); -} - -/** - * Get the expand flag from the active constraint to use for the panel. - */ -static short get_constraint_expand_flag(const bContext * /*C*/, Panel *panel) -{ - PointerRNA *con_ptr = UI_panel_custom_data_get(panel); - bConstraint *con = (bConstraint *)con_ptr->data; - - return con->ui_expand_flag; -} - -/** - * Save the expand flag for the panel and sub-panels to the constraint. - */ -static void set_constraint_expand_flag(const bContext * /*C*/, Panel *panel, short expand_flag) -{ - PointerRNA *con_ptr = UI_panel_custom_data_get(panel); - bConstraint *con = (bConstraint *)con_ptr->data; - con->ui_expand_flag = expand_flag; -} - -/** - * Function with void * argument for #uiListPanelIDFromDataFunc. - * - * \note Constraint panel types are assumed to be named with the struct name field - * concatenated to the defined prefix. - */ -static void object_constraint_panel_id(void *md_link, char *r_idname) -{ - bConstraint *con = (bConstraint *)md_link; - const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); - - /* Cannot get TypeInfo for invalid/legacy constraints. */ - if (cti == nullptr) { - return; - } - BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_TYPE_PANEL_PREFIX, cti->struct_name); -} - -static void bone_constraint_panel_id(void *md_link, char *r_idname) -{ - bConstraint *con = (bConstraint *)md_link; - const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); - - /* Cannot get TypeInfo for invalid/legacy constraints. */ - if (cti == nullptr) { - return; - } - BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_BONE_TYPE_PANEL_PREFIX, cti->struct_name); -} - -void uiTemplateConstraints(uiLayout * /*layout*/, bContext *C, bool use_bone_constraints) -{ - ARegion *region = CTX_wm_region(C); - - Object *ob = blender::ed::object::context_active_object(C); - ListBase *constraints = {nullptr}; - if (use_bone_constraints) { - constraints = blender::ed::object::pose_constraint_list(C); - } - else if (ob != nullptr) { - constraints = &ob->constraints; - } - - /* Switch between the bone panel ID function and the object panel ID function. */ - uiListPanelIDFromDataFunc panel_id_func = use_bone_constraints ? bone_constraint_panel_id : - object_constraint_panel_id; - - const bool panels_match = UI_panel_list_matches_data(region, constraints, panel_id_func); - - if (!panels_match) { - UI_panels_free_instanced(C, region); - for (bConstraint *con = - (constraints == nullptr) ? nullptr : static_cast(constraints->first); - con; - con = con->next) - { - /* Don't show invalid/legacy constraints. */ - if (con->type == CONSTRAINT_TYPE_NULL) { - continue; - } - /* Don't show temporary constraints (AutoIK and target-less IK constraints). */ - if (con->type == CONSTRAINT_TYPE_KINEMATIC) { - bKinematicConstraint *data = static_cast(con->data); - if (data->flag & CONSTRAINT_IK_TEMP) { - continue; - } - } - - char panel_idname[MAX_NAME]; - panel_id_func(con, panel_idname); - - /* Create custom data RNA pointer. */ - PointerRNA *con_ptr = MEM_new(__func__); - *con_ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); - - Panel *new_panel = UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, con_ptr); - - if (new_panel) { - /* Set the list panel functionality function pointers since we don't do it with python. */ - new_panel->type->set_list_data_expand_flag = set_constraint_expand_flag; - new_panel->type->get_list_data_expand_flag = get_constraint_expand_flag; - new_panel->type->reorder = constraint_reorder; - } - } - } - else { - /* Assuming there's only one group of instanced panels, update the custom data pointers. */ - Panel *panel = static_cast(region->panels.first); - LISTBASE_FOREACH (bConstraint *, con, constraints) { - /* Don't show invalid/legacy constraints. */ - if (con->type == CONSTRAINT_TYPE_NULL) { - continue; - } - /* Don't show temporary constraints (AutoIK and target-less IK constraints). */ - if (con->type == CONSTRAINT_TYPE_KINEMATIC) { - bKinematicConstraint *data = static_cast(con->data); - if (data->flag & CONSTRAINT_IK_TEMP) { - continue; - } - } - - /* Move to the next instanced panel corresponding to the next constraint. */ - while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { - panel = panel->next; - BLI_assert(panel != nullptr); /* There shouldn't be fewer panels than constraint panels. */ - } - - PointerRNA *con_ptr = MEM_new(__func__); - *con_ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); - UI_panel_custom_data_set(panel, con_ptr); - - panel = panel->next; - } - } -} - -#undef CONSTRAINT_TYPE_PANEL_PREFIX -#undef CONSTRAINT_BONE_TYPE_PANEL_PREFIX - -/** \} */ - -#define ERROR_LIBDATA_MESSAGE N_("Can't edit external library data") - -/* -------------------------------------------------------------------- */ -/** \name ShaderFx Template - * - * Template for building the panel layout for the active object's grease pencil shader - * effects. - * \{ */ - -/** - * Function with void * argument for #uiListPanelIDFromDataFunc. - */ -static void shaderfx_panel_id(void *fx_v, char *r_idname) -{ - ShaderFxData *fx = (ShaderFxData *)fx_v; - BKE_shaderfxType_panel_id(ShaderFxType(fx->type), r_idname); -} - -void uiTemplateShaderFx(uiLayout * /*layout*/, bContext *C) -{ - ARegion *region = CTX_wm_region(C); - Object *ob = blender::ed::object::context_active_object(C); - ListBase *shaderfx = &ob->shader_fx; - - const bool panels_match = UI_panel_list_matches_data(region, shaderfx, shaderfx_panel_id); - - if (!panels_match) { - UI_panels_free_instanced(C, region); - LISTBASE_FOREACH (ShaderFxData *, fx, shaderfx) { - char panel_idname[MAX_NAME]; - shaderfx_panel_id(fx, panel_idname); - - /* Create custom data RNA pointer. */ - PointerRNA *fx_ptr = MEM_new(__func__); - *fx_ptr = RNA_pointer_create(&ob->id, &RNA_ShaderFx, fx); - - UI_panel_add_instanced(C, region, ®ion->panels, panel_idname, fx_ptr); - } - } - else { - /* Assuming there's only one group of instanced panels, update the custom data pointers. */ - Panel *panel = static_cast(region->panels.first); - LISTBASE_FOREACH (ShaderFxData *, fx, shaderfx) { - const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(ShaderFxType(fx->type)); - if (fxi->panel_register == nullptr) { - continue; - } - - /* Move to the next instanced panel corresponding to the next modifier. */ - while ((panel->type == nullptr) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) { - panel = panel->next; - BLI_assert(panel != - nullptr); /* There shouldn't be fewer panels than modifiers with UIs. */ - } - - PointerRNA *fx_ptr = MEM_new(__func__); - *fx_ptr = RNA_pointer_create(&ob->id, &RNA_ShaderFx, fx); - UI_panel_custom_data_set(panel, fx_ptr); - - panel = panel->next; - } - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Operator Property Buttons Template - * \{ */ - -struct uiTemplateOperatorPropertyPollParam { - const bContext *C; - wmOperator *op; - short flag; -}; - -#ifdef USE_OP_RESET_BUT -static void ui_layout_operator_buts__reset_cb(bContext * /*C*/, void *op_pt, void * /*arg_dummy2*/) -{ - WM_operator_properties_reset((wmOperator *)op_pt); -} -#endif - -static bool ui_layout_operator_buts_poll_property(PointerRNA * /*ptr*/, - PropertyRNA *prop, - void *user_data) -{ - uiTemplateOperatorPropertyPollParam *params = static_cast( - user_data); - - if ((params->flag & UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED) && - (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED)) - { - return false; - } - return params->op->type->poll_property(params->C, params->op, prop); -} - -static eAutoPropButsReturn template_operator_property_buts_draw_single( - const bContext *C, - wmOperator *op, - uiLayout *layout, - const eButLabelAlign label_align, - int layout_flags) -{ - uiBlock *block = uiLayoutGetBlock(layout); - eAutoPropButsReturn return_info = eAutoPropButsReturn(0); - - if (!op->properties) { - op->properties = blender::bke::idprop::create_group("wmOperatorProperties").release(); - } - - /* poll() on this operator may still fail, - * at the moment there is no nice feedback when this happens just fails silently. */ - if (!WM_operator_repeat_check(C, op)) { - UI_block_lock_set(block, true, N_("Operator cannot redo")); - return return_info; - } - - /* useful for macros where only one of the steps can't be re-done */ - UI_block_lock_clear(block); - - if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) { - uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE); - } - - /* menu */ - if ((op->type->flag & OPTYPE_PRESET) && !(layout_flags & UI_TEMPLATE_OP_PROPS_HIDE_PRESETS)) { - /* XXX, no simple way to get WM_MT_operator_presets.bl_label - * from python! Label remains the same always! */ - PointerRNA op_ptr; - uiLayout *row; - - UI_block_set_active_operator(block, op, false); - - row = uiLayoutRow(layout, true); - uiItemM(row, "WM_MT_operator_presets", std::nullopt, ICON_NONE); - - wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false); - uiItemFullO_ptr(row, ot, "", ICON_ADD, nullptr, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE, &op_ptr); - RNA_string_set(&op_ptr, "operator", op->type->idname); - - uiItemFullO_ptr( - row, ot, "", ICON_REMOVE, nullptr, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE, &op_ptr); - RNA_string_set(&op_ptr, "operator", op->type->idname); - RNA_boolean_set(&op_ptr, "remove_active", true); - } - - if (op->type->ui) { - op->layout = layout; - op->type->ui((bContext *)C, op); - op->layout = nullptr; - - /* #UI_LAYOUT_OP_SHOW_EMPTY ignored. retun_info is ignored too. - * We could allow #wmOperatorType.ui callback to return this, but not needed right now. */ - } - else { - wmWindowManager *wm = CTX_wm_manager(C); - uiTemplateOperatorPropertyPollParam user_data{}; - user_data.C = C; - user_data.op = op; - user_data.flag = layout_flags; - const bool use_prop_split = (layout_flags & UI_TEMPLATE_OP_PROPS_NO_SPLIT_LAYOUT) == 0; - - PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties); - - uiLayoutSetPropSep(layout, use_prop_split); - uiLayoutSetPropDecorate(layout, false); - - /* main draw call */ - return_info = uiDefAutoButsRNA( - layout, - &ptr, - op->type->poll_property ? ui_layout_operator_buts_poll_property : nullptr, - op->type->poll_property ? &user_data : nullptr, - op->type->prop, - label_align, - (layout_flags & UI_TEMPLATE_OP_PROPS_COMPACT)); - - if ((return_info & UI_PROP_BUTS_NONE_ADDED) && - (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) - { - uiItemL(layout, IFACE_("No Properties"), ICON_NONE); - } - } - -#ifdef USE_OP_RESET_BUT - /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled - * but this is not so important if this button is drawn in those cases - * (which isn't all that likely anyway) - campbell */ - if (op->properties->len) { - uiBut *but; - uiLayout *col; /* needed to avoid alignment errors with previous buttons */ - - col = uiLayoutColumn(layout, false); - block = uiLayoutGetBlock(col); - but = uiDefIconTextBut(block, - UI_BTYPE_BUT, - 0, - ICON_FILE_REFRESH, - IFACE_("Reset"), - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - 0.0, - 0.0, - TIP_("Reset operator defaults")); - UI_but_func_set(but, ui_layout_operator_buts__reset_cb, op, nullptr); - } -#endif - - /* set various special settings for buttons */ - - /* Only do this if we're not refreshing an existing UI. */ - if (block->oldblock == nullptr) { - const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0; - - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - /* no undo for buttons for operator redo panels */ - UI_but_flag_disable(but, UI_BUT_UNDO); - - /* only for popups, see #36109. */ - - /* if button is operator's default property, and a text-field, enable focus for it - * - this is used for allowing operators with popups to rename stuff with fewer clicks - */ - if (is_popup) { - if ((but->rnaprop == op->type->prop) && ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM)) { - UI_but_focus_on_enter_event(CTX_wm_window(C), but); - } - } - } - } - - return return_info; -} - -static void template_operator_property_buts_draw_recursive(const bContext *C, - wmOperator *op, - uiLayout *layout, - const eButLabelAlign label_align, - int layout_flags, - bool *r_has_advanced) -{ - if (op->type->flag & OPTYPE_MACRO) { - LISTBASE_FOREACH (wmOperator *, macro_op, &op->macro) { - template_operator_property_buts_draw_recursive( - C, macro_op, layout, label_align, layout_flags, r_has_advanced); - } - } - else { - /* Might want to make label_align adjustable somehow. */ - eAutoPropButsReturn return_info = template_operator_property_buts_draw_single( - C, op, layout, label_align, layout_flags); - if (return_info & UI_PROP_BUTS_ANY_FAILED_CHECK) { - if (r_has_advanced) { - *r_has_advanced = true; - } - } - } -} - -static bool ui_layout_operator_properties_only_booleans(const bContext *C, - wmWindowManager *wm, - wmOperator *op, - int layout_flags) -{ - if (op->type->flag & OPTYPE_MACRO) { - LISTBASE_FOREACH (wmOperator *, macro_op, &op->macro) { - if (!ui_layout_operator_properties_only_booleans(C, wm, macro_op, layout_flags)) { - return false; - } - } - } - else { - uiTemplateOperatorPropertyPollParam user_data{}; - user_data.C = C; - user_data.op = op; - user_data.flag = layout_flags; - - PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties); - - bool all_booleans = true; - RNA_STRUCT_BEGIN (&ptr, prop) { - if (RNA_property_flag(prop) & PROP_HIDDEN) { - continue; - } - if (op->type->poll_property && - !ui_layout_operator_buts_poll_property(&ptr, prop, &user_data)) - { - continue; - } - if (RNA_property_type(prop) != PROP_BOOLEAN) { - all_booleans = false; - break; - } - } - RNA_STRUCT_END; - if (all_booleans == false) { - return false; - } - } - - return true; -} - -void uiTemplateOperatorPropertyButs( - const bContext *C, uiLayout *layout, wmOperator *op, eButLabelAlign label_align, short flag) -{ - wmWindowManager *wm = CTX_wm_manager(C); - - /* If there are only checkbox items, don't use split layout by default. It looks weird if the - * check-boxes only use half the width. */ - if (ui_layout_operator_properties_only_booleans(C, wm, op, flag)) { - flag |= UI_TEMPLATE_OP_PROPS_NO_SPLIT_LAYOUT; - } - - template_operator_property_buts_draw_recursive(C, op, layout, label_align, flag, nullptr); -} - -void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C) -{ - wmOperator *op = WM_operator_last_redo(C); - uiBlock *block = uiLayoutGetBlock(layout); - - if (op == nullptr) { - return; - } - - /* Disable for now, doesn't fit well in popover. */ -#if 0 - /* Repeat button with operator name as text. */ - uiItemFullO(layout, - "SCREEN_OT_repeat_last", - WM_operatortype_name(op->type, op->ptr), - ICON_NONE, - nullptr, - WM_OP_INVOKE_DEFAULT, - 0, - nullptr); -#endif - - if (WM_operator_repeat_check(C, op)) { - int layout_flags = 0; - if (block->panel == nullptr) { - layout_flags = UI_TEMPLATE_OP_PROPS_SHOW_TITLE; - } -#if 0 - bool has_advanced = false; -#endif - - UI_block_func_handle_set(block, ED_undo_operator_repeat_cb_evt, op); - template_operator_property_buts_draw_recursive( - C, op, layout, UI_BUT_LABEL_ALIGN_NONE, layout_flags, nullptr /* &has_advanced */); - /* Warning! this leaves the handle function for any other users of this block. */ - -#if 0 - if (has_advanced) { - uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last"); - } -#endif - } -} - -static wmOperator *minimal_operator_create(wmOperatorType *ot, PointerRNA *properties) -{ - /* Copied from #wm_operator_create. - * Create a slimmed down operator suitable only for UI drawing. */ - wmOperator *op = MEM_cnew(ot->rna_ext.srna ? __func__ : ot->idname); - STRNCPY(op->idname, ot->idname); - op->type = ot; - - /* Initialize properties but do not assume ownership of them. - * This "minimal" operator owns nothing. */ - op->ptr = MEM_new("wmOperatorPtrRNA"); - op->properties = static_cast(properties->data); - *op->ptr = *properties; - - return op; -} - -static void draw_export_controls( - bContext *C, uiLayout *layout, const std::string &label, int index, bool valid) -{ - uiItemL(layout, label, ICON_NONE); - if (valid) { - uiLayout *row = uiLayoutRow(layout, false); - uiLayoutSetEmboss(row, UI_EMBOSS_NONE); - uiItemPopoverPanel(row, C, "WM_PT_operator_presets", "", ICON_PRESET); - uiItemIntO(row, "", ICON_EXPORT, "COLLECTION_OT_exporter_export", "index", index); - } -} - -static void draw_export_properties(bContext *C, - uiLayout *layout, - wmOperator *op, - const std::string &filename) -{ - uiLayout *col = uiLayoutColumn(layout, false); - - uiLayoutSetPropSep(col, true); - uiLayoutSetPropDecorate(col, false); - - PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath"); - std::string placeholder = "//" + filename; - uiItemFullR(col, - op->ptr, - prop, - RNA_NO_INDEX, - 0, - UI_ITEM_NONE, - std::nullopt, - ICON_NONE, - placeholder.c_str()); - - template_operator_property_buts_draw_single( - C, op, layout, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_HIDE_PRESETS); -} - -static void draw_exporter_item(uiList * /*ui_list*/, - const bContext * /*C*/, - uiLayout *layout, - PointerRNA * /*idataptr*/, - PointerRNA *itemptr, - int /*icon*/, - PointerRNA * /*active_dataptr*/, - const char * /*active_propname*/, - int /*index*/, - int /*flt_flag*/) -{ - uiLayout *row = uiLayoutRow(layout, false); - uiLayoutSetEmboss(row, UI_EMBOSS_NONE); - uiItemR(row, itemptr, "name", UI_ITEM_NONE, "", ICON_NONE); -} - -void uiTemplateCollectionExporters(uiLayout *layout, bContext *C) -{ - Collection *collection = CTX_data_collection(C); - ListBase *exporters = &collection->exporters; - const int index = collection->active_exporter_index; - - /* Register the exporter list type on first use. */ - static const uiListType *exporter_item_list = []() { - uiListType *lt = MEM_cnew(__func__); - STRNCPY(lt->idname, "COLLECTION_UL_exporter_list"); - lt->draw_item = draw_exporter_item; - WM_uilisttype_add(lt); - return lt; - }(); - - /* Draw exporter list and controls. */ - PointerRNA collection_ptr = RNA_pointer_create(&collection->id, &RNA_Collection, collection); - uiLayout *row = uiLayoutRow(layout, false); - uiTemplateList(row, - C, - exporter_item_list->idname, - "", - &collection_ptr, - "exporters", - &collection_ptr, - "active_exporter_index", - nullptr, - 3, - 5, - UILST_LAYOUT_DEFAULT, - 1, - UI_TEMPLATE_LIST_FLAG_NONE); - - uiLayout *col = uiLayoutColumn(row, true); - uiItemM(col, "COLLECTION_MT_exporter_add", "", ICON_ADD); - uiItemIntO(col, "", ICON_REMOVE, "COLLECTION_OT_exporter_remove", "index", index); - - col = uiLayoutColumn(layout, true); - uiItemO(col, std::nullopt, ICON_EXPORT, "COLLECTION_OT_export_all"); - uiLayoutSetEnabled(col, !BLI_listbase_is_empty(exporters)); - - /* Draw the active exporter. */ - CollectionExport *data = (CollectionExport *)BLI_findlink(exporters, index); - if (!data) { - return; - } - - using namespace blender; - PointerRNA exporter_ptr = RNA_pointer_create(&collection->id, &RNA_CollectionExport, data); - PanelLayout panel = uiLayoutPanelProp(C, layout, &exporter_ptr, "is_open"); - - bke::FileHandlerType *fh = bke::file_handler_find(data->fh_idname); - if (!fh) { - std::string label = std::string(IFACE_("Undefined")) + " " + data->fh_idname; - draw_export_controls(C, panel.header, label, index, false); - return; - } - - wmOperatorType *ot = WM_operatortype_find(fh->export_operator, false); - if (!ot) { - std::string label = std::string(IFACE_("Undefined")) + " " + fh->export_operator; - draw_export_controls(C, panel.header, label, index, false); - return; - } - - /* Assign temporary operator to uiBlock, which takes ownership. */ - PointerRNA properties = RNA_pointer_create(&collection->id, ot->srna, data->export_properties); - wmOperator *op = minimal_operator_create(ot, &properties); - UI_block_set_active_operator(uiLayoutGetBlock(panel.header), op, true); - - /* Draw panel header and contents. */ - std::string label(fh->label); - draw_export_controls(C, panel.header, label, index, true); - if (panel.body) { - draw_export_properties(C, panel.body, op, fh->get_default_filename(collection->id.name + 2)); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Constraint Header Template - * \{ */ - -#define ERROR_LIBDATA_MESSAGE N_("Can't edit external library data") - -static void constraint_active_func(bContext * /*C*/, void *ob_v, void *con_v) -{ - blender::ed::object::constraint_active_set(static_cast(ob_v), - static_cast(con_v)); -} - -static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v) -{ - PointerRNA op_ptr; - uiLayout *row; - bConstraint *con = (bConstraint *)con_v; - - Object *ob = blender::ed::object::context_active_object(C); - - PointerRNA ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); - uiLayoutSetContextPointer(layout, "constraint", &ptr); - uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); - - uiLayoutSetUnitsX(layout, 4.0f); - - /* Apply. */ - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - ICON_CHECKMARK, - "CONSTRAINT_OT_apply"); - - /* Duplicate. */ - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), - ICON_DUPLICATE, - "CONSTRAINT_OT_copy"); - - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), - 0, - "CONSTRAINT_OT_copy_to_selected"); - - uiItemS(layout); - - /* Move to first. */ - row = uiLayoutColumn(layout, false); - uiItemFullO(row, - "CONSTRAINT_OT_move_to_index", - IFACE_("Move to First"), - ICON_TRIA_UP, - nullptr, - WM_OP_INVOKE_DEFAULT, - UI_ITEM_NONE, - &op_ptr); - RNA_int_set(&op_ptr, "index", 0); - if (!con->prev) { - uiLayoutSetEnabled(row, false); - } - - /* Move to last. */ - row = uiLayoutColumn(layout, false); - uiItemFullO(row, - "CONSTRAINT_OT_move_to_index", - IFACE_("Move to Last"), - ICON_TRIA_DOWN, - nullptr, - WM_OP_INVOKE_DEFAULT, - UI_ITEM_NONE, - &op_ptr); - ListBase *constraint_list = blender::ed::object::constraint_list_from_constraint( - ob, con, nullptr); - RNA_int_set(&op_ptr, "index", BLI_listbase_count(constraint_list) - 1); - if (!con->next) { - uiLayoutSetEnabled(row, false); - } -} - -static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *con) -{ - /* unless button has its own callback, it adds this callback to button */ - uiBlock *block = uiLayoutGetBlock(layout); - UI_block_func_set(block, constraint_active_func, ob, con); - - PointerRNA ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con); - - if (block->panel) { - UI_panel_context_pointer_set(block->panel, "constraint", &ptr); - } - else { - uiLayoutSetContextPointer(layout, "constraint", &ptr); - } - - /* Constraint type icon. */ - uiLayout *sub = uiLayoutRow(layout, false); - uiLayoutSetEmboss(sub, UI_EMBOSS); - uiLayoutSetRedAlert(sub, (con->flag & CONSTRAINT_DISABLE)); - uiItemL(sub, "", RNA_struct_ui_icon(ptr.type)); - - UI_block_emboss_set(block, UI_EMBOSS); - - uiLayout *row = uiLayoutRow(layout, true); - - uiItemR(row, &ptr, "name", UI_ITEM_NONE, "", ICON_NONE); - - /* Enabled eye icon. */ - uiItemR(row, &ptr, "enabled", UI_ITEM_NONE, "", ICON_NONE); - - /* Extra operators menu. */ - uiItemMenuF(row, "", ICON_DOWNARROW_HLT, constraint_ops_extra_draw, con); - - /* Close 'button' - emboss calls here disable drawing of 'button' behind X */ - sub = uiLayoutRow(row, false); - uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); - uiLayoutSetOperatorContext(sub, WM_OP_INVOKE_DEFAULT); - uiItemO(sub, "", ICON_X, "CONSTRAINT_OT_delete"); - - /* Some extra padding at the end, so the 'x' icon isn't too close to drag button. */ - uiItemS(layout); - - /* clear any locks set up for proxies/lib-linking */ - UI_block_lock_clear(block); -} - -void uiTemplateConstraintHeader(uiLayout *layout, PointerRNA *ptr) -{ - /* verify we have valid data */ - if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) { - RNA_warning("Expected constraint on object"); - return; - } - - Object *ob = (Object *)ptr->owner_id; - bConstraint *con = static_cast(ptr->data); - - if (!ob || !(GS(ob->id.name) == ID_OB)) { - RNA_warning("Expected constraint on object"); - return; - } - - UI_block_lock_set(uiLayoutGetBlock(layout), (ob && !ID_IS_EDITABLE(ob)), ERROR_LIBDATA_MESSAGE); - - draw_constraint_header(layout, ob, con); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Preview Template - * \{ */ - -#include "DNA_light_types.h" -#include "DNA_material_types.h" -#include "DNA_world_types.h" - -#define B_MATPRV 1 - -static void do_preview_buttons(bContext *C, void *arg, int event) -{ - switch (event) { - case B_MATPRV: - WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, arg); - break; - } -} - -void uiTemplatePreview(uiLayout *layout, - bContext *C, - ID *id, - bool show_buttons, - ID *parent, - MTex *slot, - const char *preview_id) -{ - Material *ma = nullptr; - Tex *tex = (Tex *)id; - short *pr_texture = nullptr; - - char _preview_id[sizeof(uiPreview::preview_id)]; - - if (id && !ELEM(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA, ID_LS)) { - RNA_warning("Expected ID of type material, texture, light, world or line style"); - return; - } - - /* decide what to render */ - ID *pid = id; - ID *pparent = nullptr; - - if (id && (GS(id->name) == ID_TE)) { - if (parent && (GS(parent->name) == ID_MA)) { - pr_texture = &((Material *)parent)->pr_texture; - } - else if (parent && (GS(parent->name) == ID_WO)) { - pr_texture = &((World *)parent)->pr_texture; - } - else if (parent && (GS(parent->name) == ID_LA)) { - pr_texture = &((Light *)parent)->pr_texture; - } - else if (parent && (GS(parent->name) == ID_LS)) { - pr_texture = &((FreestyleLineStyle *)parent)->pr_texture; - } - - if (pr_texture) { - if (*pr_texture == TEX_PR_OTHER) { - pid = parent; - } - else if (*pr_texture == TEX_PR_BOTH) { - pparent = parent; - } - } - } - - if (!preview_id || (preview_id[0] == '\0')) { - /* If no identifier given, generate one from ID type. */ - SNPRINTF(_preview_id, "uiPreview_%s", BKE_idtype_idcode_to_name(GS(id->name))); - preview_id = _preview_id; - } - - /* Find or add the uiPreview to the current Region. */ - ARegion *region = CTX_wm_region(C); - uiPreview *ui_preview = static_cast( - BLI_findstring(®ion->ui_previews, preview_id, offsetof(uiPreview, preview_id))); - - if (!ui_preview) { - ui_preview = MEM_cnew(__func__); - STRNCPY(ui_preview->preview_id, preview_id); - ui_preview->height = short(UI_UNIT_Y * 7.6f); - ui_preview->id_session_uid = pid->session_uid; - ui_preview->tag = UI_PREVIEW_TAG_DIRTY; - BLI_addtail(®ion->ui_previews, ui_preview); - } - else if (ui_preview->id_session_uid != pid->session_uid) { - ui_preview->id_session_uid = pid->session_uid; - ui_preview->tag |= UI_PREVIEW_TAG_DIRTY; - } - - if (ui_preview->height < UI_UNIT_Y) { - ui_preview->height = UI_UNIT_Y; - } - else if (ui_preview->height > UI_UNIT_Y * 50) { /* Rather high upper limit, yet not insane! */ - ui_preview->height = UI_UNIT_Y * 50; - } - - /* layout */ - uiBlock *block = uiLayoutGetBlock(layout); - uiLayout *row = uiLayoutRow(layout, false); - uiLayout *col = uiLayoutColumn(row, false); - uiLayoutSetKeepAspect(col, true); - - /* add preview */ - uiDefBut( - block, UI_BTYPE_EXTRA, 0, "", 0, 0, UI_UNIT_X * 10, ui_preview->height, pid, 0.0, 0.0, ""); - UI_but_func_drawextra_set(block, - [pid, pparent, slot, ui_preview](const bContext *C, rcti *rect) { - ED_preview_draw(C, pid, pparent, slot, ui_preview, rect); - }); - UI_block_func_handle_set(block, do_preview_buttons, nullptr); - - uiDefIconButS(block, - UI_BTYPE_GRIP, - 0, - ICON_GRIP, - 0, - 0, - UI_UNIT_X * 10, - short(UI_UNIT_Y * 0.3f), - &ui_preview->height, - UI_UNIT_Y, - UI_UNIT_Y * 50.0f, - ""); - - /* add buttons */ - if (pid && show_buttons) { - if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) { - if (GS(pid->name) == ID_MA) { - ma = (Material *)pid; - } - else { - ma = (Material *)pparent; - } - - /* Create RNA Pointer */ - PointerRNA material_ptr = RNA_pointer_create(&ma->id, &RNA_Material, ma); - - col = uiLayoutColumn(row, true); - uiLayoutSetScaleX(col, 1.5); - uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE); - - /* EEVEE preview file has baked lighting so use_preview_world has no effect, - * just hide the option until this feature is supported. */ - if (!BKE_scene_uses_blender_eevee(CTX_data_scene(C))) { - uiItemS(col); - uiItemR(col, &material_ptr, "use_preview_world", UI_ITEM_NONE, "", ICON_WORLD); - } - } - - if (pr_texture) { - /* Create RNA Pointer */ - PointerRNA texture_ptr = RNA_pointer_create(id, &RNA_Texture, tex); - - uiLayoutRow(layout, true); - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - IFACE_("Texture"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_TEXTURE, - ""); - if (GS(parent->name) == ID_MA) { - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - IFACE_("Material"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_OTHER, - ""); - } - else if (GS(parent->name) == ID_LA) { - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_OTHER, - ""); - } - else if (GS(parent->name) == ID_WO) { - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - CTX_IFACE_(BLT_I18NCONTEXT_ID_WORLD, "World"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_OTHER, - ""); - } - else if (GS(parent->name) == ID_LS) { - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - IFACE_("Line Style"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_OTHER, - ""); - } - uiDefButS(block, - UI_BTYPE_ROW, - B_MATPRV, - IFACE_("Both"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - pr_texture, - 10, - TEX_PR_BOTH, - ""); - - /* Alpha button for texture preview */ - if (*pr_texture != TEX_PR_OTHER) { - row = uiLayoutRow(layout, false); - uiItemR(row, &texture_ptr, "use_preview_alpha", UI_ITEM_NONE, std::nullopt, ICON_NONE); - } - } - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name ColorRamp Template - * \{ */ - -struct RNAUpdateCb { - PointerRNA ptr; - PropertyRNA *prop; -}; - -static void rna_update_cb(bContext &C, const RNAUpdateCb &cb) -{ - /* we call update here on the pointer property, this way the - * owner of the curve mapping can still define its own update - * and notifier, even if the CurveMapping struct is shared. */ - RNA_property_update(&C, &const_cast(cb.ptr), cb.prop); -} - -static void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/) -{ - RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb; - rna_update_cb(*C, *cb); -} - -static void colorband_flip(bContext *C, ColorBand *coba) -{ - CBData data_tmp[MAXCOLORBAND]; - - for (int a = 0; a < coba->tot; a++) { - data_tmp[a] = coba->data[coba->tot - (a + 1)]; - } - for (int a = 0; a < coba->tot; a++) { - data_tmp[a].pos = 1.0f - data_tmp[a].pos; - coba->data[a] = data_tmp[a]; - } - - /* May as well flip the `cur`. */ - coba->cur = coba->tot - (coba->cur + 1); - - ED_undo_push(C, "Flip Color Ramp"); -} - -static void colorband_distribute(bContext *C, ColorBand *coba, bool evenly) -{ - if (coba->tot > 1) { - const int tot = evenly ? coba->tot - 1 : coba->tot; - const float gap = 1.0f / tot; - float pos = 0.0f; - for (int a = 0; a < coba->tot; a++) { - coba->data[a].pos = pos; - pos += gap; - } - ED_undo_push(C, evenly ? "Distribute Stops Evenly" : "Distribute Stops from Left"); - } -} - -static uiBlock *colorband_tools_fn(bContext *C, ARegion *region, void *cb_v) -{ - RNAUpdateCb &cb = *static_cast(cb_v); - const uiStyle *style = UI_style_get_dpi(); - PointerRNA coba_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); - ColorBand *coba = static_cast(coba_ptr.data); - short yco = 0; - const short menuwidth = 10 * UI_UNIT_X; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS_PULLDOWN); - - uiLayout *layout = UI_block_layout(block, - UI_LAYOUT_VERTICAL, - UI_LAYOUT_MENU, - 0, - 0, - UI_MENU_WIDTH_MIN, - 0, - UI_MENU_PADDING, - style); - UI_block_layout_set_current(block, layout); - { - uiLayoutSetContextPointer(layout, "color_ramp", &coba_ptr); - } - - /* We could move these to operators, - * although this isn't important unless we want to assign key shortcuts to them. */ - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_ARROW_LEFTRIGHT, - IFACE_("Flip Color Ramp"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [coba, cb](bContext &C) { - colorband_flip(&C, coba); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Distribute Stops from Left"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [coba, cb](bContext &C) { - colorband_distribute(&C, coba, false); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Distribute Stops Evenly"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [coba, cb](bContext &C) { - colorband_distribute(&C, coba, true); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - - uiItemS(layout); - - uiItemO(layout, IFACE_("Eyedropper"), ICON_EYEDROPPER, "UI_OT_eyedropper_colorramp"); - - uiItemS(layout); - - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_LOOP_BACK, - IFACE_("Reset Color Ramp"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [coba, cb](bContext &C) { - BKE_colorband_init(coba, true); - ED_undo_push(&C, "Reset Color Ramp"); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - - UI_block_direction_set(block, UI_DIR_DOWN); - UI_block_bounds_set_text(block, 3.0f * UI_UNIT_X); - - return block; -} - -static void colorband_add(bContext &C, const RNAUpdateCb &cb, ColorBand &coba) -{ - float pos = 0.5f; - - if (coba.tot > 1) { - if (coba.cur > 0) { - pos = (coba.data[coba.cur - 1].pos + coba.data[coba.cur].pos) * 0.5f; - } - else { - pos = (coba.data[coba.cur + 1].pos + coba.data[coba.cur].pos) * 0.5f; - } - } - - if (BKE_colorband_element_add(&coba, pos)) { - rna_update_cb(C, cb); - ED_undo_push(&C, "Add Color Ramp Stop"); - } -} - -static void colorband_update_cb(bContext * /*C*/, void *bt_v, void *coba_v) -{ - uiBut *bt = static_cast(bt_v); - ColorBand *coba = static_cast(coba_v); - - /* Sneaky update here, we need to sort the color-band points to be in order, - * however the RNA pointer then is wrong, so we update it */ - BKE_colorband_update_sort(coba); - bt->rnapoin.data = coba->data + coba->cur; -} - -static void colorband_buttons_layout(uiLayout *layout, - uiBlock *block, - ColorBand *coba, - const rctf *butr, - const RNAUpdateCb &cb, - int expand) -{ - uiBut *bt; - const float unit = BLI_rctf_size_x(butr) / 14.0f; - const float xs = butr->xmin; - const float ys = butr->ymin; - - PointerRNA ptr = RNA_pointer_create(cb.ptr.owner_id, &RNA_ColorRamp, coba); - - uiLayout *split = uiLayoutSplit(layout, 0.4f, false); - - UI_block_emboss_set(block, UI_EMBOSS_NONE); - UI_block_align_begin(block); - uiLayout *row = uiLayoutRow(split, false); - - bt = uiDefIconTextBut(block, - UI_BTYPE_BUT, - 0, - ICON_ADD, - "", - 0, - 0, - 2.0f * unit, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Add a new color stop to the color ramp")); - UI_but_func_set(bt, [coba, cb](bContext &C) { colorband_add(C, cb, *coba); }); - - bt = uiDefIconTextBut(block, - UI_BTYPE_BUT, - 0, - ICON_REMOVE, - "", - xs + 2.0f * unit, - ys + UI_UNIT_Y, - 2.0f * unit, - UI_UNIT_Y, - nullptr, - 0, - 0, - TIP_("Delete the active position")); - UI_but_func_set(bt, [coba, cb](bContext &C) { - if (BKE_colorband_element_remove(coba, coba->cur)) { - rna_update_cb(C, cb); - ED_undo_push(&C, "Delete Color Ramp Stop"); - } - }); - - RNAUpdateCb *tools_cb = MEM_new(__func__, cb); - bt = uiDefIconBlockBut(block, - colorband_tools_fn, - tools_cb, - 0, - ICON_DOWNARROW_HLT, - xs + 4.0f * unit, - ys + UI_UNIT_Y, - 2.0f * unit, - UI_UNIT_Y, - TIP_("Tools")); - /* Pass ownership of `tools_cb` to the button. */ - UI_but_funcN_set( - bt, - [](bContext *, void *, void *) {}, - tools_cb, - nullptr, - but_func_argN_free, - but_func_argN_copy); - - UI_block_align_end(block); - UI_block_emboss_set(block, UI_EMBOSS); - - row = uiLayoutRow(split, false); - - UI_block_align_begin(block); - uiItemR(row, &ptr, "color_mode", UI_ITEM_NONE, "", ICON_NONE); - if (ELEM(coba->color_mode, COLBAND_BLEND_HSV, COLBAND_BLEND_HSL)) { - uiItemR(row, &ptr, "hue_interpolation", UI_ITEM_NONE, "", ICON_NONE); - } - else { /* COLBAND_BLEND_RGB */ - uiItemR(row, &ptr, "interpolation", UI_ITEM_NONE, "", ICON_NONE); - } - UI_block_align_end(block); - - row = uiLayoutRow(layout, false); - - bt = uiDefBut( - block, UI_BTYPE_COLORBAND, 0, "", xs, ys, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, ""); - bt->rnapoin = cb.ptr; - bt->rnaprop = cb.prop; - UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); - - row = uiLayoutRow(layout, false); - - if (coba->tot) { - CBData *cbd = coba->data + coba->cur; - - ptr = RNA_pointer_create(cb.ptr.owner_id, &RNA_ColorRampElement, cbd); - - if (!expand) { - split = uiLayoutSplit(layout, 0.3f, false); - - row = uiLayoutRow(split, false); - bt = uiDefButS(block, - UI_BTYPE_NUM, - 0, - "", - 0, - 0, - 5.0f * UI_UNIT_X, - UI_UNIT_Y, - &coba->cur, - 0.0, - float(std::max(0, coba->tot - 1)), - TIP_("Choose active color stop")); - UI_but_number_step_size_set(bt, 1); - - row = uiLayoutRow(split, false); - uiItemR(row, &ptr, "position", UI_ITEM_NONE, IFACE_("Pos"), ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "color", UI_ITEM_NONE, "", ICON_NONE); - } - else { - split = uiLayoutSplit(layout, 0.5f, false); - uiLayout *subsplit = uiLayoutSplit(split, 0.35f, false); - - row = uiLayoutRow(subsplit, false); - bt = uiDefButS(block, - UI_BTYPE_NUM, - 0, - "", - 0, - 0, - 5.0f * UI_UNIT_X, - UI_UNIT_Y, - &coba->cur, - 0.0, - float(std::max(0, coba->tot - 1)), - TIP_("Choose active color stop")); - UI_but_number_step_size_set(bt, 1); - - row = uiLayoutRow(subsplit, false); - uiItemR(row, &ptr, "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), ICON_NONE); - - row = uiLayoutRow(split, false); - uiItemR(row, &ptr, "color", UI_ITEM_NONE, "", ICON_NONE); - } - - /* Some special (rather awkward) treatment to update UI state on certain property changes. */ - LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) { - if (but->rnapoin.data != ptr.data) { - continue; - } - if (!but->rnaprop) { - continue; - } - - const char *prop_identifier = RNA_property_identifier(but->rnaprop); - if (STREQ(prop_identifier, "position")) { - UI_but_func_set(but, colorband_update_cb, but, coba); - } - - if (STREQ(prop_identifier, "color")) { - UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); - } - } - } -} - -void uiTemplateColorRamp(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - bool expand) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - return; - } - - const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp)) { - return; - } - - rctf rect; - rect.xmin = 0; - rect.xmax = 10.0f * UI_UNIT_X; - rect.ymin = 0; - rect.ymax = 19.5f * UI_UNIT_X; - - uiBlock *block = uiLayoutAbsoluteBlock(layout); - - ID *id = cptr.owner_id; - UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); - - colorband_buttons_layout( - layout, block, static_cast(cptr.data), &rect, RNAUpdateCb{*ptr, prop}, expand); - - UI_block_lock_clear(block); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Icon Template - * \{ */ - -void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale) -{ - uiBlock *block = uiLayoutAbsoluteBlock(layout); - uiBut *but = uiDefIconBut(block, - UI_BTYPE_LABEL, - 0, - ICON_X, - 0, - 0, - UI_UNIT_X * icon_scale, - UI_UNIT_Y * icon_scale, - nullptr, - 0.0, - 0.0, - ""); - ui_def_but_icon(but, icon_value, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Icon viewer Template - * \{ */ - -struct IconViewMenuArgs { - PointerRNA ptr; - PropertyRNA *prop; - bool show_labels; - float icon_scale; -}; - -/* ID Search browse menu, open */ -static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_litem) -{ - static IconViewMenuArgs args; - - /* arg_litem is malloced, can be freed by parent button */ - args = *((IconViewMenuArgs *)arg_litem); - const int w = UI_UNIT_X * (args.icon_scale); - const int h = UI_UNIT_X * (args.icon_scale + args.show_labels); - - uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN); - UI_block_flag_enable(block, UI_BLOCK_LOOP); - UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); - - bool free; - const EnumPropertyItem *item; - RNA_property_enum_items(C, &args.ptr, args.prop, &item, nullptr, &free); - - for (int a = 0; item[a].identifier; a++) { - const int x = (a % 8) * w; - const int y = -(a / 8) * h; - - const int icon = item[a].icon; - const int value = item[a].value; - uiBut *but; - if (args.show_labels) { - but = uiDefIconTextButR_prop(block, - UI_BTYPE_ROW, - 0, - icon, - item[a].name, - x, - y, - w, - h, - &args.ptr, - args.prop, - -1, - 0, - value, - nullptr); - } - else { - but = uiDefIconButR_prop( - block, UI_BTYPE_ROW, 0, icon, x, y, w, h, &args.ptr, args.prop, -1, 0, value, nullptr); - } - ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); - } - - UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); - UI_block_direction_set(block, UI_DIR_DOWN); - - if (free) { - MEM_freeN((void *)item); - } - - return block; -} - -void uiTemplateIconView(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - bool show_labels, - float icon_scale, - float icon_scale_popup) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_ENUM) { - RNA_warning("property of type Enum not found: %s.%s", - RNA_struct_identifier(ptr->type), - propname.c_str()); - return; - } - - uiBlock *block = uiLayoutAbsoluteBlock(layout); - - int tot_items; - bool free_items; - const EnumPropertyItem *items; - RNA_property_enum_items( - static_cast(block->evil_C), ptr, prop, &items, &tot_items, &free_items); - const int value = RNA_property_enum_get(ptr, prop); - int icon = ICON_NONE; - RNA_enum_icon_from_value(items, value, &icon); - - uiBut *but; - if (RNA_property_editable(ptr, prop)) { - IconViewMenuArgs *cb_args = MEM_new(__func__); - cb_args->ptr = *ptr; - cb_args->prop = prop; - cb_args->show_labels = show_labels; - cb_args->icon_scale = icon_scale_popup; - - but = uiDefBlockButN(block, - ui_icon_view_menu_cb, - cb_args, - "", - 0, - 0, - UI_UNIT_X * icon_scale, - UI_UNIT_Y * icon_scale, - "", - but_func_argN_free, - but_func_argN_copy); - } - else { - but = uiDefIconBut(block, - UI_BTYPE_LABEL, - 0, - ICON_X, - 0, - 0, - UI_UNIT_X * icon_scale, - UI_UNIT_Y * icon_scale, - nullptr, - 0.0, - 0.0, - ""); - } - - ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); - - if (free_items) { - MEM_freeN((void *)items); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Histogram Template - * \{ */ - -void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - return; - } - - const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram)) { - return; - } - Histogram *hist = (Histogram *)cptr.data; - - if (hist->height < UI_UNIT_Y) { - hist->height = UI_UNIT_Y; - } - else if (hist->height > UI_UNIT_Y * 20) { - hist->height = UI_UNIT_Y * 20; - } - - uiLayout *col = uiLayoutColumn(layout, true); - uiBlock *block = uiLayoutGetBlock(col); - - uiDefBut(block, UI_BTYPE_HISTOGRAM, 0, "", 0, 0, UI_UNIT_X * 10, hist->height, hist, 0, 0, ""); - - /* Resize grip. */ - uiDefIconButI(block, - UI_BTYPE_GRIP, - 0, - ICON_GRIP, - 0, - 0, - UI_UNIT_X * 10, - short(UI_UNIT_Y * 0.3f), - &hist->height, - UI_UNIT_Y, - UI_UNIT_Y * 20.0f, - ""); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Waveform Template - * \{ */ - -void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - return; - } - - const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes)) { - return; - } - Scopes *scopes = (Scopes *)cptr.data; - - uiLayout *col = uiLayoutColumn(layout, true); - uiBlock *block = uiLayoutGetBlock(col); - - if (scopes->wavefrm_height < UI_UNIT_Y) { - scopes->wavefrm_height = UI_UNIT_Y; - } - else if (scopes->wavefrm_height > UI_UNIT_Y * 20) { - scopes->wavefrm_height = UI_UNIT_Y * 20; - } - - uiDefBut(block, - UI_BTYPE_WAVEFORM, - 0, - "", - 0, - 0, - UI_UNIT_X * 10, - scopes->wavefrm_height, - scopes, - 0, - 0, - ""); - - /* Resize grip. */ - uiDefIconButI(block, - UI_BTYPE_GRIP, - 0, - ICON_GRIP, - 0, - 0, - UI_UNIT_X * 10, - short(UI_UNIT_Y * 0.3f), - &scopes->wavefrm_height, - UI_UNIT_Y, - UI_UNIT_Y * 20.0f, - ""); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Vector-Scope Template - * \{ */ - -void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop || RNA_property_type(prop) != PROP_POINTER) { - return; - } - - const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes)) { - return; - } - Scopes *scopes = (Scopes *)cptr.data; - - if (scopes->vecscope_height < UI_UNIT_Y) { - scopes->vecscope_height = UI_UNIT_Y; - } - else if (scopes->vecscope_height > UI_UNIT_Y * 20) { - scopes->vecscope_height = UI_UNIT_Y * 20; - } - - uiLayout *col = uiLayoutColumn(layout, true); - uiBlock *block = uiLayoutGetBlock(col); - - uiDefBut(block, - UI_BTYPE_VECTORSCOPE, - 0, - "", - 0, - 0, - UI_UNIT_X * 10, - scopes->vecscope_height, - scopes, - 0, - 0, - ""); - - /* Resize grip. */ - uiDefIconButI(block, - UI_BTYPE_GRIP, - 0, - ICON_GRIP, - 0, - 0, - UI_UNIT_X * 10, - short(UI_UNIT_Y * 0.3f), - &scopes->vecscope_height, - UI_UNIT_Y, - UI_UNIT_Y * 20.0f, - ""); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name CurveMapping Template - * \{ */ - -#define CURVE_ZOOM_MAX (1.0f / 25.0f) - -static bool curvemap_can_zoom_out(CurveMapping *cumap) -{ - return BLI_rctf_size_x(&cumap->curr) < BLI_rctf_size_x(&cumap->clipr); -} - -static bool curvemap_can_zoom_in(CurveMapping *cumap) -{ - return BLI_rctf_size_x(&cumap->curr) > CURVE_ZOOM_MAX * BLI_rctf_size_x(&cumap->clipr); -} - -static void curvemap_buttons_zoom_in(bContext *C, CurveMapping *cumap) -{ - if (curvemap_can_zoom_in(cumap)) { - const float dx = 0.1154f * BLI_rctf_size_x(&cumap->curr); - cumap->curr.xmin += dx; - cumap->curr.xmax -= dx; - const float dy = 0.1154f * BLI_rctf_size_y(&cumap->curr); - cumap->curr.ymin += dy; - cumap->curr.ymax -= dy; - } - - ED_region_tag_redraw(CTX_wm_region(C)); -} - -static void curvemap_buttons_zoom_out(bContext *C, CurveMapping *cumap) -{ - float d, d1; - - if (curvemap_can_zoom_out(cumap)) { - d = d1 = 0.15f * BLI_rctf_size_x(&cumap->curr); - - if (cumap->flag & CUMA_DO_CLIP) { - if (cumap->curr.xmin - d < cumap->clipr.xmin) { - d1 = cumap->curr.xmin - cumap->clipr.xmin; - } - } - cumap->curr.xmin -= d1; - - d1 = d; - if (cumap->flag & CUMA_DO_CLIP) { - if (cumap->curr.xmax + d > cumap->clipr.xmax) { - d1 = -cumap->curr.xmax + cumap->clipr.xmax; - } - } - cumap->curr.xmax += d1; - - d = d1 = 0.15f * BLI_rctf_size_y(&cumap->curr); - - if (cumap->flag & CUMA_DO_CLIP) { - if (cumap->curr.ymin - d < cumap->clipr.ymin) { - d1 = cumap->curr.ymin - cumap->clipr.ymin; - } - } - cumap->curr.ymin -= d1; - - d1 = d; - if (cumap->flag & CUMA_DO_CLIP) { - if (cumap->curr.ymax + d > cumap->clipr.ymax) { - d1 = -cumap->curr.ymax + cumap->clipr.ymax; - } - } - cumap->curr.ymax += d1; - } - - ED_region_tag_redraw(CTX_wm_region(C)); -} - -/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ -static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v) -{ - CurveMapping *cumap = static_cast(cumap_v); - uiBut *bt; - const float width = 8 * UI_UNIT_X; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT); - UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); - - bt = uiDefButBitI(block, - UI_BTYPE_CHECKBOX, - CUMA_DO_CLIP, - 1, - IFACE_("Use Clipping"), - 0, - 5 * UI_UNIT_Y, - width, - UI_UNIT_Y, - &cumap->flag, - 0.0, - 0.0, - ""); - UI_but_func_set(bt, [cumap](bContext & /*C*/) { BKE_curvemapping_changed(cumap, false); }); - - UI_block_align_begin(block); - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - IFACE_("Min X:"), - 0, - 4 * UI_UNIT_Y, - width, - UI_UNIT_Y, - &cumap->clipr.xmin, - -100.0, - cumap->clipr.xmax, - ""); - UI_but_number_step_size_set(bt, 10); - UI_but_number_precision_set(bt, 2); - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - IFACE_("Min Y:"), - 0, - 3 * UI_UNIT_Y, - width, - UI_UNIT_Y, - &cumap->clipr.ymin, - -100.0, - cumap->clipr.ymax, - ""); - UI_but_number_step_size_set(bt, 10); - UI_but_number_precision_set(bt, 2); - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - IFACE_("Max X:"), - 0, - 2 * UI_UNIT_Y, - width, - UI_UNIT_Y, - &cumap->clipr.xmax, - cumap->clipr.xmin, - 100.0, - ""); - UI_but_number_step_size_set(bt, 10); - UI_but_number_precision_set(bt, 2); - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - IFACE_("Max Y:"), - 0, - UI_UNIT_Y, - width, - UI_UNIT_Y, - &cumap->clipr.ymax, - cumap->clipr.ymin, - 100.0, - ""); - UI_but_number_step_size_set(bt, 10); - UI_but_number_precision_set(bt, 2); - - UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); - UI_block_direction_set(block, UI_DIR_DOWN); - - return block; -} - -static uiBlock *curvemap_tools_func( - bContext *C, ARegion *region, RNAUpdateCb &cb, bool show_extend, int reset_mode) -{ - PointerRNA cumap_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); - CurveMapping *cumap = static_cast(cumap_ptr.data); - - short yco = 0; - const short menuwidth = 10 * UI_UNIT_X; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Reset View"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [cumap](bContext &C) { - BKE_curvemapping_reset_view(cumap); - ED_region_tag_redraw(CTX_wm_region(&C)); - }); - } - - if (show_extend && !(cumap->flag & CUMA_USE_WRAPPING)) { - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Extend Horizontal"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [cumap, cb](bContext &C) { - cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE; - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - ED_undo_push(&C, "CurveMap tools"); - ED_region_tag_redraw(CTX_wm_region(&C)); - }); - } - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Extend Extrapolated"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [cumap, cb](bContext &C) { - cumap->flag |= CUMA_EXTEND_EXTRAPOLATE; - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - ED_undo_push(&C, "CurveMap tools"); - ED_region_tag_redraw(CTX_wm_region(&C)); - }); - } - } - - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Reset Curve"), - 0, - yco -= UI_UNIT_Y, - menuwidth, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [cumap, cb, reset_mode](bContext &C) { - CurveMap *cuma = cumap->cm + cumap->cur; - BKE_curvemap_reset(cuma, &cumap->clipr, cumap->preset, reset_mode); - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - ED_undo_push(&C, "CurveMap tools"); - ED_region_tag_redraw(CTX_wm_region(&C)); - }); - } - - UI_block_direction_set(block, UI_DIR_DOWN); - UI_block_bounds_set_text(block, 3.0f * UI_UNIT_X); - - return block; -} - -static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cb_v) -{ - return curvemap_tools_func( - C, region, *static_cast(cb_v), true, CURVEMAP_SLOPE_POSITIVE); -} - -static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cb_v) -{ - return curvemap_tools_func( - C, region, *static_cast(cb_v), true, CURVEMAP_SLOPE_NEGATIVE); -} - -static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cb_v) -{ - return curvemap_tools_func( - C, region, *static_cast(cb_v), false, CURVEMAP_SLOPE_POSITIVE); -} - -static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cb_v) -{ - return curvemap_tools_func( - C, region, *static_cast(cb_v), false, CURVEMAP_SLOPE_POSITIVE); -} - -static void curvemap_buttons_redraw(bContext &C) -{ - ED_region_tag_redraw(CTX_wm_region(&C)); -} - -/** - * \note Still unsure how this call evolves. - * - * \param labeltype: Used for defining which curve-channels to show. - */ -static void curvemap_buttons_layout(uiLayout *layout, - PointerRNA *ptr, - char labeltype, - bool levels, - bool brush, - bool neg_slope, - bool tone, - const RNAUpdateCb &cb) -{ - CurveMapping *cumap = static_cast(ptr->data); - CurveMap *cm = &cumap->cm[cumap->cur]; - uiBut *bt; - const float dx = UI_UNIT_X; - eButGradientType bg = UI_GRAD_NONE; - - uiBlock *block = uiLayoutGetBlock(layout); - - UI_block_emboss_set(block, UI_EMBOSS); - - if (tone) { - uiLayout *split = uiLayoutSplit(layout, 0.0f, false); - uiItemR(uiLayoutRow(split, false), ptr, "tone", UI_ITEM_R_EXPAND, std::nullopt, ICON_NONE); - } - - /* curve chooser */ - uiLayout *row = uiLayoutRow(layout, false); - - if (labeltype == 'v') { - /* vector */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - if (cumap->cm[0].curve) { - bt = uiDefButI(block, UI_BTYPE_ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, ""); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[1].curve) { - bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, ""); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[2].curve) { - bt = uiDefButI(block, UI_BTYPE_ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, ""); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - } - else if (labeltype == 'c' && cumap->tone != CURVE_TONE_FILMLIKE) { - /* color */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - if (cumap->cm[3].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "C"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 3.0, - TIP_("Combined channels")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[0].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "R"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 0.0, - TIP_("Red channel")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[1].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "G"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 1.0, - TIP_("Green channel")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[2].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - CTX_IFACE_(BLT_I18NCONTEXT_COLOR, "B"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 2.0, - TIP_("Blue channel")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - } - else if (labeltype == 'h') { - /* HSV */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - if (cumap->cm[0].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - IFACE_("H"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 0.0, - TIP_("Hue level")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[1].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - IFACE_("S"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 1.0, - TIP_("Saturation level")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - if (cumap->cm[2].curve) { - bt = uiDefButI(block, - UI_BTYPE_ROW, - 0, - IFACE_("V"), - 0, - 0, - dx, - dx, - &cumap->cur, - 0.0, - 2.0, - TIP_("Value level")); - UI_but_func_set(bt, curvemap_buttons_redraw); - } - } - else { - uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT); - } - - if (labeltype == 'h') { - bg = UI_GRAD_H; - } - - /* operation buttons */ - /* (Right aligned) */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); - - if (!(cumap->flag & CUMA_USE_WRAPPING)) { - /* Zoom in */ - bt = uiDefIconBut( - block, UI_BTYPE_BUT, 0, ICON_ZOOM_IN, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Zoom in")); - UI_but_func_set(bt, [cumap](bContext &C) { curvemap_buttons_zoom_in(&C, cumap); }); - if (!curvemap_can_zoom_in(cumap)) { - UI_but_disable(bt, ""); - } - - /* Zoom out */ - bt = uiDefIconBut( - block, UI_BTYPE_BUT, 0, ICON_ZOOM_OUT, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Zoom out")); - UI_but_func_set(bt, [cumap](bContext &C) { curvemap_buttons_zoom_out(&C, cumap); }); - if (!curvemap_can_zoom_out(cumap)) { - UI_but_disable(bt, ""); - } - - /* Clipping button. */ - const int icon = (cumap->flag & CUMA_DO_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT; - bt = uiDefIconBlockBut( - block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options")); - bt->drawflag &= ~UI_BUT_ICON_LEFT; - UI_but_func_set(bt, [cb](bContext &C) { rna_update_cb(C, cb); }); - } - - RNAUpdateCb *tools_cb = MEM_new(__func__, cb); - if (brush && neg_slope) { - bt = uiDefIconBlockBut(block, - curvemap_brush_tools_negslope_func, - tools_cb, - 0, - ICON_NONE, - 0, - 0, - dx, - dx, - TIP_("Tools")); - } - else if (brush) { - bt = uiDefIconBlockBut( - block, curvemap_brush_tools_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); - } - else if (neg_slope) { - bt = uiDefIconBlockBut( - block, curvemap_tools_negslope_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); - } - else { - bt = uiDefIconBlockBut( - block, curvemap_tools_posslope_func, tools_cb, 0, ICON_NONE, 0, 0, dx, dx, TIP_("Tools")); - } - /* Pass ownership of `tools_cb` to the button. */ - UI_but_funcN_set( - bt, - [](bContext *, void *, void *) {}, - tools_cb, - nullptr, - but_func_argN_free, - but_func_argN_copy); - - UI_block_funcN_set(block, - rna_update_cb, - MEM_new(__func__, cb), - nullptr, - but_func_argN_free, - but_func_argN_copy); - - /* Curve itself. */ - const int size = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X); - row = uiLayoutRow(layout, false); - uiButCurveMapping *curve_but = (uiButCurveMapping *)uiDefBut( - block, UI_BTYPE_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, ""); - curve_but->gradient_type = bg; - - /* Sliders for selected curve point. */ - int i; - CurveMapPoint *cmp = nullptr; - bool point_last_or_first = false; - for (i = 0; i < cm->totpoint; i++) { - if (cm->curve[i].flag & CUMA_SELECT) { - cmp = &cm->curve[i]; - break; - } - } - if (ELEM(i, 0, cm->totpoint - 1)) { - point_last_or_first = true; - } - - if (cmp) { - rctf bounds; - if (cumap->flag & CUMA_DO_CLIP) { - bounds = cumap->clipr; - } - else { - bounds.xmin = bounds.ymin = -1000.0; - bounds.xmax = bounds.ymax = 1000.0; - } - - UI_block_emboss_set(block, UI_EMBOSS); - - uiLayoutRow(layout, true); - - /* Curve handle buttons. */ - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 1, - ICON_HANDLE_AUTO, - 0, - UI_UNIT_Y, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - TIP_("Auto Handle")); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - CurveMap *cuma = cumap->cm + cumap->cur; - BKE_curvemap_handle_set(cuma, HD_AUTO); - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - }); - if (((cmp->flag & CUMA_HANDLE_AUTO_ANIM) == false) && - ((cmp->flag & CUMA_HANDLE_VECTOR) == false)) - { - bt->flag |= UI_SELECT_DRAW; - } - - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 1, - ICON_HANDLE_VECTOR, - 0, - UI_UNIT_Y, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - TIP_("Vector Handle")); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - CurveMap *cuma = cumap->cm + cumap->cur; - BKE_curvemap_handle_set(cuma, HD_VECT); - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - }); - if (cmp->flag & CUMA_HANDLE_VECTOR) { - bt->flag |= UI_SELECT_DRAW; - } - - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 1, - ICON_HANDLE_AUTOCLAMPED, - 0, - UI_UNIT_Y, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - TIP_("Auto Clamped")); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - CurveMap *cuma = cumap->cm + cumap->cur; - BKE_curvemap_handle_set(cuma, HD_AUTO_ANIM); - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - }); - if (cmp->flag & CUMA_HANDLE_AUTO_ANIM) { - bt->flag |= UI_SELECT_DRAW; - } - - /* Curve handle position */ - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - "X:", - 0, - 2 * UI_UNIT_Y, - UI_UNIT_X * 10, - UI_UNIT_Y, - &cmp->x, - bounds.xmin, - bounds.xmax, - ""); - UI_but_number_step_size_set(bt, 1); - UI_but_number_precision_set(bt, 5); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - BKE_curvemapping_changed(cumap, true); - rna_update_cb(C, cb); - }); - - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - "Y:", - 0, - 1 * UI_UNIT_Y, - UI_UNIT_X * 10, - UI_UNIT_Y, - &cmp->y, - bounds.ymin, - bounds.ymax, - ""); - UI_but_number_step_size_set(bt, 1); - UI_but_number_precision_set(bt, 5); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - BKE_curvemapping_changed(cumap, true); - rna_update_cb(C, cb); - }); - - /* Curve handle delete point */ - bt = uiDefIconBut( - block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, dx, dx, nullptr, 0.0, 0.0, TIP_("Delete points")); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - BKE_curvemap_remove(cumap->cm + cumap->cur, SELECT); - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - }); - if (point_last_or_first) { - UI_but_flag_enable(bt, UI_BUT_DISABLED); - } - } - - /* black/white levels */ - if (levels) { - uiLayout *split = uiLayoutSplit(layout, 0.0f, false); - uiItemR(uiLayoutColumn(split, false), - ptr, - "black_level", - UI_ITEM_R_EXPAND, - std::nullopt, - ICON_NONE); - uiItemR(uiLayoutColumn(split, false), - ptr, - "white_level", - UI_ITEM_R_EXPAND, - std::nullopt, - ICON_NONE); - - uiLayoutRow(layout, false); - bt = uiDefBut(block, - UI_BTYPE_BUT, - 0, - IFACE_("Reset"), - 0, - 0, - UI_UNIT_X * 10, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - TIP_("Reset Black/White point and curves")); - UI_but_func_set(bt, [cumap, cb](bContext &C) { - cumap->preset = CURVE_PRESET_LINE; - for (int a = 0; a < CM_TOT; a++) { - BKE_curvemap_reset(cumap->cm + a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); - } - - cumap->black[0] = cumap->black[1] = cumap->black[2] = 0.0f; - cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f; - BKE_curvemapping_set_black_white(cumap, nullptr, nullptr); - - BKE_curvemapping_changed(cumap, false); - rna_update_cb(C, cb); - }); - } - - UI_block_funcN_set(block, nullptr, nullptr, nullptr); -} - -void uiTemplateCurveMapping(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - int type, - bool levels, - bool brush, - bool neg_slope, - bool tone) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - uiBlock *block = uiLayoutGetBlock(layout); - - if (!prop) { - RNA_warning( - "curve property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - if (RNA_property_type(prop) != PROP_POINTER) { - RNA_warning( - "curve is not a pointer: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping)) { - return; - } - - ID *id = cptr.owner_id; - UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); - - curvemap_buttons_layout( - layout, &cptr, type, levels, brush, neg_slope, tone, RNAUpdateCb{*ptr, prop}); - - UI_block_lock_clear(block); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Curve Profile Template - * \{ */ - -static uiBlock *curve_profile_presets_fn(bContext *C, ARegion *region, void *cb_v) -{ - RNAUpdateCb &cb = *static_cast(cb_v); - PointerRNA profile_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); - CurveProfile *profile = static_cast(profile_ptr.data); - short yco = 0; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - - for (const auto &item : - {std::pair(IFACE_("Default"), PROF_PRESET_LINE), - std::pair(IFACE_("Support Loops"), PROF_PRESET_SUPPORTS), - std::pair(IFACE_("Cornice Molding"), PROF_PRESET_CORNICE), - std::pair(IFACE_("Crown Molding"), PROF_PRESET_CROWN), - std::pair(IFACE_("Steps"), PROF_PRESET_STEPS)}) - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - item.first, - 0, - yco -= UI_UNIT_Y, - 0, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - const eCurveProfilePresets preset = item.second; - UI_but_func_set(but, [profile, cb, preset](bContext &C) { - profile->preset = preset; - BKE_curveprofile_reset(profile); - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - ED_undo_push(&C, "Reset Curve Profile"); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - - UI_block_direction_set(block, UI_DIR_DOWN); - UI_block_bounds_set_text(block, int(3.0f * UI_UNIT_X)); - - return block; -} - -static uiBlock *curve_profile_tools_fn(bContext *C, ARegion *region, void *cb_v) -{ - RNAUpdateCb &cb = *static_cast(cb_v); - PointerRNA profile_ptr = RNA_property_pointer_get(&cb.ptr, cb.prop); - CurveProfile *profile = static_cast(profile_ptr.data); - short yco = 0; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Reset View"), - 0, - yco -= UI_UNIT_Y, - 0, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [profile](bContext &C) { - BKE_curveprofile_reset_view(profile); - ED_region_tag_redraw(CTX_wm_region(&C)); - }); - } - { - uiBut *but = uiDefIconTextBut(block, - UI_BTYPE_BUT_MENU, - 1, - ICON_BLANK1, - IFACE_("Reset Curve"), - 0, - yco -= UI_UNIT_Y, - 0, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - ""); - UI_but_func_set(but, [profile, cb](bContext &C) { - BKE_curveprofile_reset(profile); - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - ED_undo_push(&C, "Reset Profile"); - ED_region_tag_redraw(CTX_wm_region(&C)); - rna_update_cb(C, cb); - }); - } - - UI_block_direction_set(block, UI_DIR_DOWN); - UI_block_bounds_set_text(block, int(3.0f * UI_UNIT_X)); - - return block; -} - -static bool curve_profile_can_zoom_in(CurveProfile *profile) -{ - return BLI_rctf_size_x(&profile->view_rect) > - CURVE_ZOOM_MAX * BLI_rctf_size_x(&profile->clip_rect); -} - -static bool curve_profile_can_zoom_out(CurveProfile *profile) -{ - return BLI_rctf_size_x(&profile->view_rect) < BLI_rctf_size_x(&profile->clip_rect); -} - -static void curve_profile_zoom_in(bContext *C, CurveProfile *profile) -{ - if (curve_profile_can_zoom_in(profile)) { - const float dx = 0.1154f * BLI_rctf_size_x(&profile->view_rect); - profile->view_rect.xmin += dx; - profile->view_rect.xmax -= dx; - const float dy = 0.1154f * BLI_rctf_size_y(&profile->view_rect); - profile->view_rect.ymin += dy; - profile->view_rect.ymax -= dy; - } - - ED_region_tag_redraw(CTX_wm_region(C)); -} - -static void curve_profile_zoom_out(bContext *C, CurveProfile *profile) -{ - if (curve_profile_can_zoom_out(profile)) { - float d = 0.15f * BLI_rctf_size_x(&profile->view_rect); - float d1 = d; - - if (profile->flag & PROF_USE_CLIP) { - if (profile->view_rect.xmin - d < profile->clip_rect.xmin) { - d1 = profile->view_rect.xmin - profile->clip_rect.xmin; - } - } - profile->view_rect.xmin -= d1; - - d1 = d; - if (profile->flag & PROF_USE_CLIP) { - if (profile->view_rect.xmax + d > profile->clip_rect.xmax) { - d1 = -profile->view_rect.xmax + profile->clip_rect.xmax; - } - } - profile->view_rect.xmax += d1; - - d = d1 = 0.15f * BLI_rctf_size_y(&profile->view_rect); - - if (profile->flag & PROF_USE_CLIP) { - if (profile->view_rect.ymin - d < profile->clip_rect.ymin) { - d1 = profile->view_rect.ymin - profile->clip_rect.ymin; - } - } - profile->view_rect.ymin -= d1; - - d1 = d; - if (profile->flag & PROF_USE_CLIP) { - if (profile->view_rect.ymax + d > profile->clip_rect.ymax) { - d1 = -profile->view_rect.ymax + profile->clip_rect.ymax; - } - } - profile->view_rect.ymax += d1; - } - - ED_region_tag_redraw(CTX_wm_region(C)); -} - -static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const RNAUpdateCb &cb) -{ - CurveProfile *profile = static_cast(ptr->data); - uiBut *bt; - - uiBlock *block = uiLayoutGetBlock(layout); - - UI_block_emboss_set(block, UI_EMBOSS); - - uiLayoutSetPropSep(layout, false); - - /* Preset selector */ - /* There is probably potential to use simpler "uiItemR" functions here, but automatic updating - * after a preset is selected would be more complicated. */ - uiLayout *row = uiLayoutRow(layout, true); - RNAUpdateCb *presets_cb = MEM_new(__func__, cb); - bt = uiDefBlockBut(block, - curve_profile_presets_fn, - presets_cb, - IFACE_("Preset"), - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - ""); - /* Pass ownership of `presets_cb` to the button. */ - UI_but_funcN_set( - bt, - [](bContext *, void *, void *) {}, - presets_cb, - nullptr, - but_func_argN_free, - but_func_argN_copy); - - /* Show a "re-apply" preset button when it has been changed from the preset. */ - if (profile->flag & PROF_DIRTY_PRESET) { - /* Only for dynamic presets. */ - if (ELEM(profile->preset, PROF_PRESET_STEPS, PROF_PRESET_SUPPORTS)) { - bt = uiDefIconTextBut(block, - UI_BTYPE_BUT, - 0, - ICON_NONE, - IFACE_("Apply Preset"), - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Reapply and update the preset, removing changes")); - UI_but_func_set(bt, [profile, cb](bContext &C) { - BKE_curveprofile_reset(profile); - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - rna_update_cb(C, cb); - }); - } - } - - row = uiLayoutRow(layout, false); - - /* (Left aligned) */ - uiLayout *sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - /* Zoom in */ - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_ZOOM_IN, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Zoom in")); - UI_but_func_set(bt, [profile](bContext &C) { curve_profile_zoom_in(&C, profile); }); - if (!curve_profile_can_zoom_in(profile)) { - UI_but_disable(bt, ""); - } - - /* Zoom out */ - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_ZOOM_OUT, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Zoom out")); - UI_but_func_set(bt, [profile](bContext &C) { curve_profile_zoom_out(&C, profile); }); - if (!curve_profile_can_zoom_out(profile)) { - UI_but_disable(bt, ""); - } - - /* (Right aligned) */ - sub = uiLayoutRow(row, true); - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); - - /* Flip path */ - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_ARROW_LEFTRIGHT, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Reverse Path")); - UI_but_func_set(bt, [profile, cb](bContext &C) { - BKE_curveprofile_reverse(profile); - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - rna_update_cb(C, cb); - }); - - /* Clipping toggle */ - const int icon = (profile->flag & PROF_USE_CLIP) ? ICON_CLIPUV_HLT : ICON_CLIPUV_DEHLT; - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - icon, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Toggle Profile Clipping")); - UI_but_func_set(bt, [profile, cb](bContext &C) { - profile->flag ^= PROF_USE_CLIP; - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - rna_update_cb(C, cb); - }); - - /* Reset view, reset curve */ - RNAUpdateCb *tools_cb = MEM_new(__func__, cb); - bt = uiDefIconBlockBut(block, - curve_profile_tools_fn, - tools_cb, - 0, - ICON_NONE, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - TIP_("Tools")); - /* Pass ownership of `presets_cb` to the button. */ - UI_but_funcN_set( - bt, - [](bContext *, void *, void *) {}, - tools_cb, - nullptr, - but_func_argN_free, - but_func_argN_copy); - - UI_block_funcN_set(block, - rna_update_cb, - MEM_new(__func__, cb), - nullptr, - but_func_argN_free, - but_func_argN_copy); - - /* The path itself */ - int path_width = max_ii(uiLayoutGetWidth(layout), UI_UNIT_X); - path_width = min_ii(path_width, int(16.0f * UI_UNIT_X)); - const int path_height = path_width; - uiLayoutRow(layout, false); - uiDefBut(block, - UI_BTYPE_CURVEPROFILE, - 0, - "", - 0, - 0, - short(path_width), - short(path_height), - profile, - 0.0f, - 1.0f, - ""); - - /* Position sliders for (first) selected point */ - int i; - float *selection_x, *selection_y; - bool point_last_or_first = false; - CurveProfilePoint *point = nullptr; - for (i = 0; i < profile->path_len; i++) { - if (profile->path[i].flag & PROF_SELECT) { - point = &profile->path[i]; - selection_x = &point->x; - selection_y = &point->y; - break; - } - if (profile->path[i].flag & PROF_H1_SELECT) { - point = &profile->path[i]; - selection_x = &point->h1_loc[0]; - selection_y = &point->h1_loc[1]; - } - else if (profile->path[i].flag & PROF_H2_SELECT) { - point = &profile->path[i]; - selection_x = &point->h2_loc[0]; - selection_y = &point->h2_loc[1]; - } - } - if (ELEM(i, 0, profile->path_len - 1)) { - point_last_or_first = true; - } - - /* Selected point data */ - rctf bounds; - if (point) { - if (profile->flag & PROF_USE_CLIP) { - bounds = profile->clip_rect; - } - else { - bounds.xmin = bounds.ymin = -1000.0; - bounds.xmax = bounds.ymax = 1000.0; - } - - row = uiLayoutRow(layout, true); - - PointerRNA point_ptr = RNA_pointer_create(ptr->owner_id, &RNA_CurveProfilePoint, point); - PropertyRNA *prop_handle_type = RNA_struct_find_property(&point_ptr, "handle_type_1"); - uiItemFullR(row, - &point_ptr, - prop_handle_type, - RNA_NO_INDEX, - 0, - UI_ITEM_R_EXPAND | UI_ITEM_R_ICON_ONLY, - "", - ICON_NONE); - - /* Position */ - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - "X:", - 0, - 2 * UI_UNIT_Y, - UI_UNIT_X * 10, - UI_UNIT_Y, - selection_x, - bounds.xmin, - bounds.xmax, - ""); - UI_but_number_step_size_set(bt, 1); - UI_but_number_precision_set(bt, 5); - UI_but_func_set(bt, [profile, cb](bContext &C) { - BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); - rna_update_cb(C, cb); - }); - if (point_last_or_first) { - UI_but_flag_enable(bt, UI_BUT_DISABLED); - } - bt = uiDefButF(block, - UI_BTYPE_NUM, - 0, - "Y:", - 0, - 1 * UI_UNIT_Y, - UI_UNIT_X * 10, - UI_UNIT_Y, - selection_y, - bounds.ymin, - bounds.ymax, - ""); - UI_but_number_step_size_set(bt, 1); - UI_but_number_precision_set(bt, 5); - UI_but_func_set(bt, [profile, cb](bContext &C) { - BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); - rna_update_cb(C, cb); - }); - if (point_last_or_first) { - UI_but_flag_enable(bt, UI_BUT_DISABLED); - } - - /* Delete points */ - bt = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_X, - 0, - 0, - UI_UNIT_X, - UI_UNIT_X, - nullptr, - 0.0, - 0.0, - TIP_("Delete points")); - UI_but_func_set(bt, [profile, cb](bContext &C) { - BKE_curveprofile_remove_by_flag(profile, SELECT); - BKE_curveprofile_update(profile, PROF_UPDATE_NONE); - rna_update_cb(C, cb); - }); - if (point_last_or_first) { - UI_but_flag_enable(bt, UI_BUT_DISABLED); - } - } - - uiItemR(layout, ptr, "use_sample_straight_edges", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiItemR(layout, ptr, "use_sample_even_lengths", UI_ITEM_NONE, std::nullopt, ICON_NONE); - - UI_block_funcN_set(block, nullptr, nullptr, nullptr); -} - -void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - uiBlock *block = uiLayoutGetBlock(layout); - - if (!prop) { - RNA_warning("Curve Profile property not found: %s.%s", - RNA_struct_identifier(ptr->type), - propname.c_str()); - return; - } - - if (RNA_property_type(prop) != PROP_POINTER) { - RNA_warning("Curve Profile is not a pointer: %s.%s", - RNA_struct_identifier(ptr->type), - propname.c_str()); - return; - } - - PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveProfile)) { - return; - } - - ID *id = cptr.owner_id; - UI_block_lock_set(block, (id && !ID_IS_EDITABLE(id)), ERROR_LIBDATA_MESSAGE); - - CurveProfile_buttons_layout(layout, &cptr, RNAUpdateCb{*ptr, prop}); - - UI_block_lock_clear(block); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name ColorPicker Template - * \{ */ - -#define WHEEL_SIZE (5 * U.widget_unit) - -void uiTemplateColorPicker(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - bool value_slider, - bool lock, - bool lock_luminosity, - bool cubic) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - uiBlock *block = uiLayoutGetBlock(layout); - ColorPicker *cpicker = ui_block_colorpicker_create(block); - - if (!prop) { - RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - float softmin, softmax, step, precision; - RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); - - uiLayout *col = uiLayoutColumn(layout, true); - uiLayout *row = uiLayoutRow(col, true); - - uiBut *but = nullptr; - uiButHSVCube *hsv_but; - switch (U.color_picker_type) { - case USER_CP_SQUARE_SV: - case USER_CP_SQUARE_HS: - case USER_CP_SQUARE_HV: - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - 0, - 0, - WHEEL_SIZE, - WHEEL_SIZE, - ptr, - prop, - -1, - 0.0, - 0.0, - ""); - switch (U.color_picker_type) { - case USER_CP_SQUARE_SV: - hsv_but->gradient_type = UI_GRAD_SV; - break; - case USER_CP_SQUARE_HS: - hsv_but->gradient_type = UI_GRAD_HS; - break; - case USER_CP_SQUARE_HV: - hsv_but->gradient_type = UI_GRAD_HV; - break; - } - but = hsv_but; - break; - - /* user default */ - case USER_CP_CIRCLE_HSV: - case USER_CP_CIRCLE_HSL: - default: - but = uiDefButR_prop(block, - UI_BTYPE_HSVCIRCLE, - 0, - "", - 0, - 0, - WHEEL_SIZE, - WHEEL_SIZE, - ptr, - prop, - -1, - 0.0, - 0.0, - ""); - break; - } - - but->custom_data = cpicker; - - cpicker->use_color_lock = lock; - cpicker->use_color_cubic = cubic; - cpicker->use_luminosity_lock = lock_luminosity; - - if (lock_luminosity) { - float color[4]; /* in case of alpha */ - RNA_property_float_get_array(ptr, prop, color); - cpicker->luminosity_lock_value = len_v3(color); - } - - if (value_slider) { - switch (U.color_picker_type) { - case USER_CP_CIRCLE_HSL: - uiItemS(row); - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - WHEEL_SIZE + 6, - 0, - 14 * UI_SCALE_FAC, - WHEEL_SIZE, - ptr, - prop, - -1, - softmin, - softmax, - ""); - hsv_but->gradient_type = UI_GRAD_L_ALT; - break; - case USER_CP_SQUARE_SV: - uiItemS(col); - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - 0, - 4, - WHEEL_SIZE, - 18 * UI_SCALE_FAC, - ptr, - prop, - -1, - softmin, - softmax, - ""); - hsv_but->gradient_type = eButGradientType(UI_GRAD_SV + 3); - break; - case USER_CP_SQUARE_HS: - uiItemS(col); - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - 0, - 4, - WHEEL_SIZE, - 18 * UI_SCALE_FAC, - ptr, - prop, - -1, - softmin, - softmax, - ""); - hsv_but->gradient_type = eButGradientType(UI_GRAD_HS + 3); - break; - case USER_CP_SQUARE_HV: - uiItemS(col); - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - 0, - 4, - WHEEL_SIZE, - 18 * UI_SCALE_FAC, - ptr, - prop, - -1, - softmin, - softmax, - ""); - hsv_but->gradient_type = eButGradientType(UI_GRAD_HV + 3); - break; - - /* user default */ - case USER_CP_CIRCLE_HSV: - default: - uiItemS(row); - hsv_but = (uiButHSVCube *)uiDefButR_prop(block, - UI_BTYPE_HSVCUBE, - 0, - "", - WHEEL_SIZE + 6, - 0, - 14 * UI_SCALE_FAC, - WHEEL_SIZE, - ptr, - prop, - -1, - softmin, - softmax, - ""); - hsv_but->gradient_type = UI_GRAD_V_ALT; - break; - } - - hsv_but->custom_data = cpicker; - } -} - -static void ui_template_palette_menu(bContext * /*C*/, uiLayout *layout, void * /*but_p*/) -{ - uiLayout *row; - - uiItemL(layout, IFACE_("Sort By:"), ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemEnumO_value(row, IFACE_("Hue"), ICON_NONE, "PALETTE_OT_sort", "type", 1); - row = uiLayoutRow(layout, false); - uiItemEnumO_value(row, IFACE_("Saturation"), ICON_NONE, "PALETTE_OT_sort", "type", 2); - row = uiLayoutRow(layout, false); - uiItemEnumO_value(row, IFACE_("Value"), ICON_NONE, "PALETTE_OT_sort", "type", 3); - row = uiLayoutRow(layout, false); - uiItemEnumO_value(row, IFACE_("Luminance"), ICON_NONE, "PALETTE_OT_sort", "type", 4); -} - -void uiTemplatePalette(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - bool /*colors*/) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - uiBut *but = nullptr; - - const int cols_per_row = std::max(uiLayoutGetWidth(layout) / UI_UNIT_X, 1); - - if (!prop) { - RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - const PointerRNA cptr = RNA_property_pointer_get(ptr, prop); - if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Palette)) { - return; - } - - uiBlock *block = uiLayoutGetBlock(layout); - - Palette *palette = static_cast(cptr.data); - - uiLayout *col = uiLayoutColumn(layout, true); - uiLayoutRow(col, true); - uiDefIconButO(block, - UI_BTYPE_BUT, - "PALETTE_OT_color_add", - WM_OP_INVOKE_DEFAULT, - ICON_ADD, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - uiDefIconButO(block, - UI_BTYPE_BUT, - "PALETTE_OT_color_delete", - WM_OP_INVOKE_DEFAULT, - ICON_REMOVE, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - if (palette->colors.first != nullptr) { - but = uiDefIconButO(block, - UI_BTYPE_BUT, - "PALETTE_OT_color_move", - WM_OP_INVOKE_DEFAULT, - ICON_TRIA_UP, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - UI_but_operator_ptr_ensure(but); - RNA_enum_set(but->opptr, "type", -1); - - but = uiDefIconButO(block, - UI_BTYPE_BUT, - "PALETTE_OT_color_move", - WM_OP_INVOKE_DEFAULT, - ICON_TRIA_DOWN, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - UI_but_operator_ptr_ensure(but); - RNA_enum_set(but->opptr, "type", 1); - - /* Menu. */ - uiDefIconMenuBut( - block, ui_template_palette_menu, nullptr, ICON_SORTSIZE, 0, 0, UI_UNIT_X, UI_UNIT_Y, ""); - } - - col = uiLayoutColumn(layout, true); - uiLayoutRow(col, true); - - int row_cols = 0, col_id = 0; - LISTBASE_FOREACH (PaletteColor *, color, &palette->colors) { - if (row_cols >= cols_per_row) { - uiLayoutRow(col, true); - row_cols = 0; - } - - PointerRNA color_ptr = RNA_pointer_create(&palette->id, &RNA_PaletteColor, color); - uiButColor *color_but = (uiButColor *)uiDefButR(block, - UI_BTYPE_COLOR, - 0, - "", - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - &color_ptr, - "color", - -1, - 0.0, - 1.0, - ""); - color_but->is_pallete_color = true; - color_but->palette_color_index = col_id; - row_cols++; - col_id++; - } -} - -void uiTemplateCryptoPicker(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - int icon) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop) { - RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - uiBlock *block = uiLayoutGetBlock(layout); - - uiBut *but = uiDefIconButO(block, - UI_BTYPE_BUT, - "UI_OT_eyedropper_color", - WM_OP_INVOKE_DEFAULT, - icon, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - RNA_property_ui_description(prop)); - but->rnapoin = *ptr; - but->rnaprop = prop; - but->rnaindex = -1; -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Layer Buttons Template - * \{ */ - -static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) -{ - uiBut *but = static_cast(arg1); - const int cur = POINTER_AS_INT(arg2); - wmWindow *win = CTX_wm_window(C); - const bool shift = win->eventstate->modifier & KM_SHIFT; - - if (!shift) { - const int tot = RNA_property_array_length(&but->rnapoin, but->rnaprop); - - /* Normally clicking only selects one layer */ - RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, true); - for (int i = 0; i < tot; i++) { - if (i != cur) { - RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, false); - } - } - } - - /* view3d layer change should update depsgraph (invisible object changed maybe) */ - /* see `view3d_header.cc` */ -} - -void uiTemplateLayers(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - PointerRNA *used_ptr, - const char *used_propname, - int active_layer) -{ - const int cols_per_group = 5; - - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - if (!prop) { - RNA_warning( - "layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname.c_str()); - return; - } - - /* the number of layers determines the way we group them - * - we want 2 rows only (for now) - * - The number of columns (cols) is the total number of buttons per row the 'remainder' - * is added to this, as it will be ok to have first row slightly wider if need be. - * - For now, only split into groups if group will have at least 5 items. - */ - const int layers = RNA_property_array_length(ptr, prop); - const int cols = (layers / 2) + (layers % 2); - const int groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group); - - PropertyRNA *used_prop = nullptr; - if (used_ptr && used_propname) { - used_prop = RNA_struct_find_property(used_ptr, used_propname); - if (!used_prop) { - RNA_warning("used layers property not found: %s.%s", - RNA_struct_identifier(ptr->type), - used_propname); - return; - } - - if (RNA_property_array_length(used_ptr, used_prop) < layers) { - used_prop = nullptr; - } - } - - /* layers are laid out going across rows, with the columns being divided into groups */ - - for (int group = 0; group < groups; group++) { - uiLayout *uCol = uiLayoutColumn(layout, true); - - for (int row = 0; row < 2; row++) { - uiLayout *uRow = uiLayoutRow(uCol, true); - uiBlock *block = uiLayoutGetBlock(uRow); - int layer = groups * cols_per_group * row + cols_per_group * group; - - /* add layers as toggle buts */ - for (int col = 0; (col < cols_per_group) && (layer < layers); col++, layer++) { - int icon = 0; - const int butlay = 1 << layer; - - if (active_layer & butlay) { - icon = ICON_LAYER_ACTIVE; - } - else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer)) { - icon = ICON_LAYER_USED; - } - - uiBut *but = uiDefAutoButR( - block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2); - UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(layer)); - but->type = UI_BTYPE_TOGGLE; - } - } - } -} - -void uiTemplateGameStates(uiLayout *layout, - PointerRNA *ptr, - const char *propname, - PointerRNA *used_ptr, - const char *used_propname, - int active_state) -{ - uiLayout *uRow, *uCol; - PropertyRNA *prop, *used_prop = NULL; - int groups, cols, states; - int group, col, state, row; - int cols_per_group = 5; - Object *ob = (Object *)ptr->owner_id; - - prop = RNA_struct_find_property(ptr, propname); - if (!prop) { - RNA_warning("states property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); - return; - } - - /* the number of states determines the way we group them - * - we want 2 rows only (for now) - * - the number of columns (cols) is the total number of buttons per row - * the 'remainder' is added to this, as it will be ok to have first row slightly wider if need - *be - * - for now, only split into groups if group will have at least 5 items - */ - states = RNA_property_array_length(ptr, prop); - cols = (states / 2) + (states % 2); - groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group); - - if (used_ptr && used_propname) { - used_prop = RNA_struct_find_property(used_ptr, used_propname); - if (!used_prop) { - RNA_warning("used layers property not found: %s.%s", - RNA_struct_identifier(ptr->type), - used_propname); - return; - } - - if (RNA_property_array_length(used_ptr, used_prop) < states) - used_prop = NULL; - } - - /* layers are laid out going across rows, with the columns being divided into groups */ - - for (group = 0; group < groups; group++) { - uCol = uiLayoutColumn(layout, true); - - for (row = 0; row < 2; row++) { - uiBlock *block; - uiBut *but; - - uRow = uiLayoutRow(uCol, true); - block = uiLayoutGetBlock(uRow); - state = groups * cols_per_group * row + cols_per_group * group; - - /* add layers as toggle buts */ - for (col = 0; (col < cols_per_group) && (state < states); col++, state++) { - int icon = 0; - int butlay = 1 << state; - - if (active_state & butlay) - icon = ICON_LAYER_ACTIVE; - else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state)) - icon = ICON_LAYER_USED; - - but = uiDefIconButR_prop(block, - UI_BTYPE_ICON_TOGGLE, - 0, - icon, - 0, - 0, - UI_UNIT_X / 2, - UI_UNIT_Y / 2, - ptr, - prop, - state, - 0, - 0, - BKE_sca_get_name_state(ob, state)); - UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(state)); - but->type = UI_BTYPE_TOGGLE; - } - } - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Running Jobs Template - * \{ */ - -#define B_STOPRENDER 1 -#define B_STOPCAST 2 -#define B_STOPANIM 3 -#define B_STOPCOMPO 4 -#define B_STOPSEQ 5 -#define B_STOPCLIP 6 -#define B_STOPFILE 7 -#define B_STOPOTHER 8 - -static void do_running_jobs(bContext *C, void * /*arg*/, int event) -{ - switch (event) { - case B_STOPRENDER: - G.is_break = true; - break; - case B_STOPCAST: - WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_wm_screen(C)); - break; - case B_STOPANIM: - WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, nullptr, nullptr); - break; - case B_STOPCOMPO: - WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); - break; - case B_STOPSEQ: - WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); - break; - case B_STOPCLIP: - WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); - break; - case B_STOPFILE: - WM_jobs_stop_all_from_owner(CTX_wm_manager(C), CTX_data_scene(C)); - break; - case B_STOPOTHER: - G.is_break = true; - break; - } -} - -struct ProgressTooltip_Store { - wmWindowManager *wm; - void *owner; -}; - -static std::string progress_tooltip_func(bContext * /*C*/, void *argN, const char * /*tip*/) -{ - ProgressTooltip_Store *arg = static_cast(argN); - wmWindowManager *wm = arg->wm; - void *owner = arg->owner; - - const float progress = WM_jobs_progress(wm, owner); - - /* create tooltip text and associate it with the job */ - char elapsed_str[32]; - char remaining_str[32] = "Unknown"; - const double elapsed = BLI_time_now_seconds() - WM_jobs_starttime(wm, owner); - BLI_timecode_string_from_time_simple(elapsed_str, sizeof(elapsed_str), elapsed); - - if (progress) { - const double remaining = (elapsed / double(progress)) - elapsed; - BLI_timecode_string_from_time_simple(remaining_str, sizeof(remaining_str), remaining); - } - - return fmt::format( - "Time Remaining: {}\n" - "Time Elapsed: {}", - remaining_str, - elapsed_str); -} - -void uiTemplateRunningJobs(uiLayout *layout, bContext *C) -{ - Main *bmain = CTX_data_main(C); - wmWindowManager *wm = CTX_wm_manager(C); - ScrArea *area = CTX_wm_area(C); - void *owner = nullptr; - int handle_event, icon = 0; - const char *op_name = nullptr; - const char *op_description = nullptr; - - uiBlock *block = uiLayoutGetBlock(layout); - UI_block_layout_set_current(block, layout); - - UI_block_func_handle_set(block, do_running_jobs, nullptr); - - /* another scene can be rendering too, for example via compositor */ - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) { - handle_event = B_STOPOTHER; - icon = ICON_NONE; - owner = scene; - } - else { - continue; - } - - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PROXY)) { - handle_event = B_STOPSEQ; - icon = ICON_SEQUENCE; - owner = scene; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PREVIEW)) { - handle_event = B_STOPSEQ; - icon = ICON_SEQUENCE; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_DRAW_THUMBNAIL)) { - handle_event = B_STOPSEQ; - icon = ICON_SEQUENCE; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_BUILD_PROXY)) { - handle_event = B_STOPCLIP; - icon = ICON_TRACKER; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_PREFETCH)) { - handle_event = B_STOPCLIP; - icon = ICON_TRACKER; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_TRACK_MARKERS)) { - handle_event = B_STOPCLIP; - icon = ICON_TRACKER; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_CLIP_SOLVE_CAMERA)) { - handle_event = B_STOPCLIP; - icon = ICON_TRACKER; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_FILESEL_READDIR) || - WM_jobs_test(wm, scene, WM_JOB_TYPE_ASSET_LIBRARY_LOAD)) - { - handle_event = B_STOPFILE; - icon = ICON_FILEBROWSER; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) { - handle_event = B_STOPRENDER; - icon = ICON_SCENE; - if (U.render_display_type != USER_RENDER_DISPLAY_NONE) { - op_name = "RENDER_OT_view_show"; - op_description = "Show the render window"; - } - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) { - handle_event = B_STOPCOMPO; - icon = ICON_RENDERLAYERS; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) || - WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) - { - /* Skip bake jobs in compositor to avoid compo header displaying - * progress bar which is not being updated (bake jobs only need - * to update NC_IMAGE context. - */ - if (area->spacetype != SPACE_NODE) { - handle_event = B_STOPOTHER; - icon = ICON_IMAGE; - break; - } - continue; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) { - handle_event = B_STOPOTHER; - icon = ICON_MOD_DYNAMICPAINT; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_POINTCACHE)) { - handle_event = B_STOPOTHER; - icon = ICON_PHYSICS; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_FLUID)) { - handle_event = B_STOPOTHER; - icon = ICON_MOD_FLUIDSIM; - break; - } - if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_SIM_OCEAN)) { - handle_event = B_STOPOTHER; - icon = ICON_MOD_OCEAN; - break; - } - } - - if (owner) { - const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - const bool active = !(G.is_break || WM_jobs_is_stopped(wm, owner)); - - uiLayout *row = uiLayoutRow(layout, false); - block = uiLayoutGetBlock(row); - - /* get percentage done and set it as the UI text */ - const float progress = WM_jobs_progress(wm, owner); - char text[8]; - SNPRINTF(text, "%d%%", int(progress * 100)); - - const char *name = active ? WM_jobs_name(wm, owner) : "Canceling..."; - - /* job icon as a button */ - if (op_name) { - uiDefIconButO(block, - UI_BTYPE_BUT, - op_name, - WM_OP_INVOKE_DEFAULT, - icon, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - TIP_(op_description)); - } - - /* job name and icon if not previously set */ - const int textwidth = UI_fontstyle_string_width(fstyle, name); - uiDefIconTextBut(block, - UI_BTYPE_LABEL, - 0, - op_name ? 0 : icon, - name, - 0, - 0, - textwidth + UI_UNIT_X * 1.5f, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - ""); - - /* stick progress bar and cancel button together */ - row = uiLayoutRow(layout, true); - uiLayoutSetActive(row, active); - block = uiLayoutGetBlock(row); - - { - ProgressTooltip_Store *tip_arg = static_cast( - MEM_mallocN(sizeof(*tip_arg), __func__)); - tip_arg->wm = wm; - tip_arg->owner = owner; - uiButProgress *but_progress = (uiButProgress *)uiDefIconTextBut(block, - UI_BTYPE_PROGRESS, - 0, - ICON_NONE, - text, - UI_UNIT_X, - 0, - UI_UNIT_X * 6.0f, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - nullptr); - - but_progress->progress_factor = progress; - UI_but_func_tooltip_set(but_progress, progress_tooltip_func, tip_arg, MEM_freeN); - } - - if (!wm->runtime->is_interface_locked) { - uiDefIconTextBut(block, - UI_BTYPE_BUT, - handle_event, - ICON_PANEL_CLOSE, - "", - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - TIP_("Stop this job")); - } - } - - if (ED_screen_animation_no_scrub(wm)) { - uiDefIconTextBut(block, - UI_BTYPE_BUT, - B_STOPANIM, - ICON_CANCEL, - IFACE_("Anim Player"), - 0, - 0, - UI_UNIT_X * 5.0f, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - TIP_("Stop animation playback")); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Reports for Last Operator Template - * \{ */ - -void uiTemplateReportsBanner(uiLayout *layout, bContext *C) -{ - ReportList *reports = CTX_wm_reports(C); - Report *report = BKE_reports_last_displayable(reports); - const uiStyle *style = UI_style_get(); - - uiBut *but; - - /* if the report display has timed out, don't show */ - if (!reports->reporttimer) { - return; - } - - ReportTimerInfo *rti = (ReportTimerInfo *)reports->reporttimer->customdata; - - if (!rti || rti->widthfac == 0.0f || !report) { - return; - } - - uiLayout *ui_abs = uiLayoutAbsolute(layout, false); - uiBlock *block = uiLayoutGetBlock(ui_abs); - eUIEmbossType previous_emboss = UI_block_emboss_get(block); - - uchar report_icon_color[4]; - uchar report_text_color[4]; - - UI_GetThemeColorType4ubv( - UI_icon_colorid_from_report_type(report->type), SPACE_INFO, report_icon_color); - UI_GetThemeColorType4ubv( - UI_text_colorid_from_report_type(report->type), SPACE_INFO, report_text_color); - report_text_color[3] = 255; /* This theme color is RGB only, so have to set alpha here. */ - - if (rti->flash_progress <= 1.0) { - /* Flash report briefly according to progress through fade-out duration. */ - const int brighten_amount = int(32 * (1.0f - rti->flash_progress)); - add_v3_uchar_clamped(report_icon_color, brighten_amount); - } - - UI_fontstyle_set(&style->widget); - int width = BLF_width(style->widget.uifont_id, report->message, report->len); - width = min_ii(width, int(REPORT_BANNER_MAX_WIDTH)); - width = min_ii(int(rti->widthfac * width), width); - width = max_ii(width, 10 * UI_SCALE_FAC); - - UI_block_align_begin(block); - - /* Background for icon. */ - but = uiDefBut(block, - UI_BTYPE_ROUNDBOX, - 0, - "", - 0, - 0, - UI_UNIT_X + (6 * UI_SCALE_FAC), - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - ""); - /* UI_BTYPE_ROUNDBOX's bg color is set in but->col. */ - copy_v4_v4_uchar(but->col, report_icon_color); - - /* Background for the rest of the message. */ - but = uiDefBut(block, - UI_BTYPE_ROUNDBOX, - 0, - "", - UI_UNIT_X + (6 * UI_SCALE_FAC), - 0, - UI_UNIT_X + width, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - ""); - /* Use icon background at low opacity to highlight, but still contrasting with area TH_TEXT. */ - copy_v3_v3_uchar(but->col, report_icon_color); - but->col[3] = 64; - - UI_block_align_end(block); - UI_block_emboss_set(block, UI_EMBOSS_NONE); - - /* The report icon itself. */ - but = uiDefIconButO(block, - UI_BTYPE_BUT, - "SCREEN_OT_info_log_show", - WM_OP_INVOKE_REGION_WIN, - UI_icon_from_report_type(report->type), - (3 * UI_SCALE_FAC), - 0, - UI_UNIT_X, - UI_UNIT_Y, - TIP_("Click to open the info editor")); - copy_v4_v4_uchar(but->col, report_text_color); - - /* The report message. */ - but = uiDefButO(block, - UI_BTYPE_BUT, - "SCREEN_OT_info_log_show", - WM_OP_INVOKE_REGION_WIN, - report->message, - UI_UNIT_X, - 0, - width + UI_UNIT_X, - UI_UNIT_Y, - TIP_("Show in Info Log")); - - UI_block_emboss_set(block, previous_emboss); -} - -static bool uiTemplateInputStatusAzone(uiLayout *layout, const AZone *az, const ARegion *region) -{ - if (az->type == AZONE_AREA) { - uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); - uiItemL(layout, IFACE_("Split/Dock"), ICON_NONE); - uiItemS_ex(layout, 0.7f); - uiItemL(layout, "", ICON_EVENT_SHIFT); - uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); - uiItemL(layout, IFACE_("Duplicate into Window"), ICON_NONE); - uiItemS_ex(layout, 0.7f); - uiItemL(layout, "", ICON_EVENT_CTRL); - uiItemS_ex(layout, 1.5f); - uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); - uiItemL(layout, IFACE_("Swap Areas"), ICON_NONE); - return true; - } - - if (az->type == AZONE_REGION) { - uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); - uiItemL(layout, - (region->runtime->visible) ? IFACE_("Resize Region") : IFACE_("Show Hidden Region"), - ICON_NONE); - return true; - } - - return false; -} - -void uiTemplateInputStatus(uiLayout *layout, bContext *C) -{ - wmWindow *win = CTX_wm_window(C); - WorkSpace *workspace = CTX_wm_workspace(C); - - /* Workspace status text has priority. */ - if (!workspace->runtime->status.is_empty()) { - uiLayout *row = uiLayoutRow(layout, true); - for (const blender::bke::WorkSpaceStatusItem &item : workspace->runtime->status) { - if (item.space_factor != 0.0f) { - uiItemS_ex(row, item.space_factor); - } - else { - uiBut *but = uiItemL_ex(row, item.text, item.icon, false, false); - if (item.inverted) { - but->drawflag |= UI_BUT_ICON_INVERT; - } - const float offset = ui_event_icon_offset(item.icon); - if (offset != 0.0f) { - uiItemS_ex(row, offset); - } - } - } - return; - } - - if (WM_window_modal_keymap_status_draw(C, win, layout)) { - return; - } - - bScreen *screen = CTX_wm_screen(C); - ARegion *region = screen->active_region; - uiLayout *row = uiLayoutRow(layout, true); - - if (region == nullptr) { - /* Check if over an action zone. */ - LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) { - LISTBASE_FOREACH (AZone *, az, &area_iter->actionzones) { - if (BLI_rcti_isect_pt_v(&az->rect, win->eventstate->xy)) { - region = az->region; - if (uiTemplateInputStatusAzone(row, az, region)) { - return; - } - break; - } - } - } - } - - if (!region) { - /* On a gap between editors. */ - uiItemL(row, nullptr, ICON_MOUSE_LMB_DRAG); - uiItemL(row, IFACE_("Resize"), ICON_NONE); - uiItemS_ex(row, 0.7f); - uiItemL(row, nullptr, ICON_MOUSE_RMB); - uiItemS_ex(row, -0.5f); - uiItemL(row, IFACE_("Options"), ICON_NONE); - return; - } - - /* Otherwise should cursor keymap status. */ - for (int i = 0; i < 3; i++) { - uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); - - const char *msg = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, - WM_window_cursor_keymap_status_get(win, i, 0)); - const char *msg_drag = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, - WM_window_cursor_keymap_status_get(win, i, 1)); - - if (msg) { - uiItemL(row, "", (ICON_MOUSE_LMB + i)); - uiItemS_ex(row, -0.5f); - uiItemL(row, msg, ICON_NONE); - uiItemS_ex(row, 0.7f); - } - - if (msg_drag) { - uiItemL(row, "", (ICON_MOUSE_LMB_DRAG + i)); - uiItemL(row, msg_drag, ICON_NONE); - uiItemS_ex(row, 0.7f); - } - } -} - -static std::string ui_template_status_tooltip(bContext *C, void * /*argN*/, const char * /*tip*/) -{ - Main *bmain = CTX_data_main(C); - std::string tooltip_message = ""; - - if (bmain->has_forward_compatibility_issues) { - char writer_ver_str[12]; - BKE_blender_version_blendfile_string_from_values( - writer_ver_str, sizeof(writer_ver_str), bmain->versionfile, -1); - tooltip_message += fmt::format( - fmt::runtime(RPT_("File saved by newer Blender\n({}), expect loss of data")), - writer_ver_str); - } - if (bmain->is_asset_edit_file) { - if (!tooltip_message.empty()) { - tooltip_message += "\n\n"; - } - tooltip_message += RPT_( - "This file is managed by the Blender asset system and cannot be overridden"); - } - - return tooltip_message; -} - -void uiTemplateStatusInfo(uiLayout *layout, bContext *C) -{ - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - uiLayout *row = uiLayoutRow(layout, true); - - const char *status_info_txt = ED_info_statusbar_string_ex( - bmain, scene, view_layer, (U.statusbar_flag & ~STATUSBAR_SHOW_VERSION)); - /* True when the status is populated (delimiters required for following items). */ - bool has_status_info = false; - - if (status_info_txt[0]) { - uiItemL(row, status_info_txt, ICON_NONE); - has_status_info = true; - } - - if (U.statusbar_flag & STATUSBAR_SHOW_EXTENSIONS_UPDATES) { - wmWindowManager *wm = CTX_wm_manager(C); - - /* Special case, always show an alert for any blocked extensions. */ - if (wm->extensions_blocked > 0) { - if (has_status_info) { - uiItemS_ex(row, -0.5f); - uiItemL(row, "|", ICON_NONE); - uiItemS_ex(row, -0.5f); - } - uiLayoutSetEmboss(row, UI_EMBOSS_NONE); - /* This operator also works fine for blocked extensions. */ - uiItemO(row, "", ICON_ERROR, "EXTENSIONS_OT_userpref_show_for_update"); - uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); - uchar color[4]; - UI_GetThemeColor4ubv(TH_TEXT, color); - copy_v4_v4_uchar(but->col, color); - - BLI_str_format_integer_unit(but->icon_overlay_text.text, wm->extensions_blocked); - UI_but_icon_indicator_color_set(but, color); - - uiItemS_ex(row, 1.0f); - has_status_info = true; - } - - if ((G.f & G_FLAG_INTERNET_ALLOW) == 0) { - if (has_status_info) { - uiItemS_ex(row, -0.5f); - uiItemL(row, "|", ICON_NONE); - uiItemS_ex(row, -0.5f); - } - - if ((G.f & G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE) != 0) { - uiItemL(row, "", ICON_INTERNET_OFFLINE); - } - else { - uiLayoutSetEmboss(row, UI_EMBOSS_NONE); - uiItemO(row, "", ICON_INTERNET_OFFLINE, "EXTENSIONS_OT_userpref_show_online"); - uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); - uchar color[4]; - UI_GetThemeColor4ubv(TH_TEXT, color); - copy_v4_v4_uchar(but->col, color); - } - - uiItemS_ex(row, 1.0f); - has_status_info = true; - } - else if ((wm->extensions_updates > 0) || - (wm->extensions_updates == WM_EXTENSIONS_UPDATE_CHECKING)) - { - int icon = ICON_INTERNET; - if (wm->extensions_updates == WM_EXTENSIONS_UPDATE_CHECKING) { - icon = ICON_UV_SYNC_SELECT; - } - - if (has_status_info) { - uiItemS_ex(row, -0.5f); - uiItemL(row, "|", ICON_NONE); - uiItemS_ex(row, -0.5f); - } - uiLayoutSetEmboss(row, UI_EMBOSS_NONE); - uiItemO(row, "", icon, "EXTENSIONS_OT_userpref_show_for_update"); - uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); - uchar color[4]; - UI_GetThemeColor4ubv(TH_TEXT, color); - copy_v4_v4_uchar(but->col, color); - - if (wm->extensions_updates > 0) { - BLI_str_format_integer_unit(but->icon_overlay_text.text, wm->extensions_updates); - UI_but_icon_indicator_color_set(but, color); - } - - uiItemS_ex(row, 1.0f); - has_status_info = true; - } - } - - if (!BKE_main_has_issues(bmain)) { - if (U.statusbar_flag & STATUSBAR_SHOW_VERSION) { - if (has_status_info) { - uiItemS_ex(row, -0.5f); - uiItemL(row, "|", ICON_NONE); - uiItemS_ex(row, -0.5f); - } - const char *status_info_d_txt = ED_info_statusbar_string_ex( - bmain, scene, view_layer, STATUSBAR_SHOW_VERSION); - uiItemL(row, status_info_d_txt, ICON_NONE); - } - return; - } - - blender::StringRefNull version_string = ED_info_statusbar_string_ex( - bmain, scene, view_layer, STATUSBAR_SHOW_VERSION); - blender::StringRefNull warning_message; - - /* Blender version part is shown as warning area when there are forward compatibility issues with - * currently loaded .blend file. */ - if (bmain->has_forward_compatibility_issues) { - warning_message = version_string; - } - else { - /* For other issues, still show the version if enabled. */ - if (U.statusbar_flag & STATUSBAR_SHOW_VERSION) { - uiItemL(layout, version_string, ICON_NONE); - } - } - - const uiStyle *style = UI_style_get(); - uiLayout *ui_abs = uiLayoutAbsolute(layout, false); - uiBlock *block = uiLayoutGetBlock(ui_abs); - eUIEmbossType previous_emboss = UI_block_emboss_get(block); - - UI_fontstyle_set(&style->widget); - const int width = max_ii( - int(BLF_width(style->widget.uifont_id, warning_message.c_str(), warning_message.size())), - int(10 * UI_SCALE_FAC)); - - UI_block_align_begin(block); - - /* Background for icon. */ - uiBut *but = uiDefBut(block, - UI_BTYPE_ROUNDBOX, - 0, - "", - 0, - 0, - UI_UNIT_X + (6 * UI_SCALE_FAC), - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - ""); - /* UI_BTYPE_ROUNDBOX's bg color is set in but->col. */ - UI_GetThemeColorType4ubv(TH_INFO_WARNING, SPACE_INFO, but->col); - - if (!warning_message.is_empty()) { - /* Background for the rest of the message. */ - but = uiDefBut(block, - UI_BTYPE_ROUNDBOX, - 0, - "", - UI_UNIT_X + (6 * UI_SCALE_FAC), - 0, - UI_UNIT_X + width, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - ""); - - /* Use icon background at low opacity to highlight, but still contrasting with area TH_TEXT. */ - UI_GetThemeColorType4ubv(TH_INFO_WARNING, SPACE_INFO, but->col); - but->col[3] = 64; - } - - UI_block_align_end(block); - UI_block_emboss_set(block, UI_EMBOSS_NONE); - - /* The warning icon itself. */ - but = uiDefIconBut(block, - UI_BTYPE_BUT, - 0, - ICON_ERROR, - int(3 * UI_SCALE_FAC), - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - nullptr); - UI_but_func_tooltip_set(but, ui_template_status_tooltip, nullptr, nullptr); - UI_GetThemeColorType4ubv(TH_INFO_WARNING_TEXT, SPACE_INFO, but->col); - but->col[3] = 255; /* This theme color is RBG only, so have to set alpha here. */ - - /* The warning message, if any. */ - if (!warning_message.is_empty()) { - but = uiDefBut(block, - UI_BTYPE_BUT, - 0, - warning_message.c_str(), - UI_UNIT_X, - 0, - short(width + UI_UNIT_X), - UI_UNIT_Y, - nullptr, - 0.0f, - 0.0f, - nullptr); - UI_but_func_tooltip_set(but, ui_template_status_tooltip, nullptr, nullptr); - } - - UI_block_emboss_set(block, previous_emboss); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Keymap Template - * \{ */ - -static void keymap_item_modified(bContext * /*C*/, void *kmi_p, void * /*unused*/) -{ - wmKeyMapItem *kmi = (wmKeyMapItem *)kmi_p; - WM_keyconfig_update_tag(nullptr, kmi); - U.runtime.is_dirty = true; -} - -static void template_keymap_item_properties(uiLayout *layout, const char *title, PointerRNA *ptr) -{ - uiItemS(layout); - - if (title) { - uiItemL(layout, title, ICON_NONE); - } - - uiLayout *flow = uiLayoutColumnFlow(layout, 2, false); - - RNA_STRUCT_BEGIN_SKIP_RNA_TYPE (ptr, prop) { - const bool is_set = RNA_property_is_set(ptr, prop); - uiBut *but; - - /* recurse for nested properties */ - if (RNA_property_type(prop) == PROP_POINTER) { - PointerRNA propptr = RNA_property_pointer_get(ptr, prop); - - if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) { - const char *name = RNA_property_ui_name(prop); - template_keymap_item_properties(layout, name, &propptr); - continue; - } - } - - uiLayout *box = uiLayoutBox(flow); - uiLayoutSetActive(box, is_set); - uiLayout *row = uiLayoutRow(box, false); - - /* property value */ - uiItemFullR(row, ptr, prop, -1, 0, UI_ITEM_NONE, std::nullopt, ICON_NONE); - - if (is_set) { - /* unset operator */ - uiBlock *block = uiLayoutGetBlock(row); - UI_block_emboss_set(block, UI_EMBOSS_NONE); - but = uiDefIconButO(block, - UI_BTYPE_BUT, - "UI_OT_unset_property_button", - WM_OP_EXEC_DEFAULT, - ICON_X, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - nullptr); - but->rnapoin = *ptr; - but->rnaprop = prop; - UI_block_emboss_set(block, UI_EMBOSS); - } - } - RNA_STRUCT_END; -} - -void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr) -{ - PointerRNA propptr = RNA_pointer_get(ptr, "properties"); - - if (propptr.data) { - uiBut *but = static_cast(uiLayoutGetBlock(layout)->buttons.last); - - WM_operator_properties_sanitize(&propptr, false); - template_keymap_item_properties(layout, nullptr, &propptr); - - /* attach callbacks to compensate for missing properties update, - * we don't know which keymap (item) is being modified there */ - for (; but; but = but->next) { - /* operator buttons may store props for use (file selector, #36492) */ - if (but->rnaprop) { - UI_but_func_set(but, keymap_item_modified, ptr->data, nullptr); - - /* Otherwise the keymap will be re-generated which we're trying to edit, - * see: #47685 */ - UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY); - } - } - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Event Icon Template - * \{ */ - -static const wmKeyMapItem *keymap_item_from_enum_item(const wmKeyMap *keymap, - const EnumPropertyItem *item) -{ - if (item == nullptr) { - return nullptr; - } - - for (wmKeyMapItem *kmi = static_cast(keymap->items.first); kmi; kmi = kmi->next) - { - if (kmi->propvalue == item->value) { - return kmi; - } - } - - return nullptr; -} - -static bool keymap_item_can_collapse(const wmKeyMapItem *kmi_a, const wmKeyMapItem *kmi_b) -{ - return (kmi_a->shift == kmi_b->shift && kmi_a->ctrl == kmi_b->ctrl && kmi_a->alt == kmi_b->alt && - kmi_a->oskey == kmi_b->oskey); -} - -int uiTemplateStatusBarModalItem(uiLayout *layout, - const wmKeyMap *keymap, - const EnumPropertyItem *item) -{ - const wmKeyMapItem *kmi = keymap_item_from_enum_item(keymap, item); - if (kmi == nullptr) { - return 0; - } - - if (kmi->val == KM_RELEASE) { - /* Assume release events just disable something which was toggled on. */ - return 1; - } - - /* Try to merge some known XYZ items to save horizontal space. */ - const EnumPropertyItem *item_y = (item[1].identifier) ? item + 1 : nullptr; - const EnumPropertyItem *item_z = (item_y && item[2].identifier) ? item + 2 : nullptr; - const wmKeyMapItem *kmi_y = keymap_item_from_enum_item(keymap, item_y); - const wmKeyMapItem *kmi_z = keymap_item_from_enum_item(keymap, item_z); - - if (kmi_y && kmi_z && keymap_item_can_collapse(kmi, kmi_y) && - keymap_item_can_collapse(kmi_y, kmi_z)) - { - const char *xyz_label = nullptr; - - if (STREQ(item->identifier, "AXIS_X") && STREQ(item_y->identifier, "AXIS_Y") && - STREQ(item_z->identifier, "AXIS_Z")) - { - xyz_label = IFACE_("Axis"); - } - else if (STREQ(item->identifier, "PLANE_X") && STREQ(item_y->identifier, "PLANE_Y") && - STREQ(item_z->identifier, "PLANE_Z")) - { - xyz_label = IFACE_("Plane"); - } - - if (xyz_label) { - int icon_mod[4] = {0}; -#ifdef WITH_HEADLESS - int icon = 0; -#else - int icon = UI_icon_from_keymap_item(kmi, icon_mod); -#endif - for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) { - uiItemL(layout, "", icon_mod[j]); - } - uiItemL(layout, "", icon); - -#ifndef WITH_HEADLESS - icon = UI_icon_from_keymap_item(kmi_y, icon_mod); -#endif - uiItemL(layout, "", icon); - -#ifndef WITH_HEADLESS - icon = UI_icon_from_keymap_item(kmi_z, icon_mod); -#endif - uiItemL(layout, "", icon); - uiItemL(layout, xyz_label, ICON_NONE); - uiItemS_ex(layout, 0.7f); - return 3; - } - } - - /* Single item without merging. */ - return uiTemplateEventFromKeymapItem(layout, item->name, kmi, false) ? 1 : 0; -} - -bool uiTemplateEventFromKeymapItem(uiLayout *layout, - const StringRefNull text, - const wmKeyMapItem *kmi, - bool text_fallback) -{ - bool ok = false; - - int icon_mod[4]; -#ifdef WITH_HEADLESS - int icon = 0; -#else - const int icon = UI_icon_from_keymap_item(kmi, icon_mod); -#endif - if (icon != 0) { - for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) { - uiItemL(layout, "", icon_mod[j]); - const float offset = ui_event_icon_offset(icon_mod[j]); - if (offset != 0.0f) { - uiItemS_ex(layout, offset); - } - } - - /* Icon and text separately is closer together with aligned layout. */ - - uiItemL(layout, "", icon); - if (icon >= ICON_MOUSE_LMB && icon <= ICON_MOUSE_MMB_SCROLL) { - /* Negative space after narrow mice icons. */ - uiItemS_ex(layout, -0.5f); - } - - const float offset = ui_event_icon_offset(icon); - if (offset != 0.0f) { - uiItemS_ex(layout, offset); - } - - uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text.c_str()), ICON_NONE); - uiItemS_ex(layout, 0.7f); - ok = true; - } - else if (text_fallback) { - const char *event_text = WM_key_event_string(kmi->type, true); - uiItemL(layout, event_text, ICON_NONE); - uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text.c_str()), ICON_NONE); - uiItemS_ex(layout, 0.5f); - ok = true; - } - return ok; -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Color Management Template - * \{ */ - -void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop) { - printf("%s: property not found: %s.%s\n", - __func__, - RNA_struct_identifier(ptr->type), - propname.c_str()); - return; - } - - PointerRNA colorspace_settings_ptr = RNA_property_pointer_get(ptr, prop); - - uiItemR( - layout, &colorspace_settings_ptr, "name", UI_ITEM_NONE, IFACE_("Color Space"), ICON_NONE); -} - -void uiTemplateColormanagedViewSettings(uiLayout *layout, - bContext * /*C*/, - PointerRNA *ptr, - const StringRefNull propname) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop) { - printf("%s: property not found: %s.%s\n", - __func__, - RNA_struct_identifier(ptr->type), - propname.c_str()); - return; - } - - PointerRNA view_transform_ptr = RNA_property_pointer_get(ptr, prop); - ColorManagedViewSettings *view_settings = static_cast( - view_transform_ptr.data); - - uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, &view_transform_ptr, "view_transform", UI_ITEM_NONE, IFACE_("View"), ICON_NONE); - uiItemR(col, &view_transform_ptr, "look", UI_ITEM_NONE, IFACE_("Look"), ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiItemR(col, &view_transform_ptr, "exposure", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiItemR(col, &view_transform_ptr, "gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiItemR(col, &view_transform_ptr, "use_curve_mapping", UI_ITEM_NONE, std::nullopt, ICON_NONE); - if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) { - uiTemplateCurveMapping( - col, &view_transform_ptr, "curve_mapping", 'c', true, false, false, false); - } - - col = uiLayoutColumn(layout, false); - uiItemR(col, &view_transform_ptr, "use_white_balance", UI_ITEM_NONE, std::nullopt, ICON_NONE); - if (view_settings->flag & COLORMANAGE_VIEW_USE_WHITE_BALANCE) { - uiItemR(col, - &view_transform_ptr, - "white_balance_temperature", - UI_ITEM_NONE, - std::nullopt, - ICON_NONE); - uiItemR(col, &view_transform_ptr, "white_balance_tint", UI_ITEM_NONE, std::nullopt, ICON_NONE); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Component Menu - * \{ */ - -struct ComponentMenuArgs { - PointerRNA ptr; - char propname[64]; /* XXX arbitrary */ -}; -/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ -static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v) -{ - ComponentMenuArgs *args = (ComponentMenuArgs *)args_v; - - uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN); - - uiLayout *layout = uiLayoutColumn(UI_block_layout(block, - UI_LAYOUT_VERTICAL, - UI_LAYOUT_PANEL, - 0, - 0, - UI_UNIT_X * 6, - UI_UNIT_Y, - 0, - UI_style_get()), - false); - - uiItemR(layout, &args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE); - - UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); - UI_block_direction_set(block, UI_DIR_DOWN); - - return block; -} -void uiTemplateComponentMenu(uiLayout *layout, - PointerRNA *ptr, - const StringRefNull propname, - const StringRef name) -{ - ComponentMenuArgs *args = MEM_new(__func__); - - args->ptr = *ptr; - STRNCPY(args->propname, propname.c_str()); - - uiBlock *block = uiLayoutGetBlock(layout); - UI_block_align_begin(block); - - uiBut *but = uiDefBlockButN(block, - component_menu, - args, - name, - 0, - 0, - UI_UNIT_X * 6, - UI_UNIT_Y, - "", - but_func_argN_free, - but_func_argN_copy); - /* set rna directly, uiDefBlockButN doesn't do this */ - but->rnapoin = *ptr; - but->rnaprop = RNA_struct_find_property(ptr, propname.c_str()); - but->rnaindex = 0; - - UI_block_align_end(block); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Node Socket Icon Template - * \{ */ - -void uiTemplateNodeSocket(uiLayout *layout, bContext * /*C*/, const float color[4]) -{ - uiBlock *block = uiLayoutGetBlock(layout); - UI_block_align_begin(block); - - /* XXX using explicit socket colors is not quite ideal. - * Eventually it should be possible to use theme colors for this purpose, - * but this requires a better design for extendable color palettes in user preferences. */ - uiBut *but = uiDefBut( - block, UI_BTYPE_NODE_SOCKET, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, nullptr, 0, 0, ""); - rgba_float_to_uchar(but->col, color); + /* XXX using explicit socket colors is not quite ideal. + * Eventually it should be possible to use theme colors for this purpose, + * but this requires a better design for extendable color palettes in user preferences. */ + uiBut *but = uiDefBut( + block, UI_BTYPE_NODE_SOCKET, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, nullptr, 0, 0, ""); + rgba_float_to_uchar(but->col, color); UI_block_align_end(block); } -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Cache File Template - * \{ */ - -void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) -{ - if (RNA_pointer_is_null(fileptr)) { - return; - } - - /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ - uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); - - uiItemR(layout, fileptr, "velocity_name", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiItemR(layout, fileptr, "velocity_unit", UI_ITEM_NONE, std::nullopt, ICON_NONE); -} - -void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerRNA *fileptr) -{ - if (RNA_pointer_is_null(fileptr)) { - return; - } - - /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ - uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); - - uiLayout *row, *sub; - - /* Only enable render procedural option if the active engine supports it. */ - const RenderEngineType *engine_type = CTX_data_engine_type(C); - - Scene *scene = CTX_data_scene(C); - const bool engine_supports_procedural = RE_engine_supports_alembic_procedural(engine_type, - scene); - CacheFile *cache_file = static_cast(fileptr->data); - CacheFile *cache_file_eval = reinterpret_cast( - DEG_get_evaluated_id(CTX_data_depsgraph_pointer(C), &cache_file->id)); - bool is_alembic = cache_file_eval->type == CACHEFILE_TYPE_ALEMBIC; - - if (!is_alembic) { - row = uiLayoutRow(layout, false); - uiItemL(row, RPT_("Only Alembic Procedurals supported"), ICON_INFO); - } - else if (!engine_supports_procedural) { - row = uiLayoutRow(layout, false); - /* For Cycles, verify that experimental features are enabled. */ - if (BKE_scene_uses_cycles(scene) && !BKE_scene_uses_cycles_experimental_features(scene)) { - uiItemL( - row, - RPT_( - "The Cycles Alembic Procedural is only available with the experimental feature set"), - ICON_INFO); - } - else { - uiItemL( - row, RPT_("The active render engine does not have an Alembic Procedural"), ICON_INFO); - } - } - - row = uiLayoutRow(layout, false); - uiLayoutSetActive(row, is_alembic && engine_supports_procedural); - uiItemR(row, fileptr, "use_render_procedural", UI_ITEM_NONE, std::nullopt, ICON_NONE); - - const bool use_render_procedural = RNA_boolean_get(fileptr, "use_render_procedural"); - const bool use_prefetch = RNA_boolean_get(fileptr, "use_prefetch"); - - row = uiLayoutRow(layout, false); - uiLayoutSetEnabled(row, use_render_procedural); - uiItemR(row, fileptr, "use_prefetch", UI_ITEM_NONE, std::nullopt, ICON_NONE); - - sub = uiLayoutRow(layout, false); - uiLayoutSetEnabled(sub, use_prefetch && use_render_procedural); - uiItemR(sub, fileptr, "prefetch_cache_size", UI_ITEM_NONE, std::nullopt, ICON_NONE); -} - -void uiTemplateCacheFileTimeSettings(uiLayout *layout, PointerRNA *fileptr) -{ - if (RNA_pointer_is_null(fileptr)) { - return; - } - - /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ - uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); - - uiLayout *row, *sub, *subsub; - - row = uiLayoutRow(layout, false); - uiItemR(row, fileptr, "is_sequence", UI_ITEM_NONE, std::nullopt, ICON_NONE); - - row = uiLayoutRowWithHeading(layout, true, IFACE_("Override Frame")); - sub = uiLayoutRow(row, true); - uiLayoutSetPropDecorate(sub, false); - uiItemR(sub, fileptr, "override_frame", UI_ITEM_NONE, "", ICON_NONE); - subsub = uiLayoutRow(sub, true); - uiLayoutSetActive(subsub, RNA_boolean_get(fileptr, "override_frame")); - uiItemR(subsub, fileptr, "frame", UI_ITEM_NONE, "", ICON_NONE); - uiItemDecoratorR(row, fileptr, "frame", 0); - - row = uiLayoutRow(layout, false); - uiItemR(row, fileptr, "frame_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiLayoutSetActive(row, !RNA_boolean_get(fileptr, "is_sequence")); -} - -static void cache_file_layer_item(uiList * /*ui_list*/, - const bContext * /*C*/, - uiLayout *layout, - PointerRNA * /*dataptr*/, - PointerRNA *itemptr, - int /*icon*/, - PointerRNA * /*active_dataptr*/, - const char * /*active_propname*/, - int /*index*/, - int /*flt_flag*/) -{ - uiLayout *row = uiLayoutRow(layout, true); - uiItemR(row, itemptr, "hide_layer", UI_ITEM_R_NO_BG, "", ICON_NONE); - uiItemR(row, itemptr, "filepath", UI_ITEM_R_NO_BG, "", ICON_NONE); -} - -uiListType *UI_UL_cache_file_layers() -{ - uiListType *list_type = (uiListType *)MEM_callocN(sizeof(*list_type), __func__); - - STRNCPY(list_type->idname, "UI_UL_cache_file_layers"); - list_type->draw_item = cache_file_layer_item; - - return list_type; -} - -void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA *fileptr) -{ - if (RNA_pointer_is_null(fileptr)) { - return; - } - - /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ - uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); - - uiLayout *row = uiLayoutRow(layout, false); - uiLayout *col = uiLayoutColumn(row, true); - - uiTemplateList(col, - (bContext *)C, - "UI_UL_cache_file_layers", - "cache_file_layers", - fileptr, - "layers", - fileptr, - "active_index", - "", - 1, - 5, - UILST_LAYOUT_DEFAULT, - 1, - UI_TEMPLATE_LIST_FLAG_NONE); - - col = uiLayoutColumn(row, true); - uiItemO(col, "", ICON_ADD, "cachefile.layer_add"); - uiItemO(col, "", ICON_REMOVE, "cachefile.layer_remove"); - - CacheFile *file = static_cast(fileptr->data); - if (BLI_listbase_count(&file->layers) > 1) { - uiItemS_ex(col, 1.0f); - uiItemO(col, "", ICON_TRIA_UP, "cachefile.layer_move"); - uiItemO(col, "", ICON_TRIA_DOWN, "cachefile.layer_move"); - } -} - -bool uiTemplateCacheFilePointer(PointerRNA *ptr, - const StringRefNull propname, - PointerRNA *r_file_ptr) -{ - PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str()); - - if (!prop) { - printf("%s: property not found: %s.%s\n", - __func__, - RNA_struct_identifier(ptr->type), - propname.c_str()); - return false; - } - - if (RNA_property_type(prop) != PROP_POINTER) { - printf("%s: expected pointer property for %s.%s\n", - __func__, - RNA_struct_identifier(ptr->type), - propname.c_str()); - return false; - } - - *r_file_ptr = RNA_property_pointer_get(ptr, prop); - return true; -} - -void uiTemplateCacheFile(uiLayout *layout, - const bContext *C, - PointerRNA *ptr, - const StringRefNull propname) -{ - if (!ptr->data) { - return; - } - - PointerRNA fileptr; - if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) { - return; - } - - CacheFile *file = static_cast(fileptr.data); - - uiLayoutSetContextPointer(layout, "edit_cachefile", &fileptr); - - uiTemplateID(layout, C, ptr, propname, nullptr, "CACHEFILE_OT_open", nullptr); - - if (!file) { - return; - } - - SpaceProperties *sbuts = CTX_wm_space_properties(C); - - uiLayout *row, *sub; - - uiLayoutSetPropSep(layout, true); - - row = uiLayoutRow(layout, true); - uiItemR(row, &fileptr, "filepath", UI_ITEM_NONE, std::nullopt, ICON_NONE); - sub = uiLayoutRow(row, true); - uiItemO(sub, "", ICON_FILE_REFRESH, "cachefile.reload"); - - if (sbuts->mainb == BCONTEXT_CONSTRAINT) { - row = uiLayoutRow(layout, false); - uiItemR(row, &fileptr, "scale", UI_ITEM_NONE, IFACE_("Manual Scale"), ICON_NONE); - } - - /* TODO: unused for now, so no need to expose. */ -#if 0 - row = uiLayoutRow(layout, false); - uiItemR(row, &fileptr, "forward_axis", UI_ITEM_NONE, IFACE_("Forward Axis"), ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, &fileptr, "up_axis", UI_ITEM_NONE, IFACE_("Up Axis"), ICON_NONE); -#endif -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Recent Files Template - * \{ */ -static void uiTemplateRecentFiles_tooltip_func(bContext & /*C*/, uiTooltipData &tip, void *argN) -{ - char *path = (char *)argN; - - /* File name and path. */ - char dirname[FILE_MAX]; - char filename[FILE_MAX]; - BLI_path_split_dir_file(path, dirname, sizeof(dirname), filename, sizeof(filename)); - UI_tooltip_text_field_add(tip, filename, {}, UI_TIP_STYLE_HEADER, UI_TIP_LC_NORMAL); - UI_tooltip_text_field_add(tip, dirname, {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); - - UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); - - if (!BLI_exists(path)) { - UI_tooltip_text_field_add(tip, N_("File Not Found"), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_ALERT); - return; - } - - /* Blender version. */ - char version_str[128] = {0}; - /* Load the thumbnail from cache if existing, but don't create if not. */ - ImBuf *thumb = IMB_thumb_read(path, THB_LARGE); - if (thumb) { - /* Look for version in existing thumbnail if available. */ - IMB_metadata_get_field( - thumb->metadata, "Thumb::Blender::Version", version_str, sizeof(version_str)); - } - - eFileAttributes attributes = BLI_file_attributes(path); - if (!version_str[0] && !(attributes & FILE_ATTR_OFFLINE)) { - /* Load Blender version directly from the file. */ - short version = BLO_version_from_file(path); - if (version != 0) { - SNPRINTF(version_str, "%d.%01d", version / 100, version % 100); - } - } - - if (version_str[0]) { - UI_tooltip_text_field_add( - tip, fmt::format("Blender {}", version_str), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); - UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); - } - - BLI_stat_t status; - if (BLI_stat(path, &status) != -1) { - char date_str[FILELIST_DIRENTRY_DATE_LEN], time_st[FILELIST_DIRENTRY_TIME_LEN]; - bool is_today, is_yesterday; - std::string day_string; - BLI_filelist_entry_datetime_to_string( - nullptr, int64_t(status.st_mtime), false, time_st, date_str, &is_today, &is_yesterday); - if (is_today || is_yesterday) { - day_string = (is_today ? N_("Today") : N_("Yesterday")) + std::string(" "); - } - UI_tooltip_text_field_add(tip, - fmt::format("{}: {}{}{}", - N_("Modified"), - day_string, - (is_today || is_yesterday) ? "" : date_str, - (is_today || is_yesterday) ? time_st : ""), - {}, - UI_TIP_STYLE_NORMAL, - UI_TIP_LC_NORMAL); - - if (status.st_size > 0) { - char size[16]; - BLI_filelist_entry_size_to_string(nullptr, status.st_size, false, size); - UI_tooltip_text_field_add( - tip, fmt::format("{}: {}", N_("Size"), size), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_NORMAL); - } - } - - if (!thumb) { - /* try to load from the blend file itself. */ - BlendThumbnail *data = BLO_thumbnail_from_file(path); - thumb = BKE_main_thumbnail_to_imbuf(nullptr, data); - if (data) { - MEM_freeN(data); - } - } - - if (thumb) { - UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); - UI_tooltip_text_field_add(tip, {}, {}, UI_TIP_STYLE_SPACER, UI_TIP_LC_NORMAL); - - uiTooltipImage image_data; - float scale = (72.0f * UI_SCALE_FAC) / float(std::max(thumb->x, thumb->y)); - image_data.ibuf = thumb; - image_data.width = short(float(thumb->x) * scale); - image_data.height = short(float(thumb->y) * scale); - image_data.border = true; - image_data.background = uiTooltipImageBackground::Checkerboard_Themed; - image_data.premultiplied = true; - UI_tooltip_image_field_add(tip, image_data); - IMB_freeImBuf(thumb); - } -} - -int uiTemplateRecentFiles(uiLayout *layout, int rows) -{ - int i = 0; - LISTBASE_FOREACH_INDEX (RecentFile *, recent, &G.recent_files, i) { - if (i >= rows) { - break; - } - - const char *filename = BLI_path_basename(recent->filepath); - PointerRNA ptr; - uiItemFullO(layout, - "WM_OT_open_mainfile", - filename, - BKE_blendfile_extension_check(filename) ? ICON_FILE_BLEND : ICON_FILE_BACKUP, - nullptr, - WM_OP_INVOKE_DEFAULT, - UI_ITEM_NONE, - &ptr); - RNA_string_set(&ptr, "filepath", recent->filepath); - RNA_boolean_set(&ptr, "display_file_selector", false); - - uiBlock *block = uiLayoutGetBlock(layout); - uiBut *but = ui_but_last(block); - UI_but_func_tooltip_custom_set( - but, uiTemplateRecentFiles_tooltip_func, BLI_strdup(recent->filepath), MEM_freeN); - } - - return i; -} - -/** \} */ - /* -------------------------------------------------------------------- */ /** \name FileSelectParams Path Button Template * \{ */ diff --git a/source/blender/editors/interface/templates/interface_templates_intern.hh b/source/blender/editors/interface/templates/interface_templates_intern.hh new file mode 100644 index 000000000000..615b6ae16bdc --- /dev/null +++ b/source/blender/editors/interface/templates/interface_templates_intern.hh @@ -0,0 +1,72 @@ +/* SPDX-FileCopyrightText: 2023 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup edinterface + * + * Share between `interface/templates/` files. + */ + +#pragma once + +#include "MEM_guardedalloc.h" + +#include "RNA_types.hh" +#include "UI_interface.hh" + +struct bContext; + +#define CURVE_ZOOM_MAX (1.0f / 25.0f) +#define ERROR_LIBDATA_MESSAGE N_("Can't edit external library data") + +/* Defines for templateID/TemplateSearch. */ +#define TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH (UI_UNIT_X * 4) +#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y + +struct RNAUpdateCb { + PointerRNA ptr; + PropertyRNA *prop; +}; + +static inline void rna_update_cb(bContext &C, const RNAUpdateCb &cb) +{ + /* we call update here on the pointer property, this way the + * owner of the curve mapping can still define its own update + * and notifier, even if the CurveMapping struct is shared. */ + RNA_property_update(&C, &const_cast(cb.ptr), cb.prop); +} + +static inline void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/) +{ + RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb; + rna_update_cb(*C, *cb); +} + +/* `interface_template.cc` */ +int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop); +int template_search_textbut_height(); +void template_add_button_search_menu(const bContext *C, + uiLayout *layout, + uiBlock *block, + PointerRNA *ptr, + PropertyRNA *prop, + uiBlockCreateFunc block_func, + void *block_argN, + const char *const tip, + const bool use_previews, + const bool editable, + const bool live_icon, + uiButArgNFree func_argN_free_fn = MEM_freeN, + uiButArgNCopy func_argN_copy_fn = MEM_dupallocN); + +uiBlock *template_common_search_menu(const bContext *C, + ARegion *region, + uiButSearchUpdateFn search_update_fn, + void *search_arg, + uiButHandleFunc search_exec_fn, + void *active_item, + uiButSearchTooltipFn item_tooltip_fn, + const int preview_rows, + const int preview_cols, + float scale); diff --git a/source/blender/editors/interface/views/tree_view.cc b/source/blender/editors/interface/views/tree_view.cc index b00fcd5ea72b..b9e7e13e5e46 100644 --- a/source/blender/editors/interface/views/tree_view.cc +++ b/source/blender/editors/interface/views/tree_view.cc @@ -198,11 +198,14 @@ void AbstractTreeView::get_hierarchy_lines(const ARegion ®ion, const int descendant_count = count_visible_descendants(*item); const int first_descendant_index = item_index + 1; - const int last_descendant_index = first_descendant_index + descendant_count; + const int last_descendant_index = item_index + descendant_count; { const bool line_ends_above_visible = last_descendant_index < scroll_ofs; if (line_ends_above_visible) { + /* We won't recurse into the child items even though they are present (just scrolled out of + * view). Still update the index to be the first following item. */ + visible_item_index = last_descendant_index + 1; continue; } @@ -218,7 +221,7 @@ void AbstractTreeView::get_hierarchy_lines(const ARegion ®ion, (0.5f * UI_ICON_SIZE) + U.pixelsize + UI_SCALE_FAC) / aspect); const int ymax = std::max(0, first_descendant_index - scroll_ofs) * padded_item_height(); - const int ymin = std::min(max_visible_row_count, last_descendant_index - scroll_ofs) * + const int ymin = std::min(max_visible_row_count, last_descendant_index + 1 - scroll_ofs) * padded_item_height(); lines.append(std::make_pair(int2(x, ymax), int2(x, ymin))); diff --git a/source/blender/editors/io/io_drop_import_file.hh b/source/blender/editors/io/io_drop_import_file.hh index 5c5f6e66af0f..5f183f690b39 100644 --- a/source/blender/editors/io/io_drop_import_file.hh +++ b/source/blender/editors/io/io_drop_import_file.hh @@ -4,5 +4,7 @@ #pragma once +struct wmOperatorType; + void WM_OT_drop_import_file(wmOperatorType *ot); void ED_dropbox_drop_import_file(); diff --git a/source/blender/editors/lattice/lattice_intern.hh b/source/blender/editors/lattice/lattice_intern.hh index 47cd27fb24ef..712e56ccea62 100644 --- a/source/blender/editors/lattice/lattice_intern.hh +++ b/source/blender/editors/lattice/lattice_intern.hh @@ -8,6 +8,8 @@ #pragma once +struct wmOperatorType; + /* `editlattice_select.cc` */ void LATTICE_OT_select_all(wmOperatorType *ot); diff --git a/source/blender/editors/mask/mask_intern.hh b/source/blender/editors/mask/mask_intern.hh index dbe6d7852019..706652879f5e 100644 --- a/source/blender/editors/mask/mask_intern.hh +++ b/source/blender/editors/mask/mask_intern.hh @@ -8,9 +8,15 @@ #pragma once +#include "BKE_mask.h" + #include "ED_clip.hh" struct Mask; +struct MaskLayer; +struct MaskSpline; +struct MaskSplinePoint; +struct MaskSplinePointUW; struct bContext; struct wmOperatorType; diff --git a/source/blender/editors/mesh/editmesh_bevel.cc b/source/blender/editors/mesh/editmesh_bevel.cc index ae0f6dc270d8..f7d83c1ca7b6 100644 --- a/source/blender/editors/mesh/editmesh_bevel.cc +++ b/source/blender/editors/mesh/editmesh_bevel.cc @@ -133,13 +133,8 @@ static void edbm_bevel_update_status_text(bContext *C, wmOperator *op) } else { double offset_val = double(RNA_float_get(op->ptr, "offset")); - BKE_unit_value_as_string(offset_str, - NUM_STR_REP_LEN, - offset_val * sce->unit.scale_length, - 3, - B_UNIT_LENGTH, - &sce->unit, - true); + BKE_unit_value_as_string_scaled( + offset_str, NUM_STR_REP_LEN, offset_val, 3, B_UNIT_LENGTH, sce->unit, true); } PropertyRNA *prop; diff --git a/source/blender/editors/mesh/editmesh_inset.cc b/source/blender/editors/mesh/editmesh_inset.cc index e16c77db4be2..330d7f5d72be 100644 --- a/source/blender/editors/mesh/editmesh_inset.cc +++ b/source/blender/editors/mesh/editmesh_inset.cc @@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) char msg[UI_MAX_DRAW_STR]; char flts_str[NUM_STR_REP_LEN * 2]; if (hasNumInput(&opdata->num_input)) { - outputNumInput(&opdata->num_input, flts_str, &sce->unit); + outputNumInput(&opdata->num_input, flts_str, sce->unit); } else { BKE_unit_value_as_string(flts_str, @@ -88,14 +88,14 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) RNA_float_get(op->ptr, "thickness"), 4, B_UNIT_LENGTH, - &sce->unit, + sce->unit, true); BKE_unit_value_as_string(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, RNA_float_get(op->ptr, "depth"), 4, B_UNIT_LENGTH, - &sce->unit, + sce->unit, true); } SNPRINTF(msg, IFACE_("Thickness: %s, Depth: %s"), flts_str, flts_str + NUM_STR_REP_LEN); diff --git a/source/blender/editors/mesh/editmesh_knife.cc b/source/blender/editors/mesh/editmesh_knife.cc index c567109a608e..7dfbe41cc10f 100644 --- a/source/blender/editors/mesh/editmesh_knife.cc +++ b/source/blender/editors/mesh/editmesh_knife.cc @@ -509,18 +509,13 @@ static void knifetool_draw_visible_distances(const KnifeTool_OpData *kcd) /* Calculate distance and convert to string. */ const float cut_len = len_v3v3(kcd->prev.cage, kcd->curr.cage); - const UnitSettings *unit = &kcd->scene->unit; - if (unit->system == USER_UNIT_NONE) { + const UnitSettings &unit = kcd->scene->unit; + if (unit.system == USER_UNIT_NONE) { SNPRINTF(numstr, "%.*f", distance_precision, cut_len); } else { - BKE_unit_value_as_string(numstr, - sizeof(numstr), - double(cut_len * unit->scale_length), - distance_precision, - B_UNIT_LENGTH, - unit, - false); + BKE_unit_value_as_string_scaled( + numstr, sizeof(numstr), cut_len, distance_precision, B_UNIT_LENGTH, unit, false); } BLF_enable(blf_mono_font, BLF_ROTATION); @@ -645,8 +640,8 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, float numstr_size[2]; float posit[2]; - const UnitSettings *unit = &kcd->scene->unit; - if (unit->system == USER_UNIT_NONE) { + const UnitSettings &unit = kcd->scene->unit; + if (unit.system == USER_UNIT_NONE) { SNPRINTF(numstr, "%.*f" BLI_STR_UTF8_DEGREE_SIGN, angle_precision, RAD2DEGF(angle)); } else { diff --git a/source/blender/editors/mesh/editmesh_loopcut.cc b/source/blender/editors/mesh/editmesh_loopcut.cc index 7b5fd4c56926..eb4fe446da39 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.cc +++ b/source/blender/editors/mesh/editmesh_loopcut.cc @@ -460,7 +460,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) char buf[UI_MAX_DRAW_STR]; char str_rep[NUM_STR_REP_LEN * 2]; if (hasNumInput(&lcd->num)) { - outputNumInput(&lcd->num, str_rep, &scene->unit); + outputNumInput(&lcd->num, str_rep, scene->unit); } else { BLI_snprintf(str_rep, NUM_STR_REP_LEN, "%d", int(lcd->cuts)); @@ -692,7 +692,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) char buf[UI_MAX_DRAW_STR]; char str_rep[NUM_STR_REP_LEN * 2]; if (hasNumInput(&lcd->num)) { - outputNumInput(&lcd->num, str_rep, &sce->unit); + outputNumInput(&lcd->num, str_rep, sce->unit); } else { BLI_snprintf(str_rep, NUM_STR_REP_LEN, "%d", int(lcd->cuts)); diff --git a/source/blender/editors/mesh/editmesh_select_similar.cc b/source/blender/editors/mesh/editmesh_select_similar.cc index 6cf89e9dab9c..e0f4183f53b5 100644 --- a/source/blender/editors/mesh/editmesh_select_similar.cc +++ b/source/blender/editors/mesh/editmesh_select_similar.cc @@ -1316,7 +1316,7 @@ static const EnumPropertyItem *select_similar_type_itemf(bContext *C, #ifdef WITH_FREESTYLE const int a_end = SIMFACE_FREESTYLE; #else - const int a_end = SIMFACE_MATERIAL; + const int a_end = SIMFACE_SMOOTH; #endif for (a = SIMFACE_MATERIAL; a <= a_end; a++) { RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a); @@ -1391,7 +1391,7 @@ void MESH_OT_select_similar(wmOperatorType *ot) RNA_def_enum(ot->srna, "compare", prop_similar_compare_types, SIM_CMP_EQ, "Compare", ""); - prop = RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f); + prop = RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 100000.0f, "Threshold", "", 0.0f, 1.0f); /* Very small values are needed sometimes, similar area of small faces for e.g: see #87823 */ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 5); } diff --git a/source/blender/editors/mesh/editmesh_undo.cc b/source/blender/editors/mesh/editmesh_undo.cc index bc531661e785..139051b9cc44 100644 --- a/source/blender/editors/mesh/editmesh_undo.cc +++ b/source/blender/editors/mesh/editmesh_undo.cc @@ -6,6 +6,7 @@ * \ingroup edmesh */ +#include #include #include "MEM_guardedalloc.h" @@ -22,6 +23,7 @@ #include "BLI_array_utils.h" #include "BLI_implicit_sharing.hh" #include "BLI_listbase.h" +#include "BLI_math_base.h" #include "BLI_string.h" #include "BLI_task.hh" #include "BLI_vector.hh" diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc index f36a1d8beb2a..eec2950bca0c 100644 --- a/source/blender/editors/mesh/meshtools.cc +++ b/source/blender/editors/mesh/meshtools.cc @@ -14,6 +14,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math_matrix.h" +#include "BLI_vector.hh" #include "BLI_virtual_array.hh" #include "DNA_key_types.h" @@ -88,15 +89,13 @@ static void join_mesh_single(Depsgraph *depsgraph, int faces_num, Key *key, Key *nkey, - Material **matar, - int *matmap, - int totcol, + blender::Vector &matar, int *vertofs, int *edgeofs, int *loopofs, int *polyofs) { - int a, b; + int a; Mesh *mesh = static_cast(ob_src->data); float3 *vert_positions = *vert_positions_pp; @@ -238,16 +237,34 @@ static void join_mesh_single(Depsgraph *depsgraph, } } + /* Make remapping for material indices. Assume at least one slot, + * that will be null if there are no actual slots. */ + const int totcol = std::max(ob_src->totcol, 1); + blender::Vector matmap(totcol); if (mesh->faces_num) { - if (matmap) { - /* make mapping for materials */ - for (a = 1; a <= ob_src->totcol; a++) { - Material *ma = BKE_object_material_get(ob_src, a); - - for (b = 0; b < totcol; b++) { - if (ma == matar[b]) { - matmap[a - 1] = b; - break; + for (a = 1; a <= totcol; a++) { + Material *ma = (a <= ob_src->totcol) ? BKE_object_material_get(ob_src, a) : nullptr; + + /* Try to reuse existing slot. */ + int b = 0; + for (; b < matar.size(); b++) { + if (ma == matar[b]) { + matmap[a - 1] = b; + break; + } + } + + if (b == matar.size()) { + if (matar.size() == MAXMAT) { + /* Reached max limit of materials, use first slot. */ + matmap[a - 1] = 0; + } + else { + /* Add new slot. */ + matmap[a - 1] = matar.size(); + matar.append(ma); + if (ma) { + id_us_plus(&ma->id); } } } @@ -261,13 +278,15 @@ static void join_mesh_single(Depsgraph *depsgraph, * material is the result of joining. */ int *material_indices = static_cast(CustomData_get_layer_named_for_write( face_data, CD_PROP_INT32, "material_index", faces_num)); - if (!material_indices && totcol > 1) { + if (!material_indices && matar.size() > 1) { material_indices = (int *)CustomData_add_layer_named( face_data, CD_PROP_INT32, CD_SET_DEFAULT, faces_num, "material_index"); } if (material_indices) { for (a = 0; a < mesh->faces_num; a++) { - material_indices[a + *polyofs] = matmap ? matmap[material_indices[a + *polyofs]] : 0; + /* Clamp invalid slots, matching #BKE_object_material_get_p. */ + const int mat_index = std::clamp(material_indices[a + *polyofs], 0, totcol - 1); + material_indices[a + *polyofs] = matmap[mat_index]; } } @@ -320,13 +339,13 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - Material **matar = nullptr, *ma; + Material *ma; Mesh *mesh; blender::int2 *edge = nullptr; Key *key, *nkey = nullptr; float imat[4][4]; - int a, b, totcol, totmat = 0, totedge = 0, totvert = 0; - int totloop = 0, faces_num = 0, vertofs, *matmap = nullptr; + int a, totedge = 0, totvert = 0; + int totloop = 0, faces_num = 0, vertofs; int i, haskey = 0, edgeofs, loopofs, polyofs; bool ok = false, join_parent = false; CustomData vert_data, edge_data, ldata, face_data; @@ -353,7 +372,6 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) totedge += mesh->edges_num; totloop += mesh->corners_num; faces_num += mesh->faces_num; - totmat += ob_iter->totcol; if (ob_iter == ob) { ok = true; @@ -403,16 +421,10 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* new material indices and material array */ - if (totmat) { - matar = static_cast(MEM_callocN(sizeof(*matar) * totmat, __func__)); - matmap = static_cast(MEM_callocN(sizeof(*matmap) * totmat, __func__)); - } - totcol = ob->totcol; - /* Active object materials in new main array, is nicer start! */ + blender::Vector matar; for (a = 0; a < ob->totcol; a++) { - matar[a] = BKE_object_material_get(ob, a + 1); + matar.append(BKE_object_material_get(ob, a + 1)); id_us_plus((ID *)matar[a]); /* increase id->us : will be lowered later */ } @@ -472,30 +484,6 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) mesh_join_offset_face_sets_ID(mesh, &face_set_id_offset); if (mesh->verts_num) { - /* Add this object's materials to the base one's if they don't exist already - * (but only if limits not exceeded yet) */ - if (totcol < MAXMAT) { - for (a = 1; a <= ob_iter->totcol; a++) { - ma = BKE_object_material_get(ob_iter, a); - - for (b = 0; b < totcol; b++) { - if (ma == matar[b]) { - break; - } - } - if (b == totcol) { - matar[b] = ma; - if (ma) { - id_us_plus(&ma->id); - } - totcol++; - } - if (totcol >= MAXMAT) { - break; - } - } - } - /* If this mesh has shape-keys, * check if destination mesh already has matching entries too. */ if (mesh->key && key) { @@ -597,8 +585,6 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) key, nkey, matar, - matmap, - totcol, &vertofs, &edgeofs, &loopofs, @@ -632,8 +618,6 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) key, nkey, matar, - matmap, - totcol, &vertofs, &edgeofs, &loopofs, @@ -685,11 +669,17 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op) MEM_SAFE_FREE(ob->matbits); MEM_SAFE_FREE(mesh->mat); + /* If the object had no slots, don't add an empty one. */ + if (ob->totcol == 0 && matar.size() == 1 && matar[0] == nullptr) { + matar.clear(); + } + + const int totcol = matar.size(); if (totcol) { - mesh->mat = matar; + mesh->mat = static_cast(MEM_callocN(sizeof(*mesh->mat) * totcol, __func__)); + std::copy_n(matar.data(), totcol, mesh->mat); ob->mat = static_cast(MEM_callocN(sizeof(*ob->mat) * totcol, __func__)); ob->matbits = static_cast(MEM_callocN(sizeof(*ob->matbits) * totcol, __func__)); - MEM_freeN(matmap); } ob->totcol = mesh->totcol = totcol; diff --git a/source/blender/editors/object/object_bake_api.cc b/source/blender/editors/object/object_bake_api.cc index 23a76b50a244..ec550c2fc2b8 100644 --- a/source/blender/editors/object/object_bake_api.cc +++ b/source/blender/editors/object/object_bake_api.cc @@ -1625,7 +1625,7 @@ static int bake(const BakeAPIRender *bkr, for (i = 0; i < tot_highpoly; i++) { ok = RE_bake_engine(re, depsgraph, - highpoly[i].ob, + highpoly[i].ob_eval, i, pixel_array_high, &targets, diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index c8f8b6dfadc0..724710a017f8 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -3802,7 +3802,7 @@ static int geometry_node_tree_copy_assign_exec(bContext *C, wmOperator * /*op*/) nmd->node_group = new_tree; id_us_min(&tree->id); - ED_node_tree_propagate_change(C, bmain, new_tree); + ED_node_tree_propagate_change(bmain, new_tree); DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index f83cf5f59f53..db682695ba17 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -319,14 +319,9 @@ static void voxel_size_edit_draw(const bContext *C, ARegion * /*region*/, void * char str[VOXEL_SIZE_EDIT_MAX_STR_LEN]; short strdrawlen = 0; Scene *scene = CTX_data_scene(C); - const UnitSettings *unit = &scene->unit; - BKE_unit_value_as_string(str, - VOXEL_SIZE_EDIT_MAX_STR_LEN, - double(cd->voxel_size * unit->scale_length), - -3, - B_UNIT_LENGTH, - unit, - true); + const UnitSettings &unit = scene->unit; + + BKE_unit_value_as_string_scaled(str, sizeof(str), cd->voxel_size, -3, B_UNIT_LENGTH, unit, true); strdrawlen = BLI_strlen_utf8(str); immUnbindProgram(); diff --git a/source/blender/editors/render/render_intern.hh b/source/blender/editors/render/render_intern.hh index 6c4353e3fd4d..b4d08ea82ebd 100644 --- a/source/blender/editors/render/render_intern.hh +++ b/source/blender/editors/render/render_intern.hh @@ -8,6 +8,7 @@ #pragma once +struct ReportList; struct ScrArea; struct bContext; struct wmOperatorType; diff --git a/source/blender/editors/render/render_shading.cc b/source/blender/editors/render/render_shading.cc index 1fe98894cf45..938776e5712d 100644 --- a/source/blender/editors/render/render_shading.cc +++ b/source/blender/editors/render/render_shading.cc @@ -1642,7 +1642,7 @@ static int render_view_add_exec(bContext *C, wmOperator * /*op*/) WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); BKE_ntree_update_tag_id_changed(bmain, &scene->id); - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); return OPERATOR_FINISHED; } @@ -1681,7 +1681,7 @@ static int render_view_remove_exec(bContext *C, wmOperator * /*op*/) WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); BKE_ntree_update_tag_id_changed(bmain, &scene->id); - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); return OPERATOR_FINISHED; } @@ -2835,7 +2835,7 @@ static int paste_material_exec(bContext *C, wmOperator *op) /* There are some custom updates to the node tree above, better do a full update pass. */ BKE_ntree_update_tag_all(ma->nodetree); - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); DEG_id_tag_update(&ma->id, ID_RECALC_SYNC_TO_EVAL); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); diff --git a/source/blender/editors/render/render_update.cc b/source/blender/editors/render/render_update.cc index d526ac6998a2..fdefd4cd30f6 100644 --- a/source/blender/editors/render/render_update.cc +++ b/source/blender/editors/render/render_update.cc @@ -201,7 +201,7 @@ void ED_render_engine_changed(Main *bmain, const bool update_scene_data) ntreeCompositUpdateRLayers(scene->nodetree); } } - ED_node_tree_propagate_change(nullptr, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); /* Update #CacheFiles to ensure that procedurals are properly taken into account. */ LISTBASE_FOREACH (CacheFile *, cachefile, &bmain->cachefiles) { diff --git a/source/blender/editors/scene/scene_edit.cc b/source/blender/editors/scene/scene_edit.cc index 57534d5d8f89..2a4cbebd3660 100644 --- a/source/blender/editors/scene/scene_edit.cc +++ b/source/blender/editors/scene/scene_edit.cc @@ -71,15 +71,15 @@ Scene *ED_scene_sequencer_add(Main *bmain, eSceneCopyMethod method, const bool assign_strip) { - Strip *seq = nullptr; + Strip *strip = nullptr; Scene *scene_active = CTX_data_scene(C); Scene *scene_strip = nullptr; /* Sequencer need to use as base the scene defined in the strip, not the main scene. */ Editing *ed = scene_active->ed; if (ed) { - seq = ed->act_seq; - if (seq && seq->scene) { - scene_strip = seq->scene; + strip = ed->act_seq; + if (strip && strip->scene) { + scene_strip = strip->scene; } } @@ -98,10 +98,10 @@ Scene *ED_scene_sequencer_add(Main *bmain, /* As the scene is created in sequencer, do not set the new scene as active. * This is useful for story-boarding where we want to keep actual scene active. * The new scene is linked to the active strip and the viewport updated. */ - if (scene_new && seq) { - seq->scene = scene_new; + if (scene_new && strip) { + strip->scene = scene_new; /* Do a refresh of the sequencer data. */ - SEQ_relations_invalidate_cache_raw(scene_active, seq); + SEQ_relations_invalidate_cache_raw(scene_active, strip); DEG_id_tag_update(&scene_active->id, ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS); DEG_relations_tag_update(bmain); } @@ -311,8 +311,8 @@ static int scene_new_sequencer_exec(bContext *C, wmOperator *op) static bool scene_new_sequencer_poll(bContext *C) { Scene *scene = CTX_data_scene(C); - const Strip *seq = SEQ_select_active_get(scene); - return (seq && (seq->type == SEQ_TYPE_SCENE)); + const Strip *strip = SEQ_select_active_get(scene); + return (strip && (strip->type == STRIP_TYPE_SCENE)); } static const EnumPropertyItem *scene_new_sequencer_enum_itemf(bContext *C, @@ -334,8 +334,8 @@ static const EnumPropertyItem *scene_new_sequencer_enum_itemf(bContext *C, } else { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); - if (seq && (seq->type == SEQ_TYPE_SCENE) && (seq->scene != nullptr)) { + Strip *strip = SEQ_select_active_get(scene); + if (strip && (strip->type == STRIP_TYPE_SCENE) && (strip->scene != nullptr)) { has_scene_or_no_context = true; } } diff --git a/source/blender/editors/screen/screen_context.cc b/source/blender/editors/screen/screen_context.cc index 43e398ad87ab..a694034f6e98 100644 --- a/source/blender/editors/screen/screen_context.cc +++ b/source/blender/editors/screen/screen_context.cc @@ -673,9 +673,9 @@ static eContextResult screen_ctx_active_sequence_strip(const bContext *C, { wmWindow *win = CTX_wm_window(C); Scene *scene = WM_window_get_active_scene(win); - Strip *seq = SEQ_select_active_get(scene); - if (seq) { - CTX_data_pointer_set(result, &scene->id, &RNA_Strip, seq); + Strip *strip = SEQ_select_active_get(scene); + if (strip) { + CTX_data_pointer_set(result, &scene->id, &RNA_Strip, strip); return CTX_RESULT_OK; } return CTX_RESULT_NO_DATA; @@ -686,8 +686,8 @@ static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult Scene *scene = WM_window_get_active_scene(win); Editing *ed = SEQ_editing_get(scene); if (ed) { - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - CTX_data_list_add(result, &scene->id, &RNA_Strip, seq); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); return CTX_RESULT_OK; @@ -700,9 +700,9 @@ static eContextResult screen_ctx_selected_sequences(const bContext *C, bContextD Scene *scene = WM_window_get_active_scene(win); Editing *ed = SEQ_editing_get(scene); if (ed) { - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - CTX_data_list_add(result, &scene->id, &RNA_Strip, seq); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); } } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); @@ -721,9 +721,9 @@ static eContextResult screen_ctx_selected_editable_sequences(const bContext *C, } ListBase *channels = SEQ_channels_displayed_get(ed); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) { - CTX_data_list_add(result, &scene->id, &RNA_Strip, seq); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && !SEQ_transform_is_locked(channels, strip)) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); } } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); diff --git a/source/blender/editors/screen/screen_intern.hh b/source/blender/editors/screen/screen_intern.hh index dbe8a2029ded..df5d0415b30f 100644 --- a/source/blender/editors/screen/screen_intern.hh +++ b/source/blender/editors/screen/screen_intern.hh @@ -17,9 +17,12 @@ struct bContextDataResult; struct bScreen; struct Main; struct rcti; +struct ScrArea; struct ScrAreaMap; struct ScrEdge; struct ScrVert; +struct WorkSpaceLayout; +struct wmOperatorType; struct wmWindow; /* internal exports only */ diff --git a/source/blender/editors/sculpt_paint/brushes/multiplane_scrape.cc b/source/blender/editors/sculpt_paint/brushes/multiplane_scrape.cc index deaf86e87373..f8e8bede4598 100644 --- a/source/blender/editors/sculpt_paint/brushes/multiplane_scrape.cc +++ b/source/blender/editors/sculpt_paint/brushes/multiplane_scrape.cc @@ -39,6 +39,11 @@ struct ScrapeSampleData { std::array area_cos; std::array area_nos; std::array area_count; + + bool has_samples() const + { + return area_count[0] != 0 && area_count[1] != 0; + } }; struct LocalData { @@ -261,14 +266,21 @@ static void sample_node_surface_bmesh(const Depsgraph &depsgraph, accumulate_samples(positions, local_positions, normals, factors, sample); } -static ScrapeSampleData sample_surface(const Depsgraph &depsgraph, - const Object &object, - const Brush &brush, - const float4x4 &mat, - const IndexMask &node_mask) +/** + * Samples and partitions the underlying mesh data to aggregate position and normal data based on + * positive and negative brush local x-axis positions. + * + * \returns an empty optional to indicate that no samples were taken. + */ +static std::optional sample_surface(const Depsgraph &depsgraph, + const Object &object, + const Brush &brush, + const float4x4 &mat, + const IndexMask &node_mask) { const bke::pbvh::Tree &pbvh = *bke::object::pbvh_get(object); threading::EnumerableThreadSpecific all_tls; + ScrapeSampleData result = {}; switch (pbvh.type()) { case bke::pbvh::Type::Mesh: { Mesh &mesh = *static_cast(object.data); @@ -276,7 +288,7 @@ static ScrapeSampleData sample_surface(const Depsgraph &depsgraph, const Span nodes = pbvh.nodes(); const Span positions_eval = bke::pbvh::vert_positions_eval(depsgraph, object); const Span vert_normals = bke::pbvh::vert_normals_eval(depsgraph, object); - return threading::parallel_reduce( + result = threading::parallel_reduce( node_mask.index_range(), 1, ScrapeSampleData{}, @@ -301,7 +313,7 @@ static ScrapeSampleData sample_surface(const Depsgraph &depsgraph, } case bke::pbvh::Type::Grids: { const Span nodes = pbvh.nodes(); - return threading::parallel_reduce( + result = threading::parallel_reduce( node_mask.index_range(), 1, ScrapeSampleData{}, @@ -317,7 +329,7 @@ static ScrapeSampleData sample_surface(const Depsgraph &depsgraph, } case bke::pbvh::Type::BMesh: { const Span nodes = pbvh.nodes(); - return threading::parallel_reduce( + result = threading::parallel_reduce( node_mask.index_range(), 1, ScrapeSampleData{}, @@ -332,8 +344,8 @@ static ScrapeSampleData sample_surface(const Depsgraph &depsgraph, break; } } - BLI_assert_unreachable(); - return {}; + + return result.has_samples() ? std::make_optional(result) : std::nullopt; } static void calc_faces(const Depsgraph &depsgraph, @@ -571,18 +583,24 @@ void do_multiplane_scrape_brush(const Depsgraph &depsgraph, if (brush.flag2 & BRUSH_MULTIPLANE_SCRAPE_DYNAMIC) { /* Sample the individual normal and area center of the areas at both sides of the cursor. */ - const ScrapeSampleData sample = sample_surface(depsgraph, object, brush, mat, node_mask); + const std::optional sample = sample_surface( + depsgraph, object, brush, mat, node_mask); + if (!sample) { + return; + } + + BLI_assert(sample->has_samples()); /* Use the plane centers to check if we are sculpting along a concave or convex edge. */ const std::array sampled_plane_co{ - sample.area_cos[0] * 1.0f / float(sample.area_count[0]), - sample.area_cos[1] * 1.0f / float(sample.area_count[1])}; + sample->area_cos[0] * 1.0f / float(sample->area_count[0]), + sample->area_cos[1] * 1.0f / float(sample->area_count[1])}; const float3 mid_co = math::midpoint(sampled_plane_co[0], sampled_plane_co[1]); /* Calculate the scrape planes angle based on the sampled normals. */ const std::array sampled_plane_normals{ - math::normalize(sample.area_nos[0] * 1.0f / float(sample.area_count[0])), - math::normalize(sample.area_nos[1] * 1.0f / float(sample.area_count[1]))}; + math::normalize(sample->area_nos[0] * 1.0f / float(sample->area_count[0])), + math::normalize(sample->area_nos[1] * 1.0f / float(sample->area_count[1]))}; float sampled_angle = angle_v3v3(sampled_plane_normals[0], sampled_plane_normals[1]); const std::array sampled_cv{area_no, ss.cache->location_symm - mid_co}; diff --git a/source/blender/editors/sculpt_paint/grease_pencil_fill.cc b/source/blender/editors/sculpt_paint/grease_pencil_fill.cc index ffe8bc4084a5..492ca7982f98 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_fill.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_fill.cc @@ -788,8 +788,7 @@ static IndexMask get_visible_boundary_strokes(const Object &object, materials[curve_i] + 1); const MaterialGPencilStyle *gp_style = material ? material->gp_style : nullptr; const bool is_hidden_material = (gp_style->flag & GP_MATERIAL_HIDE); - const bool is_stroke_material = (gp_style->flag & GP_MATERIAL_STROKE_SHOW); - if (gp_style == nullptr || is_hidden_material || !is_stroke_material) { + if (gp_style == nullptr || is_hidden_material) { return false; } diff --git a/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc b/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc index c4852ba1410a..79e143d74dde 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_interpolate.cc @@ -584,7 +584,7 @@ static void grease_pencil_interpolate_status_indicators(bContext &C, std::string status; if (hasNumInput(&opdata.numeric_input)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&const_cast(opdata.numeric_input), str_ofs, &scene.unit); + outputNumInput(&const_cast(opdata.numeric_input), str_ofs, scene.unit); status = msg + std::string(str_ofs); } else { diff --git a/source/blender/editors/sculpt_paint/grease_pencil_paint_common.cc b/source/blender/editors/sculpt_paint/grease_pencil_paint_common.cc index 2c72fa4570fc..a144f30e9d27 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_paint_common.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_paint_common.cc @@ -218,58 +218,41 @@ DeltaProjectionFunc get_screen_projection_fn(const GreasePencilStrokeParams &par return world_delta; }; + float3 world_normal; switch (params.toolsettings.gp_sculpt.lock_axis) { case GP_LOCKAXIS_VIEW: { - const float3 world_normal = view_to_world.z_axis(); - return [=](const float3 &position, const float2 &screen_delta) { - const float3 world_pos = math::transform_point(layer_to_world, position); - const float3 world_delta = screen_to_world(world_pos, screen_delta); - const float3 layer_delta = math::transform_direction( - world_to_layer, world_delta - world_normal * math::dot(world_delta, world_normal)); - return position + layer_delta; - }; + world_normal = view_to_world.z_axis(); + break; } case GP_LOCKAXIS_X: { - return [=](const float3 &position, const float2 &screen_delta) { - const float3 world_pos = math::transform_point(layer_to_world, position); - const float3 world_delta = screen_to_world(world_pos, screen_delta); - const float3 layer_delta = math::transform_direction( - world_to_layer, float3(0.0f, world_delta.y, world_delta.z)); - return position + layer_delta; - }; + world_normal = layer_to_world.x_axis(); + break; } case GP_LOCKAXIS_Y: { - return [=](const float3 &position, const float2 &screen_delta) { - const float3 world_pos = math::transform_point(layer_to_world, position); - const float3 world_delta = screen_to_world(world_pos, screen_delta); - const float3 layer_delta = math::transform_direction( - world_to_layer, float3(world_delta.x, 0.0f, world_delta.z)); - return position + layer_delta; - }; + world_normal = layer_to_world.y_axis(); + break; } case GP_LOCKAXIS_Z: { - return [=](const float3 &position, const float2 &screen_delta) { - const float3 world_pos = math::transform_point(layer_to_world, position); - const float3 world_delta = screen_to_world(world_pos, screen_delta); - const float3 layer_delta = math::transform_direction( - world_to_layer, float3(world_delta.x, world_delta.y, 0.0f)); - return position + layer_delta; - }; + world_normal = layer_to_world.z_axis(); + break; } case GP_LOCKAXIS_CURSOR: { - const float3 world_normal = params.scene.cursor.matrix().z_axis(); - return [=](const float3 &position, const float2 &screen_delta) { - const float3 world_pos = math::transform_point(layer_to_world, position); - const float3 world_delta = screen_to_world(world_pos, screen_delta); - const float3 layer_delta = math::transform_direction( - world_to_layer, world_delta - world_normal * math::dot(world_delta, world_normal)); - return position + layer_delta; - }; + world_normal = params.scene.cursor.matrix().z_axis(); + break; + } + default: { + BLI_assert_unreachable(); + return [](const float3 &, const float2 &) { return float3(); }; } } - BLI_assert_unreachable(); - return [](const float3 &, const float2 &) { return float3(); }; + return [=](const float3 &position, const float2 &screen_delta) { + const float3 world_pos = math::transform_point(layer_to_world, position); + const float3 world_delta = screen_to_world(world_pos, screen_delta); + const float3 layer_delta = math::transform_direction( + world_to_layer, world_delta - world_normal * math::dot(world_delta, world_normal)); + return position + layer_delta; + }; } float3 compute_orig_delta(const DeltaProjectionFunc &projection_fn, diff --git a/source/blender/editors/sculpt_paint/grease_pencil_sculpt_strength.cc b/source/blender/editors/sculpt_paint/grease_pencil_sculpt_strength.cc index 932072f40956..6ab4cb562270 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_sculpt_strength.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_sculpt_strength.cc @@ -2,6 +2,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_index_mask.hh" #include "BLI_task.hh" #include "DNA_gpencil_legacy_types.h" diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.cc b/source/blender/editors/sculpt_paint/paint_image_proj.cc index 2de98411f523..cddd700531ac 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.cc +++ b/source/blender/editors/sculpt_paint/paint_image_proj.cc @@ -6776,7 +6776,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op) } } - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); /* In case we added more than one node, position them too. */ blender::bke::node_position_propagate(out_node); diff --git a/source/blender/editors/sculpt_paint/sculpt_color.hh b/source/blender/editors/sculpt_paint/sculpt_color.hh index 1641cca5aa39..5237f45370a3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_color.hh +++ b/source/blender/editors/sculpt_paint/sculpt_color.hh @@ -16,6 +16,7 @@ #include "BLI_span.hh" struct Depsgraph; +struct Mesh; namespace blender::bke { enum class AttrDomain : int8_t; struct GAttributeReader; diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.hh b/source/blender/editors/sculpt_paint/sculpt_geodesic.hh index 043e972d82b4..863e00db90f8 100644 --- a/source/blender/editors/sculpt_paint/sculpt_geodesic.hh +++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.hh @@ -9,6 +9,8 @@ #pragma once #include "BLI_array.hh" +#include "BLI_math_vector_types.hh" +#include "BLI_offset_indices.hh" #include "BLI_set.hh" namespace blender::ed::sculpt_paint::geodesic { diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.hh b/source/blender/editors/sculpt_paint/sculpt_pose.hh index 36b035999f5c..e2c2cae59146 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.hh +++ b/source/blender/editors/sculpt_paint/sculpt_pose.hh @@ -8,8 +8,14 @@ #pragma once +#include + +#include "BLI_array.hh" +#include "BLI_index_mask.hh" +#include "BLI_math_matrix_types.hh" #include "BLI_math_vector.hh" -#include "BLI_span.hh" + +#include "BKE_paint.hh" struct Brush; struct Depsgraph; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index 197ffa4d9e85..54516183523e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -355,7 +355,7 @@ static void restore_position_mesh(Object &object, const Span verts = unode.vert_indices.as_span().take_front(unode.unique_verts_num); if (unode.orig_position.is_empty()) { - /* When original positions aren't written separately in the the undo step, there are no + /* When original positions aren't written separately in the undo step, there are no * deform modifiers. Therefore the original and evaluated deform positions will be the * same, and modifying the positions from the original mesh is enough. */ swap_indexed_data( diff --git a/source/blender/editors/sound/sound_ops.cc b/source/blender/editors/sound/sound_ops.cc index 014d300f855d..56a5d043ef28 100644 --- a/source/blender/editors/sound/sound_ops.cc +++ b/source/blender/editors/sound/sound_ops.cc @@ -192,41 +192,41 @@ static void SOUND_OT_open_mono(wmOperatorType *ot) static void sound_update_animation_flags(Scene *scene); -static bool sound_update_animation_flags_fn(Strip *seq, void *user_data) +static bool sound_update_animation_flags_fn(Strip *strip, void *user_data) { const FCurve *fcu; Scene *scene = (Scene *)user_data; bool driven; - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "volume", 0, &driven); + fcu = id_data_find_fcurve(&scene->id, strip, &RNA_Strip, "volume", 0, &driven); if (fcu || driven) { - seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED; + strip->flag |= SEQ_AUDIO_VOLUME_ANIMATED; } else { - seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED; + strip->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED; } - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "pitch", 0, &driven); + fcu = id_data_find_fcurve(&scene->id, strip, &RNA_Strip, "pitch", 0, &driven); if (fcu || driven) { - seq->flag |= SEQ_AUDIO_PITCH_ANIMATED; + strip->flag |= SEQ_AUDIO_PITCH_ANIMATED; } else { - seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED; + strip->flag &= ~SEQ_AUDIO_PITCH_ANIMATED; } - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "pan", 0, &driven); + fcu = id_data_find_fcurve(&scene->id, strip, &RNA_Strip, "pan", 0, &driven); if (fcu || driven) { - seq->flag |= SEQ_AUDIO_PAN_ANIMATED; + strip->flag |= SEQ_AUDIO_PAN_ANIMATED; } else { - seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED; + strip->flag &= ~SEQ_AUDIO_PAN_ANIMATED; } - if (seq->type == SEQ_TYPE_SCENE) { + if (strip->type == STRIP_TYPE_SCENE) { /* TODO(sergey): For now we do manual recursion into the scene strips, * but perhaps it should be covered by recursive_apply? */ - sound_update_animation_flags(seq->scene); + sound_update_animation_flags(strip->scene); } return true; @@ -768,7 +768,7 @@ static bool sound_poll(bContext *C) { Editing *ed = CTX_data_scene(C)->ed; - if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_TYPE_SOUND_RAM) { + if (!ed || !ed->act_seq || ed->act_seq->type != STRIP_TYPE_SOUND_RAM) { return false; } @@ -782,7 +782,7 @@ static int sound_pack_exec(bContext *C, wmOperator *op) Editing *ed = CTX_data_scene(C)->ed; bSound *sound; - if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_TYPE_SOUND_RAM) { + if (!ed || !ed->act_seq || ed->act_seq->type != STRIP_TYPE_SOUND_RAM) { return OPERATOR_CANCELLED; } @@ -859,7 +859,7 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, const wmEvent * /*ev return sound_unpack_exec(C, op); } - if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_TYPE_SOUND_RAM) { + if (!ed || !ed->act_seq || ed->act_seq->type != STRIP_TYPE_SOUND_RAM) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_action/action_intern.hh b/source/blender/editors/space_action/action_intern.hh index 99d2b4e253f2..85c836464ab2 100644 --- a/source/blender/editors/space_action/action_intern.hh +++ b/source/blender/editors/space_action/action_intern.hh @@ -10,11 +10,13 @@ struct ARegion; struct ARegionType; +struct ListBase; struct Object; struct Scene; struct SpaceAction; struct bAnimContext; struct bContext; +struct wmKeyConfig; struct wmOperatorType; /* internal exports only */ diff --git a/source/blender/editors/space_buttons/buttons_intern.hh b/source/blender/editors/space_buttons/buttons_intern.hh index 2c2a8eb0efee..c6c716dc4cc6 100644 --- a/source/blender/editors/space_buttons/buttons_intern.hh +++ b/source/blender/editors/space_buttons/buttons_intern.hh @@ -11,6 +11,7 @@ #include "BLI_bitmap.h" #include "DNA_listBase.h" #include "RNA_types.hh" +#include "UI_interface.hh" struct ARegionType; struct ID; diff --git a/source/blender/editors/space_clip/clip_intern.hh b/source/blender/editors/space_clip/clip_intern.hh index 74163f23f2d6..a711966c336b 100644 --- a/source/blender/editors/space_clip/clip_intern.hh +++ b/source/blender/editors/space_clip/clip_intern.hh @@ -14,6 +14,7 @@ #include "DNA_tracking_types.h" struct ARegion; +struct ARegionType; struct MovieClip; struct MovieTrackingMarker; struct MovieTrackingTrack; diff --git a/source/blender/editors/space_console/console_intern.hh b/source/blender/editors/space_console/console_intern.hh index b75418275f55..a602c6566f58 100644 --- a/source/blender/editors/space_console/console_intern.hh +++ b/source/blender/editors/space_console/console_intern.hh @@ -10,7 +10,9 @@ /* internal exports only */ +struct ARegion; struct ConsoleLine; +struct SpaceConsole; struct bContext; struct wmOperatorType; diff --git a/source/blender/editors/space_file/file_intern.hh b/source/blender/editors/space_file/file_intern.hh index 7d5689d5ca52..edbacb4a1b57 100644 --- a/source/blender/editors/space_file/file_intern.hh +++ b/source/blender/editors/space_file/file_intern.hh @@ -11,6 +11,8 @@ #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" +#include "ED_fileselect.hh" + /* internal exports only */ struct ARegion; diff --git a/source/blender/editors/space_file/filelist.hh b/source/blender/editors/space_file/filelist.hh index aecdfda47cfd..1daef32433ac 100644 --- a/source/blender/editors/space_file/filelist.hh +++ b/source/blender/editors/space_file/filelist.hh @@ -8,6 +8,11 @@ #pragma once +#include +#include + +#include "DNA_space_types.h" + struct AssetLibraryReference; struct bContext; struct BlendHandle; diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 26fd30040847..3b91ae3c19bc 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -8,15 +8,11 @@ #pragma once +#include "ED_fileselect.hh" + /* XXX could become UserPref */ #define FSMENU_RECENT_MAX 10 -enum FSMenuCategory; -enum FSMenuInsert; - -struct FSMenu; -struct FSMenuEntry; - #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/editors/space_graph/graph_slider_ops.cc b/source/blender/editors/space_graph/graph_slider_ops.cc index 32a3235ed7f4..1d71a3a6fb6e 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.cc +++ b/source/blender/editors/space_graph/graph_slider_ops.cc @@ -134,7 +134,7 @@ static void common_draw_status_header(bContext *C, tGraphSliderOp *gso, const ch if (hasNumInput(&gso->num)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&gso->num, str_ofs, &gso->scene->unit); + outputNumInput(&gso->num, str_ofs, gso->scene->unit); SNPRINTF(status_str, "%s: %s", mode_str, str_ofs); } @@ -464,7 +464,7 @@ static void decimate_draw_status(bContext *C, tGraphSliderOp *gso) if (hasNumInput(&gso->num)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&gso->num, str_ofs, &gso->scene->unit); + outputNumInput(&gso->num, str_ofs, gso->scene->unit); SNPRINTF(status_str, "%s: %s", mode_str, str_ofs); } @@ -973,7 +973,7 @@ static void ease_draw_status_header(bContext *C, wmOperator *op) if (hasNumInput(&gso->num)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&gso->num, str_ofs, &gso->scene->unit); + outputNumInput(&gso->num, str_ofs, gso->scene->unit); SNPRINTF(status_str, "%s: %s", mode_str, str_ofs); } @@ -1577,7 +1577,7 @@ static void shear_draw_status_header(bContext *C, tGraphSliderOp *gso) if (hasNumInput(&gso->num)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&gso->num, str_ofs, &gso->scene->unit); + outputNumInput(&gso->num, str_ofs, gso->scene->unit); SNPRINTF(status_str, "%s: %s", mode_str, str_ofs); } @@ -2467,7 +2467,7 @@ static void scale_from_neighbor_draw_status_header(bContext *C, wmOperator *op) if (hasNumInput(&gso->num)) { char str_ofs[NUM_STR_REP_LEN]; - outputNumInput(&gso->num, str_ofs, &gso->scene->unit); + outputNumInput(&gso->num, str_ofs, gso->scene->unit); SNPRINTF(status_str, "%s: %s", mode_str, str_ofs); } diff --git a/source/blender/editors/space_image/image_intern.hh b/source/blender/editors/space_image/image_intern.hh index c258e0b28ad4..d70b2fa65c00 100644 --- a/source/blender/editors/space_image/image_intern.hh +++ b/source/blender/editors/space_image/image_intern.hh @@ -11,6 +11,7 @@ /* internal exports only */ struct ARegion; struct ARegionType; +struct ImageUser; struct SpaceImage; struct bContext; struct bNodeTree; diff --git a/source/blender/editors/space_info/info_intern.hh b/source/blender/editors/space_info/info_intern.hh index 533bc417e0dd..ce6354887792 100644 --- a/source/blender/editors/space_info/info_intern.hh +++ b/source/blender/editors/space_info/info_intern.hh @@ -10,6 +10,7 @@ /* internal exports only */ +struct ARegion; struct ReportList; struct SpaceInfo; struct wmOperatorType; diff --git a/source/blender/editors/space_info/textview.hh b/source/blender/editors/space_info/textview.hh index 2426e4fbbe72..1aee608d50b1 100644 --- a/source/blender/editors/space_info/textview.hh +++ b/source/blender/editors/space_info/textview.hh @@ -8,6 +8,10 @@ #pragma once +#include "BLI_utildefines.h" + +#include "DNA_vec_types.h" + #define TVC_TAB_COLUMNS 4 enum eTextViewContext_LineFlag { diff --git a/source/blender/editors/space_nla/nla_intern.hh b/source/blender/editors/space_nla/nla_intern.hh index 890bbcc7ccc2..e76e92dfb5b6 100644 --- a/source/blender/editors/space_nla/nla_intern.hh +++ b/source/blender/editors/space_nla/nla_intern.hh @@ -8,6 +8,16 @@ #pragma once +struct ARegion; +struct ARegionType; +struct ListBase; +struct PointerRNA; +struct SpaceNla; +struct bAnimContext; +struct bContext; +struct wmKeyConfig; +struct wmOperatorType; + /* internal exports only */ /* **************************************** */ diff --git a/source/blender/editors/space_node/clipboard.cc b/source/blender/editors/space_node/clipboard.cc index e6d9b5131e36..8af3c6f6284f 100644 --- a/source/blender/editors/space_node/clipboard.cc +++ b/source/blender/editors/space_node/clipboard.cc @@ -473,7 +473,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) update_multi_input_indices_for_removed_links(*new_node); } - ED_node_tree_propagate_change(C, bmain, &tree); + ED_node_tree_propagate_change(bmain, &tree); /* Pasting nodes can create arbitrary new relations because nodes can reference IDs. */ DEG_relations_tag_update(bmain); diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 66893fb9c8a9..3d744902a18d 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1012,7 +1012,7 @@ static void node_property_update_default(Main *bmain, Scene * /*scene*/, Pointer bNodeTree *ntree = (bNodeTree *)ptr->owner_id; bNode *node = (bNode *)ptr->data; BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static void node_socket_template_properties_update(blender::bke::bNodeType *ntype, diff --git a/source/blender/editors/space_node/link_drag_search.cc b/source/blender/editors/space_node/link_drag_search.cc index 89b55bcbd64e..47a722e4d9eb 100644 --- a/source/blender/editors/space_node/link_drag_search.cc +++ b/source/blender/editors/space_node/link_drag_search.cc @@ -99,7 +99,7 @@ static void add_group_input_node_fn(nodes::LinkSearchOpParams ¶ms) bNode &group_input = params.add_node("NodeGroupInput"); /* This is necessary to create the new sockets in the other input nodes. */ - ED_node_tree_propagate_change(¶ms.C, CTX_data_main(¶ms.C), ¶ms.node_tree); + ED_node_tree_propagate_change(CTX_data_main(¶ms.C), ¶ms.node_tree); /* Hide the new input in all other group input nodes, to avoid making them taller. */ for (bNode *node : params.node_tree.all_nodes()) { @@ -384,7 +384,7 @@ static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2) /* Ideally it would be possible to tag the node tree in some way so it updates only after the * translate operation is finished, but normally moving nodes around doesn't cause updates. */ - ED_node_tree_propagate_change(C, &bmain, &node_tree); + ED_node_tree_propagate_change(&bmain, &node_tree); /* Start translation operator with the new node. */ wmOperatorType *ot = WM_operatortype_find("NODE_OT_translate_attach_remove_on_cancel", true); diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 418e73cd22e5..7e60214b4dcc 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -86,7 +86,7 @@ bNode *add_node(const bContext &C, const StringRef idname, const float2 &locatio bke::node_set_selected(node, true); ED_node_set_active(&bmain, &snode, &node_tree, node, nullptr); - ED_node_tree_propagate_change(&C, &bmain, &node_tree); + ED_node_tree_propagate_change(&bmain, &node_tree); return node; } @@ -106,7 +106,7 @@ bNode *add_static_node(const bContext &C, int type, const float2 &location) bke::node_set_selected(node, true); ED_node_set_active(&bmain, &snode, &node_tree, node, nullptr); - ED_node_tree_propagate_change(&C, &bmain, &node_tree); + ED_node_tree_propagate_change(&bmain, &node_tree); return node; } @@ -223,7 +223,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op) } } - ED_node_tree_propagate_change(C, CTX_data_main(C), &ntree); + ED_node_tree_propagate_change(CTX_data_main(C), &ntree); return OPERATOR_FINISHED; } @@ -329,7 +329,7 @@ static int node_add_group_exec(bContext *C, wmOperator *op) BKE_ntree_update_tag_node_property(snode->edittree, group_node); bke::node_set_active(ntree, group_node); - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); WM_event_add_notifier(C, NC_NODE | NA_ADDED, nullptr); DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; @@ -432,7 +432,7 @@ static bool add_node_group_asset(const bContext &C, BKE_ntree_update_tag_node_property(&edit_tree, group_node); bke::node_set_active(&edit_tree, group_node); - ED_node_tree_propagate_change(&C, &bmain, nullptr); + ED_node_tree_propagate_change(&bmain, nullptr); WM_event_add_notifier(&C, NC_NODE | NA_ADDED, nullptr); DEG_relations_tag_update(&bmain); @@ -543,7 +543,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op) BKE_ntree_update_tag_socket_property(ntree, sock); bke::node_set_active(ntree, object_node); - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; @@ -630,7 +630,7 @@ static int node_add_collection_exec(bContext *C, wmOperator *op) BKE_ntree_update_tag_socket_property(&ntree, sock); bke::node_set_active(&ntree, collection_node); - ED_node_tree_propagate_change(C, bmain, &ntree); + ED_node_tree_propagate_change(bmain, &ntree); DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; @@ -824,7 +824,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - ED_node_tree_propagate_change(C, bmain, snode.edittree); + ED_node_tree_propagate_change(bmain, snode.edittree); DEG_relations_tag_update(bmain); if (nodes.size() == 1) { @@ -926,7 +926,7 @@ static int node_add_mask_exec(bContext *C, wmOperator *op) node->id = mask; id_us_plus(mask); - ED_node_tree_propagate_change(C, bmain, snode.edittree); + ED_node_tree_propagate_change(bmain, snode.edittree); DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; @@ -979,7 +979,7 @@ static int node_add_material_exec(bContext *C, wmOperator *op) material_node->id = &material->id; id_us_plus(&material->id); - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; @@ -1066,7 +1066,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) } else { const bke::bNodeTreeType *type = bke::node_tree_type_find(idname); - treename = type->ui_name; + treename = type->ui_name.c_str(); } ntree = bke::node_tree_add_tree(bmain, treename, idname); diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 9ada6e01eaf5..6c712c8cd0f5 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2381,7 +2381,7 @@ static void node_panel_toggle_button_cb(bContext *C, void *panel_state_argv, voi panel_state->flag ^= NODE_PANEL_COLLAPSED; - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /* Draw panel backgrounds first, so other node elements can be rendered on top. */ @@ -3458,7 +3458,7 @@ static void node_draw_basis(const bContext &C, nullptr, 0, 0, - TIP_(node.typeinfo->ui_description)); + TIP_(node.typeinfo->ui_description.c_str())); UI_but_func_tooltip_set( but, [](bContext * /*C*/, void *arg, const char *tip) -> std::string { @@ -3710,7 +3710,7 @@ static void node_draw_hidden(const bContext &C, nullptr, 0, 0, - TIP_(node.typeinfo->ui_description)); + TIP_(node.typeinfo->ui_description.c_str())); /* Outline. */ { diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 8afe7f0092d9..832e14b8a833 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -491,15 +491,8 @@ static void send_notifiers_after_tree_change(ID *id, bNodeTree *ntree) /** \name Node Editor Public API Functions * \{ */ -void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *root_ntree) +void ED_node_tree_propagate_change(Main *bmain, bNodeTree *root_ntree) { - if (C != nullptr) { - SpaceNode *snode = CTX_wm_space_node(C); - if (snode != nullptr && root_ntree != nullptr) { - blender::ed::space_node::send_notifiers_after_tree_change(snode->id, root_ntree); - } - } - NodeTreeUpdateExtraParams params; params.tree_changed_fn = [](bNodeTree &ntree, ID &owner_id) { blender::ed::space_node::send_notifiers_after_tree_change(&owner_id, &ntree); @@ -515,7 +508,7 @@ void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *ro void ED_node_set_tree_type(SpaceNode *snode, blender::bke::bNodeTreeType *typeinfo) { if (typeinfo) { - STRNCPY(snode->tree_idname, typeinfo->idname); + STRNCPY(snode->tree_idname, typeinfo->idname.c_str()); } else { snode->tree_idname[0] = '\0'; @@ -524,22 +517,22 @@ void ED_node_set_tree_type(SpaceNode *snode, blender::bke::bNodeTreeType *typein bool ED_node_is_compositor(const SpaceNode *snode) { - return STREQ(snode->tree_idname, ntreeType_Composite->idname); + return snode->tree_idname == ntreeType_Composite->idname; } bool ED_node_is_shader(SpaceNode *snode) { - return STREQ(snode->tree_idname, ntreeType_Shader->idname); + return snode->tree_idname == ntreeType_Shader->idname; } bool ED_node_is_texture(SpaceNode *snode) { - return STREQ(snode->tree_idname, ntreeType_Texture->idname); + return snode->tree_idname == ntreeType_Texture->idname; } bool ED_node_is_geometry(SpaceNode *snode) { - return STREQ(snode->tree_idname, ntreeType_Geometry->idname); + return snode->tree_idname == ntreeType_Geometry->idname; } bool ED_node_supports_preview(SpaceNode *snode) @@ -770,7 +763,7 @@ void ED_node_set_active( BKE_ntree_update_tag_active_output_changed(ntree); } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) { /* If active texture changed, free GLSL materials. */ @@ -814,7 +807,7 @@ void ED_node_set_active( if (r_active_texture_changed) { *r_active_texture_changed = true; } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_IMAGE, nullptr); } @@ -832,7 +825,7 @@ void ED_node_set_active( node->flag |= NODE_DO_OUTPUT; if (was_output == 0) { BKE_ntree_update_tag_active_output_changed(ntree); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /* Adding a node doesn't link this yet. */ @@ -848,11 +841,11 @@ void ED_node_set_active( node->flag |= NODE_DO_OUTPUT; BKE_ntree_update_tag_active_output_changed(ntree); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } else if (do_update) { - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } else if (ntree->type == NTREE_GEOMETRY) { @@ -1485,7 +1478,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) } tree_draw_order_update(*snode->edittree); - ED_node_tree_propagate_change(C, bmain, snode->edittree); + ED_node_tree_propagate_change(bmain, snode->edittree); return OPERATOR_FINISHED; } @@ -1547,7 +1540,7 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, bmain, &edit_tree); + ED_node_tree_propagate_change(bmain, &edit_tree); return OPERATOR_FINISHED; } @@ -1713,7 +1706,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator * /*op*/) node_flag_toggle_exec(snode, NODE_PREVIEW); - ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode->edittree); return OPERATOR_FINISHED; } @@ -1764,7 +1757,7 @@ static int node_deactivate_viewer_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode.edittree); return OPERATOR_FINISHED; } @@ -1843,7 +1836,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode->edittree); WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); /* Hack to force update of the button state after drawing, see #112462. */ @@ -1887,7 +1880,7 @@ static int node_mute_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, bmain, snode->edittree); + ED_node_tree_propagate_change(bmain, snode->edittree); return OPERATOR_FINISHED; } @@ -1929,7 +1922,7 @@ static int node_delete_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, bmain, snode->edittree); + ED_node_tree_propagate_change(bmain, snode->edittree); return OPERATOR_FINISHED; } @@ -1976,7 +1969,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, bmain, snode->edittree); + ED_node_tree_propagate_change(bmain, snode->edittree); return OPERATOR_FINISHED; } @@ -2027,7 +2020,7 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "file_path", file_path); ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format); - ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode->edittree); return OPERATOR_FINISHED; } @@ -2080,7 +2073,7 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator * return OPERATOR_CANCELLED; } - ED_node_tree_propagate_change(C, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); return OPERATOR_FINISHED; } @@ -2152,7 +2145,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) } BKE_ntree_update_tag_node_property(snode->edittree, node); - ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode->edittree); return OPERATOR_FINISHED; } @@ -2435,7 +2428,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op) btree->flag |= NTREE_VIEWER_BORDER; } - ED_node_tree_propagate_change(C, bmain, btree); + ED_node_tree_propagate_change(bmain, btree); WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); } else { @@ -2475,7 +2468,7 @@ static int clear_viewer_border_exec(bContext *C, wmOperator * /*op*/) bNodeTree *btree = snode->nodetree; btree->flag &= ~NTREE_VIEWER_BORDER; - ED_node_tree_propagate_change(C, CTX_data_main(C), btree); + ED_node_tree_propagate_change(CTX_data_main(C), btree); WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; @@ -2524,7 +2517,7 @@ static int node_cryptomatte_add_socket_exec(bContext *C, wmOperator * /*op*/) ntreeCompositCryptomatteAddSocket(ntree, node); - ED_node_tree_propagate_change(C, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); return OPERATOR_FINISHED; } @@ -2574,7 +2567,7 @@ static int node_cryptomatte_remove_socket_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_CANCELLED; } - ED_node_tree_propagate_change(C, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc index 2b81bb3584ed..19677e60d229 100644 --- a/source/blender/editors/space_node/node_geometry_attribute_search.cc +++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc @@ -212,7 +212,7 @@ static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v) /* Make the output socket with the new type on the attribute input node active. */ nodes::update_node_declaration_and_sockets(*node_tree, *node); BKE_ntree_update_tag_node_property(node_tree, node); - ED_node_tree_propagate_change(C, CTX_data_main(C), node_tree); + ED_node_tree_propagate_change(CTX_data_main(C), node_tree); } } diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 4fc4b4ce73db..3cc5fb05173e 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -116,16 +116,16 @@ const char *node_group_idname(bContext *C) SpaceNode *snode = CTX_wm_space_node(C); if (ED_node_is_shader(snode)) { - return ntreeType_Shader->group_idname; + return ntreeType_Shader->group_idname.c_str(); } if (ED_node_is_compositor(snode)) { - return ntreeType_Composite->group_idname; + return ntreeType_Composite->group_idname.c_str(); } if (ED_node_is_texture(snode)) { - return ntreeType_Texture->group_idname; + return ntreeType_Texture->group_idname.c_str(); } if (ED_node_is_geometry(snode)) { - return ntreeType_Geometry->group_idname; + return ntreeType_Geometry->group_idname.c_str(); } return ""; @@ -481,7 +481,7 @@ static int node_group_ungroup_exec(bContext *C, wmOperator * /*op*/) for (bNode *node : nodes_to_ungroup) { node_group_ungroup(bmain, snode->edittree, node); } - ED_node_tree_propagate_change(C, CTX_data_main(C), nullptr); + ED_node_tree_propagate_change(CTX_data_main(C), nullptr); return OPERATOR_FINISHED; } @@ -666,7 +666,7 @@ static int node_group_separate_exec(bContext *C, wmOperator *op) /* switch to parent tree */ ED_node_tree_pop(snode); - ED_node_tree_propagate_change(C, CTX_data_main(C), nullptr); + ED_node_tree_propagate_change(CTX_data_main(C), nullptr); return OPERATOR_FINISHED; } @@ -1202,7 +1202,7 @@ static void node_group_make_insert_selected(const bContext &C, update_nested_node_refs_after_moving_nodes_into_group(ntree, group, *gnode, node_identifier_map); - ED_node_tree_propagate_change(&C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); } static bNode *node_group_make_from_nodes(const bContext &C, diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 92820445ed00..6aec4b031414 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -584,7 +584,7 @@ static void finalize_viewer_link(const bContext &C, if (snode.edittree->type == NTREE_GEOMETRY) { viewer_path::activate_geometry_node(*bmain, snode, viewer_node); } - ED_node_tree_propagate_change(&C, bmain, snode.edittree); + ED_node_tree_propagate_change(bmain, snode.edittree); } static const bNode *find_overlapping_node(const bNodeTree &tree, @@ -849,7 +849,7 @@ static int node_active_link_viewer_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_CANCELLED; } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode.edittree); return OPERATOR_FINISHED; } @@ -1231,7 +1231,7 @@ static void add_dragged_links_to_tree(bContext &C, bNodeLinkDrag &nldrag) BKE_ntree_update_tag_link_added(&ntree, new_link); } - ED_node_tree_propagate_change(&C, bmain, &ntree); + ED_node_tree_propagate_change(bmain, &ntree); /* Ensure drag-link tool-tip is disabled. */ draw_draglink_tooltip_deactivate(region, nldrag); @@ -1252,7 +1252,7 @@ static void node_link_cancel(bContext *C, wmOperator *op) snode->runtime->linkdrag.reset(); clear_picking_highlight(&snode->edittree->links); BKE_ntree_update_tag_link_removed(snode->edittree); - ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode->edittree); } static void node_link_find_socket(bContext &C, wmOperator &op, const float2 &cursor) @@ -1619,7 +1619,7 @@ static int node_make_link_exec(bContext *C, wmOperator *op) node_deselect_all_input_sockets(node_tree, false); node_deselect_all_output_sockets(node_tree, false); - ED_node_tree_propagate_change(C, &bmain, &node_tree); + ED_node_tree_propagate_change(&bmain, &node_tree); return OPERATOR_FINISHED; } @@ -1708,7 +1708,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) update_multi_input_indices_for_removed_links(*node); } - ED_node_tree_propagate_change(C, CTX_data_main(C), snode.edittree); + ED_node_tree_propagate_change(CTX_data_main(C), snode.edittree); if (found) { return OPERATOR_FINISHED; } @@ -1838,7 +1838,7 @@ static int mute_links_exec(bContext *C, wmOperator *op) } } - ED_node_tree_propagate_change(C, CTX_data_main(C), &ntree); + ED_node_tree_propagate_change(CTX_data_main(C), &ntree); return OPERATOR_FINISHED; } @@ -1886,7 +1886,7 @@ static int detach_links_exec(bContext *C, wmOperator * /*op*/) } } - ED_node_tree_propagate_change(C, CTX_data_main(C), &ntree); + ED_node_tree_propagate_change(CTX_data_main(C), &ntree); return OPERATOR_FINISHED; } @@ -2057,7 +2057,7 @@ static int node_join_exec(bContext *C, wmOperator * /*op*/) } tree_draw_order_update(ntree); - ED_node_tree_propagate_change(C, &bmain, snode.edittree); + ED_node_tree_propagate_change(&bmain, snode.edittree); WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; @@ -2490,7 +2490,7 @@ void node_insert_on_link_flags(Main &bmain, SpaceNode &snode, bool is_new_node) snode.runtime->iofsd = iofsd; } - ED_node_tree_propagate_change(nullptr, &bmain, &ntree); + ED_node_tree_propagate_change(&bmain, &ntree); } /** \} */ diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc index 49c9998d6e91..9db55302faaf 100644 --- a/source/blender/editors/space_node/node_templates.cc +++ b/source/blender/editors/space_node/node_templates.cc @@ -179,7 +179,7 @@ static void node_socket_disconnect(Main *bmain, sock_to->flag |= SOCK_COLLAPSED; BKE_ntree_update_tag_node_property(ntree, node_to); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /* remove all nodes connected to this socket, if they aren't connected to other nodes */ @@ -193,7 +193,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN sock_to->flag |= SOCK_COLLAPSED; BKE_ntree_update_tag_node_property(ntree, node_to); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /* add new node connected to this socket, or replace an existing one */ @@ -247,7 +247,7 @@ static void node_socket_add_replace(const bContext *C, } node_link_item_apply(ntree, node_from, item); - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } bke::node_set_active(ntree, node_from); @@ -297,7 +297,7 @@ static void node_socket_add_replace(const bContext *C, BKE_ntree_update_tag_node_property(ntree, node_from); BKE_ntree_update_tag_node_property(ntree, node_to); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /****************************** Node Link Menu *******************************/ @@ -377,7 +377,7 @@ static Vector ui_node_link_items(NodeLinkArg *arg, item.socket_index = index++; item.socket_type = socket_decl.socket_type; item.socket_name = socket_decl.name.c_str(); - item.node_name = arg->node_type->ui_name; + item.node_name = arg->node_type->ui_name.c_str(); items.append(item); } } @@ -394,7 +394,7 @@ static Vector ui_node_link_items(NodeLinkArg *arg, item.socket_index = i; item.socket_type = stemp->type; item.socket_name = stemp->name; - item.node_name = arg->node_type->ui_name; + item.node_name = arg->node_type->ui_name.c_str(); items.append(item); } } @@ -459,12 +459,12 @@ static int ui_node_item_name_compare(const void *a, const void *b) { const bke::bNodeType *type_a = *(const bke::bNodeType **)a; const bke::bNodeType *type_b = *(const bke::bNodeType **)b; - return BLI_strcasecmp_natural(type_a->ui_name, type_b->ui_name); + return BLI_strcasecmp_natural(type_a->ui_name.c_str(), type_b->ui_name.c_str()); } static bool ui_node_item_special_poll(const bNodeTree * /*ntree*/, const bke::bNodeType *ntype) { - if (STREQ(ntype->idname, "ShaderNodeUVAlongStroke")) { + if (ntype->idname == "ShaderNodeUVAlongStroke") { /* TODO(sergey): Currently we don't have Freestyle nodes edited from * the buttons context, so can ignore its nodes completely. * @@ -735,7 +735,7 @@ static void node_panel_toggle_button_cb(bContext *C, void *panel_state_argv, voi panel_state->flag ^= NODE_PANEL_COLLAPSED; - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); /* Make sure panel state updates from the Properties Editor, too. */ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr); diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index afe4fa1ec750..6bfe249c1eb7 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -404,7 +404,7 @@ static SpaceLink *node_create(const ScrArea * /*area*/, const Scene * /*scene*/) /* select the first tree type for valid type */ for (const bke::bNodeTreeType *treetype : bke::node_tree_types_get()) { - STRNCPY(snode->tree_idname, treetype->idname); + STRNCPY(snode->tree_idname, treetype->idname.c_str()); break; } diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 4b2e82d7d602..338cbb1d4a44 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -2783,51 +2783,51 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case TSE_STRIP: { const TreeElementStrip *te_strip = tree_element_cast(te); switch (te_strip->get_strip_type()) { - case SEQ_TYPE_SCENE: + case STRIP_TYPE_SCENE: data.icon = ICON_SCENE_DATA; break; - case SEQ_TYPE_MOVIECLIP: + case STRIP_TYPE_MOVIECLIP: data.icon = ICON_TRACKER; break; - case SEQ_TYPE_MASK: + case STRIP_TYPE_MASK: data.icon = ICON_MOD_MASK; break; - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: data.icon = ICON_FILE_MOVIE; break; - case SEQ_TYPE_SOUND_RAM: + case STRIP_TYPE_SOUND_RAM: data.icon = ICON_SOUND; break; - case SEQ_TYPE_IMAGE: + case STRIP_TYPE_IMAGE: data.icon = ICON_FILE_IMAGE; break; - case SEQ_TYPE_COLOR: - case SEQ_TYPE_ADJUSTMENT: + case STRIP_TYPE_COLOR: + case STRIP_TYPE_ADJUSTMENT: data.icon = ICON_COLOR; break; - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: data.icon = ICON_FONT_DATA; break; - case SEQ_TYPE_ADD: - case SEQ_TYPE_SUB: - case SEQ_TYPE_MUL: - case SEQ_TYPE_OVERDROP: - case SEQ_TYPE_ALPHAOVER: - case SEQ_TYPE_ALPHAUNDER: - case SEQ_TYPE_COLORMIX: - case SEQ_TYPE_MULTICAM: - case SEQ_TYPE_TRANSFORM: - case SEQ_TYPE_SPEED: - case SEQ_TYPE_GLOW: - case SEQ_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_ADD: + case STRIP_TYPE_SUB: + case STRIP_TYPE_MUL: + case STRIP_TYPE_OVERDROP: + case STRIP_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAUNDER: + case STRIP_TYPE_COLORMIX: + case STRIP_TYPE_MULTICAM: + case STRIP_TYPE_TRANSFORM: + case STRIP_TYPE_SPEED: + case STRIP_TYPE_GLOW: + case STRIP_TYPE_GAUSSIAN_BLUR: data.icon = ICON_SHADERFX; break; - case SEQ_TYPE_CROSS: - case SEQ_TYPE_GAMCROSS: - case SEQ_TYPE_WIPE: + case STRIP_TYPE_CROSS: + case STRIP_TYPE_GAMCROSS: + case STRIP_TYPE_WIPE: data.icon = ICON_ARROW_LEFTRIGHT; break; - case SEQ_TYPE_META: + case STRIP_TYPE_META: data.icon = ICON_SEQ_STRIP_META; break; default: diff --git a/source/blender/editors/space_outliner/outliner_intern.hh b/source/blender/editors/space_outliner/outliner_intern.hh index bec1c3b09d18..dd515bac0635 100644 --- a/source/blender/editors/space_outliner/outliner_intern.hh +++ b/source/blender/editors/space_outliner/outliner_intern.hh @@ -10,6 +10,8 @@ #include +#include "DNA_listBase.h" + #include "BLI_function_ref.hh" #include "RNA_types.hh" diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index a5c8f66863dc..34dede0f2761 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -736,21 +736,21 @@ static void tree_element_strip_activate(bContext *C, const eOLSetState set) { const TreeElementStrip *te_strip = tree_element_cast(te); - Strip *seq = &te_strip->get_strip(); + Strip *strip = &te_strip->get_strip(); Editing *ed = SEQ_editing_get(scene); - if (BLI_findindex(ed->seqbasep, seq) != -1) { + if (BLI_findindex(ed->seqbasep, strip) != -1) { if (set == OL_SETSEL_EXTEND) { SEQ_select_active_set(scene, nullptr); } ED_sequencer_deselect_all(scene); - if ((set == OL_SETSEL_EXTEND) && seq->flag & SELECT) { - seq->flag &= ~SELECT; + if ((set == OL_SETSEL_EXTEND) && strip->flag & SELECT) { + strip->flag &= ~SELECT; } else { - seq->flag |= SELECT; - SEQ_select_active_set(scene, seq); + strip->flag |= SELECT; + SEQ_select_active_set(scene, strip); } } @@ -762,7 +762,7 @@ static void tree_element_strip_dup_activate(Scene *scene, TreeElement * /*te*/) Editing *ed = SEQ_editing_get(scene); #if 0 - select_single_seq(seq, 1); + select_single_seq(strip, 1); #endif Strip *p = static_cast(ed->seqbasep->first); while (p) { @@ -772,7 +772,7 @@ static void tree_element_strip_dup_activate(Scene *scene, TreeElement * /*te*/) } #if 0 - if (STREQ(p->strip->stripdata->filename, seq->data->stripdata->filename)) { + if (STREQ(p->strip->stripdata->filename, strip->data->stripdata->filename)) { select_single_seq(p, 0); } #endif @@ -1023,10 +1023,10 @@ static eOLDrawState tree_element_bone_collection_state_get(const TreeElement *te static eOLDrawState tree_element_strip_state_get(const Scene *scene, const TreeElement *te) { const TreeElementStrip *te_strip = tree_element_cast(te); - const Strip *seq = &te_strip->get_strip(); + const Strip *strip = &te_strip->get_strip(); const Editing *ed = scene->ed; - if (ed && ed->act_seq == seq && seq->flag & SELECT) { + if (ed && ed->act_seq == strip && strip->flag & SELECT) { return OL_DRAWSEL_NORMAL; } return OL_DRAWSEL_NONE; @@ -1035,8 +1035,8 @@ static eOLDrawState tree_element_strip_state_get(const Scene *scene, const TreeE static eOLDrawState tree_element_strip_dup_state_get(const TreeElement *te) { const TreeElementStripDuplicate *te_dup = tree_element_cast(te); - const Strip *seq = &te_dup->get_strip(); - if (seq->flag & SELECT) { + const Strip *strip = &te_dup->get_strip(); + if (strip->flag & SELECT) { return OL_DRAWSEL_NORMAL; } return OL_DRAWSEL_NONE; diff --git a/source/blender/editors/space_outliner/outliner_sync.cc b/source/blender/editors/space_outliner/outliner_sync.cc index e22324178930..a02ad0f28344 100644 --- a/source/blender/editors/space_outliner/outliner_sync.cc +++ b/source/blender/editors/space_outliner/outliner_sync.cc @@ -255,17 +255,17 @@ static void outliner_select_sync_to_strip(Scene *scene, const TreeElement *te) const TreeStoreElem *tselem = TREESTORE(te); const TreeElementStrip *te_strip = tree_element_cast(te); - Strip *seq = &te_strip->get_strip(); + Strip *strip = &te_strip->get_strip(); if (tselem->flag & TSE_ACTIVE) { - SEQ_select_active_set(scene, seq); + SEQ_select_active_set(scene, strip); } if (tselem->flag & TSE_SELECTED) { - seq->flag |= SELECT; + strip->flag |= SELECT; } else { - seq->flag &= ~SELECT; + strip->flag &= ~SELECT; } } @@ -429,16 +429,16 @@ static void outliner_select_sync_from_strip(Strip *strip_active, const TreeEleme TreeStoreElem *tselem = TREESTORE(te); const TreeElementStrip *te_strip = tree_element_cast(te); - const Strip *seq = &te_strip->get_strip(); + const Strip *strip = &te_strip->get_strip(); - if (seq == strip_active) { + if (strip == strip_active) { tselem->flag |= TSE_ACTIVE; } else { tselem->flag &= ~TSE_ACTIVE; } - if (seq->flag & SELECT) { + if (strip->flag & SELECT) { tselem->flag |= TSE_SELECTED; } else { diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index 1edb1a8c66ee..70f4800e5f57 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -2150,26 +2150,26 @@ static void ebone_fn(int event, TreeElement *te, TreeStoreElem * /*tselem*/, voi static void sequence_fn(int event, TreeElement *te, TreeStoreElem * /*tselem*/, void *scene_ptr) { TreeElementStrip *te_strip = tree_element_cast(te); - Strip *seq = &te_strip->get_strip(); + Strip *strip = &te_strip->get_strip(); Scene *scene = (Scene *)scene_ptr; Editing *ed = SEQ_editing_get(scene); - if (BLI_findindex(ed->seqbasep, seq) != -1) { + if (BLI_findindex(ed->seqbasep, strip) != -1) { if (event == OL_DOP_SELECT) { - ED_sequencer_select_sequence_single(scene, seq, true); + ED_sequencer_select_sequence_single(scene, strip, true); } else if (event == OL_DOP_DESELECT) { - seq->flag &= ~SELECT; + strip->flag &= ~SELECT; } else if (event == OL_DOP_HIDE) { - if (!(seq->flag & SEQ_MUTE)) { - seq->flag |= SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if (!(strip->flag & SEQ_MUTE)) { + strip->flag |= SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } else if (event == OL_DOP_UNHIDE) { - if (seq->flag & SEQ_MUTE) { - seq->flag &= ~SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if (strip->flag & SEQ_MUTE) { + strip->flag &= ~SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } } @@ -2722,7 +2722,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op) WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active); } - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -3021,7 +3021,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) break; } - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); /* wrong notifier still... */ WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr); @@ -3112,7 +3112,7 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op) break; } - ED_node_tree_propagate_change(C, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); /* wrong notifier still... */ WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr); diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh index 5d7c05a9f88e..1b78d0ce4a66 100644 --- a/source/blender/editors/space_outliner/tree/tree_display.hh +++ b/source/blender/editors/space_outliner/tree/tree_display.hh @@ -233,8 +233,8 @@ class TreeDisplaySequencer final : public AbstractTreeDisplay { /** * Helped function to put duplicate sequence in the same tree. */ - StripAddOp need_add_strip_dup(Strip *seq) const; - void add_strip_dup(Strip *seq, TreeElement *te, short index); + StripAddOp need_add_strip_dup(Strip *strip) const; + void add_strip_dup(Strip *strip, TreeElement *te, short index); }; /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc index 18620cf3056b..2ccb1e64e9c2 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc @@ -38,23 +38,23 @@ ListBase TreeDisplaySequencer::build_tree(const TreeSourceData &source_data) return tree; } - for (Strip *seq : List(ed->seqbasep)) { - StripAddOp op = need_add_strip_dup(seq); + for (Strip *strip : List(ed->seqbasep)) { + StripAddOp op = need_add_strip_dup(strip); if (op == StripAddOp::None) { - add_element(&tree, nullptr, seq, nullptr, TSE_STRIP, 0); + add_element(&tree, nullptr, strip, nullptr, TSE_STRIP, 0); } else if (op == StripAddOp::Add) { - TreeElement *te = add_element(&tree, nullptr, seq, nullptr, TSE_STRIP_DUP, 0); - add_strip_dup(seq, te, 0); + TreeElement *te = add_element(&tree, nullptr, strip, nullptr, TSE_STRIP_DUP, 0); + add_strip_dup(strip, te, 0); } } return tree; } -StripAddOp TreeDisplaySequencer::need_add_strip_dup(Strip *seq) const +StripAddOp TreeDisplaySequencer::need_add_strip_dup(Strip *strip) const { - if ((!seq->data) || (!seq->data->stripdata)) { + if ((!strip->data) || (!strip->data->stripdata)) { return StripAddOp::None; } @@ -62,27 +62,27 @@ StripAddOp TreeDisplaySequencer::need_add_strip_dup(Strip *seq) const * First check backward, if we found a duplicate * sequence before this, don't need it, just return. */ - Strip *p = seq->prev; + Strip *p = strip->prev; while (p) { if ((!p->data) || (!p->data->stripdata)) { p = p->prev; continue; } - if (STREQ(p->data->stripdata->filename, seq->data->stripdata->filename)) { + if (STREQ(p->data->stripdata->filename, strip->data->stripdata->filename)) { return StripAddOp::Noop; } p = p->prev; } - p = seq->next; + p = strip->next; while (p) { if ((!p->data) || (!p->data->stripdata)) { p = p->next; continue; } - if (STREQ(p->data->stripdata->filename, seq->data->stripdata->filename)) { + if (STREQ(p->data->stripdata->filename, strip->data->stripdata->filename)) { return StripAddOp::Add; } p = p->next; @@ -91,16 +91,16 @@ StripAddOp TreeDisplaySequencer::need_add_strip_dup(Strip *seq) const return StripAddOp::None; } -void TreeDisplaySequencer::add_strip_dup(Strip *seq, TreeElement *te, short index) +void TreeDisplaySequencer::add_strip_dup(Strip *strip, TreeElement *te, short index) { - Strip *p = seq; + Strip *p = strip; while (p) { if ((!p->data) || (!p->data->stripdata) || (p->data->stripdata->filename[0] == '\0')) { p = p->next; continue; } - if (STREQ(p->data->stripdata->filename, seq->data->stripdata->filename)) { + if (STREQ(p->data->stripdata->filename, strip->data->stripdata->filename)) { add_element(&te->subtree, nullptr, (void *)p, te, TSE_STRIP, index); } p = p->next; diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh index 0e8aafa48b4e..566732bdefff 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct AnimData; + namespace blender::ed::outliner { class TreeElementAnimData final : public AbstractTreeElement { diff --git a/source/blender/editors/space_outliner/tree/tree_element_collection.hh b/source/blender/editors/space_outliner/tree/tree_element_collection.hh index c94c83e84724..4e6d521b625e 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_collection.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_collection.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct Scene; + namespace blender::ed::outliner { class TreeElementCollectionBase final : public AbstractTreeElement { diff --git a/source/blender/editors/space_outliner/tree/tree_element_constraint.hh b/source/blender/editors/space_outliner/tree/tree_element_constraint.hh index f52be424fcb7..fa7a2b0c6d3c 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_constraint.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_constraint.hh @@ -11,6 +11,7 @@ #include "tree_element.hh" struct bConstraint; +struct Object; namespace blender::ed::outliner { diff --git a/source/blender/editors/space_outliner/tree/tree_element_driver.hh b/source/blender/editors/space_outliner/tree/tree_element_driver.hh index d13fe702d70c..f0e33bdf9dad 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_driver.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_driver.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct AnimData; + namespace blender::ed::outliner { class TreeElementDriverBase final : public AbstractTreeElement { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_collection.hh b/source/blender/editors/space_outliner/tree/tree_element_id_collection.hh index 701bb842b282..7f12417c4e82 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_collection.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_collection.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct Collection; + namespace blender::ed::outliner { class TreeElementIDCollection final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_curve.hh b/source/blender/editors/space_outliner/tree/tree_element_id_curve.hh index 387ecffbb53b..be10660a51c1 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_curve.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_curve.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct Curve; + namespace blender::ed::outliner { class TreeElementIDCurve final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_gpencil_legacy.hh b/source/blender/editors/space_outliner/tree/tree_element_id_gpencil_legacy.hh index 1e045f092942..08fe9f279bd4 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_gpencil_legacy.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_gpencil_legacy.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct bGPdata; + namespace blender::ed::outliner { class TreeElementIDGPLegacy final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_object.hh b/source/blender/editors/space_outliner/tree/tree_element_id_object.hh index 87034c27fcb5..33d15f82dc0e 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_object.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_object.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct Object; + namespace blender::ed::outliner { class TreeElementIDObject final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh b/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh index 772f26f0e17d..9d3453293821 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct Scene; + namespace blender::ed::outliner { class TreeElementIDScene final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_texture.hh b/source/blender/editors/space_outliner/tree/tree_element_id_texture.hh index 3acad7be8483..dc5eab316a45 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_id_texture.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_id_texture.hh @@ -10,6 +10,8 @@ #include "tree_element_id.hh" +struct Tex; + namespace blender::ed::outliner { class TreeElementIDTexture final : public TreeElementID { diff --git a/source/blender/editors/space_outliner/tree/tree_element_layer_collection.hh b/source/blender/editors/space_outliner/tree/tree_element_layer_collection.hh index 6f2479d934cc..d1d760763f7c 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_layer_collection.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_layer_collection.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct LayerCollection; + namespace blender::ed::outliner { class TreeElementLayerCollection final : public AbstractTreeElement { diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.hh b/source/blender/editors/space_outliner/tree/tree_element_nla.hh index 2acec04c62d5..19970a8338e6 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_nla.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_nla.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct bAction; +struct AnimData; struct NlaTrack; namespace blender::ed::outliner { diff --git a/source/blender/editors/space_outliner/tree/tree_element_particle_system.hh b/source/blender/editors/space_outliner/tree/tree_element_particle_system.hh index 35e243e3d8cb..c6080db70054 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_particle_system.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_particle_system.hh @@ -10,6 +10,7 @@ #include "tree_element.hh" +struct Object; struct ParticleSystem; namespace blender::ed::outliner { diff --git a/source/blender/editors/space_outliner/tree/tree_element_pose.hh b/source/blender/editors/space_outliner/tree/tree_element_pose.hh index a1a8f4826dd8..ecd1a62a6ba0 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_pose.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_pose.hh @@ -10,6 +10,7 @@ #include "tree_element.hh" +struct bPoseChannel; struct Object; namespace blender::ed::outliner { diff --git a/source/blender/editors/space_outliner/tree/tree_element_seq.cc b/source/blender/editors/space_outliner/tree/tree_element_seq.cc index 9bc16db307b3..9d4d6025fcc1 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_seq.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_seq.cc @@ -27,7 +27,7 @@ TreeElementStrip::TreeElementStrip(TreeElement &legacy_te, Strip &strip) bool TreeElementStrip::expand_poll(const SpaceOutliner & /*space_outliner*/) const { - return !(strip_.type & SEQ_TYPE_EFFECT); + return !(strip_.type & STRIP_TYPE_EFFECT); } void TreeElementStrip::expand(SpaceOutliner & /*space_outliner*/) const @@ -38,7 +38,7 @@ void TreeElementStrip::expand(SpaceOutliner & /*space_outliner*/) const * show it, in other case put the filename. */ - if (strip_.type == SEQ_TYPE_META) { + if (strip_.type == STRIP_TYPE_META) { LISTBASE_FOREACH (Strip *, child, &strip_.seqbase) { add_element(&legacy_te_.subtree, nullptr, child, &legacy_te_, TSE_STRIP, 0); } @@ -53,9 +53,9 @@ Strip &TreeElementStrip::get_strip() const return strip_; } -SequenceType TreeElementStrip::get_strip_type() const +StripType TreeElementStrip::get_strip_type() const { - return SequenceType(strip_.type); + return StripType(strip_.type); } /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/tree/tree_element_seq.hh b/source/blender/editors/space_outliner/tree/tree_element_seq.hh index c25eab238a39..ca1ea0697e02 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_seq.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_seq.hh @@ -27,7 +27,7 @@ class TreeElementStrip : public AbstractTreeElement { void expand(SpaceOutliner &) const override; Strip &get_strip() const; - SequenceType get_strip_type() const; + StripType get_strip_type() const; }; /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/tree/tree_element_view_collection.hh b/source/blender/editors/space_outliner/tree/tree_element_view_collection.hh index bf63a7aa3421..020fbf37890c 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_view_collection.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_view_collection.hh @@ -10,6 +10,8 @@ #include "tree_element.hh" +struct Scene; + namespace blender::ed::outliner { class TreeElementViewCollectionBase final : public AbstractTreeElement { diff --git a/source/blender/editors/space_outliner/tree/tree_element_view_layer.hh b/source/blender/editors/space_outliner/tree/tree_element_view_layer.hh index 7ef6644d7ab7..977af82fc309 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_view_layer.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_view_layer.hh @@ -10,6 +10,9 @@ #include "tree_element.hh" +struct Scene; +struct ViewLayer; + namespace blender::ed::outliner { class TreeElementViewLayerBase final : public AbstractTreeElement { diff --git a/source/blender/editors/space_script/script_intern.hh b/source/blender/editors/space_script/script_intern.hh index 43e5cf3579d8..235c3b006d25 100644 --- a/source/blender/editors/space_script/script_intern.hh +++ b/source/blender/editors/space_script/script_intern.hh @@ -10,6 +10,9 @@ /* internal exports only */ +struct wmKeyConfig; +struct wmOperatorType; + /* `script_ops.cc` */ void script_operatortypes(); diff --git a/source/blender/editors/space_sequencer/sequencer_add.cc b/source/blender/editors/space_sequencer/sequencer_add.cc index b14aa9531e36..72381c4436fb 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.cc +++ b/source/blender/editors/space_sequencer/sequencer_add.cc @@ -174,7 +174,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, if (RNA_struct_find_property(op->ptr, identifier)) { Scene *scene = CTX_data_scene(C); Strip *last_seq = SEQ_select_active_get(scene); - if (last_seq && last_seq->data && SEQ_HAS_PATH(last_seq)) { + if (last_seq && last_seq->data && STRIP_HAS_PATH(last_seq)) { Main *bmain = CTX_data_main(C); char dirpath[FILE_MAX]; STRNCPY(dirpath, last_seq->data->dirpath); @@ -196,18 +196,18 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) return 1; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - const int strip_end = SEQ_time_right_handle_frame_get(scene, seq); - if (ELEM(type, -1, seq->type) && (strip_end <= timeline_frame) && + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + const int strip_end = SEQ_time_right_handle_frame_get(scene, strip); + if (ELEM(type, -1, strip->type) && (strip_end <= timeline_frame) && (timeline_frame - strip_end < proximity)) { - tgt = seq; + tgt = strip; proximity = timeline_frame - strip_end; } } if (tgt) { - return (type == SEQ_TYPE_MOVIE) ? tgt->machine - 1 : tgt->machine; + return (type == STRIP_TYPE_MOVIE) ? tgt->machine - 1 : tgt->machine; } return 1; } @@ -372,22 +372,22 @@ static bool load_data_init_from_operator(SeqLoadData *load_data, bContext *C, wm return true; } -static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *seq) +static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *strip) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - if (seq == nullptr) { + if (strip == nullptr) { return; } if (RNA_boolean_get(op->ptr, "replace_sel")) { - seq->flag |= SELECT; - SEQ_select_active_set(scene, seq); + strip->flag |= SELECT; + SEQ_select_active_set(scene, strip); } if (RNA_boolean_get(op->ptr, "overlap") == true || - !SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) + !SEQ_transform_test_overlap(scene, ed->seqbasep, strip)) { /* No overlap should be handled or the strip is not overlapping, exit early. */ return; @@ -396,7 +396,7 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *s if (RNA_boolean_get(op->ptr, "overlap_shuffle_override")) { /* Use set overlap_mode to fix overlaps. */ blender::VectorSet strip_col; - strip_col.add(seq); + strip_col.add(strip); ScrArea *area = CTX_wm_area(C); const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag & SEQ_MARKER_TRANS) != @@ -405,28 +405,28 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *s } else { /* Shuffle strip channel to fix overlaps. */ - SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); + SEQ_transform_seqbase_shuffle(ed->seqbasep, strip, scene); } } /* In this alternative version we only check for overlap, but do not do anything about them. */ static bool seq_load_apply_generic_options_only_test_overlap(bContext *C, wmOperator *op, - Strip *seq) + Strip *strip) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - if (seq == nullptr) { + if (strip == nullptr) { return false; } if (RNA_boolean_get(op->ptr, "replace_sel")) { - seq->flag |= SELECT; - SEQ_select_active_set(scene, seq); + strip->flag |= SELECT; + SEQ_select_active_set(scene, strip); } - return SEQ_transform_test_overlap(scene, ed->seqbasep, seq); + return SEQ_transform_test_overlap(scene, ed->seqbasep, strip); } static bool seq_effect_add_properties_poll(const bContext * /*C*/, @@ -442,7 +442,7 @@ static bool seq_effect_add_properties_poll(const bContext * /*C*/, return false; } } - if ((type != SEQ_TYPE_COLOR) && STREQ(prop_id, "color")) { + if ((type != STRIP_TYPE_COLOR) && STREQ(prop_id, "color")) { return false; } @@ -470,8 +470,8 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) load_data_init_from_operator(&load_data, C, op); load_data.scene = sce_seq; - Strip *seq = SEQ_add_scene_strip(scene, ed->seqbasep, &load_data); - seq_load_apply_generic_options(C, op, seq); + Strip *strip = SEQ_add_scene_strip(scene, ed->seqbasep, &load_data); + seq_load_apply_generic_options(C, op, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_relations_tag_update(bmain); @@ -501,7 +501,7 @@ static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, const w return WM_enum_search_invoke(C, op, event); } - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_SCENE); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_SCENE); return sequencer_add_scene_strip_exec(C, op); } @@ -569,8 +569,8 @@ static int sequencer_add_scene_strip_new_exec(bContext *C, wmOperator *op) } load_data.scene = scene_new; - Strip *seq = SEQ_add_scene_strip(scene, ed->seqbasep, &load_data); - seq_load_apply_generic_options(C, op, seq); + Strip *strip = SEQ_add_scene_strip(scene, ed->seqbasep, &load_data); + seq_load_apply_generic_options(C, op, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_relations_tag_update(bmain); @@ -584,7 +584,7 @@ static int sequencer_add_scene_strip_new_invoke(bContext *C, const wmEvent * /*event*/) { sequencer_disable_one_time_properties(C, op); - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_SCENE); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_SCENE); return sequencer_add_scene_strip_new_exec(C, op); } @@ -607,8 +607,8 @@ static const EnumPropertyItem *strip_new_sequencer_enum_itemf(bContext *C, } else { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); - if (seq && (seq->type == SEQ_TYPE_SCENE) && (seq->scene != nullptr)) { + Strip *strip = SEQ_select_active_get(scene); + if (strip && (strip->type == STRIP_TYPE_SCENE) && (strip->scene != nullptr)) { has_scene_or_no_context = true; } } @@ -671,8 +671,8 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) } load_data.clip = clip; - Strip *seq = SEQ_add_movieclip_strip(scene, ed->seqbasep, &load_data); - seq_load_apply_generic_options(C, op, seq); + Strip *strip = SEQ_add_movieclip_strip(scene, ed->seqbasep, &load_data); + seq_load_apply_generic_options(C, op, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -686,7 +686,7 @@ static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, con return WM_enum_search_invoke(C, op, event); } - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIECLIP); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_MOVIECLIP); return sequencer_add_movieclip_strip_exec(C, op); } @@ -735,8 +735,8 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) load_data_init_from_operator(&load_data, C, op); load_data.mask = mask; - Strip *seq = SEQ_add_mask_strip(scene, ed->seqbasep, &load_data); - seq_load_apply_generic_options(C, op, seq); + Strip *strip = SEQ_add_mask_strip(scene, ed->seqbasep, &load_data); + seq_load_apply_generic_options(C, op, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -750,7 +750,7 @@ static int sequencer_add_mask_strip_invoke(bContext *C, wmOperator *op, const wm return WM_enum_search_invoke(C, op, event); } - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MASK); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_MASK); return sequencer_add_mask_strip_exec(C, op); } @@ -829,12 +829,13 @@ static void seq_build_proxy(bContext *C, blender::Span movie_strips) wmJob *wm_job = ED_seq_proxy_wm_job_get(C); ProxyJob *pj = ED_seq_proxy_job_get(C, wm_job); - for (Strip *seq : movie_strips) { + for (Strip *strip : movie_strips) { /* Enable and set proxy size. */ - SEQ_proxy_set(seq, true); - seq->data->proxy->build_size_flags = seq_get_proxy_size_flags(C); - seq->data->proxy->build_flags |= SEQ_PROXY_SKIP_EXISTING; - SEQ_proxy_rebuild_context(pj->main, pj->depsgraph, pj->scene, seq, nullptr, &pj->queue, true); + SEQ_proxy_set(strip, true); + strip->data->proxy->build_size_flags = seq_get_proxy_size_flags(C); + strip->data->proxy->build_flags |= SEQ_PROXY_SKIP_EXISTING; + SEQ_proxy_rebuild_context( + pj->main, pj->depsgraph, pj->scene, strip, nullptr, &pj->queue, true); } if (!WM_jobs_is_running(wm_job)) { @@ -845,22 +846,22 @@ static void seq_build_proxy(bContext *C, blender::Span movie_strips) } static void sequencer_add_movie_sync_sound_strip( - Main *bmain, Scene *scene, Strip *seq_movie, Strip *seq_sound, SeqLoadData *load_data) + Main *bmain, Scene *scene, Strip *strip_movie, Strip *strip_sound, SeqLoadData *load_data) { - if (ELEM(nullptr, seq_movie, seq_sound)) { + if (ELEM(nullptr, strip_movie, strip_sound)) { return; } /* Make sure that the sound strip start time relative to the movie is taken into account. */ - SEQ_add_sound_av_sync(bmain, scene, seq_sound, load_data); + SEQ_add_sound_av_sync(bmain, scene, strip_sound, load_data); /* Ensure that the sound strip start/end matches the movie strip even if the actual * length and true position of the sound doesn't match up exactly. */ SEQ_time_right_handle_frame_set( - scene, seq_sound, SEQ_time_right_handle_frame_get(scene, seq_movie)); + scene, strip_sound, SEQ_time_right_handle_frame_get(scene, strip_movie)); SEQ_time_left_handle_frame_set( - scene, seq_sound, SEQ_time_left_handle_frame_get(scene, seq_movie)); + scene, strip_sound, SEQ_time_left_handle_frame_get(scene, strip_movie)); } static void sequencer_add_movie_multiple_strips(bContext *C, @@ -883,44 +884,44 @@ static void sequencer_add_movie_multiple_strips(bContext *C, RNA_string_get(&itemptr, "name", file_only); BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only); STRNCPY(load_data->name, file_only); - Strip *seq_movie = nullptr; - Strip *seq_sound = nullptr; + Strip *strip_movie = nullptr; + Strip *strip_sound = nullptr; - seq_movie = SEQ_add_movie_strip(bmain, scene, ed->seqbasep, load_data); + strip_movie = SEQ_add_movie_strip(bmain, scene, ed->seqbasep, load_data); - if (seq_movie == nullptr) { + if (strip_movie == nullptr) { BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); } else { if (RNA_boolean_get(op->ptr, "sound")) { - seq_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - sequencer_add_movie_sync_sound_strip(bmain, scene, seq_movie, seq_sound, load_data); - added_strips.append(seq_movie); + strip_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); + sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data); + added_strips.append(strip_movie); - if (seq_sound) { + if (strip_sound) { /* The video has sound, shift the video strip up a channel to make room for the sound * strip. */ - added_strips.append(seq_sound); - seq_movie->machine++; + added_strips.append(strip_sound); + strip_movie->machine++; } } - load_data->start_frame += SEQ_time_right_handle_frame_get(scene, seq_movie) - - SEQ_time_left_handle_frame_get(scene, seq_movie); + load_data->start_frame += SEQ_time_right_handle_frame_get(scene, strip_movie) - + SEQ_time_left_handle_frame_get(scene, strip_movie); if (overlap_shuffle_override) { - has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, seq_sound); - has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, seq_movie); + has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, strip_sound); + has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, strip_movie); } else { - seq_load_apply_generic_options(C, op, seq_sound); - seq_load_apply_generic_options(C, op, seq_movie); + seq_load_apply_generic_options(C, op, strip_sound); + seq_load_apply_generic_options(C, op, strip_movie); } if (U.sequencer_editor_flag & USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT) { - SEQ_connect(seq_movie, seq_sound); + SEQ_connect(strip_movie, strip_sound); } - r_movie_strips.add(seq_movie); + r_movie_strips.add(strip_movie); } } RNA_END; @@ -944,26 +945,26 @@ static bool sequencer_add_movie_single_strip(bContext *C, Scene *scene = CTX_data_scene(C); const Editing *ed = SEQ_editing_ensure(scene); - Strip *seq_movie = nullptr; - Strip *seq_sound = nullptr; + Strip *strip_movie = nullptr; + Strip *strip_sound = nullptr; blender::Vector added_strips; - seq_movie = SEQ_add_movie_strip(bmain, scene, ed->seqbasep, load_data); + strip_movie = SEQ_add_movie_strip(bmain, scene, ed->seqbasep, load_data); - if (seq_movie == nullptr) { + if (strip_movie == nullptr) { BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); return false; } if (RNA_boolean_get(op->ptr, "sound")) { - seq_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - sequencer_add_movie_sync_sound_strip(bmain, scene, seq_movie, seq_sound, load_data); - added_strips.append(seq_movie); + strip_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); + sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data); + added_strips.append(strip_movie); - if (seq_sound) { - added_strips.append(seq_sound); + if (strip_sound) { + added_strips.append(strip_sound); /* The video has sound, shift the video strip up a channel to make room for the sound * strip. */ - seq_movie->machine++; + strip_movie->machine++; } } @@ -972,8 +973,8 @@ static bool sequencer_add_movie_single_strip(bContext *C, if (overlap_shuffle_override) { bool has_seq_overlap = false; - has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, seq_sound); - has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, seq_movie); + has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, strip_sound); + has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(C, op, strip_movie); if (has_seq_overlap) { ScrArea *area = CTX_wm_area(C); @@ -983,15 +984,15 @@ static bool sequencer_add_movie_single_strip(bContext *C, } } else { - seq_load_apply_generic_options(C, op, seq_sound); - seq_load_apply_generic_options(C, op, seq_movie); + seq_load_apply_generic_options(C, op, strip_sound); + seq_load_apply_generic_options(C, op, strip_movie); } if (U.sequencer_editor_flag & USER_SEQ_ED_CONNECT_STRIPS_BY_DEFAULT) { - SEQ_connect(seq_movie, seq_sound); + SEQ_connect(strip_movie, strip_sound); } - r_movie_strips.add(seq_movie); + r_movie_strips.add(strip_movie); return true; } @@ -1051,11 +1052,11 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, const w !RNA_collection_is_empty(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) { - sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_MOVIE, event); + sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, STRIP_TYPE_MOVIE, event); return sequencer_add_movie_strip_exec(C, op); } - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIE); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_MOVIE); sequencer_add_init(C, op); /* Show multiview save options only if scene use multiview. */ @@ -1142,14 +1143,14 @@ static void sequencer_add_sound_multiple_strips(bContext *C, RNA_string_get(&itemptr, "name", file_only); BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only); STRNCPY(load_data->name, file_only); - Strip *seq = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - if (seq == nullptr) { + Strip *strip = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); + if (strip == nullptr) { BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); } else { - seq_load_apply_generic_options(C, op, seq); - load_data->start_frame += SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq); + seq_load_apply_generic_options(C, op, strip); + load_data->start_frame += SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip); } } RNA_END; @@ -1161,12 +1162,12 @@ static bool sequencer_add_sound_single_strip(bContext *C, wmOperator *op, SeqLoa Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_ensure(scene); - Strip *seq = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); - if (seq == nullptr) { + Strip *strip = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); + if (strip == nullptr) { BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); return false; } - seq_load_apply_generic_options(C, op, seq); + seq_load_apply_generic_options(C, op, strip); return true; } @@ -1211,11 +1212,11 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, const w !RNA_collection_is_empty(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) { - sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_SOUND_RAM, event); + sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, STRIP_TYPE_SOUND_RAM, event); return sequencer_add_sound_strip_exec(C, op); } - sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_SOUND_RAM); + sequencer_generic_invoke_xy__internal(C, op, 0, STRIP_TYPE_SOUND_RAM); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -1326,25 +1327,25 @@ static int sequencer_add_image_strip_calculate_length(wmOperator *op, static void sequencer_add_image_strip_load_files(wmOperator *op, Scene *scene, - Strip *seq, + Strip *strip, SeqLoadData *load_data, const int minframe, const int numdigits) { const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); - char dirpath[sizeof(seq->data->dirpath)]; + char dirpath[sizeof(strip->data->dirpath)]; BLI_path_split_dir_part(load_data->path, dirpath, sizeof(dirpath)); - SEQ_add_image_set_directory(seq, dirpath); + SEQ_add_image_set_directory(strip, dirpath); if (use_placeholders) { sequencer_image_seq_reserve_frames( - op, seq->data->stripdata, load_data->image.len, minframe, numdigits); + op, strip->data->stripdata, load_data->image.len, minframe, numdigits); } else { size_t strip_frame = 0; RNA_BEGIN (op->ptr, itemptr, "files") { char *filename = RNA_string_get_alloc(&itemptr, "name", nullptr, 0, nullptr); - SEQ_add_image_load_file(scene, seq, strip_frame, filename); + SEQ_add_image_load_file(scene, strip, strip_frame, filename); MEM_freeN(filename); strip_frame++; } @@ -1374,16 +1375,16 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) ED_sequencer_deselect_all(scene); } - Strip *seq = SEQ_add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data); - sequencer_add_image_strip_load_files(op, scene, seq, &load_data, minframe, numdigits); - SEQ_add_image_init_alpha_mode(seq); + Strip *strip = SEQ_add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data); + sequencer_add_image_strip_load_files(op, scene, strip, &load_data, minframe, numdigits); + SEQ_add_image_init_alpha_mode(strip); /* Adjust length. */ if (load_data.image.len == 1) { - SEQ_time_right_handle_frame_set(scene, seq, load_data.image.end_frame); + SEQ_time_right_handle_frame_set(scene, strip, load_data.image.end_frame); } - seq_load_apply_generic_options(C, op, seq); + seq_load_apply_generic_options(C, op, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -1406,11 +1407,11 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, const w /* Name set already by drag and drop. */ if (RNA_struct_property_is_set(op->ptr, "files") && !RNA_collection_is_empty(op->ptr, "files")) { sequencer_generic_invoke_xy__internal( - C, op, SEQPROP_ENDFRAME | SEQPROP_NOPATHS, SEQ_TYPE_IMAGE, event); + C, op, SEQPROP_ENDFRAME | SEQPROP_NOPATHS, STRIP_TYPE_IMAGE, event); return sequencer_add_image_strip_exec(C, op); } - sequencer_generic_invoke_xy__internal(C, op, SEQPROP_ENDFRAME, SEQ_TYPE_IMAGE); + sequencer_generic_invoke_xy__internal(C, op, SEQPROP_ENDFRAME, STRIP_TYPE_IMAGE); sequencer_add_init(C, op); /* Show multiview save options only if scene use multiview. */ @@ -1468,7 +1469,8 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) load_data.effect.type = RNA_enum_get(op->ptr, "type"); Strip *seq1, *seq2; - if (!seq_effect_find_selected(scene, nullptr, load_data.effect.type, &seq1, &seq2, &error_msg)) { + if (!strip_effect_find_selected(scene, nullptr, load_data.effect.type, &seq1, &seq2, &error_msg)) + { BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } @@ -1490,11 +1492,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) } } - Strip *seq = SEQ_add_effect_strip(scene, ed->seqbasep, &load_data); - seq_load_apply_generic_options(C, op, seq); + Strip *strip = SEQ_add_effect_strip(scene, ed->seqbasep, &load_data); + seq_load_apply_generic_options(C, op, strip); - if (seq->type == SEQ_TYPE_COLOR) { - SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; + if (strip->type == STRIP_TYPE_COLOR) { + SolidColorVars *colvars = (SolidColorVars *)strip->effectdata; RNA_float_get_array(op->ptr, "color", colvars->col); } @@ -1534,41 +1536,41 @@ static std::string sequencer_add_effect_strip_get_description(bContext * /*C*/, const int type = RNA_enum_get(ptr, "type"); switch (type) { - case SEQ_TYPE_CROSS: + case STRIP_TYPE_CROSS: return TIP_("Add a crossfade transition to the sequencer"); - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: return TIP_("Add an add effect strip to the sequencer"); - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: return TIP_("Add a subtract effect strip to the sequencer"); - case SEQ_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAOVER: return TIP_("Add an alpha over effect strip to the sequencer"); - case SEQ_TYPE_ALPHAUNDER: + case STRIP_TYPE_ALPHAUNDER: return TIP_("Add an alpha under effect strip to the sequencer"); - case SEQ_TYPE_GAMCROSS: + case STRIP_TYPE_GAMCROSS: return TIP_("Add a gamma cross transition to the sequencer"); - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: return TIP_("Add a multiply effect strip to the sequencer"); - case SEQ_TYPE_OVERDROP: + case STRIP_TYPE_OVERDROP: return TIP_("Add an alpha over drop effect strip to the sequencer"); - case SEQ_TYPE_WIPE: + case STRIP_TYPE_WIPE: return TIP_("Add a wipe transition to the sequencer"); - case SEQ_TYPE_GLOW: + case STRIP_TYPE_GLOW: return TIP_("Add a glow effect strip to the sequencer"); - case SEQ_TYPE_TRANSFORM: + case STRIP_TYPE_TRANSFORM: return TIP_("Add a transform effect strip to the sequencer"); - case SEQ_TYPE_COLOR: + case STRIP_TYPE_COLOR: return TIP_("Add a color strip to the sequencer"); - case SEQ_TYPE_SPEED: + case STRIP_TYPE_SPEED: return TIP_("Add a speed effect strip to the sequencer"); - case SEQ_TYPE_MULTICAM: + case STRIP_TYPE_MULTICAM: return TIP_("Add a multicam selector effect strip to the sequencer"); - case SEQ_TYPE_ADJUSTMENT: + case STRIP_TYPE_ADJUSTMENT: return TIP_("Add an adjustment layer effect strip to the sequencer"); - case SEQ_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_GAUSSIAN_BLUR: return TIP_("Add a gaussian blur effect strip to the sequencer"); - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: return TIP_("Add a text strip to the sequencer"); - case SEQ_TYPE_COLORMIX: + case STRIP_TYPE_COLORMIX: return TIP_("Add a color mix effect strip to the sequencer"); default: break; @@ -1600,7 +1602,7 @@ void SEQUENCER_OT_effect_strip_add(wmOperatorType *ot) prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, - SEQ_TYPE_CROSS, + STRIP_TYPE_CROSS, "Type", "Sequencer effect type"); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE); diff --git a/source/blender/editors/space_sequencer/sequencer_clipboard.cc b/source/blender/editors/space_sequencer/sequencer_clipboard.cc index ec17a8f284e3..19de8b84e739 100644 --- a/source/blender/editors/space_sequencer/sequencer_clipboard.cc +++ b/source/blender/editors/space_sequencer/sequencer_clipboard.cc @@ -72,20 +72,20 @@ using namespace blender::bke::blendfile; */ static void sequencer_copy_animation_listbase(Scene *scene_src, - Strip *seq_dst, + Strip *strip_dst, ListBase *clipboard_dst, ListBase *fcurve_base_src) { /* Add curves for strips inside meta strip. */ - if (seq_dst->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, meta_child, &seq_dst->seqbase) { + if (strip_dst->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, meta_child, &strip_dst->seqbase) { sequencer_copy_animation_listbase(scene_src, meta_child, clipboard_dst, fcurve_base_src); } } Vector fcurves_src = animrig::fcurves_in_listbase_filtered( *fcurve_base_src, - [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*seq_dst, fcurve); }); + [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*strip_dst, fcurve); }); for (FCurve *fcu_src : fcurves_src) { BLI_addtail(clipboard_dst, BKE_fcurve_copy(fcu_src)); @@ -96,14 +96,14 @@ static void sequencer_copy_animation_listbase(Scene *scene_src, * above, except that it copies from an action's animation to a vector rather * than between two listbases. */ static void sequencer_copy_animation_to_vector(Scene *scene_src, - Strip *seq_dst, + Strip *strip_dst, Vector &clipboard_dst, bAction &fcurves_src_action, animrig::slot_handle_t fcurves_src_slot_handle) { /* Add curves for strips inside meta strip. */ - if (seq_dst->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, meta_child, &seq_dst->seqbase) { + if (strip_dst->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, meta_child, &strip_dst->seqbase) { sequencer_copy_animation_to_vector( scene_src, meta_child, clipboard_dst, fcurves_src_action, fcurves_src_slot_handle); } @@ -111,7 +111,7 @@ static void sequencer_copy_animation_to_vector(Scene *scene_src, Vector fcurves_src = animrig::fcurves_in_action_slot_filtered( &fcurves_src_action, fcurves_src_slot_handle, [&](const FCurve &fcurve) { - return SEQ_fcurve_matches(*seq_dst, fcurve); + return SEQ_fcurve_matches(*strip_dst, fcurve); }); for (FCurve *fcu_src : fcurves_src) { @@ -127,14 +127,14 @@ static void sequencer_copy_animation_to_vector(Scene *scene_src, static void sequencer_copy_animation(Scene *scene_src, Vector &fcurves_dst, ListBase *drivers_dst, - Strip *seq_dst) + Strip *strip_dst) { if (SEQ_animation_keyframes_exist(scene_src)) { sequencer_copy_animation_to_vector( - scene_src, seq_dst, fcurves_dst, *scene_src->adt->action, scene_src->adt->slot_handle); + scene_src, strip_dst, fcurves_dst, *scene_src->adt->action, scene_src->adt->slot_handle); } if (SEQ_animation_drivers_exist(scene_src)) { - sequencer_copy_animation_listbase(scene_src, seq_dst, drivers_dst, &scene_src->adt->drivers); + sequencer_copy_animation_listbase(scene_src, strip_dst, drivers_dst, &scene_src->adt->drivers); } } @@ -176,18 +176,18 @@ static bool sequencer_write_copy_paste_file(Main *bmain_src, scene_dst->r.cfra = scene_src->r.cfra; Strip *active_seq_src = SEQ_select_active_get(scene_src); if (active_seq_src) { - Strip *seq_dst = static_cast( + Strip *strip_dst = static_cast( BLI_findstring(&scene_dst->ed->seqbase, active_seq_src->name, offsetof(Strip, name))); - if (seq_dst) { - SEQ_select_active_set(scene_dst, seq_dst); + if (strip_dst) { + SEQ_select_active_set(scene_dst, strip_dst); } } Vector fcurves_dst = {}; ListBase drivers_dst = {nullptr, nullptr}; - LISTBASE_FOREACH (Strip *, seq_dst, &scene_dst->ed->seqbase) { - /* Copy any fcurves/drivers from `scene_src` that are relevant to `seq_dst`. */ - sequencer_copy_animation(scene_src, fcurves_dst, &drivers_dst, seq_dst); + LISTBASE_FOREACH (Strip *, strip_dst, &scene_dst->ed->seqbase) { + /* Copy any fcurves/drivers from `scene_src` that are relevant to `strip_dst`. */ + sequencer_copy_animation(scene_src, fcurves_dst, &drivers_dst, strip_dst); } BLI_assert(scene_dst->adt == nullptr); diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.cc b/source/blender/editors/space_sequencer/sequencer_drag_drop.cc index b96bcc1e5d7c..4f24fd9a8c98 100644 --- a/source/blender/editors/space_sequencer/sequencer_drag_drop.cc +++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.cc @@ -279,8 +279,8 @@ static void sequencer_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop) /* Get the top most strip channel that is in view. */ int max_channel = -1; - for (Strip *seq : strips) { - max_channel = max_ii(seq->machine, max_channel); + for (Strip *strip : strips) { + max_channel = max_ii(strip->machine, max_channel); } if (max_channel != -1) { @@ -406,8 +406,8 @@ static void draw_seq_in_view(bContext *C, wmWindow * /*win*/, wmDrag *drag, cons StripsDrawBatch batch(®ion->v2d); for (int i = 0; i < coords->channel_len; i++) { - float y1 = floorf(coords->channel) + i + SEQ_STRIP_OFSBOTTOM; - float y2 = floorf(coords->channel) + i + SEQ_STRIP_OFSTOP; + float y1 = floorf(coords->channel) + i + STRIP_OFSBOTTOM; + float y2 = floorf(coords->channel) + i + STRIP_OFSTOP; if (coords->type == TH_SEQ_MOVIE && i == 0 && coords->channel_len > 1) { /* Assume only video strips occupies two channels. diff --git a/source/blender/editors/space_sequencer/sequencer_edit.cc b/source/blender/editors/space_sequencer/sequencer_edit.cc index 856c1d08b17d..0f8639ab1f73 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.cc +++ b/source/blender/editors/space_sequencer/sequencer_edit.cc @@ -195,9 +195,9 @@ bool sequencer_strip_editable_poll(bContext *C) bool sequencer_strip_has_path_poll(bContext *C) { Editing *ed; - Strip *seq; + Strip *strip; return (((ed = SEQ_editing_get(CTX_data_scene(C))) != nullptr) && - ((seq = ed->act_seq) != nullptr) && SEQ_HAS_PATH(seq)); + ((strip = ed->act_seq) != nullptr) && STRIP_HAS_PATH(strip)); } bool sequencer_view_has_preview_poll(bContext *C) @@ -361,51 +361,52 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) snap_frame = RNA_int_get(op->ptr, "frame"); /* Check meta-strips. */ - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq) && - SEQ_transform_sequence_can_be_translated(seq)) + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && !SEQ_transform_is_locked(channels, strip) && + SEQ_transform_sequence_can_be_translated(strip)) { - if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { - SEQ_transform_translate_sequence(scene, seq, (snap_frame - seq->startofs) - seq->start); + if ((strip->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { + SEQ_transform_translate_sequence( + scene, strip, (snap_frame - strip->startofs) - strip->start); } else { - if (seq->flag & SEQ_LEFTSEL) { - SEQ_time_left_handle_frame_set(scene, seq, snap_frame); + if (strip->flag & SEQ_LEFTSEL) { + SEQ_time_left_handle_frame_set(scene, strip, snap_frame); } else { /* SEQ_RIGHTSEL */ - SEQ_time_right_handle_frame_set(scene, seq, snap_frame); + SEQ_time_right_handle_frame_set(scene, strip, snap_frame); } } - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_relations_invalidate_cache_composite(scene, strip); } } /* Test for effects and overlap. */ - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) { - seq->flag &= ~SEQ_OVERLAP; - if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) { - SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && !SEQ_transform_is_locked(channels, strip)) { + strip->flag &= ~SEQ_OVERLAP; + if (SEQ_transform_test_overlap(scene, ed->seqbasep, strip)) { + SEQ_transform_seqbase_shuffle(ed->seqbasep, strip, scene); } } } /* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */ - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->type & SEQ_TYPE_EFFECT) { - const bool either_handle_selected = (seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0; + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->type & STRIP_TYPE_EFFECT) { + const bool either_handle_selected = (strip->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0; - if (seq->seq1 && (seq->seq1->flag & SELECT)) { + if (strip->seq1 && (strip->seq1->flag & SELECT)) { if (!either_handle_selected) { SEQ_offset_animdata( - scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq))); + scene, strip, (snap_frame - SEQ_time_left_handle_frame_get(scene, strip))); } } - else if (seq->seq2 && (seq->seq2->flag & SELECT)) { + else if (strip->seq2 && (strip->seq2->flag & SELECT)) { if (!either_handle_selected) { SEQ_offset_animdata( - scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq))); + scene, strip, (snap_frame - SEQ_time_left_handle_frame_get(scene, strip))); } } } @@ -466,20 +467,20 @@ struct SlipData { int previous_offset; float previous_subframe_offset; float subframe_restore; - Strip **seq_array; + Strip **strip_array; int num_seq; bool slow; int slow_offset; /* Offset at the point where offset was turned on. */ NumInput num_input; }; -static void slip_add_sequences(ListBase *seqbasep, Strip **seq_array) +static void slip_add_sequences(ListBase *seqbasep, Strip **strip_array) { int i = 0; - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - if (!(seq->type & SEQ_TYPE_EFFECT) && (seq->flag & SELECT)) { - seq_array[i] = seq; + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + if (!(strip->type & STRIP_TYPE_EFFECT) && (strip->flag & SELECT)) { + strip_array[i] = strip; i++; } } @@ -489,8 +490,8 @@ static int slip_count_sequences(ListBase *seqbasep) { int trimmed_sequences = 0; - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - if (!(seq->type & SEQ_TYPE_EFFECT) && (seq->flag & SELECT)) { + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + if (!(strip->type & STRIP_TYPE_EFFECT) && (strip->flag & SELECT)) { trimmed_sequences++; } } @@ -516,7 +517,7 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve data = MEM_cnew("trimdata"); op->customdata = static_cast(data); - data->seq_array = MEM_cnew_array(num_seq, "trimdata_sequences"); + data->strip_array = MEM_cnew_array(num_seq, "trimdata_strips"); data->num_seq = num_seq; data->previous_offset = 0; @@ -525,7 +526,7 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve data->num_input.unit_sys = USER_UNIT_NONE; data->num_input.unit_type[0] = 0; - slip_add_sequences(ed->seqbasep, data->seq_array); + slip_add_sequences(ed->seqbasep, data->strip_array); UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mouseloc[0], &mouseloc[1]); @@ -544,19 +545,19 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve static void sequencer_slip_strips(Scene *scene, SlipData *data, int delta, float subframe_delta) { for (int i = data->num_seq - 1; i >= 0; i--) { - Strip *seq = data->seq_array[i]; + Strip *strip = data->strip_array[i]; ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(scene)); - if (SEQ_transform_is_locked(channels, seq)) { + if (SEQ_transform_is_locked(channels, strip)) { continue; } - SEQ_time_slip_strip(scene, seq, delta, subframe_delta); + SEQ_time_slip_strip(scene, strip, delta, subframe_delta); } for (int i = data->num_seq - 1; i >= 0; i--) { - Strip *seq = data->seq_array[i]; - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + Strip *strip = data->strip_array[i]; + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -567,17 +568,18 @@ static int sequencer_slip_apply_limits(const Scene *scene, SlipData *data, int * int delta_offset = *offset - data->previous_offset; for (int i = 0; i < data->num_seq; i++) { - Strip *seq = data->seq_array[i]; - int seq_content_start = SEQ_time_start_frame_get(seq) + delta_offset; - int seq_content_end = seq_content_start + seq->len + seq->anim_startofs + seq->anim_endofs; + Strip *strip = data->strip_array[i]; + int strip_content_start = SEQ_time_start_frame_get(strip) + delta_offset; + int strip_content_end = strip_content_start + strip->len + strip->anim_startofs + + strip->anim_endofs; int diff = 0; - if (seq_content_start >= SEQ_time_right_handle_frame_get(scene, seq)) { - diff = SEQ_time_right_handle_frame_get(scene, seq) - seq_content_start - 1; + if (strip_content_start >= SEQ_time_right_handle_frame_get(scene, strip)) { + diff = SEQ_time_right_handle_frame_get(scene, strip) - strip_content_start - 1; } - if (seq_content_end <= SEQ_time_left_handle_frame_get(scene, seq)) { - diff = SEQ_time_left_handle_frame_get(scene, seq) - seq_content_end + 1; + if (strip_content_end <= SEQ_time_left_handle_frame_get(scene, strip)) { + diff = SEQ_time_left_handle_frame_get(scene, strip) - strip_content_end + 1; } *offset += diff; delta_offset += diff; @@ -601,10 +603,10 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op) SlipData *data = MEM_cnew("trimdata"); op->customdata = static_cast(data); - data->seq_array = MEM_cnew_array(num_seq, "trimdata_sequences"); + data->strip_array = MEM_cnew_array(num_seq, "trimdata_strips"); data->num_seq = num_seq; - slip_add_sequences(ed->seqbasep, data->seq_array); + slip_add_sequences(ed->seqbasep, data->strip_array); float offset_fl = RNA_float_get(op->ptr, "offset"); int offset = round_fl_to_int(offset_fl); @@ -618,7 +620,7 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op) sequencer_slip_apply_limits(scene, data, &offset); sequencer_slip_strips(scene, data, offset, subframe_delta); - MEM_freeN(data->seq_array); + MEM_freeN(data->strip_array); MEM_freeN(data); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -635,7 +637,7 @@ static void sequencer_slip_update_header(Scene *scene, ScrArea *area, SlipData * char msg[UI_MAX_DRAW_STR]; if (hasNumInput(&data->num_input)) { char num_str[NUM_STR_REP_LEN]; - outputNumInput(&data->num_input, num_str, &scene->unit); + outputNumInput(&data->num_input, num_str, scene->unit); SNPRINTF(msg, IFACE_("Slip offset: %s"), num_str); } else { @@ -740,7 +742,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even case LEFTMOUSE: case EVT_RETKEY: case EVT_SPACEKEY: { - MEM_freeN(data->seq_array); + MEM_freeN(data->strip_array); MEM_freeN(data); op->customdata = nullptr; if (area) { @@ -757,7 +759,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even float subframe_delta = data->subframe_restore; sequencer_slip_strips(scene, data, -offset, -subframe_delta); - MEM_freeN(data->seq_array); + MEM_freeN(data->strip_array); MEM_freeN(data); op->customdata = nullptr; @@ -843,18 +845,18 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) selected = !RNA_boolean_get(op->ptr, "unselected"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (!SEQ_transform_is_locked(channels, seq)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (!SEQ_transform_is_locked(channels, strip)) { if (selected) { - if (seq->flag & SELECT) { - seq->flag |= SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if (strip->flag & SELECT) { + strip->flag |= SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } else { - if ((seq->flag & SELECT) == 0) { - seq->flag |= SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if ((strip->flag & SELECT) == 0) { + strip->flag |= SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } } @@ -899,18 +901,18 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) selected = !RNA_boolean_get(op->ptr, "unselected"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (!SEQ_transform_is_locked(channels, seq)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (!SEQ_transform_is_locked(channels, strip)) { if (selected) { - if (seq->flag & SELECT) { - seq->flag &= ~SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if (strip->flag & SELECT) { + strip->flag &= ~SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } else { - if ((seq->flag & SELECT) == 0) { - seq->flag &= ~SEQ_MUTE; - SEQ_relations_invalidate_dependent(scene, seq); + if ((strip->flag & SELECT) == 0) { + strip->flag &= ~SEQ_MUTE; + SEQ_relations_invalidate_dependent(scene, strip); } } } @@ -954,9 +956,9 @@ static int sequencer_lock_exec(bContext *C, wmOperator * /*op*/) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - seq->flag |= SEQ_LOCK; + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + strip->flag |= SEQ_LOCK; } } @@ -991,9 +993,9 @@ static int sequencer_unlock_exec(bContext *C, wmOperator * /*op*/) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - seq->flag &= ~SEQ_LOCK; + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + strip->flag &= ~SEQ_LOCK; } } @@ -1109,14 +1111,14 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op) Editing *ed = SEQ_editing_get(scene); const bool adjust_length = RNA_boolean_get(op->ptr, "adjust_length"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - SEQ_add_reload_new_file(bmain, scene, seq, !adjust_length); - blender::seq::thumbnail_cache_invalidate_strip(scene, seq); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + SEQ_add_reload_new_file(bmain, scene, strip, !adjust_length); + blender::seq::thumbnail_cache_invalidate_strip(scene, strip); if (adjust_length) { - if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) { - SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); + if (SEQ_transform_test_overlap(scene, ed->seqbasep, strip)) { + SEQ_transform_seqbase_shuffle(ed->seqbasep, strip, scene); } } } @@ -1197,12 +1199,12 @@ void SEQUENCER_OT_refresh_all(wmOperatorType *ot) /** \name Reassign Inputs Operator * \{ */ -int seq_effect_find_selected(Scene *scene, - Strip *activeseq, - int type, - Strip **r_selseq1, - Strip **r_selseq2, - const char **r_error_str) +int strip_effect_find_selected(Scene *scene, + Strip *activeseq, + int type, + Strip **r_selseq1, + Strip **r_selseq2, + const char **r_error_str) { Editing *ed = SEQ_editing_get(scene); Strip *seq1 = nullptr, *seq2 = nullptr; @@ -1218,18 +1220,18 @@ int seq_effect_find_selected(Scene *scene, return 1; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - if (seq->type == SEQ_TYPE_SOUND_RAM) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { *r_error_str = N_("Cannot apply effects to audio sequence strips"); return 0; } - if (!ELEM(seq, activeseq, seq2)) { + if (!ELEM(strip, activeseq, seq2)) { if (seq2 == nullptr) { - seq2 = seq; + seq2 = strip; } else if (seq1 == nullptr) { - seq1 = seq; + seq1 = strip; } else { *r_error_str = N_("Cannot apply effect to more than 2 sequence strips"); @@ -1284,7 +1286,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &error_msg) || + if (!strip_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &error_msg) || SEQ_effect_get_num_inputs(last_seq->type) == 0) { BKE_report(op->reports, RPT_ERROR, error_msg); @@ -1306,7 +1308,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) /* Force time position update for reassigned effects. * TODO(Richard): This is because internally startdisp is still used, due to poor performance of * mapping effect range to inputs. This mapping could be cached though. */ - SEQ_sequence_lookup_invalidate(scene); + SEQ_strip_lookup_invalidate(scene); SEQ_time_left_handle_frame_set(scene, seq1, SEQ_time_left_handle_frame_get(scene, seq1)); SEQ_relations_invalidate_cache_preprocessed(scene, last_seq); @@ -1324,7 +1326,7 @@ static bool sequencer_effect_poll(bContext *C) if (ed) { Strip *last_seq = SEQ_select_active_get(scene); - if (last_seq && (last_seq->type & SEQ_TYPE_EFFECT)) { + if (last_seq && (last_seq->type & STRIP_TYPE_EFFECT)) { return true; } } @@ -1356,16 +1358,16 @@ void SEQUENCER_OT_reassign_inputs(wmOperatorType *ot) static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq, *last_seq = SEQ_select_active_get(scene); + Strip *strip, *last_seq = SEQ_select_active_get(scene); if (last_seq->seq1 == nullptr || last_seq->seq2 == nullptr) { BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap"); return OPERATOR_CANCELLED; } - seq = last_seq->seq1; + strip = last_seq->seq1; last_seq->seq1 = last_seq->seq2; - last_seq->seq2 = seq; + last_seq->seq2 = strip; SEQ_relations_invalidate_cache_preprocessed(scene, last_seq); @@ -1446,7 +1448,7 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); bool changed = false; - bool seq_selected = false; + bool strip_selected = false; const bool use_cursor_position = RNA_boolean_get(op->ptr, "use_cursor_position"); @@ -1461,15 +1463,15 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) SEQ_prefetch_stop(scene); - LISTBASE_FOREACH_BACKWARD (Strip *, seq, ed->seqbasep) { - if (use_cursor_position && seq->machine != split_channel) { + LISTBASE_FOREACH_BACKWARD (Strip *, strip, ed->seqbasep) { + if (use_cursor_position && strip->machine != split_channel) { continue; } - if (ignore_selection || seq->flag & SELECT) { + if (ignore_selection || strip->flag & SELECT) { const char *error_msg = nullptr; - if (SEQ_edit_strip_split(bmain, scene, ed->seqbasep, seq, split_frame, method, &error_msg) != - nullptr) + if (SEQ_edit_strip_split( + bmain, scene, ed->seqbasep, strip, split_frame, method, &error_msg) != nullptr) { changed = true; } @@ -1482,19 +1484,19 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) if (changed) { /* Got new strips? */ if (ignore_selection) { if (use_cursor_position) { - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if (SEQ_time_right_handle_frame_get(scene, seq) == split_frame && - seq->machine == split_channel) + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if (SEQ_time_right_handle_frame_get(scene, strip) == split_frame && + strip->machine == split_channel) { - seq_selected = seq->flag & SEQ_ALLSEL; + strip_selected = strip->flag & STRIP_ALLSEL; } } - if (!seq_selected) { - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if (SEQ_time_left_handle_frame_get(scene, seq) == split_frame && - seq->machine == split_channel) + if (!strip_selected) { + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if (SEQ_time_left_handle_frame_get(scene, strip) == split_frame && + strip->machine == split_channel) { - seq->flag &= ~SEQ_ALLSEL; + strip->flag &= ~STRIP_ALLSEL; } } } @@ -1502,15 +1504,15 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) } else { if (split_side != SEQ_SIDE_BOTH) { - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { if (split_side == SEQ_SIDE_LEFT) { - if (SEQ_time_left_handle_frame_get(scene, seq) >= split_frame) { - seq->flag &= ~SEQ_ALLSEL; + if (SEQ_time_left_handle_frame_get(scene, strip) >= split_frame) { + strip->flag &= ~STRIP_ALLSEL; } } else { - if (SEQ_time_right_handle_frame_get(scene, seq) <= split_frame) { - seq->flag &= ~SEQ_ALLSEL; + if (SEQ_time_right_handle_frame_get(scene, strip) <= split_frame) { + strip->flag &= ~STRIP_ALLSEL; } } } @@ -1678,7 +1680,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator * /*op*/) SEQ_animation_backup_original(scene, &animation_backup); ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - Strip *seq_last = static_cast(seqbase->last); + Strip *strip_last = static_cast(seqbase->last); /* Rely on the `duplicated_strips` list being added at the end. * Their UIDs has been re-generated by the #SEQ_sequence_base_dupli_recursive(). */ @@ -1686,30 +1688,30 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator * /*op*/) /* Handle duplicated strips: set active, select, ensure unique name and duplicate animation * data. */ - for (Strip *seq = seq_last->next; seq; seq = seq->next) { - if (active_seq != nullptr && STREQ(seq->name, active_seq->name)) { - SEQ_select_active_set(scene, seq); + for (Strip *strip = strip_last->next; strip; strip = strip->next) { + if (active_seq != nullptr && STREQ(strip->name, active_seq->name)) { + SEQ_select_active_set(scene, strip); } - seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK); - seq->flag |= SEQ_IGNORE_CHANNEL_LOCK; + strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK); + strip->flag |= SEQ_IGNORE_CHANNEL_LOCK; - SEQ_animation_duplicate_backup_to_scene(scene, seq, &animation_backup); - SEQ_ensure_unique_name(seq, scene); + SEQ_animation_duplicate_backup_to_scene(scene, strip, &animation_backup); + SEQ_ensure_unique_name(strip, scene); } /* Special case for duplicating strips in preview: Do not duplicate sound strips and handle * overlap, because strips won't be translated. */ if (region->regiontype == RGN_TYPE_PREVIEW && sequencer_view_preview_only_poll(C)) { - for (Strip *seq = seq_last->next; seq; seq = seq->next) { - if (seq->type == SEQ_TYPE_SOUND_RAM) { - SEQ_edit_flag_for_removal(scene, ed->seqbasep, seq); + for (Strip *strip = strip_last->next; strip; strip = strip->next) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { + SEQ_edit_flag_for_removal(scene, ed->seqbasep, strip); } } SEQ_edit_remove_flagged_sequences(scene, ed->seqbasep); - for (Strip *seq = seq_last->next; seq; seq = seq->next) { - if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) { - SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); + for (Strip *strip = strip_last->next; strip; strip = strip->next) { + if (SEQ_transform_test_overlap(scene, ed->seqbasep, strip)) { + SEQ_transform_seqbase_shuffle(ed->seqbasep, strip, scene); } } } @@ -1743,16 +1745,16 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) /** \name Erase Strips Operator * \{ */ -static void sequencer_delete_strip_data(bContext *C, Strip *seq) +static void sequencer_delete_strip_data(bContext *C, Strip *strip) { - if (seq->type != SEQ_TYPE_SCENE) { + if (strip->type != STRIP_TYPE_SCENE) { return; } Main *bmain = CTX_data_main(C); - if (seq->scene) { - if (ED_scene_delete(C, bmain, seq->scene)) { - WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, seq->scene); + if (strip->scene) { + if (ED_scene_delete(C, bmain, strip->scene)) { + WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, strip->scene); } } } @@ -1770,10 +1772,10 @@ static int sequencer_delete_exec(bContext *C, wmOperator *op) SEQ_prefetch_stop(scene); - for (Strip *seq : ED_sequencer_selected_strips_from_context(C)) { - SEQ_edit_flag_for_removal(scene, seqbasep, seq); + for (Strip *strip : ED_sequencer_selected_strips_from_context(C)) { + SEQ_edit_flag_for_removal(scene, seqbasep, strip); if (delete_data) { - sequencer_delete_strip_data(C, seq); + sequencer_delete_strip_data(C, strip); } } SEQ_edit_remove_flagged_sequences(scene, seqbasep); @@ -1842,33 +1844,35 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator * /*op*/) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *seq; + Strip *strip; ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(scene)); /* For effects, try to find a replacement input. */ - for (seq = static_cast(ed->seqbasep->first); seq; seq = static_cast(seq->next)) + for (strip = static_cast(ed->seqbasep->first); strip; + strip = static_cast(strip->next)) { - if (SEQ_transform_is_locked(channels, seq)) { + if (SEQ_transform_is_locked(channels, strip)) { continue; } - if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { - seq->startofs = seq->endofs = 0; + if ((strip->type & STRIP_TYPE_EFFECT) == 0 && (strip->flag & SELECT)) { + strip->startofs = strip->endofs = 0; } } /* Update lengths, etc. */ - seq = static_cast(ed->seqbasep->first); - while (seq) { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); - seq = seq->next; + strip = static_cast(ed->seqbasep->first); + while (strip) { + SEQ_relations_invalidate_cache_preprocessed(scene, strip); + strip = strip->next; } - for (seq = static_cast(ed->seqbasep->first); seq; seq = static_cast(seq->next)) + for (strip = static_cast(ed->seqbasep->first); strip; + strip = static_cast(strip->next)) { - if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { - if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) { - SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene); + if ((strip->type & STRIP_TYPE_EFFECT) == 0 && (strip->flag & SELECT)) { + if (SEQ_transform_test_overlap(scene, ed->seqbasep, strip)) { + SEQ_transform_seqbase_shuffle(ed->seqbasep, strip, scene); } } } @@ -1906,40 +1910,41 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) Editing *ed = SEQ_editing_get(scene); ListBase *seqbase = SEQ_active_seqbase_get(ed); - Strip *seq, *seq_new; + Strip *strip, *strip_new; StripData *data_new; StripElem *se, *se_new; int start_ofs, timeline_frame, frame_end; int step = RNA_int_get(op->ptr, "length"); - seq = static_cast(seqbase->first); /* Poll checks this is valid. */ + strip = static_cast(seqbase->first); /* Poll checks this is valid. */ SEQ_prefetch_stop(scene); - while (seq) { - if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) { - Strip *seq_next; + while (strip) { + if ((strip->flag & SELECT) && (strip->type == STRIP_TYPE_IMAGE) && (strip->len > 1)) { + Strip *strip_next; /* TODO: remove f-curve and assign to split image strips. - * The old animation system would remove the user of `seq->ipo`. */ + * The old animation system would remove the user of `strip->ipo`. */ - start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(scene, seq); - frame_end = SEQ_time_right_handle_frame_get(scene, seq); + start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(scene, strip); + frame_end = SEQ_time_right_handle_frame_get(scene, strip); while (timeline_frame < frame_end) { - /* New seq. */ - se = SEQ_render_give_stripelem(scene, seq, timeline_frame); + /* New strip. */ + se = SEQ_render_give_stripelem(scene, strip, timeline_frame); - seq_new = SEQ_sequence_dupli_recursive(scene, scene, seqbase, seq, SEQ_DUPE_UNIQUE_NAME); + strip_new = SEQ_sequence_dupli_recursive( + scene, scene, seqbase, strip, STRIP_DUPE_UNIQUE_NAME); - seq_new->start = start_ofs; - seq_new->type = SEQ_TYPE_IMAGE; - seq_new->len = 1; - seq_new->flag |= SEQ_SINGLE_FRAME_CONTENT; - seq_new->endofs = 1 - step; + strip_new->start = start_ofs; + strip_new->type = STRIP_TYPE_IMAGE; + strip_new->len = 1; + strip_new->flag |= SEQ_SINGLE_FRAME_CONTENT; + strip_new->endofs = 1 - step; /* New strip. */ - data_new = seq_new->data; + data_new = strip_new->data; data_new->us = 1; /* New stripdata, only one element now. */ @@ -1950,9 +1955,9 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) data_new->stripdata = se_new; if (step > 1) { - seq_new->flag &= ~SEQ_OVERLAP; - if (SEQ_transform_test_overlap(scene, seqbase, seq_new)) { - SEQ_transform_seqbase_shuffle(seqbase, seq_new, scene); + strip_new->flag &= ~SEQ_OVERLAP; + if (SEQ_transform_test_overlap(scene, seqbase, strip_new)) { + SEQ_transform_seqbase_shuffle(seqbase, strip_new, scene); } } @@ -1962,12 +1967,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) start_ofs += step; } - seq_next = static_cast(seq->next); - SEQ_edit_flag_for_removal(scene, seqbase, seq); - seq = seq_next; + strip_next = static_cast(strip->next); + SEQ_edit_flag_for_removal(scene, seqbase, strip); + strip = strip_next; } else { - seq = seq->next; + strip = strip->next; } } @@ -2011,14 +2016,14 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator * /*op*/) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *active_seq = SEQ_select_active_get(scene); + Strip *active_strip = SEQ_select_active_get(scene); SEQ_prefetch_stop(scene); - if (active_seq && active_seq->type == SEQ_TYPE_META && active_seq->flag & SELECT) { - /* Deselect active meta seq. */ + if (active_strip && active_strip->type == STRIP_TYPE_META && active_strip->flag & SELECT) { + /* Deselect active meta strip. */ SEQ_select_active_set(scene, nullptr); - SEQ_meta_stack_set(scene, active_seq); + SEQ_meta_stack_set(scene, active_strip); } else { /* Exit meta-strip if possible. */ @@ -2062,7 +2067,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *active_seq = SEQ_select_active_get(scene); + Strip *active_strip = SEQ_select_active_get(scene); ListBase *active_seqbase = SEQ_active_seqbase_get(ed); if (SEQ_transform_seqbase_isolated_sel_check(active_seqbase) == false) { @@ -2074,26 +2079,26 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) int channel_max = 1, channel_min = INT_MAX, meta_start_frame = MAXFRAME, meta_end_frame = MINFRAME; - Strip *seqm = SEQ_sequence_alloc(active_seqbase, 1, 1, SEQ_TYPE_META); + Strip *seqm = SEQ_sequence_alloc(active_seqbase, 1, 1, STRIP_TYPE_META); /* Remove all selected from main list, and put in meta. * Sequence is moved within the same edit, no need to re-generate the UID. */ blender::VectorSet strips_to_move; - LISTBASE_FOREACH (Strip *, seq, active_seqbase) { - if (seq != seqm && seq->flag & SELECT) { - strips_to_move.add(seq); - strips_to_move.add_multiple(SEQ_get_connected_strips(seq)); + LISTBASE_FOREACH (Strip *, strip, active_seqbase) { + if (strip != seqm && strip->flag & SELECT) { + strips_to_move.add(strip); + strips_to_move.add_multiple(SEQ_get_connected_strips(strip)); } } - for (Strip *seq : strips_to_move) { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); - BLI_remlink(active_seqbase, seq); - BLI_addtail(&seqm->seqbase, seq); - channel_max = max_ii(seq->machine, channel_max); - channel_min = min_ii(seq->machine, channel_min); - meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, seq), meta_start_frame); - meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, seq), meta_end_frame); + for (Strip *strip : strips_to_move) { + SEQ_relations_invalidate_cache_preprocessed(scene, strip); + BLI_remlink(active_seqbase, strip); + BLI_addtail(&seqm->seqbase, strip); + channel_max = max_ii(strip->machine, channel_max); + channel_min = min_ii(strip->machine, channel_min); + meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, strip), meta_start_frame); + meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, strip), meta_end_frame); } ListBase *channels_cur = SEQ_channels_displayed_get(ed); @@ -2105,7 +2110,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) channel_meta->flag = channel_cur->flag; } - seqm->machine = active_seq ? active_seq->machine : channel_max; + seqm->machine = active_strip ? active_strip->machine : channel_max; BLI_strncpy(seqm->name + 2, DATA_("MetaStrip"), sizeof(seqm->name) - 2); SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm); seqm->start = meta_start_frame; @@ -2115,7 +2120,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene); } - SEQ_sequence_lookup_invalidate(scene); + SEQ_strip_lookup_invalidate(scene); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -2147,33 +2152,33 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator * /*op*/) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *active_seq = SEQ_select_active_get(scene); + Strip *active_strip = SEQ_select_active_get(scene); - if (active_seq == nullptr || active_seq->type != SEQ_TYPE_META) { + if (active_strip == nullptr || active_strip->type != STRIP_TYPE_META) { return OPERATOR_CANCELLED; } SEQ_prefetch_stop(scene); - LISTBASE_FOREACH (Strip *, seq, &active_seq->seqbase) { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + LISTBASE_FOREACH (Strip *, strip, &active_strip->seqbase) { + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } /* Remove all selected from meta, and put in main list. * Sequence is moved within the same edit, no need to re-generate the UID. */ - BLI_movelisttolist(ed->seqbasep, &active_seq->seqbase); - BLI_listbase_clear(&active_seq->seqbase); + BLI_movelisttolist(ed->seqbasep, &active_strip->seqbase); + BLI_listbase_clear(&active_strip->seqbase); ListBase *active_seqbase = SEQ_active_seqbase_get(ed); - SEQ_edit_flag_for_removal(scene, active_seqbase, active_seq); + SEQ_edit_flag_for_removal(scene, active_seqbase, active_strip); SEQ_edit_remove_flagged_sequences(scene, active_seqbase); /* Test for effects and overlap. */ - LISTBASE_FOREACH (Strip *, seq, active_seqbase) { - if (seq->flag & SELECT) { - seq->flag &= ~SEQ_OVERLAP; - if (SEQ_transform_test_overlap(scene, active_seqbase, seq)) { - SEQ_transform_seqbase_shuffle(active_seqbase, seq, scene); + LISTBASE_FOREACH (Strip *, strip, active_seqbase) { + if (strip->flag & SELECT) { + strip->flag &= ~SEQ_OVERLAP; + if (SEQ_transform_test_overlap(scene, active_seqbase, strip)) { + SEQ_transform_seqbase_shuffle(active_seqbase, strip, scene); } } } @@ -2285,24 +2290,24 @@ static void swap_sequence(Scene *scene, Strip *seqa, Strip *seqb) { int gap = SEQ_time_left_handle_frame_get(scene, seqb) - SEQ_time_right_handle_frame_get(scene, seqa); - int seq_a_start; - int seq_b_start; + int strip_a_start; + int strip_b_start; - seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(scene, seqb)) + - SEQ_time_left_handle_frame_get(scene, seqa); - SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start); + strip_b_start = (seqb->start - SEQ_time_left_handle_frame_get(scene, seqb)) + + SEQ_time_left_handle_frame_get(scene, seqa); + SEQ_transform_translate_sequence(scene, seqb, strip_b_start - seqb->start); SEQ_relations_invalidate_cache_preprocessed(scene, seqb); - seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(scene, seqa)) + - SEQ_time_right_handle_frame_get(scene, seqb) + gap; - SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start); + strip_a_start = (seqa->start - SEQ_time_left_handle_frame_get(scene, seqa)) + + SEQ_time_right_handle_frame_get(scene, seqb) + gap; + SEQ_transform_translate_sequence(scene, seqa, strip_a_start - seqa->start); SEQ_relations_invalidate_cache_preprocessed(scene, seqa); } static Strip *find_next_prev_sequence(Scene *scene, Strip *test, int lr, int sel) { /* sel: 0==unselected, 1==selected, -1==don't care. */ - Strip *seq, *best_seq = nullptr; + Strip *strip, *best_strip = nullptr; Editing *ed = SEQ_editing_get(scene); int dist, best_dist; @@ -2312,49 +2317,49 @@ static Strip *find_next_prev_sequence(Scene *scene, Strip *test, int lr, int sel return nullptr; } - seq = static_cast(ed->seqbasep->first); - while (seq) { - if ((seq != test) && (test->machine == seq->machine) && - ((sel == -1) || (sel == (seq->flag & SELECT)))) + strip = static_cast(ed->seqbasep->first); + while (strip) { + if ((strip != test) && (test->machine == strip->machine) && + ((sel == -1) || (sel == (strip->flag & SELECT)))) { dist = MAXFRAME * 2; switch (lr) { case SEQ_SIDE_LEFT: - if (SEQ_time_right_handle_frame_get(scene, seq) <= + if (SEQ_time_right_handle_frame_get(scene, strip) <= SEQ_time_left_handle_frame_get(scene, test)) { dist = SEQ_time_right_handle_frame_get(scene, test) - - SEQ_time_left_handle_frame_get(scene, seq); + SEQ_time_left_handle_frame_get(scene, strip); } break; case SEQ_SIDE_RIGHT: - if (SEQ_time_left_handle_frame_get(scene, seq) >= + if (SEQ_time_left_handle_frame_get(scene, strip) >= SEQ_time_right_handle_frame_get(scene, test)) { - dist = SEQ_time_left_handle_frame_get(scene, seq) - + dist = SEQ_time_left_handle_frame_get(scene, strip) - SEQ_time_right_handle_frame_get(scene, test); } break; } if (dist == 0) { - best_seq = seq; + best_strip = strip; break; } if (dist < best_dist) { best_dist = dist; - best_seq = seq; + best_strip = strip; } } - seq = static_cast(seq->next); + strip = static_cast(strip->next); } - return best_seq; /* Can be nullptr. */ + return best_strip; /* Can be nullptr. */ } -static bool seq_is_parent(const Strip *par, const Strip *seq) +static bool strip_is_parent(const Strip *par, const Strip *strip) { - return ((par->seq1 == seq) || (par->seq2 == seq)); + return ((par->seq1 == strip) || (par->seq2 == strip)); } static int sequencer_swap_exec(bContext *C, wmOperator *op) @@ -2363,19 +2368,21 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) Editing *ed = SEQ_editing_get(scene); Strip *active_seq = SEQ_select_active_get(scene); ListBase *seqbase = SEQ_active_seqbase_get(ed); - Strip *seq; + Strip *strip; int side = RNA_enum_get(op->ptr, "side"); if (active_seq == nullptr) { return OPERATOR_CANCELLED; } - seq = find_next_prev_sequence(scene, active_seq, side, -1); + strip = find_next_prev_sequence(scene, active_seq, side, -1); - if (seq) { + if (strip) { /* Disallow effect strips. */ - if (SEQ_effect_get_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2)) { + if (SEQ_effect_get_num_inputs(strip->type) >= 1 && + (strip->effectdata || strip->seq1 || strip->seq2)) + { return OPERATOR_CANCELLED; } if ((SEQ_effect_get_num_inputs(active_seq->type) >= 1) && @@ -2385,23 +2392,24 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) } ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(scene)); - if (SEQ_transform_is_locked(channels, seq) || SEQ_transform_is_locked(channels, active_seq)) { + if (SEQ_transform_is_locked(channels, strip) || SEQ_transform_is_locked(channels, active_seq)) + { return OPERATOR_CANCELLED; } switch (side) { case SEQ_SIDE_LEFT: - swap_sequence(scene, seq, active_seq); + swap_sequence(scene, strip, active_seq); break; case SEQ_SIDE_RIGHT: - swap_sequence(scene, active_seq, seq); + swap_sequence(scene, active_seq, strip); break; } /* Do this in a new loop since both effects need to be calculated first. */ LISTBASE_FOREACH (Strip *, iseq, seqbase) { - if ((iseq->type & SEQ_TYPE_EFFECT) && - (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) + if ((iseq->type & STRIP_TYPE_EFFECT) && + (strip_is_parent(iseq, active_seq) || strip_is_parent(iseq, strip))) { /* This may now overlap. */ if (SEQ_transform_test_overlap(scene, seqbase, iseq)) { @@ -2453,10 +2461,10 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator * /*op*/) } switch (active_seq->type) { - case SEQ_TYPE_IMAGE: + case STRIP_TYPE_IMAGE: se = SEQ_render_give_stripelem(scene, active_seq, scene->r.cfra); break; - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: se = active_seq->data->stripdata; break; default: @@ -2536,9 +2544,9 @@ bool ED_sequencer_deselect_all(Scene *scene) return changed; } - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if (seq->flag & SEQ_ALLSEL) { - seq->flag &= ~SEQ_ALLSEL; + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if (strip->flag & STRIP_ALLSEL) { + strip->flag &= ~STRIP_ALLSEL; changed = true; } } @@ -2578,40 +2586,40 @@ void SEQUENCER_OT_paste(wmOperatorType *ot) static int sequencer_swap_data_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq_act; - Strip *seq_other; + Strip *strip_act; + Strip *strip_other; const char *error_msg; - if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == false) { + if (SEQ_select_active_get_pair(scene, &strip_act, &strip_other) == false) { BKE_report(op->reports, RPT_ERROR, "Please select two strips"); return OPERATOR_CANCELLED; } - if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == false) { + if (SEQ_edit_sequence_swap(scene, strip_act, strip_other, &error_msg) == false) { BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } - if (seq_act->scene_sound) { - BKE_sound_remove_scene_sound(scene, seq_act->scene_sound); + if (strip_act->scene_sound) { + BKE_sound_remove_scene_sound(scene, strip_act->scene_sound); } - if (seq_other->scene_sound) { - BKE_sound_remove_scene_sound(scene, seq_other->scene_sound); + if (strip_other->scene_sound) { + BKE_sound_remove_scene_sound(scene, strip_other->scene_sound); } - seq_act->scene_sound = nullptr; - seq_other->scene_sound = nullptr; + strip_act->scene_sound = nullptr; + strip_other->scene_sound = nullptr; - if (seq_act->sound) { - BKE_sound_add_scene_sound_defaults(scene, seq_act); + if (strip_act->sound) { + BKE_sound_add_scene_sound_defaults(scene, strip_act); } - if (seq_other->sound) { - BKE_sound_add_scene_sound_defaults(scene, seq_other); + if (strip_other->sound) { + BKE_sound_add_scene_sound_defaults(scene, strip_other); } - SEQ_relations_invalidate_cache_raw(scene, seq_act); - SEQ_relations_invalidate_cache_raw(scene, seq_other); + SEQ_relations_invalidate_cache_raw(scene, strip_act); + SEQ_relations_invalidate_cache_raw(scene, strip_other); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -2642,18 +2650,18 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot) static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); - Strip **seq_1 = &seq->seq1, **seq_2 = &seq->seq2; + Strip **strip_1 = &strip->seq1, **strip_2 = &strip->seq2; - if (*seq_1 == nullptr || *seq_2 == nullptr) { + if (*strip_1 == nullptr || *strip_2 == nullptr) { BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, cannot swap"); return OPERATOR_CANCELLED; } - std::swap(*seq_1, *seq_2); + std::swap(*strip_1, *strip_2); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2680,56 +2688,56 @@ void SEQUENCER_OT_change_effect_input(wmOperatorType *ot) * \{ */ const EnumPropertyItem sequencer_prop_effect_types[] = { - {SEQ_TYPE_CROSS, "CROSS", 0, "Crossfade", "Crossfade effect strip type"}, - {SEQ_TYPE_ADD, "ADD", 0, "Add", "Add effect strip type"}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract effect strip type"}, - {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Alpha Over effect strip type"}, - {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Alpha Under effect strip type"}, - {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"}, - {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"}, - {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"}, - {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"}, - {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"}, - {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"}, - {SEQ_TYPE_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, - {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, - {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, - {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, - {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, - {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""}, - {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, + {STRIP_TYPE_CROSS, "CROSS", 0, "Crossfade", "Crossfade effect strip type"}, + {STRIP_TYPE_ADD, "ADD", 0, "Add", "Add effect strip type"}, + {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", "Subtract effect strip type"}, + {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", "Alpha Over effect strip type"}, + {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", "Alpha Under effect strip type"}, + {STRIP_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"}, + {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"}, + {STRIP_TYPE_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"}, + {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"}, + {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"}, + {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"}, + {STRIP_TYPE_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, + {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, + {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {STRIP_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, + {STRIP_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, + {STRIP_TYPE_TEXT, "TEXT", 0, "Text", ""}, + {STRIP_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, {0, nullptr, 0, nullptr, nullptr}, }; static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); const int new_type = RNA_enum_get(op->ptr, "type"); /* Free previous effect and init new effect. */ SeqEffectHandle sh; - if ((seq->type & SEQ_TYPE_EFFECT) == 0) { + if ((strip->type & STRIP_TYPE_EFFECT) == 0) { return OPERATOR_CANCELLED; } /* Can someone explain the logic behind only allowing to increase this, * copied from 2.4x - campbell */ - if (SEQ_effect_get_num_inputs(seq->type) < SEQ_effect_get_num_inputs(new_type)) { + if (SEQ_effect_get_num_inputs(strip->type) < SEQ_effect_get_num_inputs(new_type)) { BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips"); return OPERATOR_CANCELLED; } - sh = SEQ_effect_handle_get(seq); - sh.free(seq, true); + sh = SEQ_effect_handle_get(strip); + sh.free(strip, true); - seq->type = new_type; + strip->type = new_type; - sh = SEQ_effect_handle_get(seq); - sh.init(seq); + sh = SEQ_effect_handle_get(strip); + sh.init(strip); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2751,7 +2759,7 @@ void SEQUENCER_OT_change_effect_type(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, - SEQ_TYPE_CROSS, + STRIP_TYPE_CROSS, "Type", "Sequencer effect type"); RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_SEQUENCE); @@ -2767,19 +2775,19 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); int minext_frameme, numdigits; - if (seq->type == SEQ_TYPE_IMAGE) { + if (strip->type == STRIP_TYPE_IMAGE) { char directory[FILE_MAX]; int len; StripElem *se; /* Need to find min/max frame for placeholders. */ if (use_placeholders) { - len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minext_frameme, &numdigits); + len = sequencer_image_seq_get_minmax_frame(op, strip->sfra, &minext_frameme, &numdigits); } else { len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); @@ -2795,12 +2803,12 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) * but look into changing after 2.60. */ BLI_path_rel(directory, BKE_main_blendfile_path(bmain)); } - STRNCPY(seq->data->dirpath, directory); + STRNCPY(strip->data->dirpath, directory); - if (seq->data->stripdata) { - MEM_freeN(seq->data->stripdata); + if (strip->data->stripdata) { + MEM_freeN(strip->data->stripdata); } - seq->data->stripdata = se = MEM_cnew_array(len, "stripelem"); + strip->data->stripdata = se = MEM_cnew_array(len, "stripelem"); if (use_placeholders) { sequencer_image_seq_reserve_frames(op, se, len, minext_frameme, numdigits); @@ -2816,21 +2824,21 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) } if (len == 1) { - seq->flag |= SEQ_SINGLE_FRAME_CONTENT; + strip->flag |= SEQ_SINGLE_FRAME_CONTENT; } else { - seq->flag &= ~SEQ_SINGLE_FRAME_CONTENT; + strip->flag &= ~SEQ_SINGLE_FRAME_CONTENT; } /* Reset these else we won't see all the images. */ - seq->anim_startofs = seq->anim_endofs = 0; + strip->anim_startofs = strip->anim_endofs = 0; /* Correct start/end frames so we don't move. - * Important not to set seq->len = len; allow the function to handle it. */ - SEQ_add_reload_new_file(bmain, scene, seq, true); + * Important not to set strip->len = len; allow the function to handle it. */ + SEQ_add_reload_new_file(bmain, scene, strip, true); } - else if (seq->type == SEQ_TYPE_SOUND_RAM) { - bSound *sound = seq->sound; + else if (strip->type == STRIP_TYPE_SOUND_RAM) { + bSound *sound = strip->sound; if (sound == nullptr) { return OPERATOR_CANCELLED; } @@ -2844,16 +2852,16 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) PropertyRNA *prop; char filepath[FILE_MAX]; - PointerRNA seq_ptr = RNA_pointer_create(&scene->id, &RNA_Strip, seq); + PointerRNA strip_ptr = RNA_pointer_create(&scene->id, &RNA_Strip, strip); RNA_string_get(op->ptr, "filepath", filepath); - prop = RNA_struct_find_property(&seq_ptr, "filepath"); - RNA_property_string_set(&seq_ptr, prop, filepath); - RNA_property_update(C, &seq_ptr, prop); - SEQ_relations_sequence_free_anim(seq); + prop = RNA_struct_find_property(&strip_ptr, "filepath"); + RNA_property_string_set(&strip_ptr, prop, filepath); + RNA_property_update(C, &strip_ptr, prop); + SEQ_relations_sequence_free_anim(strip); } - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -2862,16 +2870,17 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) static int sequencer_change_path_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); char filepath[FILE_MAX]; - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join( + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); - RNA_string_set(op->ptr, "directory", seq->data->dirpath); + RNA_string_set(op->ptr, "directory", strip->data->dirpath); RNA_string_set(op->ptr, "filepath", filepath); - /* Set default display depending on seq type. */ - if (seq->type == SEQ_TYPE_IMAGE) { + /* Set default display depending on strip type. */ + if (strip->type == STRIP_TYPE_IMAGE) { RNA_boolean_set(op->ptr, "filter_movie", false); } else { @@ -2924,8 +2933,8 @@ static bool sequencer_strip_change_scene_poll(bContext *C) if (ed == nullptr) { return false; } - Strip *seq = ed->act_seq; - return ((seq != nullptr) && (seq->type == SEQ_TYPE_SCENE)); + Strip *strip = ed->act_seq; + return ((strip != nullptr) && (strip->type == STRIP_TYPE_SCENE)); } static int sequencer_change_scene_exec(bContext *C, wmOperator *op) { @@ -2940,11 +2949,11 @@ static int sequencer_change_scene_exec(bContext *C, wmOperator *op) } /* Assign new scene. */ - Strip *seq = SEQ_select_active_get(scene); - if (seq) { - seq->scene = scene_seq; + Strip *strip = SEQ_select_active_get(scene); + if (strip) { + strip->scene = scene_seq; /* Do a refresh of the sequencer data. */ - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS); DEG_relations_tag_update(bmain); } @@ -2995,21 +3004,21 @@ void SEQUENCER_OT_change_scene(wmOperatorType *ot) * \{ */ /** Comparison function suitable to be used with BLI_listbase_sort(). */ -static int seq_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b) +static int strip_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b) { const Scene *scene = static_cast(thunk); - const Strip *seq_a = static_cast(a); - const Strip *seq_b = static_cast(b); + const Strip *strip_a = static_cast(a); + const Strip *strip_b = static_cast(b); - int seq_a_start = SEQ_time_left_handle_frame_get(scene, seq_a); - int seq_b_start = SEQ_time_left_handle_frame_get(scene, seq_b); + int strip_a_start = SEQ_time_left_handle_frame_get(scene, strip_a); + int strip_b_start = SEQ_time_left_handle_frame_get(scene, strip_b); /* If strips have the same start frame favor the one with a higher channel. */ - if (seq_a_start == seq_b_start) { - return seq_a->machine > seq_b->machine; + if (strip_a_start == strip_b_start) { + return strip_a->machine > strip_b->machine; } - return (seq_a_start > seq_b_start); + return (strip_a_start > strip_b_start); } static int sequencer_export_subtitles_invoke(bContext *C, @@ -3028,16 +3037,16 @@ struct Seq_get_text_cb_data { Scene *scene; }; -static bool seq_get_text_strip_cb(Strip *seq, void *user_data) +static bool strip_get_text_strip_cb(Strip *strip, void *user_data) { Seq_get_text_cb_data *cd = (Seq_get_text_cb_data *)user_data; Editing *ed = SEQ_editing_get(cd->scene); ListBase *channels = SEQ_channels_displayed_get(ed); /* Only text strips that are not muted and don't end with negative frame. */ - if ((seq->type == SEQ_TYPE_TEXT) && !SEQ_render_is_muted(channels, seq) && - (SEQ_time_right_handle_frame_get(cd->scene, seq) > cd->scene->r.sfra)) + if ((strip->type == STRIP_TYPE_TEXT) && !SEQ_render_is_muted(channels, strip) && + (SEQ_time_right_handle_frame_get(cd->scene, strip) > cd->scene->r.sfra)) { - BLI_addtail(cd->text_seq, MEM_dupallocN(seq)); + BLI_addtail(cd->text_seq, MEM_dupallocN(strip)); } return true; } @@ -3045,7 +3054,7 @@ static bool seq_get_text_strip_cb(Strip *seq, void *user_data) static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq, *seq_next; + Strip *strip, *strip_next; Editing *ed = SEQ_editing_get(scene); ListBase text_seq = {nullptr}; int iter = 1; /* Sequence numbers in `.srt` files are 1-indexed. */ @@ -3075,7 +3084,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) if (ed != nullptr) { Seq_get_text_cb_data cb_data = {&text_seq, scene}; - SEQ_for_each_callback(&ed->seqbase, seq_get_text_strip_cb, &cb_data); + SEQ_for_each_callback(&ed->seqbase, strip_get_text_strip_cb, &cb_data); } if (BLI_listbase_is_empty(&text_seq)) { @@ -3083,13 +3092,13 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_listbase_sort_r(&text_seq, seq_cmp_time_startdisp_channel, scene); + BLI_listbase_sort_r(&text_seq, strip_cmp_time_startdisp_channel, scene); /* Open and write file. */ file = BLI_fopen(filepath, "w"); - for (seq = static_cast(text_seq.first); seq; seq = seq_next) { - TextVars *data = static_cast(seq->effectdata); + for (strip = static_cast(text_seq.first); strip; strip = strip_next) { + TextVars *data = static_cast(strip->effectdata); char timecode_str_start[32]; char timecode_str_end[32]; @@ -3098,22 +3107,22 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) timecode_str_start, sizeof(timecode_str_start), -2, - FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(scene, seq) - scene->r.sfra, 0)), + FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(scene, strip) - scene->r.sfra, 0)), FPS, USER_TIMECODE_SUBRIP); BLI_timecode_string_from_time( timecode_str_end, sizeof(timecode_str_end), -2, - FRA2TIME(SEQ_time_right_handle_frame_get(scene, seq) - scene->r.sfra), + FRA2TIME(SEQ_time_right_handle_frame_get(scene, strip) - scene->r.sfra), FPS, USER_TIMECODE_SUBRIP); fprintf( file, "%d\n%s --> %s\n%s\n\n", iter++, timecode_str_start, timecode_str_end, data->text); - seq_next = static_cast(seq->next); - MEM_freeN(seq); + strip_next = static_cast(strip->next); + MEM_freeN(strip); } fclose(file); @@ -3124,9 +3133,9 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) static bool sequencer_strip_is_text_poll(bContext *C) { Editing *ed; - Strip *seq; + Strip *strip; return (((ed = SEQ_editing_get(CTX_data_scene(C))) != nullptr) && - ((seq = ed->act_seq) != nullptr) && (seq->type == SEQ_TYPE_TEXT)); + ((strip = ed->act_seq) != nullptr) && (strip->type == STRIP_TYPE_TEXT)); } void SEQUENCER_OT_export_subtitles(wmOperatorType *ot) @@ -3169,14 +3178,14 @@ static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op) bool selected = false; const bool preview = RNA_boolean_get(op->ptr, "preview"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { selected = true; - sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(scene, seq)); + sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(scene, strip)); /* Offset of -1 is needed because in the sequencer every frame has width. * Range from 1 to 1 is drawn as range 1 to 2, because 1 frame long strip starts at frame 1 * and ends at frame 2. See #106480. */ - efra = max_ii(efra, SEQ_time_right_handle_frame_get(scene, seq) - 1); + efra = max_ii(efra, SEQ_time_right_handle_frame_get(scene, strip) - 1); } } @@ -3252,9 +3261,9 @@ static int sequencer_strip_transform_clear_exec(bContext *C, wmOperator *op) const Editing *ed = SEQ_editing_get(scene); const int property = RNA_enum_get(op->ptr, "property"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) { - StripTransform *transform = seq->data->transform; + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) { + StripTransform *transform = strip->data->transform; switch (property) { case STRIP_TRANSFORM_POSITION: transform->xofs = 0; @@ -3275,7 +3284,7 @@ static int sequencer_strip_transform_clear_exec(bContext *C, wmOperator *op) transform->rotation = 0.0f; break; } - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -3324,22 +3333,22 @@ static int sequencer_strip_transform_fit_exec(bContext *C, wmOperator *op) const Editing *ed = SEQ_editing_get(scene); const eSeqImageFitMethod fit_method = eSeqImageFitMethod(RNA_enum_get(op->ptr, "fit_method")); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) { const int timeline_frame = scene->r.cfra; - StripElem *strip_elem = SEQ_render_give_stripelem(scene, seq, timeline_frame); + StripElem *strip_elem = SEQ_render_give_stripelem(scene, strip, timeline_frame); if (strip_elem == nullptr) { continue; } - SEQ_set_scale_to_fit(seq, + SEQ_set_scale_to_fit(strip, strip_elem->orig_width, strip_elem->orig_height, scene->r.xsch, scene->r.ysch, fit_method); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -3374,9 +3383,9 @@ static int sequencer_strip_color_tag_set_exec(bContext *C, wmOperator *op) const Editing *ed = SEQ_editing_get(scene); const short color_tag = RNA_enum_get(op->ptr, "color"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - seq->color_tag = color_tag; + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + strip->color_tag = color_tag; } } @@ -3414,8 +3423,7 @@ void SEQUENCER_OT_strip_color_tag_set(wmOperatorType *ot) /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum( - ot->srna, "color", rna_enum_strip_color_items, SEQUENCE_COLOR_NONE, "Color Tag", ""); + RNA_def_enum(ot->srna, "color", rna_enum_strip_color_items, STRIP_COLOR_NONE, "Color Tag", ""); } /** \} */ @@ -3490,18 +3498,18 @@ static int sequencer_scene_frame_range_update_exec(bContext *C, wmOperator * /*o { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *seq = ed->act_seq; + Strip *strip = ed->act_seq; - const int old_start = SEQ_time_left_handle_frame_get(scene, seq); - const int old_end = SEQ_time_right_handle_frame_get(scene, seq); + const int old_start = SEQ_time_left_handle_frame_get(scene, strip); + const int old_end = SEQ_time_right_handle_frame_get(scene, strip); - Scene *target_scene = seq->scene; + Scene *target_scene = strip->scene; - seq->len = target_scene->r.efra - target_scene->r.sfra + 1; - SEQ_time_left_handle_frame_set(scene, seq, old_start); - SEQ_time_right_handle_frame_set(scene, seq, old_end); + strip->len = target_scene->r.efra - target_scene->r.sfra + 1; + SEQ_time_left_handle_frame_set(scene, strip, old_start); + SEQ_time_right_handle_frame_set(scene, strip, old_end); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_SEQUENCER, nullptr); return OPERATOR_FINISHED; @@ -3510,7 +3518,7 @@ static int sequencer_scene_frame_range_update_exec(bContext *C, wmOperator * /*o static bool sequencer_scene_frame_range_update_poll(bContext *C) { Editing *ed = SEQ_editing_get(CTX_data_scene(C)); - return (ed != nullptr && ed->act_seq != nullptr && (ed->act_seq->type & SEQ_TYPE_SCENE) != 0); + return (ed != nullptr && ed->act_seq != nullptr && (ed->act_seq->type & STRIP_TYPE_SCENE) != 0); } void SEQUENCER_OT_scene_frame_range_update(wmOperatorType *ot) diff --git a/source/blender/editors/space_sequencer/sequencer_intern.hh b/source/blender/editors/space_sequencer/sequencer_intern.hh index fc29381d1329..3c72e07eea95 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.hh +++ b/source/blender/editors/space_sequencer/sequencer_intern.hh @@ -83,7 +83,7 @@ struct SeqChannelDrawContext { }; struct StripDrawContext { - Strip *seq; + Strip *strip; const FCurve *curve = nullptr; /* Curve for overlay, if any (blend factor or volume). */ /* Strip boundary in timeline space. Content start/end is clamped by left/right handle. */ @@ -140,9 +140,9 @@ void sequencer_draw_preview(const bContext *C, bool sequencer_draw_get_transform_preview(SpaceSeq *sseq, Scene *scene); int sequencer_draw_get_transform_preview_frame(Scene *scene); -void sequencer_special_update_set(Strip *seq); +void sequencer_special_update_set(Strip *strip); /* Get handle width in 2d-View space. */ -float sequence_handle_size_get_clamped(const Scene *scene, Strip *seq, float pixelx); +float sequence_handle_size_get_clamped(const Scene *scene, Strip *strip, float pixelx); /* UNUSED */ /* void seq_reset_imageofs(SpaceSeq *sseq); */ @@ -174,15 +174,15 @@ void channel_draw_context_init(const bContext *C, /* `sequencer_edit.cc` */ -void seq_rectf(const Scene *scene, const Strip *seq, rctf *r_rect); +void strip_rectf(const Scene *scene, const Strip *strip, rctf *r_rect); Strip *find_neighboring_sequence(Scene *scene, Strip *test, int lr, int sel); -void recurs_sel_seq(Strip *seq_meta); -int seq_effect_find_selected(Scene *scene, - Strip *activeseq, - int type, - Strip **r_selseq1, - Strip **r_selseq2, - const char **r_error_str); +void recurs_sel_seq(Strip *strip_meta); +int strip_effect_find_selected(Scene *scene, + Strip *activeseq, + int type, + Strip **r_selseq1, + Strip **r_selseq2, + const char **r_error_str); /* Operator helpers. */ bool sequencer_edit_poll(bContext *C); @@ -281,7 +281,7 @@ Strip *find_nearest_seq(const Scene *scene, const View2D *v2d, const int mval[2], eSeqHandle *r_hand); -bool seq_point_image_isect(const Scene *scene, const Strip *seq, float point_view[2]); +bool strip_point_image_isect(const Scene *scene, const Strip *strip, float point_view[2]); /* `sequencer_add.cc` */ @@ -334,7 +334,7 @@ void SEQUENCER_OT_rename_channel(wmOperatorType *ot); /* `sequencer_preview.cc` */ -void sequencer_preview_add_sound(const bContext *C, const Strip *seq); +void sequencer_preview_add_sound(const bContext *C, const Strip *strip); /* `sequencer_add.cc` */ @@ -373,13 +373,13 @@ void sequencer_retiming_keys_draw(const TimelineDrawContext *timeline_ctx, blender::Span strips); void sequencer_retiming_speed_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx); -void realize_fake_keys(const Scene *scene, Strip *seq); -SeqRetimingKey *try_to_realize_fake_keys(const bContext *C, Strip *seq, const int mval[2]); +void realize_fake_keys(const Scene *scene, Strip *strip); +SeqRetimingKey *try_to_realize_fake_keys(const bContext *C, Strip *strip, const int mval[2]); SeqRetimingKey *retiming_mouseover_key_get(const bContext *C, const int mval[2], Strip **r_seq); -int left_fake_key_frame_get(const bContext *C, const Strip *seq); -int right_fake_key_frame_get(const bContext *C, const Strip *seq); +int left_fake_key_frame_get(const bContext *C, const Strip *strip); +int right_fake_key_frame_get(const bContext *C, const Strip *strip); bool retiming_keys_can_be_displayed(const SpaceSeq *sseq); -rctf seq_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Strip *seq); +rctf strip_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Strip *strip); /* `sequencer_text_edit.cc` */ bool sequencer_text_editing_active_poll(bContext *C); @@ -394,8 +394,8 @@ void SEQUENCER_OT_text_cursor_set(wmOperatorType *ot); void SEQUENCER_OT_text_edit_copy(wmOperatorType *ot); void SEQUENCER_OT_text_edit_paste(wmOperatorType *ot); void SEQUENCER_OT_text_edit_cut(wmOperatorType *ot); -blender::int2 seq_text_cursor_offset_to_position(const TextVarsRuntime *text, int cursor_offset); -blender::IndexRange seq_text_selection_range_get(const TextVars *data); +blender::int2 strip_text_cursor_offset_to_position(const TextVarsRuntime *text, int cursor_offset); +blender::IndexRange strip_text_selection_range_get(const TextVars *data); /* `sequencer_timeline_draw.cc` */ blender::Vector sequencer_visible_strips_get(const bContext *C); diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.cc b/source/blender/editors/space_sequencer/sequencer_modifier.cc index 8e736251bdf8..94b42b3ebac2 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.cc +++ b/source/blender/editors/space_sequencer/sequencer_modifier.cc @@ -36,12 +36,12 @@ static int strip_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); int type = RNA_enum_get(op->ptr, "type"); - SEQ_modifier_new(seq, nullptr, type); + SEQ_modifier_new(strip, nullptr, type); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -57,9 +57,9 @@ static const EnumPropertyItem *filter_modifiers_by_sequence_type_itemf(bContext } Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); - if (seq) { - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + Strip *strip = SEQ_select_active_get(scene); + if (strip) { + if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM)) { return rna_enum_sequence_sound_modifier_type_items; } } @@ -97,25 +97,25 @@ void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot) static int strip_modifier_remove_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); char name[MAX_NAME]; SequenceModifierData *smd; RNA_string_get(op->ptr, "name", name); - smd = SEQ_modifier_find_by_name(seq, name); + smd = SEQ_modifier_find_by_name(strip, name); if (!smd) { return OPERATOR_CANCELLED; } - BLI_remlink(&seq->modifiers, smd); + BLI_remlink(&strip->modifiers, smd); SEQ_modifier_free(smd); - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM)) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -157,7 +157,7 @@ enum { static int strip_modifier_move_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); char name[MAX_NAME]; int direction; SequenceModifierData *smd; @@ -165,29 +165,29 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); direction = RNA_enum_get(op->ptr, "direction"); - smd = SEQ_modifier_find_by_name(seq, name); + smd = SEQ_modifier_find_by_name(strip, name); if (!smd) { return OPERATOR_CANCELLED; } if (direction == SEQ_MODIFIER_MOVE_UP) { if (smd->prev) { - BLI_remlink(&seq->modifiers, smd); - BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd); + BLI_remlink(&strip->modifiers, smd); + BLI_insertlinkbefore(&strip->modifiers, smd->prev, smd); } } else if (direction == SEQ_MODIFIER_MOVE_DOWN) { if (smd->next) { - BLI_remlink(&seq->modifiers, smd); - BLI_insertlinkafter(&seq->modifiers, smd->next, smd); + BLI_remlink(&strip->modifiers, smd); + BLI_insertlinkafter(&strip->modifiers, smd->next, smd); } } - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM)) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -239,51 +239,51 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Editing *ed = scene->ed; - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); const int type = RNA_enum_get(op->ptr, "type"); - if (!seq || !seq->modifiers.first) { + if (!strip || !strip->modifiers.first) { return OPERATOR_CANCELLED; } - int isSound = ELEM(seq->type, SEQ_TYPE_SOUND_RAM); + int isSound = ELEM(strip->type, STRIP_TYPE_SOUND_RAM); - LISTBASE_FOREACH (Strip *, seq_iter, SEQ_active_seqbase_get(ed)) { - if (seq_iter->flag & SELECT) { - if (seq_iter == seq) { + LISTBASE_FOREACH (Strip *, strip_iter, SEQ_active_seqbase_get(ed)) { + if (strip_iter->flag & SELECT) { + if (strip_iter == strip) { continue; } - int seq_iter_is_sound = ELEM(seq_iter->type, SEQ_TYPE_SOUND_RAM); + int strip_iter_is_sound = ELEM(strip_iter->type, STRIP_TYPE_SOUND_RAM); /* If original is sound, only copy to "sound" strips * If original is not sound, only copy to "not sound" strips */ - if (isSound != seq_iter_is_sound) { + if (isSound != strip_iter_is_sound) { continue; } if (type == SEQ_MODIFIER_COPY_REPLACE) { - if (seq_iter->modifiers.first) { + if (strip_iter->modifiers.first) { SequenceModifierData *smd_tmp, - *smd = static_cast(seq_iter->modifiers.first); + *smd = static_cast(strip_iter->modifiers.first); while (smd) { smd_tmp = smd->next; - BLI_remlink(&seq_iter->modifiers, smd); + BLI_remlink(&strip_iter->modifiers, smd); SEQ_modifier_free(smd); smd = smd_tmp; } - BLI_listbase_clear(&seq_iter->modifiers); + BLI_listbase_clear(&strip_iter->modifiers); } } - SEQ_modifier_list_copy(seq_iter, seq); + SEQ_modifier_list_copy(strip_iter, strip); } } - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM)) { + if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM)) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); } else { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -329,20 +329,20 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) static int strip_modifier_equalizer_redefine_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); SequenceModifierData *smd; char name[MAX_NAME]; RNA_string_get(op->ptr, "name", name); int number = RNA_enum_get(op->ptr, "graphs"); - smd = SEQ_modifier_find_by_name(seq, name); + smd = SEQ_modifier_find_by_name(strip, name); if (!smd) { return OPERATOR_CANCELLED; } SEQ_sound_equalizermodifier_set_graphs((SoundEqualizerModifierData *)smd, number); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_sequencer/sequencer_preview.cc b/source/blender/editors/space_sequencer/sequencer_preview.cc index 57c00914f5fc..e02d5b9a75ff 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview.cc +++ b/source/blender/editors/space_sequencer/sequencer_preview.cc @@ -178,7 +178,7 @@ static void preview_endjob(void *data) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene); } -void sequencer_preview_add_sound(const bContext *C, const Strip *seq) +void sequencer_preview_add_sound(const bContext *C, const Strip *strip) { wmJob *wm_job; PreviewJob *pj; @@ -202,7 +202,7 @@ void sequencer_preview_add_sound(const bContext *C, const Strip *seq) BLI_mutex_unlock(pj->mutex); /* Clear the sound loading tag to that it can be reattempted. */ - clear_sound_waveform_loading_tag(seq->sound); + clear_sound_waveform_loading_tag(strip->sound); WM_event_add_notifier(C, NC_SCENE | ND_SPACE_SEQUENCER, CTX_data_scene(C)); return; } @@ -223,7 +223,7 @@ void sequencer_preview_add_sound(const bContext *C, const Strip *seq) PreviewJobAudio *audiojob = MEM_cnew("preview_audio"); audiojob->bmain = CTX_data_main(C); - audiojob->sound = seq->sound; + audiojob->sound = strip->sound; BLI_addtail(&pj->previews, audiojob); pj->total++; diff --git a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc index 7869f8cfd646..9454a7ee6ea1 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc @@ -75,9 +75,9 @@ static Strip *special_seq_update = nullptr; -void sequencer_special_update_set(Strip *seq) +void sequencer_special_update_set(Strip *strip) { - special_seq_update = seq; + special_seq_update = strip; } Strip *ED_sequencer_special_preview_get() @@ -90,8 +90,8 @@ void ED_sequencer_special_preview_set(bContext *C, const int mval[2]) Scene *scene = CTX_data_scene(C); ARegion *region = CTX_wm_region(C); eSeqHandle hand_dummy; - Strip *seq = find_nearest_seq(scene, ®ion->v2d, mval, &hand_dummy); - sequencer_special_update_set(seq); + Strip *strip = find_nearest_seq(scene, ®ion->v2d, mval, &hand_dummy); + sequencer_special_update_set(strip); } void ED_sequencer_special_preview_clear() @@ -1007,14 +1007,16 @@ int sequencer_draw_get_transform_preview_frame(Scene *scene) return preview_frame; } -static void seq_draw_image_origin_and_outline(const bContext *C, Strip *seq, bool is_active_seq) +static void strip_draw_image_origin_and_outline(const bContext *C, + Strip *strip, + bool is_active_seq) { SpaceSeq *sseq = CTX_wm_space_seq(C); const ARegion *region = CTX_wm_region(C); if (region->regiontype == RGN_TYPE_PREVIEW && !sequencer_view_preview_only_poll(C)) { return; } - if ((seq->flag & SELECT) == 0) { + if ((strip->flag & SELECT) == 0) { return; } if (ED_screen_animation_no_scrub(CTX_wm_manager(C))) { @@ -1035,7 +1037,7 @@ static void seq_draw_image_origin_and_outline(const bContext *C, Strip *seq, boo } float origin[2]; - SEQ_image_transform_origin_offset_pixelspace_get(CTX_data_scene(C), seq, origin); + SEQ_image_transform_origin_offset_pixelspace_get(CTX_data_scene(C), strip, origin); /* Origin. */ GPUVertFormat *format = immVertexFormat(); @@ -1051,8 +1053,8 @@ static void seq_draw_image_origin_and_outline(const bContext *C, Strip *seq, boo immUnbindProgram(); /* Outline. */ - float seq_image_quad[4][2]; - SEQ_image_transform_final_quad_get(CTX_data_scene(C), seq, seq_image_quad); + float strip_image_quad[4][2]; + SEQ_image_transform_final_quad_get(CTX_data_scene(C), strip, strip_image_quad); GPU_line_smooth(true); GPU_blend(GPU_BLEND_ALPHA); @@ -1069,10 +1071,10 @@ static void seq_draw_image_origin_and_outline(const bContext *C, Strip *seq, boo immUniformColor3fv(col); immUniform1f("lineWidth", U.pixelsize); immBegin(GPU_PRIM_LINE_LOOP, 4); - immVertex2f(pos, seq_image_quad[0][0], seq_image_quad[0][1]); - immVertex2f(pos, seq_image_quad[1][0], seq_image_quad[1][1]); - immVertex2f(pos, seq_image_quad[2][0], seq_image_quad[2][1]); - immVertex2f(pos, seq_image_quad[3][0], seq_image_quad[3][1]); + immVertex2f(pos, strip_image_quad[0][0], strip_image_quad[0][1]); + immVertex2f(pos, strip_image_quad[1][0], strip_image_quad[1][1]); + immVertex2f(pos, strip_image_quad[2][0], strip_image_quad[2][1]); + immVertex2f(pos, strip_image_quad[3][0], strip_image_quad[3][1]); immEnd(); immUnbindProgram(); GPU_line_width(1); @@ -1080,20 +1082,20 @@ static void seq_draw_image_origin_and_outline(const bContext *C, Strip *seq, boo GPU_line_smooth(false); } -static void text_selection_draw(const bContext *C, const Strip *seq, uint pos) +static void text_selection_draw(const bContext *C, const Strip *strip, uint pos) { - const TextVars *data = static_cast(seq->effectdata); + const TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; const Scene *scene = CTX_data_scene(C); - if (data->selection_start_offset == -1 || seq_text_selection_range_get(data).is_empty()) { + if (data->selection_start_offset == -1 || strip_text_selection_range_get(data).is_empty()) { return; } - const blender::IndexRange sel_range = seq_text_selection_range_get(data); - const blender::int2 selection_start = seq_text_cursor_offset_to_position(text, - sel_range.first()); - const blender::int2 selection_end = seq_text_cursor_offset_to_position(text, sel_range.last()); + const blender::IndexRange sel_range = strip_text_selection_range_get(data); + const blender::int2 selection_start = strip_text_cursor_offset_to_position(text, + sel_range.first()); + const blender::int2 selection_end = strip_text_cursor_offset_to_position(text, sel_range.last()); const int line_start = selection_start.y; const int line_end = selection_end.y; @@ -1114,7 +1116,7 @@ static void text_selection_draw(const bContext *C, const Strip *seq, uint pos) const blender::float3 view_offs{-scene->r.xsch / 2.0f, -scene->r.ysch / 2.0f, 0.0f}; const float view_aspect = scene->r.xasp / scene->r.yasp; blender::float4x4 transform_mat; - SEQ_image_transform_matrix_get(scene, seq, transform_mat.ptr()); + SEQ_image_transform_matrix_get(scene, strip, transform_mat.ptr()); blender::float4x3 selection_quad{ {character_start.position.x, line_y, 0.0f}, {character_start.position.x, line_y + text->line_height, 0.0f}, @@ -1150,18 +1152,18 @@ static blender::float2 coords_region_view_align(const View2D *v2d, const blender return coords_region_aligned; } -static void text_edit_draw_cursor(const bContext *C, const Strip *seq, uint pos) +static void text_edit_draw_cursor(const bContext *C, const Strip *strip, uint pos) { - const TextVars *data = static_cast(seq->effectdata); + const TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; const Scene *scene = CTX_data_scene(C); const blender::float3 view_offs{-scene->r.xsch / 2.0f, -scene->r.ysch / 2.0f, 0.0f}; const float view_aspect = scene->r.xasp / scene->r.yasp; blender::float4x4 transform_mat; - SEQ_image_transform_matrix_get(scene, seq, transform_mat.ptr()); - const blender::int2 cursor_position = seq_text_cursor_offset_to_position(text, - data->cursor_offset); + SEQ_image_transform_matrix_get(scene, strip, transform_mat.ptr()); + const blender::int2 cursor_position = strip_text_cursor_offset_to_position(text, + data->cursor_offset); const float cursor_width = 10; blender::float2 cursor_coords = text->lines[cursor_position.y].characters[cursor_position.x].position; @@ -1198,16 +1200,16 @@ static void text_edit_draw_cursor(const bContext *C, const Strip *seq, uint pos) immEnd(); } -static void text_edit_draw_box(const bContext *C, const Strip *seq, uint pos) +static void text_edit_draw_box(const bContext *C, const Strip *strip, uint pos) { - const TextVars *data = static_cast(seq->effectdata); + const TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; const Scene *scene = CTX_data_scene(C); const blender::float3 view_offs{-scene->r.xsch / 2.0f, -scene->r.ysch / 2.0f, 0.0f}; const float view_aspect = scene->r.xasp / scene->r.yasp; blender::float4x4 transform_mat; - SEQ_image_transform_matrix_get(CTX_data_scene(C), seq, transform_mat.ptr()); + SEQ_image_transform_matrix_get(CTX_data_scene(C), strip, transform_mat.ptr()); blender::float4x3 box_quad{ {float(text->text_boundbox.xmin), float(text->text_boundbox.ymin), 0.0f}, {float(text->text_boundbox.xmin), float(text->text_boundbox.ymax), 0.0f}, @@ -1240,8 +1242,8 @@ static void text_edit_draw(const bContext *C) if (!sequencer_text_editing_active_poll(const_cast(C))) { return; } - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - if (!SEQ_effects_can_render_text(seq)) { + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + if (!SEQ_effects_can_render_text(strip)) { return; } @@ -1251,14 +1253,14 @@ static void text_edit_draw(const bContext *C) GPU_blend(GPU_BLEND_ALPHA); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - text_selection_draw(C, seq, pos); - text_edit_draw_cursor(C, seq, pos); + text_selection_draw(C, strip, pos); + text_edit_draw_cursor(C, strip, pos); immUnbindProgram(); GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); - text_edit_draw_box(C, seq, pos); + text_edit_draw_box(C, strip, pos); } void sequencer_draw_preview(const bContext *C, @@ -1345,8 +1347,8 @@ void sequencer_draw_preview(const bContext *C, blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, ed->seqbasep, timeline_frame, 0); Strip *active_seq = SEQ_select_active_get(scene); - for (Strip *seq : strips) { - seq_draw_image_origin_and_outline(C, seq, seq == active_seq); + for (Strip *strip : strips) { + strip_draw_image_origin_and_outline(C, strip, strip == active_seq); text_edit_draw(C); } } diff --git a/source/blender/editors/space_sequencer/sequencer_proxy.cc b/source/blender/editors/space_sequencer/sequencer_proxy.cc index 8739321bd10e..aca161b9560b 100644 --- a/source/blender/editors/space_sequencer/sequencer_proxy.cc +++ b/source/blender/editors/space_sequencer/sequencer_proxy.cc @@ -54,7 +54,7 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports) bool selected = false; /* Check for no selected strips */ LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE) || (seq->flag & SELECT) == 0) { + if (!ELEM(seq->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE) || (seq->flag & SELECT) == 0) { continue; } @@ -172,7 +172,7 @@ static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op) LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { if (seq->flag & SELECT) { - if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { + if (ELEM(seq->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { SEQ_proxy_set(seq, turnon); if (seq->data->proxy == nullptr) { continue; diff --git a/source/blender/editors/space_sequencer/sequencer_retiming.cc b/source/blender/editors/space_sequencer/sequencer_retiming.cc index 2ca5bc4b3570..54f2a4d52269 100644 --- a/source/blender/editors/space_sequencer/sequencer_retiming.cc +++ b/source/blender/editors/space_sequencer/sequencer_retiming.cc @@ -56,34 +56,34 @@ bool sequencer_retiming_mode_is_active(const bContext *C) static void sequencer_retiming_data_show_selection(ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if ((seq->flag & SELECT) == 0) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if ((strip->flag & SELECT) == 0) { continue; } - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { continue; } - seq->flag |= SEQ_SHOW_RETIMING; + strip->flag |= SEQ_SHOW_RETIMING; } } static void sequencer_retiming_data_hide_selection(ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if ((seq->flag & SELECT) == 0) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if ((strip->flag & SELECT) == 0) { continue; } - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { continue; } - seq->flag &= ~SEQ_SHOW_RETIMING; + strip->flag &= ~SEQ_SHOW_RETIMING; } } static void sequencer_retiming_data_hide_all(ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - seq->flag &= ~SEQ_SHOW_RETIMING; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + strip->flag &= ~SEQ_SHOW_RETIMING; } } @@ -91,16 +91,16 @@ static int sequencer_retiming_data_show_exec(bContext *C, wmOperator * /*op*/) { Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); - Strip *seq_act = SEQ_select_active_get(scene); + Strip *strip_act = SEQ_select_active_get(scene); - if (seq_act == nullptr) { + if (strip_act == nullptr) { return OPERATOR_CANCELLED; } if (sequencer_retiming_mode_is_active(C)) { sequencer_retiming_data_hide_all(ed->seqbasep); } - else if (SEQ_retiming_data_is_editable(seq_act)) { + else if (SEQ_retiming_data_is_editable(strip_act)) { sequencer_retiming_data_hide_selection(ed->seqbasep); } else { @@ -134,11 +134,11 @@ static bool retiming_poll(bContext *C) if (ed == nullptr) { return false; } - Strip *seq = ed->act_seq; - if (seq == nullptr) { + Strip *strip = ed->act_seq; + if (strip == nullptr) { return false; } - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { CTX_wm_operator_poll_msg_set(C, "This strip type cannot be retimed"); return false; } @@ -154,8 +154,8 @@ static int sequencer_retiming_reset_exec(bContext *C, wmOperator * /*op*/) Scene *scene = CTX_data_scene(C); const Editing *ed = SEQ_editing_get(scene); - for (Strip *seq : SEQ_query_selected_strips(ed->seqbasep)) { - SEQ_retiming_reset(scene, seq); + for (Strip *strip : SEQ_query_selected_strips(ed->seqbasep)) { + SEQ_retiming_reset(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -179,12 +179,12 @@ void SEQUENCER_OT_retiming_reset(wmOperatorType *ot) /** \} */ -static SeqRetimingKey *ensure_left_and_right_keys(const bContext *C, Strip *seq) +static SeqRetimingKey *ensure_left_and_right_keys(const bContext *C, Strip *strip) { Scene *scene = CTX_data_scene(C); - SEQ_retiming_data_ensure(seq); - SEQ_retiming_add_key(scene, seq, left_fake_key_frame_get(C, seq)); - return SEQ_retiming_add_key(scene, seq, right_fake_key_frame_get(C, seq)); + SEQ_retiming_data_ensure(strip); + SEQ_retiming_add_key(scene, strip, left_fake_key_frame_get(C, strip)); + return SEQ_retiming_add_key(scene, strip, right_fake_key_frame_get(C, strip)); } /* -------------------------------------------------------------------- */ @@ -193,26 +193,26 @@ static SeqRetimingKey *ensure_left_and_right_keys(const bContext *C, Strip *seq) static bool retiming_key_add_new_for_seq(bContext *C, wmOperator *op, - Strip *seq, + Strip *strip, const int timeline_frame) { Scene *scene = CTX_data_scene(C); - const float frame_index = (BKE_scene_frame_get(scene) - SEQ_time_start_frame_get(seq)) * - SEQ_time_media_playback_rate_factor_get(scene, seq); - const SeqRetimingKey *key = SEQ_retiming_find_segment_start_key(seq, frame_index); + const float frame_index = (BKE_scene_frame_get(scene) - SEQ_time_start_frame_get(strip)) * + SEQ_time_media_playback_rate_factor_get(scene, strip); + const SeqRetimingKey *key = SEQ_retiming_find_segment_start_key(strip, frame_index); if (key != nullptr && SEQ_retiming_key_is_transition_start(key)) { BKE_report(op->reports, RPT_WARNING, "Cannot create key inside of speed transition"); return false; } - const float end_frame = seq->start + SEQ_time_strip_length_get(scene, seq); - if (seq->start > timeline_frame || end_frame < timeline_frame) { + const float end_frame = strip->start + SEQ_time_strip_length_get(scene, strip); + if (strip->start > timeline_frame || end_frame < timeline_frame) { return false; } - ensure_left_and_right_keys(C, seq); - SEQ_retiming_add_key(scene, seq, timeline_frame); + ensure_left_and_right_keys(C, strip); + SEQ_retiming_add_key(scene, strip, timeline_frame); return true; } @@ -223,11 +223,11 @@ static int retiming_key_add_from_selection(bContext *C, { bool inserted = false; - for (Strip *seq : strips) { - if (!SEQ_retiming_is_allowed(seq)) { + for (Strip *strip : strips) { + if (!SEQ_retiming_is_allowed(strip)) { continue; } - inserted |= retiming_key_add_new_for_seq(C, op, seq, timeline_frame); + inserted |= retiming_key_add_new_for_seq(C, op, strip, timeline_frame); } return inserted ? OPERATOR_FINISHED : OPERATOR_CANCELLED; @@ -246,8 +246,8 @@ static int retiming_key_add_to_editable_strips(bContext *C, return OPERATOR_CANCELLED; } - for (Strip *seq : selection.values()) { - inserted |= retiming_key_add_new_for_seq(C, op, seq, timeline_frame); + for (Strip *strip : selection.values()) { + inserted |= retiming_key_add_new_for_seq(C, op, strip, timeline_frame); } return inserted ? OPERATOR_FINISHED : OPERATOR_CANCELLED; @@ -311,15 +311,15 @@ void SEQUENCER_OT_retiming_key_add(wmOperatorType *ot) static bool freeze_frame_add_new_for_seq(const bContext *C, const wmOperator *op, - Strip *seq, + Strip *strip, const int timeline_frame, const int duration) { Scene *scene = CTX_data_scene(C); - ensure_left_and_right_keys(C, seq); + ensure_left_and_right_keys(C, strip); // ensure L+R key - SeqRetimingKey *key = SEQ_retiming_add_key(scene, seq, timeline_frame); + SeqRetimingKey *key = SEQ_retiming_add_key(scene, strip, timeline_frame); if (key == nullptr) { BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame"); @@ -331,7 +331,7 @@ static bool freeze_frame_add_new_for_seq(const bContext *C, return false; } - SeqRetimingKey *freeze = SEQ_retiming_add_freeze_frame(scene, seq, key, duration); + SeqRetimingKey *freeze = SEQ_retiming_add_freeze_frame(scene, strip, key, duration); if (freeze == nullptr) { BKE_report(op->reports, RPT_WARNING, "Cannot create freeze frame"); @@ -341,7 +341,7 @@ static bool freeze_frame_add_new_for_seq(const bContext *C, ED_sequencer_deselect_all(scene); SEQ_retiming_selection_append(freeze); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); return true; } @@ -351,13 +351,13 @@ static bool freeze_frame_add_from_strip_selection(bContext *C, { Scene *scene = CTX_data_scene(C); blender::VectorSet strips = ED_sequencer_selected_strips_from_context(C); - strips.remove_if([&](Strip *seq) { return !SEQ_retiming_is_allowed(seq); }); + strips.remove_if([&](Strip *strip) { return !SEQ_retiming_is_allowed(strip); }); const int timeline_frame = BKE_scene_frame_get(scene); bool success = false; - for (Strip *seq : strips) { - success |= freeze_frame_add_new_for_seq(C, op, seq, timeline_frame, duration); - SEQ_relations_invalidate_cache_raw(scene, seq); + for (Strip *strip : strips) { + success |= freeze_frame_add_new_for_seq(C, op, strip, timeline_frame, duration); + SEQ_relations_invalidate_cache_raw(scene, strip); } return success; } @@ -436,26 +436,26 @@ void SEQUENCER_OT_retiming_freeze_frame_add(wmOperatorType *ot) static bool transition_add_new_for_seq(const bContext *C, const wmOperator *op, - Strip *seq, + Strip *strip, const int timeline_frame, const int duration) { Scene *scene = CTX_data_scene(C); // ensure L+R key - ensure_left_and_right_keys(C, seq); - SeqRetimingKey *key = SEQ_retiming_add_key(scene, seq, timeline_frame); + ensure_left_and_right_keys(C, strip); + SeqRetimingKey *key = SEQ_retiming_add_key(scene, strip, timeline_frame); if (key == nullptr) { - key = SEQ_retiming_key_get_by_timeline_frame(scene, seq, timeline_frame); + key = SEQ_retiming_key_get_by_timeline_frame(scene, strip, timeline_frame); } - if (SEQ_retiming_is_last_key(seq, key) || key->strip_frame_index == 0) { + if (SEQ_retiming_is_last_key(strip, key) || key->strip_frame_index == 0) { BKE_report(op->reports, RPT_WARNING, "Cannot create transition from first or last key"); return false; } - SeqRetimingKey *transition = SEQ_retiming_add_transition(seq, key, duration); + SeqRetimingKey *transition = SEQ_retiming_add_transition(strip, key, duration); if (transition == nullptr) { BKE_report(op->reports, RPT_WARNING, "Cannot create transition"); @@ -465,7 +465,7 @@ static bool transition_add_new_for_seq(const bContext *C, ED_sequencer_deselect_all(scene); SEQ_retiming_selection_append(transition); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); return true; } @@ -552,24 +552,24 @@ static int sequencer_retiming_key_delete_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } - for (Strip *seq : selection.values()) { - strips_to_handle.append_non_duplicates(seq); + for (Strip *strip : selection.values()) { + strips_to_handle.append_non_duplicates(strip); } - for (Strip *seq : strips_to_handle) { + for (Strip *strip : strips_to_handle) { blender::Vector keys_to_delete; for (auto item : selection.items()) { - if (item.value != seq) { + if (item.value != strip) { continue; } keys_to_delete.append(item.key); } - SEQ_retiming_remove_multiple_keys(seq, keys_to_delete); + SEQ_retiming_remove_multiple_keys(strip, keys_to_delete); } - for (Strip *seq : strips_to_handle) { - SEQ_relations_invalidate_cache_raw(scene, seq); + for (Strip *strip : strips_to_handle) { + SEQ_relations_invalidate_cache_raw(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -625,9 +625,9 @@ static float strip_speed_get(bContext *C, const wmOperator * /*op*/) if (!sequencer_retiming_mode_is_active(C)) { blender::VectorSet strips = ED_sequencer_selected_strips_from_context(C); if (strips.size() == 1) { - Strip *seq = strips[0]; - SeqRetimingKey *key = ensure_left_and_right_keys(C, seq); - return SEQ_retiming_key_speed_get(seq, key); + Strip *strip = strips[0]; + SeqRetimingKey *key = ensure_left_and_right_keys(C, strip); + return SEQ_retiming_key_speed_get(strip, key); } } @@ -647,23 +647,23 @@ static int strip_speed_set_exec(bContext *C, const wmOperator *op) { Scene *scene = CTX_data_scene(C); blender::VectorSet strips = ED_sequencer_selected_strips_from_context(C); - strips.remove_if([&](Strip *seq) { return !SEQ_retiming_is_allowed(seq); }); + strips.remove_if([&](Strip *strip) { return !SEQ_retiming_is_allowed(strip); }); - for (Strip *seq : strips) { - SeqRetimingKey *key = ensure_left_and_right_keys(C, seq); + for (Strip *strip : strips) { + SeqRetimingKey *key = ensure_left_and_right_keys(C, strip); if (key == nullptr) { continue; } /* TODO: it would be nice to multiply speed with complex retiming by a factor. */ - SEQ_retiming_key_speed_set(scene, seq, key, RNA_float_get(op->ptr, "speed"), false); + SEQ_retiming_key_speed_set(scene, strip, key, RNA_float_get(op->ptr, "speed"), false); ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); - if (SEQ_transform_test_overlap(scene, seqbase, seq)) { - SEQ_transform_seqbase_shuffle(seqbase, seq, scene); + if (SEQ_transform_test_overlap(scene, seqbase, strip)) { + SEQ_transform_seqbase_shuffle(seqbase, strip, scene); } - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -867,21 +867,21 @@ int sequencer_retiming_key_select_exec(bContext *C, return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static void realize_fake_keys_in_rect(bContext *C, Strip *seq, const rctf &rectf) +static void realize_fake_keys_in_rect(bContext *C, Strip *strip, const rctf &rectf) { const Scene *scene = CTX_data_scene(C); - const int content_start = SEQ_time_start_frame_get(seq); - const int left_key_frame = max_ii(content_start, SEQ_time_left_handle_frame_get(scene, seq)); - const int content_end = SEQ_time_content_end_frame_get(scene, seq); - const int right_key_frame = min_ii(content_end, SEQ_time_right_handle_frame_get(scene, seq)); + const int content_start = SEQ_time_start_frame_get(strip); + const int left_key_frame = max_ii(content_start, SEQ_time_left_handle_frame_get(scene, strip)); + const int content_end = SEQ_time_content_end_frame_get(scene, strip); + const int right_key_frame = min_ii(content_end, SEQ_time_right_handle_frame_get(scene, strip)); /* Realize "fake" keys. */ if (left_key_frame > rectf.xmin && left_key_frame < rectf.xmax) { - SEQ_retiming_add_key(scene, seq, left_key_frame); + SEQ_retiming_add_key(scene, strip, left_key_frame); } if (right_key_frame > rectf.xmin && right_key_frame < rectf.xmax) { - SEQ_retiming_add_key(scene, seq, right_key_frame); + SEQ_retiming_add_key(scene, strip, right_key_frame); } } @@ -908,19 +908,19 @@ int sequencer_retiming_box_select_exec(bContext *C, wmOperator *op) blender::Set and_keys; - for (Strip *seq : sequencer_visible_strips_get(C)) { - if (seq->machine < rectf.ymin || seq->machine > rectf.ymax) { + for (Strip *strip : sequencer_visible_strips_get(C)) { + if (strip->machine < rectf.ymin || strip->machine > rectf.ymax) { continue; } - if (!SEQ_retiming_data_is_editable(seq)) { + if (!SEQ_retiming_data_is_editable(strip)) { continue; } - realize_fake_keys_in_rect(C, seq, rectf); + realize_fake_keys_in_rect(C, strip, rectf); - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { - const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, &key); - const int strip_start = SEQ_time_left_handle_frame_get(scene, seq); - const int strip_end = SEQ_time_right_handle_frame_get(scene, seq); + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { + const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, &key); + const int strip_start = SEQ_time_left_handle_frame_get(scene, strip); + const int strip_end = SEQ_time_right_handle_frame_get(scene, strip); if (key_frame < strip_start || key_frame > strip_end) { continue; } @@ -977,11 +977,11 @@ int sequencer_retiming_select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; - for (Strip *seq : strips) { - if (!SEQ_retiming_data_is_editable(seq)) { + for (Strip *strip : strips) { + if (!SEQ_retiming_data_is_editable(strip)) { continue; } - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { if (key.flag & SEQ_KEY_SELECTED) { action = SEL_DESELECT; break; @@ -994,11 +994,11 @@ int sequencer_retiming_select_all_exec(bContext *C, wmOperator *op) SEQ_retiming_selection_clear(SEQ_editing_get(scene)); } - for (Strip *seq : strips) { - if (!SEQ_retiming_data_is_editable(seq)) { + for (Strip *strip : strips) { + if (!SEQ_retiming_data_is_editable(strip)) { continue; } - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { switch (action) { case SEL_SELECT: key.flag |= SEQ_KEY_SELECTED; diff --git a/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc b/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc index f6cfa833fa2d..e519ab7a4284 100644 --- a/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_retiming_draw.cc @@ -40,7 +40,8 @@ #include "sequencer_quads_batch.hh" #define KEY_SIZE (10 * U.pixelsize) -#define KEY_CENTER (UI_view2d_view_to_region_y(v2d, strip_y_rescale(seq, 0.0f)) + 4 + KEY_SIZE / 2) +#define KEY_CENTER \ + (UI_view2d_view_to_region_y(v2d, strip_y_rescale(strip, 0.0f)) + 4 + KEY_SIZE / 2) bool retiming_keys_can_be_displayed(const SpaceSeq *sseq) { @@ -48,18 +49,18 @@ bool retiming_keys_can_be_displayed(const SpaceSeq *sseq) (sseq->flag & SEQ_SHOW_OVERLAY); } -static float strip_y_rescale(const Strip *seq, const float y_value) +static float strip_y_rescale(const Strip *strip, const float y_value) { - const float y_range = SEQ_STRIP_OFSTOP - SEQ_STRIP_OFSBOTTOM; - return (y_value * y_range) + seq->machine + SEQ_STRIP_OFSBOTTOM; + const float y_range = STRIP_OFSTOP - STRIP_OFSBOTTOM; + return (y_value * y_range) + strip->machine + STRIP_OFSBOTTOM; } -static float key_x_get(const Scene *scene, const Strip *seq, const SeqRetimingKey *key) +static float key_x_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key) { - if (SEQ_retiming_is_last_key(seq, key)) { - return SEQ_retiming_key_timeline_frame_get(scene, seq, key) + 1; + if (SEQ_retiming_is_last_key(strip, key)) { + return SEQ_retiming_key_timeline_frame_get(scene, strip, key) + 1; } - return SEQ_retiming_key_timeline_frame_get(scene, seq, key); + return SEQ_retiming_key_timeline_frame_get(scene, strip, key); } static float pixels_to_view_width(const bContext *C, const float width) @@ -76,74 +77,76 @@ static float pixels_to_view_height(const bContext *C, const float height) return height / scale_y; } -static float strip_start_screenspace_get(const Scene *scene, const View2D *v2d, const Strip *seq) +static float strip_start_screenspace_get(const Scene *scene, const View2D *v2d, const Strip *strip) { - return UI_view2d_view_to_region_x(v2d, SEQ_time_left_handle_frame_get(scene, seq)); + return UI_view2d_view_to_region_x(v2d, SEQ_time_left_handle_frame_get(scene, strip)); } -static float strip_end_screenspace_get(const Scene *scene, const View2D *v2d, const Strip *seq) +static float strip_end_screenspace_get(const Scene *scene, const View2D *v2d, const Strip *strip) { - return UI_view2d_view_to_region_x(v2d, SEQ_time_right_handle_frame_get(scene, seq)); + return UI_view2d_view_to_region_x(v2d, SEQ_time_right_handle_frame_get(scene, strip)); } -static rctf strip_box_get(const Scene *scene, const View2D *v2d, const Strip *seq) +static rctf strip_box_get(const Scene *scene, const View2D *v2d, const Strip *strip) { rctf rect; - rect.xmin = strip_start_screenspace_get(scene, v2d, seq); - rect.xmax = strip_end_screenspace_get(scene, v2d, seq); - rect.ymin = UI_view2d_view_to_region_y(v2d, strip_y_rescale(seq, 0)); - rect.ymax = UI_view2d_view_to_region_y(v2d, strip_y_rescale(seq, 1)); + rect.xmin = strip_start_screenspace_get(scene, v2d, strip); + rect.xmax = strip_end_screenspace_get(scene, v2d, strip); + rect.ymin = UI_view2d_view_to_region_y(v2d, strip_y_rescale(strip, 0)); + rect.ymax = UI_view2d_view_to_region_y(v2d, strip_y_rescale(strip, 1)); return rect; } /** Size in pixels. */ #define RETIME_KEY_MOUSEOVER_THRESHOLD (16.0f * UI_SCALE_FAC) -rctf seq_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Strip *seq) +rctf strip_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Strip *strip) { - rctf rect = strip_box_get(scene, v2d, seq); + rctf rect = strip_box_get(scene, v2d, strip); rect.ymax = KEY_CENTER + KEY_SIZE / 2; rect.ymin = KEY_CENTER - KEY_SIZE / 2; return rect; } -int left_fake_key_frame_get(const bContext *C, const Strip *seq) +int left_fake_key_frame_get(const bContext *C, const Strip *strip) { const Scene *scene = CTX_data_scene(C); - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); - const int content_start = SEQ_time_start_frame_get(seq) + sound_offset; - return max_ii(content_start, SEQ_time_left_handle_frame_get(scene, seq)); + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); + const int content_start = SEQ_time_start_frame_get(strip) + sound_offset; + return max_ii(content_start, SEQ_time_left_handle_frame_get(scene, strip)); } -int right_fake_key_frame_get(const bContext *C, const Strip *seq) +int right_fake_key_frame_get(const bContext *C, const Strip *strip) { const Scene *scene = CTX_data_scene(C); - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); - const int content_end = SEQ_time_content_end_frame_get(scene, seq) - 1 + sound_offset; - return min_ii(content_end, SEQ_time_right_handle_frame_get(scene, seq)); + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); + const int content_end = SEQ_time_content_end_frame_get(scene, strip) - 1 + sound_offset; + return min_ii(content_end, SEQ_time_right_handle_frame_get(scene, strip)); } static bool retiming_fake_key_frame_clicked(const bContext *C, - const Strip *seq, + const Strip *strip, const int mval[2], int &r_frame) { const Scene *scene = CTX_data_scene(C); const View2D *v2d = UI_view2d_fromcontext(C); - rctf box = seq_retiming_keys_box_get(scene, v2d, seq); + rctf box = strip_retiming_keys_box_get(scene, v2d, strip); if (!BLI_rctf_isect_pt(&box, mval[0], mval[1])) { return false; } - const int left_frame = left_fake_key_frame_get(C, seq); + const int left_frame = left_fake_key_frame_get(C, strip); const float left_distance = fabs(UI_view2d_view_to_region_x(v2d, left_frame) - mval[0]); - const int right_frame = right_fake_key_frame_get(C, seq); + const int right_frame = right_fake_key_frame_get(C, strip); int right_x = right_frame; /* `key_x_get()` compensates 1 frame offset of last key, however this can not * be conveyed via `fake_key` alone. Therefore the same offset must be emulated. */ - if (SEQ_time_right_handle_frame_get(scene, seq) >= SEQ_time_content_end_frame_get(scene, seq)) { + if (SEQ_time_right_handle_frame_get(scene, strip) >= + SEQ_time_content_end_frame_get(scene, strip)) + { right_x += 1; } const float right_distance = fabs(UI_view2d_view_to_region_x(v2d, right_x) - mval[0]); @@ -152,28 +155,28 @@ static bool retiming_fake_key_frame_clicked(const bContext *C, return min_ff(left_distance, right_distance) < RETIME_KEY_MOUSEOVER_THRESHOLD; } -void realize_fake_keys(const Scene *scene, Strip *seq) +void realize_fake_keys(const Scene *scene, Strip *strip) { - SEQ_retiming_data_ensure(seq); - SEQ_retiming_add_key(scene, seq, SEQ_time_left_handle_frame_get(scene, seq)); - SEQ_retiming_add_key(scene, seq, SEQ_time_right_handle_frame_get(scene, seq)); + SEQ_retiming_data_ensure(strip); + SEQ_retiming_add_key(scene, strip, SEQ_time_left_handle_frame_get(scene, strip)); + SEQ_retiming_add_key(scene, strip, SEQ_time_right_handle_frame_get(scene, strip)); } -SeqRetimingKey *try_to_realize_fake_keys(const bContext *C, Strip *seq, const int mval[2]) +SeqRetimingKey *try_to_realize_fake_keys(const bContext *C, Strip *strip, const int mval[2]) { Scene *scene = CTX_data_scene(C); SeqRetimingKey *key = nullptr; int key_frame; - if (retiming_fake_key_frame_clicked(C, seq, mval, key_frame)) { - realize_fake_keys(scene, seq); - key = SEQ_retiming_key_get_by_timeline_frame(scene, seq, key_frame); + if (retiming_fake_key_frame_clicked(C, strip, mval, key_frame)) { + realize_fake_keys(scene, strip); + key = SEQ_retiming_key_get_by_timeline_frame(scene, strip, key_frame); } return key; } static SeqRetimingKey *mouse_over_key_get_from_strip(const bContext *C, - const Strip *seq, + const Strip *strip, const int mval[2]) { const Scene *scene = CTX_data_scene(C); @@ -182,13 +185,13 @@ static SeqRetimingKey *mouse_over_key_get_from_strip(const bContext *C, int best_distance = INT_MAX; SeqRetimingKey *best_key = nullptr; - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { int distance = round_fl_to_int( - fabsf(UI_view2d_view_to_region_x(v2d, key_x_get(scene, seq, &key)) - mval[0])); + fabsf(UI_view2d_view_to_region_x(v2d, key_x_get(scene, strip, &key)) - mval[0])); int threshold = RETIME_KEY_MOUSEOVER_THRESHOLD; - if (key_x_get(scene, seq, &key) == SEQ_time_left_handle_frame_get(scene, seq) || - key_x_get(scene, seq, &key) == SEQ_time_right_handle_frame_get(scene, seq)) + if (key_x_get(scene, strip, &key) == SEQ_time_left_handle_frame_get(scene, strip) || + key_x_get(scene, strip, &key) == SEQ_time_right_handle_frame_get(scene, strip)) { threshold *= 2; /* Make first and last key easier to select. */ } @@ -206,17 +209,17 @@ SeqRetimingKey *retiming_mouseover_key_get(const bContext *C, const int mval[2], { const Scene *scene = CTX_data_scene(C); const View2D *v2d = UI_view2d_fromcontext(C); - for (Strip *seq : sequencer_visible_strips_get(C)) { - rctf box = seq_retiming_keys_box_get(scene, v2d, seq); + for (Strip *strip : sequencer_visible_strips_get(C)) { + rctf box = strip_retiming_keys_box_get(scene, v2d, strip); if (!BLI_rctf_isect_pt(&box, mval[0], mval[1])) { continue; } if (r_seq != nullptr) { - *r_seq = seq; + *r_seq = strip; } - SeqRetimingKey *key = mouse_over_key_get_from_strip(C, seq, mval); + SeqRetimingKey *key = mouse_over_key_get_from_strip(C, strip, mval); if (key == nullptr) { continue; @@ -239,7 +242,7 @@ static bool can_draw_retiming(const TimelineDrawContext *timeline_ctx, return false; } - if (!SEQ_retiming_is_allowed(strip_ctx.seq)) { + if (!SEQ_retiming_is_allowed(strip_ctx.strip)) { return false; } @@ -261,10 +264,10 @@ static void retime_key_draw(const TimelineDrawContext *timeline_ctx, { const Scene *scene = timeline_ctx->scene; const View2D *v2d = timeline_ctx->v2d; - Strip *seq = strip_ctx.seq; + Strip *strip = strip_ctx.strip; - const float key_x = key_x_get(scene, seq, key); - const rctf strip_box = strip_box_get(scene, v2d, seq); + const float key_x = key_x_get(scene, strip, key); + const rctf strip_box = strip_box_get(scene, v2d, strip); if (!BLI_rctf_isect_x(&strip_box, UI_view2d_view_to_region_x(v2d, key_x))) { return; /* Key out of the strip bounds. */ } @@ -287,12 +290,12 @@ static void retime_key_draw(const TimelineDrawContext *timeline_ctx, const float left_pos_min = UI_view2d_view_to_region_x(v2d, strip_ctx.left_handle) + (size / 2); float key_position = UI_view2d_view_to_region_x(v2d, key_x); CLAMP(key_position, left_pos_min, right_pos_max); - const float alpha = SEQ_retiming_data_is_editable(seq) ? 1.0f : 0.3f; + const float alpha = SEQ_retiming_data_is_editable(strip) ? 1.0f : 0.3f; draw_keyframe_shape(key_position, bottom, size, - is_selected && SEQ_retiming_data_is_editable(seq), + is_selected && SEQ_retiming_data_is_editable(strip), key_type, KEYFRAME_SHAPE_BOTH, alpha, @@ -304,23 +307,24 @@ static void retime_key_draw(const TimelineDrawContext *timeline_ctx, void sequencer_retiming_draw_continuity(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx) { - if (!can_draw_retiming(timeline_ctx, strip_ctx) || SEQ_retiming_keys_count(strip_ctx.seq) == 0) { + if (!can_draw_retiming(timeline_ctx, strip_ctx) || SEQ_retiming_keys_count(strip_ctx.strip) == 0) + { return; } - const Strip *seq = strip_ctx.seq; + const Strip *strip = strip_ctx.strip; const View2D *v2d = timeline_ctx->v2d; const Scene *scene = timeline_ctx->scene; const float left_handle_position = UI_view2d_view_to_region_x(v2d, strip_ctx.left_handle); const float right_handle_position = UI_view2d_view_to_region_x(v2d, strip_ctx.right_handle); - for (const SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { - if (key_x_get(scene, seq, &key) == strip_ctx.left_handle || key.strip_frame_index == 0) { + for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { + if (key_x_get(scene, strip, &key) == strip_ctx.left_handle || key.strip_frame_index == 0) { continue; } - float key_position = UI_view2d_view_to_region_x(v2d, key_x_get(scene, seq, &key)); - float prev_key_position = UI_view2d_view_to_region_x(v2d, key_x_get(scene, seq, &key - 1)); + float key_position = UI_view2d_view_to_region_x(v2d, key_x_get(scene, strip, &key)); + float prev_key_position = UI_view2d_view_to_region_x(v2d, key_x_get(scene, strip, &key - 1)); if (prev_key_position > right_handle_position || key_position < left_handle_position) { /* Don't draw highlights for out of bounds retiming keys. */ continue; @@ -336,7 +340,7 @@ void sequencer_retiming_draw_continuity(const TimelineDrawContext *timeline_ctx, const float top = y_center + size * width_fac; uchar color[4]; - if (SEQ_retiming_data_is_editable(seq) && + if (SEQ_retiming_data_is_editable(strip) && (timeline_ctx->retiming_selection.contains(const_cast(&key)) || timeline_ctx->retiming_selection.contains(const_cast(&key - 1)))) { @@ -355,12 +359,12 @@ void sequencer_retiming_draw_continuity(const TimelineDrawContext *timeline_ctx, } } -static SeqRetimingKey fake_retiming_key_init(const Scene *scene, const Strip *seq, int key_x) +static SeqRetimingKey fake_retiming_key_init(const Scene *scene, const Strip *strip, int key_x) { - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); SeqRetimingKey fake_key = {0}; - fake_key.strip_frame_index = (key_x - SEQ_time_start_frame_get(seq) - sound_offset) * - SEQ_time_media_playback_rate_factor_get(scene, seq); + fake_key.strip_frame_index = (key_x - SEQ_time_start_frame_get(strip) - sound_offset) * + SEQ_time_media_playback_rate_factor_get(scene, strip); fake_key.flag = 0; return fake_key; } @@ -371,27 +375,27 @@ static bool fake_keys_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const KeyframeShaderBindings &sh_bindings) { - const Strip *seq = strip_ctx.seq; + const Strip *strip = strip_ctx.strip; const Scene *scene = timeline_ctx->scene; - if (!SEQ_retiming_is_active(seq) && !SEQ_retiming_data_is_editable(seq)) { + if (!SEQ_retiming_is_active(strip) && !SEQ_retiming_data_is_editable(strip)) { return false; } - const int left_key_frame = left_fake_key_frame_get(timeline_ctx->C, seq); - if (SEQ_retiming_key_get_by_timeline_frame(scene, seq, left_key_frame) == nullptr) { - SeqRetimingKey fake_key = fake_retiming_key_init(scene, seq, left_key_frame); + const int left_key_frame = left_fake_key_frame_get(timeline_ctx->C, strip); + if (SEQ_retiming_key_get_by_timeline_frame(scene, strip, left_key_frame) == nullptr) { + SeqRetimingKey fake_key = fake_retiming_key_init(scene, strip, left_key_frame); retime_key_draw(timeline_ctx, strip_ctx, &fake_key, sh_bindings); } - int right_key_frame = right_fake_key_frame_get(timeline_ctx->C, seq); - if (SEQ_retiming_key_get_by_timeline_frame(scene, seq, right_key_frame) == nullptr) { + int right_key_frame = right_fake_key_frame_get(timeline_ctx->C, strip); + if (SEQ_retiming_key_get_by_timeline_frame(scene, strip, right_key_frame) == nullptr) { /* `key_x_get()` compensates 1 frame offset of last key, however this can not * be conveyed via `fake_key` alone. Therefore the same offset must be emulated. */ - if (strip_ctx.right_handle >= SEQ_time_content_end_frame_get(scene, seq)) { + if (strip_ctx.right_handle >= SEQ_time_content_end_frame_get(scene, strip)) { right_key_frame += 1; } - SeqRetimingKey fake_key = fake_retiming_key_init(scene, seq, right_key_frame); + SeqRetimingKey fake_key = fake_retiming_key_init(scene, strip, right_key_frame); retime_key_draw(timeline_ctx, strip_ctx, &fake_key, sh_bindings); } return true; @@ -439,7 +443,7 @@ void sequencer_retiming_keys_draw(const TimelineDrawContext *timeline_ctx, point_counter += 2; } - for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip_ctx.seq)) { + for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip_ctx.strip)) { retime_key_draw(timeline_ctx, strip_ctx, &key, sh_bindings); point_counter++; @@ -466,22 +470,22 @@ void sequencer_retiming_keys_draw(const TimelineDrawContext *timeline_ctx, /** \name Retiming Speed Label * \{ */ -static size_t label_str_get(const Strip *seq, +static size_t label_str_get(const Strip *strip, const SeqRetimingKey *key, char *r_label_str, const size_t label_str_maxncpy) { const SeqRetimingKey *next_key = key + 1; if (SEQ_retiming_key_is_transition_start(key)) { - const float prev_speed = SEQ_retiming_key_speed_get(seq, key); - const float next_speed = SEQ_retiming_key_speed_get(seq, next_key + 1); + const float prev_speed = SEQ_retiming_key_speed_get(strip, key); + const float next_speed = SEQ_retiming_key_speed_get(strip, next_key + 1); return BLI_snprintf_rlen(r_label_str, label_str_maxncpy, "%d%% - %d%%", round_fl_to_int(prev_speed * 100.0f), round_fl_to_int(next_speed * 100.0f)); } - const float speed = SEQ_retiming_key_speed_get(seq, next_key); + const float speed = SEQ_retiming_key_speed_get(strip, next_key); return BLI_snprintf_rlen( r_label_str, label_str_maxncpy, "%d%%", round_fl_to_int(speed * 100.0f)); } @@ -498,12 +502,12 @@ static bool label_rect_get(const TimelineDrawContext *timeline_ctx, const SeqRetimingKey *next_key = key + 1; const float width = pixels_to_view_width(C, BLF_width(BLF_default(), label_str, label_len)); const float height = pixels_to_view_height(C, BLF_height(BLF_default(), label_str, label_len)); - const float xmin = max_ff(strip_ctx.left_handle, key_x_get(scene, strip_ctx.seq, key)); - const float xmax = min_ff(strip_ctx.right_handle, key_x_get(scene, strip_ctx.seq, next_key)); + const float xmin = max_ff(strip_ctx.left_handle, key_x_get(scene, strip_ctx.strip, key)); + const float xmax = min_ff(strip_ctx.right_handle, key_x_get(scene, strip_ctx.strip, next_key)); rect->xmin = (xmin + xmax - width) / 2; rect->xmax = rect->xmin + width; - rect->ymin = strip_y_rescale(strip_ctx.seq, 0) + pixels_to_view_height(C, 5); + rect->ymin = strip_y_rescale(strip_ctx.strip, 0) + pixels_to_view_height(C, 5); rect->ymax = rect->ymin + height; return width < xmax - xmin - pixels_to_view_width(C, KEY_SIZE); @@ -513,30 +517,30 @@ static void retime_speed_text_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const SeqRetimingKey *key) { - const Strip *seq = strip_ctx.seq; + const Strip *strip = strip_ctx.strip; const Scene *scene = timeline_ctx->scene; - if (SEQ_retiming_is_last_key(seq, key)) { + if (SEQ_retiming_is_last_key(strip, key)) { return; } const SeqRetimingKey *next_key = key + 1; - if (key_x_get(scene, seq, next_key) < strip_ctx.left_handle || - key_x_get(scene, seq, key) > strip_ctx.right_handle) + if (key_x_get(scene, strip, next_key) < strip_ctx.left_handle || + key_x_get(scene, strip, key) > strip_ctx.right_handle) { return; /* Label out of strip bounds. */ } char label_str[40]; rctf label_rect; - size_t label_len = label_str_get(seq, key, label_str, sizeof(label_str)); + size_t label_len = label_str_get(strip, key, label_str, sizeof(label_str)); if (!label_rect_get(timeline_ctx, strip_ctx, key, label_str, label_len, &label_rect)) { return; /* Not enough space to draw the label. */ } uchar col[4] = {255, 255, 255, 255}; - if ((seq->flag & SELECT) == 0) { + if ((strip->flag & SELECT) == 0) { memset(col, 0, sizeof(col)); col[3] = 255; } @@ -552,7 +556,7 @@ void sequencer_retiming_speed_draw(const TimelineDrawContext *timeline_ctx, return; } - for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip_ctx.seq)) { + for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip_ctx.strip)) { retime_speed_text_draw(timeline_ctx, strip_ctx, &key); } diff --git a/source/blender/editors/space_sequencer/sequencer_select.cc b/source/blender/editors/space_sequencer/sequencer_select.cc index df0ce3ed6599..d4595226d24c 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.cc +++ b/source/blender/editors/space_sequencer/sequencer_select.cc @@ -97,7 +97,7 @@ blender::VectorSet ED_sequencer_selected_strips_from_context(bContext * if (is_preview) { blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); return strips; } @@ -110,7 +110,7 @@ static void select_surrounding_handles(Scene *scene, Strip *test) /* XXX BRING B neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1); if (neighbor) { - /* Only select neighbor handle if matching handle from test seq is also selected, + /* Only select neighbor handle if matching handle from test strip is also selected, * or if neighbor was not selected at all up till now. * Otherwise, we get odd mismatch when shift-alt-rmb selecting neighbor strips... */ if (!(neighbor->flag & SELECT) || (test->flag & SEQ_LEFTSEL)) { @@ -134,24 +134,24 @@ static void select_active_side( const Scene *scene, ListBase *seqbase, int sel_side, int channel, int frame) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (channel == seq->machine) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (channel == strip->machine) { switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > SEQ_time_left_handle_frame_get(scene, seq)) { - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + if (frame > SEQ_time_left_handle_frame_get(scene, strip)) { + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < SEQ_time_left_handle_frame_get(scene, seq)) { - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + if (frame < SEQ_time_left_handle_frame_get(scene, strip)) { + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; } break; case SEQ_SIDE_BOTH: - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; break; } } @@ -165,28 +165,28 @@ static void select_active_side_range(const Scene *scene, const int frame_ranges[SEQ_MAX_CHANNELS], const int frame_ignore) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->machine < SEQ_MAX_CHANNELS) { - const int frame = frame_ranges[seq->machine]; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->machine < SEQ_MAX_CHANNELS) { + const int frame = frame_ranges[strip->machine]; if (frame == frame_ignore) { continue; } switch (sel_side) { case SEQ_SIDE_LEFT: - if (frame > SEQ_time_left_handle_frame_get(scene, seq)) { - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + if (frame > SEQ_time_left_handle_frame_get(scene, strip)) { + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; } break; case SEQ_SIDE_RIGHT: - if (frame < SEQ_time_left_handle_frame_get(scene, seq)) { - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + if (frame < SEQ_time_left_handle_frame_get(scene, strip)) { + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; } break; case SEQ_SIDE_BOTH: - seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); - seq->flag |= SELECT; + strip->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL); + strip->flag |= SELECT; break; } } @@ -195,33 +195,34 @@ static void select_active_side_range(const Scene *scene, /* Used alongside `select_linked_time` helper function in SEQUENCER_OT_select. */ static void select_linked_time_seq(const Scene *scene, - const Strip *seq_source, + const Strip *strip_source, const eSeqHandle handle_clicked) { ListBase *seqbase = SEQ_active_seqbase_get(scene->ed); - int source_left = SEQ_time_left_handle_frame_get(scene, seq_source); - int source_right = SEQ_time_right_handle_frame_get(scene, seq_source); + int source_left = SEQ_time_left_handle_frame_get(scene, strip_source); + int source_right = SEQ_time_right_handle_frame_get(scene, strip_source); - LISTBASE_FOREACH (Strip *, seq_dest, seqbase) { - if (seq_source->machine != seq_dest->machine) { - const bool left_match = (SEQ_time_left_handle_frame_get(scene, seq_dest) == source_left); - const bool right_match = (SEQ_time_right_handle_frame_get(scene, seq_dest) == source_right); + LISTBASE_FOREACH (Strip *, strip_dest, seqbase) { + if (strip_source->machine != strip_dest->machine) { + const bool left_match = (SEQ_time_left_handle_frame_get(scene, strip_dest) == source_left); + const bool right_match = (SEQ_time_right_handle_frame_get(scene, strip_dest) == + source_right); if (left_match && right_match) { /* Direct match, copy all selection settings. */ - seq_dest->flag &= ~(SEQ_ALLSEL); - seq_dest->flag |= seq_source->flag & (SEQ_ALLSEL); - recurs_sel_seq(seq_dest); + strip_dest->flag &= ~(STRIP_ALLSEL); + strip_dest->flag |= strip_source->flag & (STRIP_ALLSEL); + recurs_sel_seq(strip_dest); } else if (left_match && handle_clicked == SEQ_HANDLE_LEFT) { - seq_dest->flag &= ~(SELECT | SEQ_LEFTSEL); - seq_dest->flag |= seq_source->flag & (SELECT | SEQ_LEFTSEL); - recurs_sel_seq(seq_dest); + strip_dest->flag &= ~(SELECT | SEQ_LEFTSEL); + strip_dest->flag |= strip_source->flag & (SELECT | SEQ_LEFTSEL); + recurs_sel_seq(strip_dest); } else if (right_match && handle_clicked == SEQ_HANDLE_RIGHT) { - seq_dest->flag &= ~(SELECT | SEQ_RIGHTSEL); - seq_dest->flag |= seq_source->flag & (SELECT | SEQ_RIGHTSEL); - recurs_sel_seq(seq_dest); + strip_dest->flag &= ~(SELECT | SEQ_RIGHTSEL); + strip_dest->flag |= strip_source->flag & (SELECT | SEQ_RIGHTSEL); + recurs_sel_seq(strip_dest); } } } @@ -230,17 +231,17 @@ static void select_linked_time_seq(const Scene *scene, #if 0 /* BRING BACK */ void select_surround_from_last(Scene *scene) { - Strip *seq = get_last_seq(scene); + Strip *strip = get_last_seq(scene); - if (seq == nullptr) { + if (strip == nullptr) { return; } - select_surrounding_handles(scene, seq); + select_surrounding_handles(scene, strip); } #endif -void ED_sequencer_select_sequence_single(Scene *scene, Strip *seq, bool deselect_all) +void ED_sequencer_select_sequence_single(Scene *scene, Strip *strip, bool deselect_all) { Editing *ed = SEQ_editing_get(scene); @@ -248,28 +249,28 @@ void ED_sequencer_select_sequence_single(Scene *scene, Strip *seq, bool deselect ED_sequencer_deselect_all(scene); } - SEQ_select_active_set(scene, seq); + SEQ_select_active_set(scene, strip); - if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) { - if (seq->data) { - BLI_strncpy(ed->act_imagedir, seq->data->dirpath, FILE_MAXDIR); + if (ELEM(strip->type, STRIP_TYPE_IMAGE, STRIP_TYPE_MOVIE)) { + if (strip->data) { + BLI_strncpy(ed->act_imagedir, strip->data->dirpath, FILE_MAXDIR); } } - else if (seq->type == SEQ_TYPE_SOUND_RAM) { - if (seq->data) { - BLI_strncpy(ed->act_sounddir, seq->data->dirpath, FILE_MAXDIR); + else if (strip->type == STRIP_TYPE_SOUND_RAM) { + if (strip->data) { + BLI_strncpy(ed->act_sounddir, strip->data->dirpath, FILE_MAXDIR); } } - seq->flag |= SELECT; - recurs_sel_seq(seq); + strip->flag |= SELECT; + recurs_sel_seq(strip); } -void seq_rectf(const Scene *scene, const Strip *seq, rctf *r_rect) +void strip_rectf(const Scene *scene, const Strip *strip, rctf *r_rect) { - r_rect->xmin = SEQ_time_left_handle_frame_get(scene, seq); - r_rect->xmax = SEQ_time_right_handle_frame_get(scene, seq); - r_rect->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM; - r_rect->ymax = seq->machine + SEQ_STRIP_OFSTOP; + r_rect->xmin = SEQ_time_left_handle_frame_get(scene, strip); + r_rect->xmax = SEQ_time_right_handle_frame_get(scene, strip); + r_rect->ymin = strip->machine + STRIP_OFSBOTTOM; + r_rect->ymax = strip->machine + STRIP_OFSTOP; } Strip *find_neighboring_sequence(Scene *scene, Strip *test, int lr, int sel) @@ -284,23 +285,24 @@ Strip *find_neighboring_sequence(Scene *scene, Strip *test, int lr, int sel) if (sel > 0) { sel = SELECT; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if ((seq != test) && (test->machine == seq->machine) && - ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0))) + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if ((strip != test) && (test->machine == strip->machine) && + ((sel == -1) || (sel && (strip->flag & SELECT)) || + (sel == 0 && (strip->flag & SELECT) == 0))) { switch (lr) { case SEQ_SIDE_LEFT: if (SEQ_time_left_handle_frame_get(scene, test) == - SEQ_time_right_handle_frame_get(scene, seq)) + SEQ_time_right_handle_frame_get(scene, strip)) { - return seq; + return strip; } break; case SEQ_SIDE_RIGHT: if (SEQ_time_right_handle_frame_get(scene, test) == - SEQ_time_left_handle_frame_get(scene, seq)) + SEQ_time_left_handle_frame_get(scene, strip)) { - return seq; + return strip; } break; } @@ -314,7 +316,7 @@ Strip *find_nearest_seq(const Scene *scene, const int mval[2], eSeqHandle *r_hand) { - Strip *seq; + Strip *strip; Editing *ed = SEQ_editing_get(scene); float x, y; float pixelx; @@ -330,26 +332,26 @@ Strip *find_nearest_seq(const Scene *scene, UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); - seq = static_cast(ed->seqbasep->first); + strip = static_cast(ed->seqbasep->first); - while (seq) { - if (seq->machine == int(y)) { + while (strip) { + if (strip->machine == int(y)) { /* Check for both normal strips, and strips that have been flipped horizontally. */ - if (((SEQ_time_left_handle_frame_get(scene, seq) < - SEQ_time_right_handle_frame_get(scene, seq)) && - (SEQ_time_left_handle_frame_get(scene, seq) <= x && - SEQ_time_right_handle_frame_get(scene, seq) >= x)) || - ((SEQ_time_left_handle_frame_get(scene, seq) > - SEQ_time_right_handle_frame_get(scene, seq)) && - (SEQ_time_left_handle_frame_get(scene, seq) >= x && - SEQ_time_right_handle_frame_get(scene, seq) <= x))) + if (((SEQ_time_left_handle_frame_get(scene, strip) < + SEQ_time_right_handle_frame_get(scene, strip)) && + (SEQ_time_left_handle_frame_get(scene, strip) <= x && + SEQ_time_right_handle_frame_get(scene, strip) >= x)) || + ((SEQ_time_left_handle_frame_get(scene, strip) > + SEQ_time_right_handle_frame_get(scene, strip)) && + (SEQ_time_left_handle_frame_get(scene, strip) >= x && + SEQ_time_right_handle_frame_get(scene, strip) <= x))) { - if (SEQ_transform_sequence_can_be_translated(seq)) { + if (SEQ_transform_sequence_can_be_translated(strip)) { /* Clamp handles to defined size in pixel space. */ - handsize = 4.0f * sequence_handle_size_get_clamped(scene, seq, pixelx); - displen = float(abs(SEQ_time_left_handle_frame_get(scene, seq) - - SEQ_time_right_handle_frame_get(scene, seq))); + handsize = 4.0f * sequence_handle_size_get_clamped(scene, strip, pixelx); + displen = float(abs(SEQ_time_left_handle_frame_get(scene, strip) - + SEQ_time_right_handle_frame_get(scene, strip))); /* Don't even try to grab the handles of small strips. */ if (displen / pixelx > 16) { @@ -364,18 +366,18 @@ Strip *find_nearest_seq(const Scene *scene, CLAMP(handsize, 7 * pixelx, 30 * pixelx); } - if (handsize + SEQ_time_left_handle_frame_get(scene, seq) >= x) { + if (handsize + SEQ_time_left_handle_frame_get(scene, strip) >= x) { *r_hand = SEQ_HANDLE_LEFT; } - else if (-handsize + SEQ_time_right_handle_frame_get(scene, seq) <= x) { + else if (-handsize + SEQ_time_right_handle_frame_get(scene, strip) <= x) { *r_hand = SEQ_HANDLE_RIGHT; } } } - return seq; + return strip; } } - seq = static_cast(seq->next); + strip = static_cast(strip->next); } return nullptr; } @@ -383,27 +385,27 @@ Strip *find_nearest_seq(const Scene *scene, #if 0 static void select_neighbor_from_last(Scene *scene, int lr) { - Strip *seq = SEQ_select_active_get(scene); + Strip *strip = SEQ_select_active_get(scene); Strip *neighbor; bool changed = false; - if (seq) { - neighbor = find_neighboring_sequence(scene, seq, lr, -1); + if (strip) { + neighbor = find_neighboring_sequence(scene, strip, lr, -1); if (neighbor) { switch (lr) { case SEQ_SIDE_LEFT: neighbor->flag |= SELECT; recurs_sel_seq(neighbor); neighbor->flag |= SEQ_RIGHTSEL; - seq->flag |= SEQ_LEFTSEL; + strip->flag |= SEQ_LEFTSEL; break; case SEQ_SIDE_RIGHT: neighbor->flag |= SELECT; recurs_sel_seq(neighbor); neighbor->flag |= SEQ_LEFTSEL; - seq->flag |= SEQ_RIGHTSEL; + strip->flag |= SEQ_RIGHTSEL; break; } - seq->flag |= SELECT; + strip->flag |= SELECT; changed = true; } } @@ -413,37 +415,40 @@ static void select_neighbor_from_last(Scene *scene, int lr) } #endif -void recurs_sel_seq(Strip *seq_meta) +void recurs_sel_seq(Strip *strip_meta) { - Strip *seq; - seq = static_cast(seq_meta->seqbase.first); + Strip *strip; + strip = static_cast(strip_meta->seqbase.first); - while (seq) { + while (strip) { - if (seq_meta->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) { - seq->flag &= ~SEQ_ALLSEL; + if (strip_meta->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) { + strip->flag &= ~STRIP_ALLSEL; } - else if (seq_meta->flag & SELECT) { - seq->flag |= SELECT; + else if (strip_meta->flag & SELECT) { + strip->flag |= SELECT; } else { - seq->flag &= ~SEQ_ALLSEL; + strip->flag &= ~STRIP_ALLSEL; } - if (seq->seqbase.first) { - recurs_sel_seq(seq); + if (strip->seqbase.first) { + recurs_sel_seq(strip); } - seq = static_cast(seq->next); + strip = static_cast(strip->next); } } -bool seq_point_image_isect(const Scene *scene, const Strip *seq, float point_view[2]) +bool strip_point_image_isect(const Scene *scene, const Strip *strip, float point_view[2]) { - float seq_image_quad[4][2]; - SEQ_image_transform_final_quad_get(scene, seq, seq_image_quad); - return isect_point_quad_v2( - point_view, seq_image_quad[0], seq_image_quad[1], seq_image_quad[2], seq_image_quad[3]); + float strip_image_quad[4][2]; + SEQ_image_transform_final_quad_get(scene, strip, strip_image_quad); + return isect_point_quad_v2(point_view, + strip_image_quad[0], + strip_image_quad[1], + strip_image_quad[2], + strip_image_quad[3]); } static void sequencer_select_do_updates(bContext *C, Scene *scene) @@ -476,30 +481,30 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; - for (Strip *seq : strips) { - if (seq->flag & SEQ_ALLSEL) { + for (Strip *strip : strips) { + if (strip->flag & STRIP_ALLSEL) { action = SEL_DESELECT; break; } } } - for (Strip *seq : strips) { + for (Strip *strip : strips) { switch (action) { case SEL_SELECT: - seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); - seq->flag |= SELECT; + strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); + strip->flag |= SELECT; break; case SEL_DESELECT: - seq->flag &= ~SEQ_ALLSEL; + strip->flag &= ~STRIP_ALLSEL; break; case SEL_INVERT: - if (seq->flag & SEQ_ALLSEL) { - seq->flag &= ~SEQ_ALLSEL; + if (strip->flag & STRIP_ALLSEL) { + strip->flag &= ~STRIP_ALLSEL; } else { - seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); - seq->flag |= SELECT; + strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); + strip->flag |= SELECT; } break; } @@ -543,13 +548,13 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator * /*op*/) blender::VectorSet strips = all_strips_from_context(C); - for (Strip *seq : strips) { - if (seq->flag & SELECT) { - seq->flag &= ~SEQ_ALLSEL; + for (Strip *strip : strips) { + if (strip->flag & SELECT) { + strip->flag &= ~STRIP_ALLSEL; } else { - seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); - seq->flag |= SELECT; + strip->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); + strip->flag |= SELECT; } } @@ -580,23 +585,23 @@ void SEQUENCER_OT_select_inverse(wmOperatorType *ot) /** \name Select Operator * \{ */ -static void sequencer_select_set_active(Scene *scene, Strip *seq) +static void sequencer_select_set_active(Scene *scene, Strip *strip) { Editing *ed = SEQ_editing_get(scene); - SEQ_select_active_set(scene, seq); + SEQ_select_active_set(scene, strip); - if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) { - if (seq->data) { - BLI_strncpy(ed->act_imagedir, seq->data->dirpath, FILE_MAXDIR); + if (ELEM(strip->type, STRIP_TYPE_IMAGE, STRIP_TYPE_MOVIE)) { + if (strip->data) { + BLI_strncpy(ed->act_imagedir, strip->data->dirpath, FILE_MAXDIR); } } - else if (seq->type == SEQ_TYPE_SOUND_RAM) { - if (seq->data) { - BLI_strncpy(ed->act_sounddir, seq->data->dirpath, FILE_MAXDIR); + else if (strip->type == STRIP_TYPE_SOUND_RAM) { + if (strip->data) { + BLI_strncpy(ed->act_sounddir, strip->data->dirpath, FILE_MAXDIR); } } - recurs_sel_seq(seq); + recurs_sel_seq(strip); } static void sequencer_select_side_of_frame(const bContext *C, @@ -607,15 +612,15 @@ static void sequencer_select_side_of_frame(const bContext *C, Editing *ed = SEQ_editing_get(scene); const float x = UI_view2d_region_to_view_x(v2d, mval[0]); - LISTBASE_FOREACH (Strip *, seq_iter, SEQ_active_seqbase_get(ed)) { + LISTBASE_FOREACH (Strip *, strip_iter, SEQ_active_seqbase_get(ed)) { if (((x < scene->r.cfra) && - (SEQ_time_right_handle_frame_get(scene, seq_iter) <= scene->r.cfra)) || + (SEQ_time_right_handle_frame_get(scene, strip_iter) <= scene->r.cfra)) || ((x >= scene->r.cfra) && - (SEQ_time_left_handle_frame_get(scene, seq_iter) >= scene->r.cfra))) + (SEQ_time_left_handle_frame_get(scene, strip_iter) >= scene->r.cfra))) { /* Select left or right. */ - seq_iter->flag |= SELECT; - recurs_sel_seq(seq_iter); + strip_iter->flag |= SELECT; + recurs_sel_seq(strip_iter); } } @@ -638,7 +643,7 @@ static void sequencer_select_side_of_frame(const bContext *C, } static void sequencer_select_linked_handle(const bContext *C, - Strip *seq, + Strip *strip, const eSeqHandle handle_clicked) { Scene *scene = CTX_data_scene(C); @@ -647,14 +652,14 @@ static void sequencer_select_linked_handle(const bContext *C, /* First click selects the strip and its adjacent handles (if valid). * Second click selects the strip, * both of its handles and its adjacent handles (if valid). */ - const bool is_striponly_selected = ((seq->flag & SEQ_ALLSEL) == SELECT); - seq->flag &= ~SEQ_ALLSEL; - seq->flag |= is_striponly_selected ? SEQ_ALLSEL : SELECT; - select_surrounding_handles(scene, seq); + const bool is_striponly_selected = ((strip->flag & STRIP_ALLSEL) == SELECT); + strip->flag &= ~STRIP_ALLSEL; + strip->flag |= is_striponly_selected ? STRIP_ALLSEL : SELECT; + select_surrounding_handles(scene, strip); } else { /* Always select the strip under the cursor. */ - seq->flag |= SELECT; + strip->flag |= SELECT; /* First click selects adjacent handles on that side. * Second click selects all strips in that direction. @@ -662,49 +667,52 @@ static void sequencer_select_linked_handle(const bContext *C, */ const int sel_side = (handle_clicked == SEQ_HANDLE_LEFT) ? SEQ_SIDE_LEFT : SEQ_SIDE_RIGHT; - Strip *neighbor = find_neighboring_sequence(scene, seq, sel_side, -1); + Strip *neighbor = find_neighboring_sequence(scene, strip, sel_side, -1); if (neighbor) { switch (sel_side) { case SEQ_SIDE_LEFT: - if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { - seq->flag |= SELECT; + if ((strip->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { + strip->flag |= SELECT; select_active_side(scene, ed->seqbasep, SEQ_SIDE_LEFT, - seq->machine, - SEQ_time_left_handle_frame_get(scene, seq)); + strip->machine, + SEQ_time_left_handle_frame_get(scene, strip)); } else { - seq->flag |= SELECT; + strip->flag |= SELECT; neighbor->flag |= SELECT; recurs_sel_seq(neighbor); neighbor->flag |= SEQ_RIGHTSEL; - seq->flag |= SEQ_LEFTSEL; + strip->flag |= SEQ_LEFTSEL; } break; case SEQ_SIDE_RIGHT: - if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { - seq->flag |= SELECT; + if ((strip->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { + strip->flag |= SELECT; select_active_side(scene, ed->seqbasep, SEQ_SIDE_RIGHT, - seq->machine, - SEQ_time_left_handle_frame_get(scene, seq)); + strip->machine, + SEQ_time_left_handle_frame_get(scene, strip)); } else { - seq->flag |= SELECT; + strip->flag |= SELECT; neighbor->flag |= SELECT; recurs_sel_seq(neighbor); neighbor->flag |= SEQ_LEFTSEL; - seq->flag |= SEQ_RIGHTSEL; + strip->flag |= SEQ_RIGHTSEL; } break; } } else { - select_active_side( - scene, ed->seqbasep, sel_side, seq->machine, SEQ_time_left_handle_frame_get(scene, seq)); + select_active_side(scene, + ed->seqbasep, + sel_side, + strip->machine, + SEQ_time_left_handle_frame_get(scene, strip)); } } } @@ -712,27 +720,27 @@ static void sequencer_select_linked_handle(const bContext *C, /** Collect sequencer that are candidates for being selected. */ struct SeqSelect_Link { SeqSelect_Link *next, *prev; - Strip *seq; + Strip *strip; /** Only use for center selection. */ float center_dist_sq; }; -static int seq_sort_for_depth_select(const void *a, const void *b) +static int strip_sort_for_depth_select(const void *a, const void *b) { const SeqSelect_Link *slink_a = static_cast(a); const SeqSelect_Link *slink_b = static_cast(b); /* Exactly overlapping strips, sort by machine (so the top-most is first). */ - if (slink_a->seq->machine < slink_b->seq->machine) { + if (slink_a->strip->machine < slink_b->strip->machine) { return 1; } - if (slink_a->seq->machine > slink_b->seq->machine) { + if (slink_a->strip->machine > slink_b->strip->machine) { return -1; } return 0; } -static int seq_sort_for_center_select(const void *a, const void *b) +static int strip_sort_for_center_select(const void *a, const void *b) { const SeqSelect_Link *slink_a = static_cast(a); const SeqSelect_Link *slink_b = static_cast(b); @@ -744,7 +752,7 @@ static int seq_sort_for_center_select(const void *a, const void *b) } /* Exactly overlapping strips, use depth. */ - return seq_sort_for_depth_select(a, b); + return strip_sort_for_depth_select(a, b); } /** @@ -752,7 +760,7 @@ static int seq_sort_for_center_select(const void *a, const void *b) * If multiple strips are found, loop through them in order * (depth (top-most first) or closest to mouse when `center` is true). */ -static Strip *seq_select_seq_from_preview( +static Strip *strip_select_seq_from_preview( const bContext *C, const int mval[2], const bool toggle, const bool extend, const bool center) { Scene *scene = CTX_data_scene(C); @@ -781,50 +789,50 @@ static Strip *seq_select_seq_from_preview( scene, channels, seqbase, scene->r.cfra, sseq->chanshown); SeqSelect_Link *slink_active = nullptr; - Strip *seq_active = SEQ_select_active_get(scene); + Strip *strip_active = SEQ_select_active_get(scene); ListBase strips_ordered = {nullptr}; - for (Strip *seq : strips) { + for (Strip *strip : strips) { bool isect = false; float center_dist_sq_test = 0.0f; if (center) { /* Detect overlapping center points (scaled by the zoom level). */ float co[2]; - SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, co); + SEQ_image_transform_origin_offset_pixelspace_get(scene, strip, co); sub_v2_v2(co, mouseco_view); mul_v2_v2(co, center_scale_px); center_dist_sq_test = len_squared_v2(co); isect = center_dist_sq_test <= center_dist_sq_max; if (isect) { /* Use an active strip penalty for "center" selection when cycle is enabled. */ - if (use_cycle && (seq == seq_active) && (seq_active->flag & SELECT)) { + if (use_cycle && (strip == strip_active) && (strip_active->flag & SELECT)) { center_dist_sq_test = square_f(sqrtf(center_dist_sq_test) + (3.0f * U.pixelsize)); } } } else { - isect = seq_point_image_isect(scene, seq, mouseco_view); + isect = strip_point_image_isect(scene, strip, mouseco_view); } if (isect) { SeqSelect_Link *slink = MEM_cnew(__func__); - slink->seq = seq; + slink->strip = strip; slink->center_dist_sq = center_dist_sq_test; BLI_addtail(&strips_ordered, slink); - if (seq == seq_active) { + if (strip == strip_active) { slink_active = slink; } } } BLI_listbase_sort(&strips_ordered, - center ? seq_sort_for_center_select : seq_sort_for_depth_select); + center ? strip_sort_for_center_select : strip_sort_for_depth_select); SeqSelect_Link *slink_select = static_cast(strips_ordered.first); - Strip *seq_select = nullptr; + Strip *strip_select = nullptr; if (slink_select != nullptr) { /* Only use special behavior for the active strip when it's selected. */ - if ((center == false) && slink_active && (seq_active->flag & SELECT)) { + if ((center == false) && slink_active && (strip_active->flag & SELECT)) { if (use_cycle) { if (slink_active->next) { slink_select = slink_active->next; @@ -836,18 +844,18 @@ static Strip *seq_select_seq_from_preview( slink_select = slink_active; } } - seq_select = slink_select->seq; + strip_select = slink_select->strip; } BLI_freelistN(&strips_ordered); - return seq_select; + return strip_select; } -bool ED_sequencer_handle_is_selected(const Strip *seq, eSeqHandle handle) +bool ED_sequencer_handle_is_selected(const Strip *strip, eSeqHandle handle) { - return ((handle == SEQ_HANDLE_LEFT) && (seq->flag & SEQ_LEFTSEL)) || - ((handle == SEQ_HANDLE_RIGHT) && (seq->flag & SEQ_RIGHTSEL)); + return ((handle == SEQ_HANDLE_LEFT) && (strip->flag & SEQ_LEFTSEL)) || + ((handle == SEQ_HANDLE_RIGHT) && (strip->flag & SEQ_RIGHTSEL)); } static bool element_already_selected(const StripSelection &selection) @@ -883,28 +891,28 @@ static void sequencer_select_connected_strips(const StripSelection &selection) blender::VectorSet connections = SEQ_get_connected_strips(source); for (Strip *connection : connections) { /* Copy selection settings exactly for connected strips. */ - connection->flag &= ~(SEQ_ALLSEL); - connection->flag |= source->flag & (SEQ_ALLSEL); + connection->flag &= ~(STRIP_ALLSEL); + connection->flag |= source->flag & (STRIP_ALLSEL); } } } static void sequencer_select_strip_impl(const Editing *ed, - Strip *seq, + Strip *strip, const eSeqHandle handle_clicked, const bool extend, const bool deselect, const bool toggle) { - const bool is_active = (ed->act_seq == seq); + const bool is_active = (ed->act_seq == strip); /* Exception for active strip handles. */ - if ((handle_clicked != SEQ_HANDLE_NONE) && (seq->flag & SELECT) && is_active && toggle) { + if ((handle_clicked != SEQ_HANDLE_NONE) && (strip->flag & SELECT) && is_active && toggle) { if (handle_clicked == SEQ_HANDLE_LEFT) { - seq->flag ^= SEQ_LEFTSEL; + strip->flag ^= SEQ_LEFTSEL; } else if (handle_clicked == SEQ_HANDLE_RIGHT) { - seq->flag ^= SEQ_RIGHTSEL; + strip->flag ^= SEQ_RIGHTSEL; } return; } @@ -919,7 +927,7 @@ static void sequencer_select_strip_impl(const Editing *ed, action = 0; } else { - if (!((seq->flag & SELECT) && is_active)) { + if (!((strip->flag & SELECT) && is_active)) { action = 1; } else if (toggle) { @@ -928,16 +936,16 @@ static void sequencer_select_strip_impl(const Editing *ed, } if (action == 1) { - seq->flag |= SELECT; + strip->flag |= SELECT; if (handle_clicked == SEQ_HANDLE_LEFT) { - seq->flag |= SEQ_LEFTSEL; + strip->flag |= SEQ_LEFTSEL; } if (handle_clicked == SEQ_HANDLE_RIGHT) { - seq->flag |= SEQ_RIGHTSEL; + strip->flag |= SEQ_RIGHTSEL; } } else if (action == 0) { - seq->flag &= ~SEQ_ALLSEL; + strip->flag &= ~STRIP_ALLSEL; } } @@ -961,23 +969,23 @@ static void select_linked_time(const Scene *scene, } /* Similar to `sequence_handle_size_get_clamped()` but allows for larger clickable area. */ -static float clickable_handle_size_get(const Scene *scene, const Strip *seq, const View2D *v2d) +static float clickable_handle_size_get(const Scene *scene, const Strip *strip, const View2D *v2d) { const float pixelx = 1 / UI_view2d_scale_get_x(v2d); - const float strip_len = SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq); + const float strip_len = SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip); return min_ff(15.0f * pixelx * U.pixelsize, strip_len / 4); } -bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *seq, const View2D *v2d) +bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *strip, const View2D *v2d) { - if (SEQ_effect_get_num_inputs(seq->type) > 0) { + if (SEQ_effect_get_num_inputs(strip->type) > 0) { return false; } Editing *ed = SEQ_editing_get(scene); ListBase *channels = SEQ_channels_displayed_get(ed); - if (SEQ_transform_is_locked(channels, seq)) { + if (SEQ_transform_is_locked(channels, strip)) { return false; } @@ -987,8 +995,8 @@ bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *seq, const } const float pixelx = 1 / UI_view2d_scale_get_x(v2d); - const int strip_len = SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq); + const int strip_len = SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip); if (strip_len / pixelx < min_len) { return false; } @@ -996,17 +1004,17 @@ bool ED_sequencer_can_select_handle(const Scene *scene, const Strip *seq, const } static void strip_clickable_areas_get(const Scene *scene, - const Strip *seq, + const Strip *strip, const View2D *v2d, rctf *r_body, rctf *r_left_handle, rctf *r_right_handle) { - seq_rectf(scene, seq, r_body); + strip_rectf(scene, strip, r_body); *r_left_handle = *r_body; *r_right_handle = *r_body; - const float handsize = clickable_handle_size_get(scene, seq, v2d); + const float handsize = clickable_handle_size_get(scene, strip, v2d); BLI_rctf_pad(r_left_handle, handsize / 3, 0.0f); BLI_rctf_pad(r_right_handle, handsize / 3, 0.0f); r_left_handle->xmax = r_body->xmin + handsize; @@ -1014,10 +1022,10 @@ static void strip_clickable_areas_get(const Scene *scene, BLI_rctf_pad(r_body, -handsize, 0.0f); } -static rctf strip_clickable_area_get(const Scene *scene, const View2D *v2d, const Strip *seq) +static rctf strip_clickable_area_get(const Scene *scene, const View2D *v2d, const Strip *strip) { rctf body, left, right; - strip_clickable_areas_get(scene, seq, v2d, &body, &left, &right); + strip_clickable_areas_get(scene, strip, v2d, &body, &left, &right); BLI_rctf_union(&body, &left); BLI_rctf_union(&body, &right); return body; @@ -1025,11 +1033,11 @@ static rctf strip_clickable_area_get(const Scene *scene, const View2D *v2d, cons static float strip_to_frame_distance(const Scene *scene, const View2D *v2d, - const Strip *seq, + const Strip *strip, float timeline_frame) { rctf body, left, right; - strip_clickable_areas_get(scene, seq, v2d, &body, &left, &right); + strip_clickable_areas_get(scene, strip, v2d, &body, &left, &right); return BLI_rctf_length_x(&body, timeline_frame); } @@ -1041,21 +1049,21 @@ static blender::Vector mouseover_strips_sorted_get(const Scene *scene, Editing *ed = SEQ_editing_get(scene); blender::Vector strips; - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->machine != int(mouse_co[1])) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->machine != int(mouse_co[1])) { continue; } - if (SEQ_time_left_handle_frame_get(scene, seq) > v2d->cur.xmax) { + if (SEQ_time_left_handle_frame_get(scene, strip) > v2d->cur.xmax) { continue; } - if (SEQ_time_right_handle_frame_get(scene, seq) < v2d->cur.xmin) { + if (SEQ_time_right_handle_frame_get(scene, strip) < v2d->cur.xmin) { continue; } - const rctf body = strip_clickable_area_get(scene, v2d, seq); + const rctf body = strip_clickable_area_get(scene, v2d, strip); if (!BLI_rctf_isect_pt_v(&body, mouse_co)) { continue; } - strips.append(seq); + strips.append(strip); } std::sort(strips.begin(), strips.end(), [&](const Strip *seq1, const Strip *seq2) { @@ -1077,16 +1085,16 @@ static bool strips_are_adjacent(const Scene *scene, const Strip *seq1, const Str } static eSeqHandle get_strip_handle_under_cursor(const Scene *scene, - const Strip *seq, + const Strip *strip, const View2D *v2d, float mouse_co[2]) { - if (!ED_sequencer_can_select_handle(scene, seq, v2d)) { + if (!ED_sequencer_can_select_handle(scene, strip, v2d)) { return SEQ_HANDLE_NONE; } rctf body, left, right; - strip_clickable_areas_get(scene, seq, v2d, &body, &left, &right); + strip_clickable_areas_get(scene, strip, v2d, &body, &left, &right); if (BLI_rctf_isect_pt_v(&left, mouse_co)) { return SEQ_HANDLE_LEFT; } @@ -1170,18 +1178,18 @@ int sequencer_select_exec(bContext *C, wmOperator *op) MouseCoords mouse_co(v2d, RNA_int_get(op->ptr, "mouse_x"), RNA_int_get(op->ptr, "mouse_y")); - /* Check to see if the mouse cursor intersects with the retiming box; if so, `seq_key_owner` is + /* Check to see if the mouse cursor intersects with the retiming box; if so, `strip_key_owner` is * set. If the cursor intersects with a retiming key, `key` will be set too. */ - Strip *seq_key_owner = nullptr; - SeqRetimingKey *key = retiming_mouseover_key_get(C, mouse_co.region, &seq_key_owner); + Strip *strip_key_owner = nullptr; + SeqRetimingKey *key = retiming_mouseover_key_get(C, mouse_co.region, &strip_key_owner); /* If no key was found, the mouse cursor may still intersect with a "fake key" that has not been * realized yet. */ - if (seq_key_owner != nullptr && key == nullptr && + if (strip_key_owner != nullptr && key == nullptr && retiming_keys_can_be_displayed(CTX_wm_space_seq(C)) && - SEQ_retiming_data_is_editable(seq_key_owner)) + SEQ_retiming_data_is_editable(strip_key_owner)) { - key = try_to_realize_fake_keys(C, seq_key_owner, mouse_co.region); + key = try_to_realize_fake_keys(C, strip_key_owner, mouse_co.region); } if (key != nullptr) { @@ -1189,9 +1197,9 @@ int sequencer_select_exec(bContext *C, wmOperator *op) ED_sequencer_deselect_all(scene); } /* Attempt to realize any other connected strips' fake keys. */ - if (SEQ_is_strip_connected(seq_key_owner)) { - const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, seq_key_owner, key); - blender::VectorSet connections = SEQ_get_connected_strips(seq_key_owner); + if (SEQ_is_strip_connected(strip_key_owner)) { + const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, strip_key_owner, key); + blender::VectorSet connections = SEQ_get_connected_strips(strip_key_owner); for (Strip *connection : connections) { if (key_frame == left_fake_key_frame_get(C, connection) || key_frame == right_fake_key_frame_get(C, connection)) @@ -1200,7 +1208,7 @@ int sequencer_select_exec(bContext *C, wmOperator *op) } } } - return sequencer_retiming_key_select_exec(C, op, key, seq_key_owner); + return sequencer_retiming_key_select_exec(C, op, key, strip_key_owner); } /* We should only reach here if no retiming selection is happening. */ @@ -1217,7 +1225,7 @@ int sequencer_select_exec(bContext *C, wmOperator *op) StripSelection selection; if (region->regiontype == RGN_TYPE_PREVIEW) { - selection.seq1 = seq_select_seq_from_preview(C, mouse_co.region, toggle, extend, center); + selection.seq1 = strip_select_seq_from_preview(C, mouse_co.region, toggle, extend, center); } else { selection = ED_sequencer_pick_strip_and_handle(scene, v2d, mouse_co.view); @@ -1410,8 +1418,8 @@ static int sequencer_select_handle_exec(bContext *C, wmOperator *op) } /* Ignore clicks on retiming keys. */ - Strip *seq_key_test = nullptr; - SeqRetimingKey *key = retiming_mouseover_key_get(C, mouse_co.region, &seq_key_test); + Strip *strip_key_test = nullptr; + SeqRetimingKey *key = retiming_mouseover_key_get(C, mouse_co.region, &strip_key_test); if (key != nullptr) { return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } @@ -1504,18 +1512,18 @@ static bool select_linked_internal(Scene *scene) bool changed = false; - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if ((seq->flag & SELECT) == 0) { + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if ((strip->flag & SELECT) == 0) { continue; } /* Only get unselected neighbors. */ - Strip *neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, 0); + Strip *neighbor = find_neighboring_sequence(scene, strip, SEQ_SIDE_LEFT, 0); if (neighbor) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); changed = true; } - neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, 0); + neighbor = find_neighboring_sequence(scene, strip, SEQ_SIDE_RIGHT, 0); if (neighbor) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); @@ -1539,16 +1547,16 @@ static bool select_more_less_seq__internal(Scene *scene, bool select_more) const int neighbor_selection_filter = select_more ? 0 : SELECT; const int selection_filter = select_more ? SELECT : 0; - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if ((seq->flag & SELECT) != selection_filter) { + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if ((strip->flag & SELECT) != selection_filter) { continue; } Strip *neighbor = find_neighboring_sequence( - scene, seq, SEQ_SIDE_LEFT, neighbor_selection_filter); + scene, strip, SEQ_SIDE_LEFT, neighbor_selection_filter); if (neighbor) { BLI_gset_add(neighbors, neighbor); } - neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, neighbor_selection_filter); + neighbor = find_neighboring_sequence(scene, strip, SEQ_SIDE_RIGHT, neighbor_selection_filter); if (neighbor) { BLI_gset_add(neighbors, neighbor); } @@ -1770,22 +1778,22 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = SEQ_editing_get(scene); int sel_side = RNA_enum_get(op->ptr, "side"); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT) { - Strip *l_neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, -1); - Strip *r_neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, -1); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + Strip *l_neighbor = find_neighboring_sequence(scene, strip, SEQ_SIDE_LEFT, -1); + Strip *r_neighbor = find_neighboring_sequence(scene, strip, SEQ_SIDE_RIGHT, -1); switch (sel_side) { case SEQ_SELECT_HANDLES_SIDE_LEFT: - seq->flag &= ~SEQ_RIGHTSEL; - seq->flag |= SEQ_LEFTSEL; + strip->flag &= ~SEQ_RIGHTSEL; + strip->flag |= SEQ_LEFTSEL; break; case SEQ_SELECT_HANDLES_SIDE_RIGHT: - seq->flag &= ~SEQ_LEFTSEL; - seq->flag |= SEQ_RIGHTSEL; + strip->flag &= ~SEQ_LEFTSEL; + strip->flag |= SEQ_RIGHTSEL; break; case SEQ_SELECT_HANDLES_SIDE_BOTH: - seq->flag |= SEQ_LEFTSEL | SEQ_RIGHTSEL; + strip->flag |= SEQ_LEFTSEL | SEQ_RIGHTSEL; break; case SEQ_SELECT_HANDLES_SIDE_LEFT_NEIGHBOR: if (l_neighbor) { @@ -1817,11 +1825,11 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op) } } /* Select strips */ - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if ((seq->flag & SEQ_LEFTSEL) || (seq->flag & SEQ_RIGHTSEL)) { - if (!(seq->flag & SELECT)) { - seq->flag |= SELECT; - recurs_sel_seq(seq); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if ((strip->flag & SEQ_LEFTSEL) || (strip->flag & SEQ_RIGHTSEL)) { + if (!(strip->flag & SELECT)) { + strip->flag |= SELECT; + recurs_sel_seq(strip); } } } @@ -1876,23 +1884,23 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op) ED_sequencer_deselect_all(scene); } const int timeline_frame = scene->r.cfra; - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { bool test = false; switch (side) { case -1: - test = (timeline_frame >= SEQ_time_right_handle_frame_get(scene, seq)); + test = (timeline_frame >= SEQ_time_right_handle_frame_get(scene, strip)); break; case 1: - test = (timeline_frame <= SEQ_time_left_handle_frame_get(scene, seq)); + test = (timeline_frame <= SEQ_time_left_handle_frame_get(scene, strip)); break; case 2: - test = SEQ_time_strip_intersects_frame(scene, seq, timeline_frame); + test = SEQ_time_strip_intersects_frame(scene, strip, timeline_frame); break; } if (test) { - seq->flag |= SELECT; - recurs_sel_seq(seq); + strip->flag |= SELECT; + recurs_sel_seq(strip); } } @@ -1949,18 +1957,18 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op) copy_vn_i(frame_ranges, ARRAY_SIZE(frame_ranges), frame_init); - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (UNLIKELY(seq->machine >= SEQ_MAX_CHANNELS)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (UNLIKELY(strip->machine >= SEQ_MAX_CHANNELS)) { continue; } - int *frame_limit_p = &frame_ranges[seq->machine]; - if (seq->flag & SELECT) { + int *frame_limit_p = &frame_ranges[strip->machine]; + if (strip->flag & SELECT) { selected = true; if (sel_side == SEQ_SIDE_LEFT) { - *frame_limit_p = max_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, seq)); + *frame_limit_p = max_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, strip)); } else { - *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, seq)); + *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, strip)); } } } @@ -2007,27 +2015,29 @@ void SEQUENCER_OT_select_side(wmOperatorType *ot) /** \name Box Select Operator * \{ */ -static bool seq_box_select_rect_image_isect(const Scene *scene, const Strip *seq, const rctf *rect) +static bool strip_box_select_rect_image_isect(const Scene *scene, + const Strip *strip, + const rctf *rect) { - float seq_image_quad[4][2]; - SEQ_image_transform_final_quad_get(scene, seq, seq_image_quad); + float strip_image_quad[4][2]; + SEQ_image_transform_final_quad_get(scene, strip, strip_image_quad); float rect_quad[4][2] = {{rect->xmax, rect->ymax}, {rect->xmax, rect->ymin}, {rect->xmin, rect->ymin}, {rect->xmin, rect->ymax}}; - return seq_point_image_isect(scene, seq, rect_quad[0]) || - seq_point_image_isect(scene, seq, rect_quad[1]) || - seq_point_image_isect(scene, seq, rect_quad[2]) || - seq_point_image_isect(scene, seq, rect_quad[3]) || + return strip_point_image_isect(scene, strip, rect_quad[0]) || + strip_point_image_isect(scene, strip, rect_quad[1]) || + strip_point_image_isect(scene, strip, rect_quad[2]) || + strip_point_image_isect(scene, strip, rect_quad[3]) || isect_point_quad_v2( - seq_image_quad[0], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || + strip_image_quad[0], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || isect_point_quad_v2( - seq_image_quad[1], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || + strip_image_quad[1], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || isect_point_quad_v2( - seq_image_quad[2], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || + strip_image_quad[2], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]) || isect_point_quad_v2( - seq_image_quad[3], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]); + strip_image_quad[3], rect_quad[0], rect_quad[1], rect_quad[2], rect_quad[3]); } static void seq_box_select_seq_from_preview(const bContext *C, @@ -2042,17 +2052,17 @@ static void seq_box_select_seq_from_preview(const bContext *C, blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, sseq->chanshown); - for (Strip *seq : strips) { - if (!seq_box_select_rect_image_isect(scene, seq, rect)) { + for (Strip *strip : strips) { + if (!strip_box_select_rect_image_isect(scene, strip, rect)) { continue; } if (ELEM(mode, SEL_OP_ADD, SEL_OP_SET)) { - seq->flag |= SELECT; + strip->flag |= SELECT; } else { BLI_assert(mode == SEL_OP_SUB); - seq->flag &= ~SELECT; + strip->flag &= ~SELECT; } } } @@ -2096,41 +2106,41 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { rctf rq; - seq_rectf(scene, seq, &rq); + strip_rectf(scene, strip, &rq); if (BLI_rctf_isect(&rq, &rectf, nullptr)) { if (handles) { /* Get the handles draw size. */ float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); - float handsize = sequence_handle_size_get_clamped(scene, seq, pixelx) * 4; + float handsize = sequence_handle_size_get_clamped(scene, strip, pixelx) * 4; /* Right handle. */ - if (rectf.xmax > (SEQ_time_right_handle_frame_get(scene, seq) - handsize)) { + if (rectf.xmax > (SEQ_time_right_handle_frame_get(scene, strip) - handsize)) { if (select) { - seq->flag |= SELECT | SEQ_RIGHTSEL; + strip->flag |= SELECT | SEQ_RIGHTSEL; } else { /* Deselect the strip if it's left with no handles selected. */ - if ((seq->flag & SEQ_RIGHTSEL) && ((seq->flag & SEQ_LEFTSEL) == 0)) { - seq->flag &= ~SELECT; + if ((strip->flag & SEQ_RIGHTSEL) && ((strip->flag & SEQ_LEFTSEL) == 0)) { + strip->flag &= ~SELECT; } - seq->flag &= ~SEQ_RIGHTSEL; + strip->flag &= ~SEQ_RIGHTSEL; } changed = true; } /* Left handle. */ - if (rectf.xmin < (SEQ_time_left_handle_frame_get(scene, seq) + handsize)) { + if (rectf.xmin < (SEQ_time_left_handle_frame_get(scene, strip) + handsize)) { if (select) { - seq->flag |= SELECT | SEQ_LEFTSEL; + strip->flag |= SELECT | SEQ_LEFTSEL; } else { /* Deselect the strip if it's left with no handles selected. */ - if ((seq->flag & SEQ_LEFTSEL) && ((seq->flag & SEQ_RIGHTSEL) == 0)) { - seq->flag &= ~SELECT; + if ((strip->flag & SEQ_LEFTSEL) && ((strip->flag & SEQ_RIGHTSEL) == 0)) { + strip->flag &= ~SELECT; } - seq->flag &= ~SEQ_LEFTSEL; + strip->flag &= ~SEQ_LEFTSEL; } } @@ -2139,8 +2149,8 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) /* Regular box selection. */ else { - SET_FLAG_FROM_TEST(seq->flag, select, SELECT); - seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); + SET_FLAG_FROM_TEST(strip->flag, select, SELECT); + strip->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); changed = true; } @@ -2148,7 +2158,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) if (!ignore_connections) { /* Propagate selection to connected strips. */ StripSelection selection; - selection.seq1 = seq; + selection.seq1 = strip; sequencer_select_connected_strips(selection); } } @@ -2276,14 +2286,16 @@ static const EnumPropertyItem sequencer_prop_select_grouped_types[] = { {0, nullptr, 0, nullptr, nullptr}, }; -#define SEQ_IS_SOUND(_seq) ((_seq->type & SEQ_TYPE_SOUND_RAM) && !(_seq->type & SEQ_TYPE_EFFECT)) +#define STRIP_IS_SOUND(_seq) \ + ((_seq->type & STRIP_TYPE_SOUND_RAM) && !(_seq->type & STRIP_TYPE_EFFECT)) -#define SEQ_IS_EFFECT(_seq) ((_seq->type & SEQ_TYPE_EFFECT) != 0) +#define STRIP_IS_EFFECT(_seq) ((_seq->type & STRIP_TYPE_EFFECT) != 0) -#define SEQ_USE_DATA(_seq) \ - (ELEM(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq)) +#define STRIP_USE_DATA(_seq) \ + (ELEM(_seq->type, STRIP_TYPE_SCENE, STRIP_TYPE_MOVIECLIP, STRIP_TYPE_MASK) || \ + STRIP_HAS_PATH(_seq)) -#define SEQ_CHANNEL_CHECK(_seq, _chan) ELEM((_chan), 0, (_seq)->machine) +#define STRIP_CHANNEL_CHECK(_seq, _chan) ELEM((_chan), 0, (_seq)->machine) static bool select_grouped_type(blender::Span strips, ListBase * /*seqbase*/, @@ -2292,9 +2304,9 @@ static bool select_grouped_type(blender::Span strips, { bool changed = false; - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == actseq->type) { - seq->flag |= SELECT; + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && strip->type == actseq->type) { + strip->flag |= SELECT; changed = true; } } @@ -2308,11 +2320,13 @@ static bool select_grouped_type_basic(blender::Span strips, const int channel) { bool changed = false; - const bool is_sound = SEQ_IS_SOUND(actseq); + const bool is_sound = STRIP_IS_SOUND(actseq); - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq))) { - seq->flag |= SELECT; + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && + (is_sound ? STRIP_IS_SOUND(strip) : !STRIP_IS_SOUND(strip))) + { + strip->flag |= SELECT; changed = true; } } @@ -2326,12 +2340,13 @@ static bool select_grouped_type_effect(blender::Span strips, const int channel) { bool changed = false; - const bool is_effect = SEQ_IS_EFFECT(actseq); + const bool is_effect = STRIP_IS_EFFECT(actseq); - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq))) + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && + (is_effect ? STRIP_IS_EFFECT(strip) : !STRIP_IS_EFFECT(strip))) { - seq->flag |= SELECT; + strip->flag |= SELECT; changed = true; } } @@ -2347,44 +2362,49 @@ static bool select_grouped_data(blender::Span strips, bool changed = false; const char *dirpath = actseq->data ? actseq->data->dirpath : nullptr; - if (!SEQ_USE_DATA(actseq)) { + if (!STRIP_USE_DATA(actseq)) { return changed; } - if (SEQ_HAS_PATH(actseq) && dirpath) { - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && SEQ_HAS_PATH(seq) && seq->data && - STREQ(seq->data->dirpath, dirpath)) + if (STRIP_HAS_PATH(actseq) && dirpath) { + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && STRIP_HAS_PATH(strip) && strip->data && + STREQ(strip->data->dirpath, dirpath)) { - seq->flag |= SELECT; + strip->flag |= SELECT; changed = true; } } } - else if (actseq->type == SEQ_TYPE_SCENE) { + else if (actseq->type == STRIP_TYPE_SCENE) { Scene *sce = actseq->scene; - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_SCENE && seq->scene == sce) { - seq->flag |= SELECT; + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && strip->type == STRIP_TYPE_SCENE && + strip->scene == sce) + { + strip->flag |= SELECT; changed = true; } } } - else if (actseq->type == SEQ_TYPE_MOVIECLIP) { + else if (actseq->type == STRIP_TYPE_MOVIECLIP) { MovieClip *clip = actseq->clip; - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MOVIECLIP && seq->clip == clip) + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && strip->type == STRIP_TYPE_MOVIECLIP && + strip->clip == clip) { - seq->flag |= SELECT; + strip->flag |= SELECT; changed = true; } } } - else if (actseq->type == SEQ_TYPE_MASK) { + else if (actseq->type == STRIP_TYPE_MASK) { Mask *mask = actseq->mask; - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MASK && seq->mask == mask) { - seq->flag |= SELECT; + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && strip->type == STRIP_TYPE_MASK && + strip->mask == mask) + { + strip->flag |= SELECT; changed = true; } } @@ -2399,27 +2419,27 @@ static bool select_grouped_effect(blender::Span strips, const int channel) { bool changed = false; - bool effects[SEQ_TYPE_MAX + 1]; + bool effects[STRIP_TYPE_MAX + 1]; - for (int i = 0; i <= SEQ_TYPE_MAX; i++) { + for (int i = 0; i <= STRIP_TYPE_MAX; i++) { effects[i] = false; } - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && (seq->type & SEQ_TYPE_EFFECT) && - SEQ_relation_is_effect_of_strip(seq, actseq)) + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && (strip->type & STRIP_TYPE_EFFECT) && + SEQ_relation_is_effect_of_strip(strip, actseq)) { - effects[seq->type] = true; + effects[strip->type] = true; } } - for (Strip *seq : strips) { - if (SEQ_CHANNEL_CHECK(seq, channel) && effects[seq->type]) { - if (seq->seq1) { - seq->seq1->flag |= SELECT; + for (Strip *strip : strips) { + if (STRIP_CHANNEL_CHECK(strip, channel) && effects[strip->type]) { + if (strip->seq1) { + strip->seq1->flag |= SELECT; } - if (seq->seq2) { - seq->seq2->flag |= SELECT; + if (strip->seq2) { + strip->seq2->flag |= SELECT; } changed = true; } @@ -2435,13 +2455,13 @@ static bool select_grouped_time_overlap(const Scene *scene, { bool changed = false; - for (Strip *seq : strips) { - if (SEQ_time_left_handle_frame_get(scene, seq) < + for (Strip *strip : strips) { + if (SEQ_time_left_handle_frame_get(scene, strip) < SEQ_time_right_handle_frame_get(scene, actseq) && - SEQ_time_right_handle_frame_get(scene, seq) > + SEQ_time_right_handle_frame_get(scene, strip) > SEQ_time_left_handle_frame_get(scene, actseq)) { - seq->flag |= SELECT; + strip->flag |= SELECT; changed = true; } } @@ -2449,24 +2469,24 @@ static bool select_grouped_time_overlap(const Scene *scene, return changed; } -/* Query strips that are in lower channel and intersect in time with seq_reference. */ +/* Query strips that are in lower channel and intersect in time with strip_reference. */ static void query_lower_channel_strips(const Scene *scene, - Strip *seq_reference, + Strip *strip_reference, ListBase *seqbase, blender::VectorSet &strips) { - LISTBASE_FOREACH (Strip *, seq_test, seqbase) { - if (seq_test->machine > seq_reference->machine) { + LISTBASE_FOREACH (Strip *, strip_test, seqbase) { + if (strip_test->machine > strip_reference->machine) { continue; /* Not lower channel. */ } - if (SEQ_time_right_handle_frame_get(scene, seq_test) <= - SEQ_time_left_handle_frame_get(scene, seq_reference) || - SEQ_time_left_handle_frame_get(scene, seq_test) >= - SEQ_time_right_handle_frame_get(scene, seq_reference)) + if (SEQ_time_right_handle_frame_get(scene, strip_test) <= + SEQ_time_left_handle_frame_get(scene, strip_reference) || + SEQ_time_left_handle_frame_get(scene, strip_test) >= + SEQ_time_right_handle_frame_get(scene, strip_reference)) { continue; /* Not intersecting in time. */ } - strips.add(seq_test); + strips.add(strip_test); } } @@ -2479,7 +2499,7 @@ static bool select_grouped_effect_link(const Scene *scene, const int /*channel*/) { /* Get collection of strips. */ - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); const int selected_strip_count = strips.size(); /* XXX: this uses scene as arg, so it does not work with iterator :( I had thought about this, * but expand function is just so useful... I can just add scene and inject it I guess. */ @@ -2490,16 +2510,16 @@ static bool select_grouped_effect_link(const Scene *scene, const bool changed = strips.size() > selected_strip_count; /* Actual logic. */ - for (Strip *seq : strips) { - seq->flag |= SELECT; + for (Strip *strip : strips) { + strip->flag |= SELECT; } return changed; } -#undef SEQ_IS_SOUND -#undef SEQ_IS_EFFECT -#undef SEQ_USE_DATA +#undef STRIP_IS_SOUND +#undef STRIP_IS_EFFECT +#undef STRIP_USE_DATA static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) { @@ -2526,8 +2546,8 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) bool changed = false; if (!extend) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - seq->flag &= ~SELECT; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + strip->flag &= ~SELECT; changed = true; } } diff --git a/source/blender/editors/space_sequencer/sequencer_text_edit.cc b/source/blender/editors/space_sequencer/sequencer_text_edit.cc index b3a5c6bbdce2..ab8210bec279 100644 --- a/source/blender/editors/space_sequencer/sequencer_text_edit.cc +++ b/source/blender/editors/space_sequencer/sequencer_text_edit.cc @@ -43,12 +43,12 @@ static bool sequencer_text_editing_poll(bContext *C) return false; } - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - if (seq == nullptr || seq->type != SEQ_TYPE_TEXT || !SEQ_effects_can_render_text(seq)) { + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + if (strip == nullptr || strip->type != STRIP_TYPE_TEXT || !SEQ_effects_can_render_text(strip)) { return false; } - const TextVars *data = static_cast(seq->effectdata); + const TextVars *data = static_cast(strip->effectdata); if (data == nullptr || data->runtime == nullptr) { return false; } @@ -58,8 +58,8 @@ static bool sequencer_text_editing_poll(bContext *C) bool sequencer_text_editing_active_poll(bContext *C) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - if (seq == nullptr || !sequencer_text_editing_poll(C)) { + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + if (strip == nullptr || !sequencer_text_editing_poll(C)) { return false; } @@ -69,14 +69,14 @@ bool sequencer_text_editing_active_poll(bContext *C) const Scene *scene = CTX_data_scene(C); - if (!SEQ_time_strip_intersects_frame(scene, seq, BKE_scene_frame_get(scene))) { + if (!SEQ_time_strip_intersects_frame(scene, strip, BKE_scene_frame_get(scene))) { return false; } - return (seq->flag & SEQ_FLAG_TEXT_EDITING_ACTIVE) != 0; + return (strip->flag & SEQ_FLAG_TEXT_EDITING_ACTIVE) != 0; } -int2 seq_text_cursor_offset_to_position(const TextVarsRuntime *text, int cursor_offset) +int2 strip_text_cursor_offset_to_position(const TextVarsRuntime *text, int cursor_offset) { cursor_offset = std::clamp(cursor_offset, 0, text->character_count); @@ -106,7 +106,7 @@ static const seq::CharInfo &character_at_cursor_pos_get(const TextVarsRuntime *t static const seq::CharInfo &character_at_cursor_offset_get(const TextVarsRuntime *text, const int cursor_offset) { - const int2 cursor_pos = seq_text_cursor_offset_to_position(text, cursor_offset); + const int2 cursor_pos = strip_text_cursor_offset_to_position(text, cursor_offset); return character_at_cursor_pos_get(text, cursor_pos); } @@ -121,7 +121,7 @@ static void text_selection_cancel(TextVars *data) data->selection_end_offset = 0; } -IndexRange seq_text_selection_range_get(const TextVars *data) +IndexRange strip_text_selection_range_get(const TextVars *data) { /* Ensure, that selection start < selection end. */ int sel_start_offset = data->selection_start_offset; @@ -135,7 +135,7 @@ IndexRange seq_text_selection_range_get(const TextVars *data) static bool text_has_selection(const TextVars *data) { - return !seq_text_selection_range_get(data).is_empty(); + return !strip_text_selection_range_get(data).is_empty(); } static void delete_selected_text(TextVars *data) @@ -145,7 +145,7 @@ static void delete_selected_text(TextVars *data) } TextVarsRuntime *text = data->runtime; - IndexRange sel_range = seq_text_selection_range_get(data); + IndexRange sel_range = strip_text_selection_range_get(data); seq::CharInfo char_start = character_at_cursor_offset_get(text, sel_range.first()); seq::CharInfo char_end = character_at_cursor_offset_get(text, sel_range.last()); @@ -155,15 +155,15 @@ static void delete_selected_text(TextVars *data) std::memmove(addr_start, addr_end, BLI_strnlen(addr_end, sizeof(data->text)) + 1); - const int2 sel_start = seq_text_cursor_offset_to_position(text, sel_range.first()); + const int2 sel_start = strip_text_cursor_offset_to_position(text, sel_range.first()); data->cursor_offset = cursor_position_to_offset(text, sel_start); text_selection_cancel(data); } static void text_editing_update(const bContext *C) { - Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - SEQ_relations_invalidate_cache_raw(CTX_data_scene(C), seq); + Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + SEQ_relations_invalidate_cache_raw(CTX_data_scene(C), strip); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, CTX_data_scene(C)); } @@ -296,15 +296,15 @@ static int2 cursor_move_next_word(int2 cursor_position, const TextVarsRuntime *t static int sequencer_text_cursor_move_exec(bContext *C, wmOperator *op) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; if (RNA_boolean_get(op->ptr, "select_text") && !text_has_selection(data)) { data->selection_start_offset = data->cursor_offset; } - int2 cursor_position = seq_text_cursor_offset_to_position(text, data->cursor_offset); + int2 cursor_position = strip_text_cursor_offset_to_position(text, data->cursor_offset); switch (RNA_enum_get(op->ptr, "type")) { case PREV_CHAR: @@ -407,8 +407,8 @@ static bool text_insert(TextVars *data, const char *buf) static int sequencer_text_insert_exec(bContext *C, wmOperator *op) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); char str[512]; RNA_string_get(op->ptr, "string", str); @@ -470,8 +470,8 @@ static void delete_character(const seq::CharInfo character, const TextVars *data static int sequencer_text_delete_exec(bContext *C, wmOperator *op) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; const int type = RNA_enum_get(op->ptr, "type"); @@ -526,8 +526,8 @@ void SEQUENCER_OT_text_delete(wmOperatorType *ot) static int sequencer_text_line_break_exec(bContext *C, wmOperator * /*op*/) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); if (!text_insert(data, "\n")) { return OPERATOR_CANCELLED; @@ -554,8 +554,8 @@ void SEQUENCER_OT_text_line_break(wmOperatorType *ot) static int sequencer_text_select_all(bContext *C, wmOperator * /*op*/) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); data->selection_start_offset = 0; data->selection_end_offset = data->runtime->character_count; text_editing_update(C); @@ -579,12 +579,12 @@ void SEQUENCER_OT_text_select_all(wmOperatorType *ot) static int sequencer_text_deselect_all(bContext *C, wmOperator * /*op*/) { - Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); if (!text_has_selection(data)) { /* Exit edit mode, so text can be translated by mouse. */ - seq->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; + strip->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; } else { text_selection_cancel(data); @@ -611,12 +611,12 @@ void SEQUENCER_OT_text_deselect_all(wmOperatorType *ot) static int sequencer_text_edit_mode_toggle(bContext *C, wmOperator * /*op*/) { - Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); + Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); if (sequencer_text_editing_active_poll(C)) { - seq->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; + strip->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; } else { - seq->flag |= SEQ_FLAG_TEXT_EDITING_ACTIVE; + strip->flag |= SEQ_FLAG_TEXT_EDITING_ACTIVE; } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, CTX_data_scene(C)); @@ -660,8 +660,8 @@ static int find_closest_cursor_offset(const TextVars *data, float2 mouse_loc) static void cursor_set_by_mouse_position(const bContext *C, const wmEvent *event) { const Scene *scene = CTX_data_scene(C); - const Strip *seq = SEQ_select_active_get(scene); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(scene); + TextVars *data = static_cast(strip->effectdata); const View2D *v2d = UI_view2d_fromcontext(C); int2 mval_region; @@ -673,7 +673,7 @@ static void cursor_set_by_mouse_position(const bContext *C, const wmEvent *event const blender::float3 view_offs{-scene->r.xsch / 2.0f, -scene->r.ysch / 2.0f, 0.0f}; const float view_aspect = scene->r.xasp / scene->r.yasp; blender::float4x4 transform_mat; - SEQ_image_transform_matrix_get(CTX_data_scene(C), seq, transform_mat.ptr()); + SEQ_image_transform_matrix_get(CTX_data_scene(C), strip, transform_mat.ptr()); transform_mat = blender::math::invert(transform_mat); mouse_loc.x /= view_aspect; @@ -685,8 +685,8 @@ static void cursor_set_by_mouse_position(const bContext *C, const wmEvent *event static int sequencer_text_cursor_set_modal(bContext *C, wmOperator * /*op*/, const wmEvent *event) { const Scene *scene = CTX_data_scene(C); - const Strip *seq = SEQ_select_active_get(scene); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(scene); + TextVars *data = static_cast(strip->effectdata); bool make_selection = false; switch (event->type) { @@ -719,8 +719,8 @@ static int sequencer_text_cursor_set_modal(bContext *C, wmOperator * /*op*/, con static int sequencer_text_cursor_set_invoke(bContext *C, wmOperator *op, const wmEvent *event) { const Scene *scene = CTX_data_scene(C); - Strip *seq = SEQ_select_active_get(scene); - TextVars *data = static_cast(seq->effectdata); + Strip *strip = SEQ_select_active_get(scene); + TextVars *data = static_cast(strip->effectdata); const View2D *v2d = UI_view2d_fromcontext(C); int2 mval_region; @@ -728,8 +728,8 @@ static int sequencer_text_cursor_set_invoke(bContext *C, wmOperator *op, const w float2 mouse_loc; UI_view2d_region_to_view(v2d, mval_region.x, mval_region.y, &mouse_loc.x, &mouse_loc.y); - if (!seq_point_image_isect(scene, seq, mouse_loc)) { - seq->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; + if (!strip_point_image_isect(scene, strip, mouse_loc)) { + strip->flag &= ~SEQ_FLAG_TEXT_EDITING_ACTIVE; return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } @@ -766,7 +766,7 @@ void SEQUENCER_OT_text_cursor_set(wmOperatorType *ot) static void text_edit_copy(const TextVars *data) { const TextVarsRuntime *text = data->runtime; - const IndexRange selection_range = seq_text_selection_range_get(data); + const IndexRange selection_range = strip_text_selection_range_get(data); const seq::CharInfo start = character_at_cursor_offset_get(text, selection_range.first()); const seq::CharInfo end = character_at_cursor_offset_get(text, selection_range.last()); const size_t len = end.str_ptr + end.byte_length - start.str_ptr; @@ -778,8 +778,8 @@ static void text_edit_copy(const TextVars *data) static int sequencer_text_edit_copy_exec(bContext *C, wmOperator * /*op*/) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - const TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + const TextVars *data = static_cast(strip->effectdata); if (!text_has_selection(data)) { return OPERATOR_CANCELLED; @@ -807,8 +807,8 @@ void SEQUENCER_OT_text_edit_copy(wmOperatorType *ot) static int sequencer_text_edit_paste_exec(bContext *C, wmOperator * /*op*/) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); const TextVarsRuntime *text = data->runtime; delete_selected_text(data); @@ -853,8 +853,8 @@ void SEQUENCER_OT_text_edit_paste(wmOperatorType *ot) static int sequencer_text_edit_cut_exec(bContext *C, wmOperator * /*op*/) { - const Strip *seq = SEQ_select_active_get(CTX_data_scene(C)); - TextVars *data = static_cast(seq->effectdata); + const Strip *strip = SEQ_select_active_get(CTX_data_scene(C)); + TextVars *data = static_cast(strip->effectdata); if (!text_has_selection(data)) { return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc index f45055ce711a..6f11bc82d356 100644 --- a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc +++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc @@ -47,47 +47,48 @@ struct SeqThumbInfo { bool is_muted; }; -static float thumb_calc_first_timeline_frame(const Strip *seq, +static float thumb_calc_first_timeline_frame(const Strip *strip, float left_handle, float frame_step, const rctf *view_area) { - int first_drawable_frame = max_iii(left_handle, seq->start, view_area->xmin); + int first_drawable_frame = max_iii(left_handle, strip->start, view_area->xmin); /* First frame should correspond to handle position. */ if (first_drawable_frame == left_handle) { return left_handle; } - float aligned_frame_offset = int((first_drawable_frame - seq->start) / frame_step) * frame_step; - return seq->start + aligned_frame_offset; + float aligned_frame_offset = int((first_drawable_frame - strip->start) / frame_step) * + frame_step; + return strip->start + aligned_frame_offset; } -static float thumb_calc_next_timeline_frame(const Strip *seq, +static float thumb_calc_next_timeline_frame(const Strip *strip, float left_handle, float last_frame, float frame_step) { float next_frame = last_frame + frame_step; - /* If handle position was displayed, align next frame with `seq->start`. */ + /* If handle position was displayed, align next frame with `strip->start`. */ if (last_frame == left_handle) { - next_frame = seq->start + (int((last_frame - seq->start) / frame_step) + 1) * frame_step; + next_frame = strip->start + (int((last_frame - strip->start) / frame_step) + 1) * frame_step; } return next_frame; } -static void seq_get_thumb_image_dimensions(const Strip *seq, - float pixelx, - float pixely, - float *r_thumb_width, - float thumb_height, - float *r_image_width, - float *r_image_height) +static void strip_get_thumb_image_dimensions(const Strip *strip, + float pixelx, + float pixely, + float *r_thumb_width, + float thumb_height, + float *r_image_width, + float *r_image_height) { - float image_width = seq->data->stripdata->orig_width; - float image_height = seq->data->stripdata->orig_height; + float image_width = strip->data->stripdata->orig_width; + float image_height = strip->data->stripdata->orig_height; /* Fix the dimensions to be max SEQ_THUMB_SIZE for x or y. */ float aspect_ratio = image_width / image_height; @@ -119,7 +120,7 @@ static void get_seq_strip_thumbnails(const View2D *v2d, bool is_muted, Vector &r_thumbs) { - if (!seq::strip_can_have_thumbnail(scene, strip.seq)) { + if (!seq::strip_can_have_thumbnail(scene, strip.strip)) { return; } @@ -130,18 +131,18 @@ static void get_seq_strip_thumbnails(const View2D *v2d, } float thumb_width, image_width, image_height; - seq_get_thumb_image_dimensions( - strip.seq, pixelx, pixely, &thumb_width, thumb_height, &image_width, &image_height); + strip_get_thumb_image_dimensions( + strip.strip, pixelx, pixely, &thumb_width, thumb_height, &image_width, &image_height); const float crop_x_multiplier = 1.0f / pixelx / (thumb_height / image_height / pixely); float upper_thumb_bound = min_ff(strip.right_handle, strip.content_end); - if (strip.seq->type == SEQ_TYPE_IMAGE) { + if (strip.strip->type == STRIP_TYPE_IMAGE) { upper_thumb_bound = strip.right_handle; } float timeline_frame = thumb_calc_first_timeline_frame( - strip.seq, strip.left_handle, thumb_width, &v2d->cur); + strip.strip, strip.left_handle, thumb_width, &v2d->cur); /* Start going over the strip length. */ while (timeline_frame < upper_thumb_bound) { @@ -173,7 +174,7 @@ static void get_seq_strip_thumbnails(const View2D *v2d, } /* Get the thumbnail image. */ - ImBuf *ibuf = seq::thumbnail_cache_get(C, scene, strip.seq, timeline_frame); + ImBuf *ibuf = seq::thumbnail_cache_get(C, scene, strip.strip, timeline_frame); if (ibuf == nullptr) { break; } @@ -198,7 +199,7 @@ static void get_seq_strip_thumbnails(const View2D *v2d, r_thumbs.append(thumb); timeline_frame = thumb_calc_next_timeline_frame( - strip.seq, strip.left_handle, timeline_frame, thumb_width); + strip.strip, strip.left_handle, timeline_frame, thumb_width); } } diff --git a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc index 0fe14d78b549..81178cf38477 100644 --- a/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_timeline_draw.cc @@ -89,24 +89,24 @@ Vector sequencer_visible_strips_get(const Scene *scene, const View2D *v const Editing *ed = SEQ_editing_get(scene); Vector strips; - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (min_ii(SEQ_time_left_handle_frame_get(scene, seq), SEQ_time_start_frame_get(seq)) > + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (min_ii(SEQ_time_left_handle_frame_get(scene, strip), SEQ_time_start_frame_get(strip)) > v2d->cur.xmax) { continue; } - if (max_ii(SEQ_time_right_handle_frame_get(scene, seq), - SEQ_time_content_end_frame_get(scene, seq)) < v2d->cur.xmin) + if (max_ii(SEQ_time_right_handle_frame_get(scene, strip), + SEQ_time_content_end_frame_get(scene, strip)) < v2d->cur.xmin) { continue; } - if (seq->machine + 1.0f < v2d->cur.ymin) { + if (strip->machine + 1.0f < v2d->cur.ymin) { continue; } - if (seq->machine > v2d->cur.ymax) { + if (strip->machine > v2d->cur.ymax) { continue; } - strips.append(seq); + strips.append(strip); } return strips; } @@ -137,12 +137,12 @@ static TimelineDrawContext timeline_draw_context_get(const bContext *C, SeqQuads return ctx; } -static bool seq_draw_waveforms_poll(const SpaceSeq *sseq, const Strip *seq) +static bool seq_draw_waveforms_poll(const SpaceSeq *sseq, const Strip *strip) { - const bool strip_is_valid = seq->type == SEQ_TYPE_SOUND_RAM && seq->sound != nullptr; + const bool strip_is_valid = strip->type == STRIP_TYPE_SOUND_RAM && strip->sound != nullptr; const bool overlays_enabled = (sseq->flag & SEQ_SHOW_OVERLAY) != 0; const bool ovelay_option = ((sseq->timeline_overlay.flag & SEQ_TIMELINE_ALL_WAVEFORMS) != 0 || - (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM)); + (strip->flag & SEQ_AUDIO_DRAW_WAVEFORM)); if ((sseq->timeline_overlay.flag & SEQ_TIMELINE_NO_WAVEFORMS) != 0) { return false; @@ -158,8 +158,8 @@ static bool seq_draw_waveforms_poll(const SpaceSeq *sseq, const Strip *seq) static bool strip_hides_text_overlay_first(const TimelineDrawContext *ctx, const StripDrawContext *strip_ctx) { - return seq_draw_waveforms_poll(ctx->sseq, strip_ctx->seq) || - strip_ctx->seq->type == SEQ_TYPE_COLOR; + return seq_draw_waveforms_poll(ctx->sseq, strip_ctx->strip) || + strip_ctx->strip->type == STRIP_TYPE_COLOR; } static void strip_draw_context_set_text_overlay_visibility(TimelineDrawContext *ctx, @@ -201,23 +201,23 @@ static void strip_draw_context_set_retiming_overlay_visibility(TimelineDrawConte strip_ctx->can_draw_retiming_overlay &= retiming_keys_can_be_displayed(ctx->sseq); } -static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip *seq) +static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip *strip) { using namespace seq; StripDrawContext strip_ctx; Scene *scene = ctx->scene; - strip_ctx.seq = seq; - strip_ctx.bottom = seq->machine + SEQ_STRIP_OFSBOTTOM; - strip_ctx.top = seq->machine + SEQ_STRIP_OFSTOP; - strip_ctx.left_handle = SEQ_time_left_handle_frame_get(scene, seq); - strip_ctx.right_handle = SEQ_time_right_handle_frame_get(scene, seq); - strip_ctx.content_start = SEQ_time_start_frame_get(seq); - strip_ctx.content_end = SEQ_time_content_end_frame_get(scene, seq); + strip_ctx.strip = strip; + strip_ctx.bottom = strip->machine + STRIP_OFSBOTTOM; + strip_ctx.top = strip->machine + STRIP_OFSTOP; + strip_ctx.left_handle = SEQ_time_left_handle_frame_get(scene, strip); + strip_ctx.right_handle = SEQ_time_right_handle_frame_get(scene, strip); + strip_ctx.content_start = SEQ_time_start_frame_get(strip); + strip_ctx.content_end = SEQ_time_content_end_frame_get(scene, strip); - if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound != nullptr) { + if (strip->type == STRIP_TYPE_SOUND_RAM && strip->sound != nullptr) { /* Visualize sub-frame sound offsets. */ - const double sound_offset = (seq->sound->offset_time + seq->sound_offset) * FPS; + const double sound_offset = (strip->sound->offset_time + strip->sound_offset) * FPS; strip_ctx.content_start += sound_offset; strip_ctx.content_end += sound_offset; } @@ -233,18 +233,18 @@ static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip * strip_draw_context_set_retiming_overlay_visibility(ctx, &strip_ctx); strip_ctx.strip_is_too_small = (!strip_ctx.can_draw_text_overlay && !strip_ctx.can_draw_strip_content); - strip_ctx.is_active_strip = seq == SEQ_select_active_get(scene); - strip_ctx.is_single_image = SEQ_transform_single_image_check(seq); - strip_ctx.handle_width = sequence_handle_size_get_clamped(ctx->scene, seq, ctx->pixelx); + strip_ctx.is_active_strip = strip == SEQ_select_active_get(scene); + strip_ctx.is_single_image = SEQ_transform_single_image_check(strip); + strip_ctx.handle_width = sequence_handle_size_get_clamped(ctx->scene, strip, ctx->pixelx); strip_ctx.show_strip_color_tag = (ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG); /* Determine if strip (or contents of meta strip) has missing data/media. */ - strip_ctx.missing_data_block = !SEQ_sequence_has_valid_data(seq); - strip_ctx.missing_media = media_presence_is_missing(scene, seq); - strip_ctx.is_connected = SEQ_is_strip_connected(seq); - if (seq->type == SEQ_TYPE_META) { - const ListBase *seqbase = &seq->seqbase; + strip_ctx.missing_data_block = !SEQ_sequence_has_valid_data(strip); + strip_ctx.missing_media = media_presence_is_missing(scene, strip); + strip_ctx.is_connected = SEQ_is_strip_connected(strip); + if (strip->type == STRIP_TYPE_META) { + const ListBase *seqbase = &strip->seqbase; LISTBASE_FOREACH (const Strip *, sub, seqbase) { if (!SEQ_sequence_has_valid_data(sub)) { strip_ctx.missing_data_block = true; @@ -262,7 +262,7 @@ static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip * strip_ctx.strip_content_top = strip_ctx.top; } - strip_ctx.is_muted = SEQ_render_is_muted(ctx->channels, seq); + strip_ctx.is_muted = SEQ_render_is_muted(ctx->channels, strip); strip_ctx.curve = nullptr; return strip_ctx; } @@ -275,13 +275,14 @@ static void strip_draw_context_curve_get(const TimelineDrawContext *ctx, (ctx->sseq->flag & SEQ_SHOW_OVERLAY) != 0 && (ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_FCURVES) != 0; - const bool showing_waveform = (strip_ctx.seq->type == SEQ_TYPE_SOUND_RAM) && + const bool showing_waveform = (strip_ctx.strip->type == STRIP_TYPE_SOUND_RAM) && !strip_ctx.strip_is_too_small && - seq_draw_waveforms_poll(ctx->sseq, strip_ctx.seq); + seq_draw_waveforms_poll(ctx->sseq, strip_ctx.strip); if (showing_curve_overlay || showing_waveform) { - const char *prop_name = strip_ctx.seq->type == SEQ_TYPE_SOUND_RAM ? "volume" : "blend_alpha"; + const char *prop_name = strip_ctx.strip->type == STRIP_TYPE_SOUND_RAM ? "volume" : + "blend_alpha"; strip_ctx.curve = id_data_find_fcurve( - &ctx->scene->id, strip_ctx.seq, &RNA_Strip, prop_name, 0, nullptr); + &ctx->scene->id, strip_ctx.strip, &RNA_Strip, prop_name, 0, nullptr); if (strip_ctx.curve && BKE_fcurve_is_empty(strip_ctx.curve)) { strip_ctx.curve = nullptr; } @@ -289,16 +290,16 @@ static void strip_draw_context_curve_get(const TimelineDrawContext *ctx, } static void color3ubv_from_seq(const Scene *curscene, - const Strip *seq, + const Strip *strip, const bool show_strip_color_tag, const bool is_muted, uchar r_col[3]) { - if (show_strip_color_tag && uint(seq->color_tag) < SEQUENCE_COLOR_TOT && - seq->color_tag != SEQUENCE_COLOR_NONE) + if (show_strip_color_tag && uint(strip->color_tag) < STRIP_COLOR_TOT && + strip->color_tag != STRIP_COLOR_NONE) { bTheme *btheme = UI_GetTheme(); - const ThemeStripColor *strip_color = &btheme->strip_color[seq->color_tag]; + const ThemeStripColor *strip_color = &btheme->strip_color[strip->color_tag]; copy_v3_v3_uchar(r_col, strip_color->color); return; } @@ -311,113 +312,113 @@ static void color3ubv_from_seq(const Scene *curscene, UI_Theme_Store(&theme_state); UI_SetTheme(SPACE_SEQ, RGN_TYPE_WINDOW); - switch (seq->type) { - case SEQ_TYPE_IMAGE: + switch (strip->type) { + case STRIP_TYPE_IMAGE: UI_GetThemeColor3ubv(TH_SEQ_IMAGE, r_col); break; - case SEQ_TYPE_META: + case STRIP_TYPE_META: UI_GetThemeColor3ubv(TH_SEQ_META, r_col); break; - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: UI_GetThemeColor3ubv(TH_SEQ_MOVIE, r_col); break; - case SEQ_TYPE_MOVIECLIP: + case STRIP_TYPE_MOVIECLIP: UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, r_col); break; - case SEQ_TYPE_MASK: + case STRIP_TYPE_MASK: UI_GetThemeColor3ubv(TH_SEQ_MASK, r_col); break; - case SEQ_TYPE_SCENE: + case STRIP_TYPE_SCENE: UI_GetThemeColor3ubv(TH_SEQ_SCENE, r_col); - if (seq->scene == curscene) { + if (strip->scene == curscene) { UI_GetColorPtrShade3ubv(r_col, 20, r_col); } break; /* Transitions use input colors, fallback for when the input is a transition itself. */ - case SEQ_TYPE_CROSS: - case SEQ_TYPE_GAMCROSS: - case SEQ_TYPE_WIPE: + case STRIP_TYPE_CROSS: + case STRIP_TYPE_GAMCROSS: + case STRIP_TYPE_WIPE: UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, r_col); /* Slightly offset hue to distinguish different transition types. */ - if (seq->type == SEQ_TYPE_GAMCROSS) { + if (strip->type == STRIP_TYPE_GAMCROSS) { rgb_byte_set_hue_float_offset(r_col, 0.03); } - else if (seq->type == SEQ_TYPE_WIPE) { + else if (strip->type == STRIP_TYPE_WIPE) { rgb_byte_set_hue_float_offset(r_col, 0.06); } break; /* Effects. */ - case SEQ_TYPE_TRANSFORM: - case SEQ_TYPE_SPEED: - case SEQ_TYPE_ADD: - case SEQ_TYPE_SUB: - case SEQ_TYPE_MUL: - case SEQ_TYPE_ALPHAOVER: - case SEQ_TYPE_ALPHAUNDER: - case SEQ_TYPE_OVERDROP: - case SEQ_TYPE_GLOW: - case SEQ_TYPE_MULTICAM: - case SEQ_TYPE_ADJUSTMENT: - case SEQ_TYPE_GAUSSIAN_BLUR: - case SEQ_TYPE_COLORMIX: + case STRIP_TYPE_TRANSFORM: + case STRIP_TYPE_SPEED: + case STRIP_TYPE_ADD: + case STRIP_TYPE_SUB: + case STRIP_TYPE_MUL: + case STRIP_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAUNDER: + case STRIP_TYPE_OVERDROP: + case STRIP_TYPE_GLOW: + case STRIP_TYPE_MULTICAM: + case STRIP_TYPE_ADJUSTMENT: + case STRIP_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_COLORMIX: UI_GetThemeColor3ubv(TH_SEQ_EFFECT, r_col); /* Slightly offset hue to distinguish different effects. */ - if (seq->type == SEQ_TYPE_ADD) { + if (strip->type == STRIP_TYPE_ADD) { rgb_byte_set_hue_float_offset(r_col, 0.09); } - else if (seq->type == SEQ_TYPE_SUB) { + else if (strip->type == STRIP_TYPE_SUB) { rgb_byte_set_hue_float_offset(r_col, 0.03); } - else if (seq->type == SEQ_TYPE_MUL) { + else if (strip->type == STRIP_TYPE_MUL) { rgb_byte_set_hue_float_offset(r_col, 0.06); } - else if (seq->type == SEQ_TYPE_ALPHAOVER) { + else if (strip->type == STRIP_TYPE_ALPHAOVER) { rgb_byte_set_hue_float_offset(r_col, 0.16); } - else if (seq->type == SEQ_TYPE_ALPHAUNDER) { + else if (strip->type == STRIP_TYPE_ALPHAUNDER) { rgb_byte_set_hue_float_offset(r_col, 0.19); } - else if (seq->type == SEQ_TYPE_OVERDROP) { + else if (strip->type == STRIP_TYPE_OVERDROP) { rgb_byte_set_hue_float_offset(r_col, 0.22); } - else if (seq->type == SEQ_TYPE_COLORMIX) { + else if (strip->type == STRIP_TYPE_COLORMIX) { rgb_byte_set_hue_float_offset(r_col, 0.25); } - else if (seq->type == SEQ_TYPE_GAUSSIAN_BLUR) { + else if (strip->type == STRIP_TYPE_GAUSSIAN_BLUR) { rgb_byte_set_hue_float_offset(r_col, 0.31); } - else if (seq->type == SEQ_TYPE_GLOW) { + else if (strip->type == STRIP_TYPE_GLOW) { rgb_byte_set_hue_float_offset(r_col, 0.34); } - else if (seq->type == SEQ_TYPE_ADJUSTMENT) { + else if (strip->type == STRIP_TYPE_ADJUSTMENT) { rgb_byte_set_hue_float_offset(r_col, 0.89); } - else if (seq->type == SEQ_TYPE_SPEED) { + else if (strip->type == STRIP_TYPE_SPEED) { rgb_byte_set_hue_float_offset(r_col, 0.72); } - else if (seq->type == SEQ_TYPE_TRANSFORM) { + else if (strip->type == STRIP_TYPE_TRANSFORM) { rgb_byte_set_hue_float_offset(r_col, 0.75); } - else if (seq->type == SEQ_TYPE_MULTICAM) { + else if (strip->type == STRIP_TYPE_MULTICAM) { rgb_byte_set_hue_float_offset(r_col, 0.85); } break; - case SEQ_TYPE_COLOR: + case STRIP_TYPE_COLOR: UI_GetThemeColor3ubv(TH_SEQ_COLOR, r_col); break; - case SEQ_TYPE_SOUND_RAM: + case STRIP_TYPE_SOUND_RAM: UI_GetThemeColor3ubv(TH_SEQ_AUDIO, r_col); blendcol[0] = blendcol[1] = blendcol[2] = 128; if (is_muted) { @@ -425,7 +426,7 @@ static void color3ubv_from_seq(const Scene *curscene, } break; - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: UI_GetThemeColor3ubv(TH_SEQ_TEXT, r_col); break; @@ -439,9 +440,9 @@ static void color3ubv_from_seq(const Scene *curscene, UI_Theme_Restore(&theme_state); } -static void waveform_job_start_if_needed(const bContext *C, const Strip *seq) +static void waveform_job_start_if_needed(const bContext *C, const Strip *strip) { - bSound *sound = seq->sound; + bSound *sound = strip->sound; BLI_spin_lock(static_cast(sound->spinlock)); if (!sound->waveform) { @@ -450,7 +451,7 @@ static void waveform_job_start_if_needed(const bContext *C, const Strip *seq) /* Prevent sounds from reloading. */ sound->tags |= SOUND_TAGS_WAVEFORM_LOADING; BLI_spin_unlock(static_cast(sound->spinlock)); - sequencer_preview_add_sound(C, seq); + sequencer_preview_add_sound(C, strip); } else { BLI_spin_unlock(static_cast(sound->spinlock)); @@ -467,7 +468,7 @@ static float align_frame_with_pixel(float frame_coord, float frames_per_pixel) static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, const StripDrawContext *strip_ctx) { - if (!seq_draw_waveforms_poll(timeline_ctx->sseq, strip_ctx->seq) || + if (!seq_draw_waveforms_poll(timeline_ctx->sseq, strip_ctx->strip) || strip_ctx->strip_is_too_small) { return; @@ -475,7 +476,7 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, const View2D *v2d = timeline_ctx->v2d; Scene *scene = timeline_ctx->scene; - Strip *seq = strip_ctx->seq; + Strip *strip = strip_ctx->strip; const bool half_style = (timeline_ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_WAVEFORMS_HALF) != 0; @@ -499,7 +500,7 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, strip_ctx->right_handle - timeline_ctx->pixelx * 3.0f); /* Offset must be also aligned, otherwise waveform flickers when moving left handle. */ float sample_start_frame = draw_start_frame - - (seq->sound->offset_time + seq->sound_offset) * FPS; + (strip->sound->offset_time + strip->sound_offset) * FPS; const int pixels_to_draw = round_fl_to_int((draw_end_frame - draw_start_frame) / frames_per_pixel); @@ -508,9 +509,9 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, return; /* Not much to draw, exit before running job. */ } - waveform_job_start_if_needed(timeline_ctx->C, seq); + waveform_job_start_if_needed(timeline_ctx->C, strip); - SoundWaveform *waveform = static_cast(seq->sound->waveform); + SoundWaveform *waveform = static_cast(strip->sound->waveform); if (waveform == nullptr || waveform->length == 0) { return; /* Waveform was not built. */ } @@ -524,7 +525,7 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, float prev_y_mid = y_zero; for (int i = 0; i < pixels_to_draw; i++) { float timeline_frame = sample_start_frame + i * frames_per_pixel; - float frame_index = SEQ_give_frame_index(scene, seq, timeline_frame) + seq->anim_startofs; + float frame_index = SEQ_give_frame_index(scene, strip, timeline_frame) + strip->anim_startofs; float sample = frame_index * samples_per_frame; int sample_index = round_fl_to_int(sample); @@ -552,7 +553,7 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx, } } - float volume = seq->volume; + float volume = strip->volume; if (strip_ctx->curve != nullptr) { float evaltime = draw_start_frame + (i * frames_per_pixel); volume = evaluate_fcurve(strip_ctx->curve, evaltime); @@ -626,12 +627,12 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx, float corner_radius) { using namespace seq; - Strip *seq_meta = strip_ctx->seq; + Strip *strip_meta = strip_ctx->strip; if (!strip_ctx->can_draw_strip_content || (timeline_ctx->sseq->flag & SEQ_SHOW_OVERLAY) == 0) { return; } - if ((seq_meta->type != SEQ_TYPE_META) && - ((seq_meta->type != SEQ_TYPE_SCENE) || (seq_meta->flag & SEQ_SCENE_STRIPS) == 0)) + if ((strip_meta->type != STRIP_TYPE_META) && + ((strip_meta->type != STRIP_TYPE_SCENE) || (strip_meta->flag & SEQ_SCENE_STRIPS) == 0)) { return; } @@ -658,22 +659,22 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx, ListBase *meta_channels; int offset; - meta_seqbase = SEQ_get_seqbase_from_sequence(seq_meta, &meta_channels, &offset); + meta_seqbase = SEQ_get_seqbase_from_sequence(strip_meta, &meta_channels, &offset); if (!meta_seqbase || BLI_listbase_is_empty(meta_seqbase)) { return; } - if (seq_meta->type == SEQ_TYPE_SCENE) { - offset = seq_meta->start - offset; + if (strip_meta->type == STRIP_TYPE_SCENE) { + offset = strip_meta->start - offset; } else { offset = 0; } - LISTBASE_FOREACH (Strip *, seq, meta_seqbase) { - chan_min = min_ii(chan_min, seq->machine); - chan_max = max_ii(chan_max, seq->machine); + LISTBASE_FOREACH (Strip *, strip, meta_seqbase) { + chan_min = min_ii(chan_min, strip->machine); + chan_max = max_ii(chan_max, strip->machine); } chan_range = (chan_max - chan_min) + 1; @@ -685,30 +686,31 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx, const float meta_x2 = strip_ctx->right_handle; /* Draw only immediate children (1 level depth). */ - LISTBASE_FOREACH (Strip *, seq, meta_seqbase) { - float x1_chan = SEQ_time_left_handle_frame_get(scene, seq) + offset; - float x2_chan = SEQ_time_right_handle_frame_get(scene, seq) + offset; + LISTBASE_FOREACH (Strip *, strip, meta_seqbase) { + float x1_chan = SEQ_time_left_handle_frame_get(scene, strip) + offset; + float x2_chan = SEQ_time_right_handle_frame_get(scene, strip) + offset; if (x1_chan <= meta_x2 && x2_chan >= meta_x1) { - float y_chan = (seq->machine - chan_min) / float(chan_range) * draw_range; + float y_chan = (strip->machine - chan_min) / float(chan_range) * draw_range; float y1_chan, y2_chan; - if (seq->type == SEQ_TYPE_COLOR) { - SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; + if (strip->type == STRIP_TYPE_COLOR) { + SolidColorVars *colvars = (SolidColorVars *)strip->effectdata; rgb_float_to_uchar(col, colvars->col); } else { - color3ubv_from_seq(scene, seq, strip_ctx->show_strip_color_tag, strip_ctx->is_muted, col); + color3ubv_from_seq( + scene, strip, strip_ctx->show_strip_color_tag, strip_ctx->is_muted, col); } - if (strip_ctx->is_muted || SEQ_render_is_muted(meta_channels, seq)) { + if (strip_ctx->is_muted || SEQ_render_is_muted(meta_channels, strip)) { col[3] = 64; } else { col[3] = 196; } - const bool missing_data = !SEQ_sequence_has_valid_data(seq); - const bool missing_media = media_presence_is_missing(scene, seq); + const bool missing_data = !SEQ_sequence_has_valid_data(strip); + const bool missing_media = media_presence_is_missing(scene, strip); if (missing_data || missing_media) { col[0] = 112; col[1] = 0; @@ -719,8 +721,8 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx, x1_chan = max_ff(x1_chan, meta_x1); x2_chan = min_ff(x2_chan, meta_x2); - y1_chan = bottom + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM); - y2_chan = bottom + y_chan + (draw_height * SEQ_STRIP_OFSTOP); + y1_chan = bottom + y_chan + (draw_height * STRIP_OFSBOTTOM); + y2_chan = bottom + y_chan + (draw_height * STRIP_OFSTOP); timeline_ctx->quads->add_quad(x1_chan, y1_chan, x2_chan, y2_chan, col); } @@ -732,11 +734,11 @@ static void draw_handle_transform_text(const TimelineDrawContext *timeline_ctx, eSeqHandle handle) { /* Draw numbers for start and end of the strip next to its handles. */ - if (strip_ctx->strip_is_too_small || (strip_ctx->seq->flag & SELECT) == 0) { + if (strip_ctx->strip_is_too_small || (strip_ctx->strip->flag & SELECT) == 0) { return; } - if (ED_sequencer_handle_is_selected(strip_ctx->seq, handle) == 0 && + if (ED_sequencer_handle_is_selected(strip_ctx->strip, handle) == 0 && (G.moving & G_TRANSFORM_SEQ) == 0) { return; @@ -771,7 +773,7 @@ static void draw_handle_transform_text(const TimelineDrawContext *timeline_ctx, UI_view2d_text_cache_add(timeline_ctx->v2d, text_x, text_y, numstr, numstr_len, col); } -float sequence_handle_size_get_clamped(const Scene *scene, Strip *seq, const float pixelx) +float sequence_handle_size_get_clamped(const Scene *scene, Strip *strip, const float pixelx) { const bool use_thin_handle = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) != 0; const float handle_size = use_thin_handle ? 5.0f : 8.0f; @@ -779,70 +781,71 @@ float sequence_handle_size_get_clamped(const Scene *scene, Strip *seq, const flo /* Ensure that handle is not wider, than quarter of strip. */ return min_ff(maxhandle, - (float(SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq)) / + (float(SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip)) / 4.0f)); } -static const char *draw_seq_text_get_name(const Strip *seq) +static const char *draw_seq_text_get_name(const Strip *strip) { - const char *name = seq->name + 2; + const char *name = strip->name + 2; if (name[0] == '\0') { - name = SEQ_sequence_give_name(seq); + name = SEQ_sequence_give_name(strip); } return name; } -static void draw_seq_text_get_source(const Strip *seq, char *r_source, size_t source_maxncpy) +static void draw_seq_text_get_source(const Strip *strip, char *r_source, size_t source_maxncpy) { *r_source = '\0'; /* Set source for the most common types. */ - switch (seq->type) { - case SEQ_TYPE_IMAGE: - case SEQ_TYPE_MOVIE: { - BLI_path_join(r_source, source_maxncpy, seq->data->dirpath, seq->data->stripdata->filename); + switch (strip->type) { + case STRIP_TYPE_IMAGE: + case STRIP_TYPE_MOVIE: { + BLI_path_join( + r_source, source_maxncpy, strip->data->dirpath, strip->data->stripdata->filename); break; } - case SEQ_TYPE_SOUND_RAM: { - if (seq->sound != nullptr) { - BLI_strncpy(r_source, seq->sound->filepath, source_maxncpy); + case STRIP_TYPE_SOUND_RAM: { + if (strip->sound != nullptr) { + BLI_strncpy(r_source, strip->sound->filepath, source_maxncpy); } break; } - case SEQ_TYPE_MULTICAM: { - BLI_snprintf(r_source, source_maxncpy, "Channel: %d", seq->multicam_source); + case STRIP_TYPE_MULTICAM: { + BLI_snprintf(r_source, source_maxncpy, "Channel: %d", strip->multicam_source); break; } - case SEQ_TYPE_TEXT: { - const TextVars *textdata = static_cast(seq->effectdata); + case STRIP_TYPE_TEXT: { + const TextVars *textdata = static_cast(strip->effectdata); BLI_strncpy(r_source, textdata->text, source_maxncpy); break; } - case SEQ_TYPE_SCENE: { - if (seq->scene != nullptr) { - if (seq->scene_camera != nullptr) { + case STRIP_TYPE_SCENE: { + if (strip->scene != nullptr) { + if (strip->scene_camera != nullptr) { BLI_snprintf(r_source, source_maxncpy, "%s (%s)", - seq->scene->id.name + 2, - seq->scene_camera->id.name + 2); + strip->scene->id.name + 2, + strip->scene_camera->id.name + 2); } else { - BLI_strncpy(r_source, seq->scene->id.name + 2, source_maxncpy); + BLI_strncpy(r_source, strip->scene->id.name + 2, source_maxncpy); } } break; } - case SEQ_TYPE_MOVIECLIP: { - if (seq->clip != nullptr) { - BLI_strncpy(r_source, seq->clip->id.name + 2, source_maxncpy); + case STRIP_TYPE_MOVIECLIP: { + if (strip->clip != nullptr) { + BLI_strncpy(r_source, strip->clip->id.name + 2, source_maxncpy); } break; } - case SEQ_TYPE_MASK: { - if (seq->mask != nullptr) { - BLI_strncpy(r_source, seq->mask->id.name + 2, source_maxncpy); + case STRIP_TYPE_MASK: { + if (strip->mask != nullptr) { + BLI_strncpy(r_source, strip->mask->id.name + 2, source_maxncpy); } break; } @@ -854,19 +857,19 @@ static size_t draw_seq_text_get_overlay_string(TimelineDrawContext *timeline_ctx char *r_overlay_string, size_t overlay_string_len) { - const Strip *seq = strip_ctx->seq; + const Strip *strip = strip_ctx->strip; const char *text_sep = " | "; const char *text_array[5]; int i = 0; if (timeline_ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_NAME) { - text_array[i++] = draw_seq_text_get_name(seq); + text_array[i++] = draw_seq_text_get_name(strip); } char source[FILE_MAX]; if (timeline_ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE) { - draw_seq_text_get_source(seq, source, sizeof(source)); + draw_seq_text_get_source(strip, source, sizeof(source)); if (source[0] != '\0') { if (i != 0) { text_array[i++] = text_sep; @@ -889,10 +892,10 @@ static size_t draw_seq_text_get_overlay_string(TimelineDrawContext *timeline_ctx return BLI_string_join_array(r_overlay_string, overlay_string_len, text_array, i); } -static void get_strip_text_color(const StripDrawContext *strip, uchar r_col[4]) +static void get_strip_text_color(const StripDrawContext *strip_ctx, uchar r_col[4]) { - const Strip *seq = strip->seq; - const bool active_or_selected = (seq->flag & SELECT) || strip->is_active_strip; + const Strip *strip = strip_ctx->strip; + const bool active_or_selected = (strip->flag & SELECT) || strip_ctx->is_active_strip; /* Text: white when selected/active, black otherwise. */ r_col[0] = r_col[1] = r_col[2] = r_col[3] = 255; @@ -902,7 +905,7 @@ static void get_strip_text_color(const StripDrawContext *strip, uchar r_col[4]) r_col[0] = r_col[1] = r_col[2] = 0; /* On muted and missing media/data-block strips: gray color, reduce opacity. */ - if (strip->is_muted || strip->missing_data_block || strip->missing_media) { + if (strip_ctx->is_muted || strip_ctx->missing_data_block || strip_ctx->missing_media) { r_col[0] = r_col[1] = r_col[2] = 192; r_col[3] *= 0.66f; } @@ -990,7 +993,7 @@ static void draw_strip_icons(TimelineDrawContext *timeline_ctx, } /* Draw icon in center of content. */ - if (strip.can_draw_strip_content && strip.seq->type != SEQ_TYPE_META) { + if (strip.can_draw_strip_content && strip.strip->type != STRIP_TYPE_META) { rctf rect; rect.xmin = strip.left_handle + strip.handle_width; rect.xmax = strip.right_handle - strip.handle_width; @@ -1066,7 +1069,7 @@ static void draw_seq_text_overlay(TimelineDrawContext *timeline_ctx, static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, const StripDrawContext *strip_ctx) { - const Strip *seq = strip_ctx->seq; + const Strip *strip = strip_ctx->strip; if ((timeline_ctx->sseq->flag & SEQ_SHOW_OVERLAY) == 0) { return; } @@ -1074,7 +1077,7 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, return; } if ((timeline_ctx->sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS) == 0 && - (strip_ctx->seq != ED_sequencer_special_preview_get())) + (strip_ctx->strip != ED_sequencer_special_preview_get())) { return; } @@ -1082,8 +1085,8 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, const Scene *scene = timeline_ctx->scene; uchar col[4], blend_col[4]; - color3ubv_from_seq(scene, seq, strip_ctx->show_strip_color_tag, strip_ctx->is_muted, col); - if (seq->flag & SELECT) { + color3ubv_from_seq(scene, strip, strip_ctx->show_strip_color_tag, strip_ctx->is_muted, col); + if (strip->flag & SELECT) { UI_GetColorPtrShade3ubv(col, 50, col); } col[3] = strip_ctx->is_muted ? MUTE_ALPHA : 200; @@ -1094,24 +1097,24 @@ static void draw_strip_offsets(TimelineDrawContext *timeline_ctx, timeline_ctx->quads->add_quad(strip_ctx->left_handle, strip_ctx->bottom - timeline_ctx->pixely, strip_ctx->content_start, - strip_ctx->bottom - SEQ_STRIP_OFSBOTTOM, + strip_ctx->bottom - STRIP_OFSBOTTOM, col); timeline_ctx->quads->add_wire_quad(strip_ctx->left_handle, strip_ctx->bottom - timeline_ctx->pixely, strip_ctx->content_start, - strip_ctx->bottom - SEQ_STRIP_OFSBOTTOM, + strip_ctx->bottom - STRIP_OFSBOTTOM, blend_col); } if (strip_ctx->right_handle < strip_ctx->content_end) { timeline_ctx->quads->add_quad(strip_ctx->right_handle, strip_ctx->top + timeline_ctx->pixely, strip_ctx->content_end, - strip_ctx->top + SEQ_STRIP_OFSBOTTOM, + strip_ctx->top + STRIP_OFSBOTTOM, col); timeline_ctx->quads->add_wire_quad(strip_ctx->right_handle, strip_ctx->top + timeline_ctx->pixely, strip_ctx->content_end, - strip_ctx->top + SEQ_STRIP_OFSBOTTOM, + strip_ctx->top + STRIP_OFSBOTTOM, blend_col); } } @@ -1196,10 +1199,10 @@ static void draw_multicam_highlight(TimelineDrawContext *timeline_ctx, { Strip *act_seq = SEQ_select_active_get(timeline_ctx->scene); - if (strip_ctx->seq != act_seq || act_seq == nullptr) { + if (strip_ctx->strip != act_seq || act_seq == nullptr) { return; } - if ((act_seq->flag & SELECT) == 0 || act_seq->type != SEQ_TYPE_MULTICAM) { + if ((act_seq->flag & SELECT) == 0 || act_seq->type != STRIP_TYPE_MULTICAM) { return; } @@ -1258,9 +1261,9 @@ static void visible_strips_ordered_get(TimelineDrawContext *timeline_ctx, Vector strips = sequencer_visible_strips_get(timeline_ctx->C); r_bottom_layer.reserve(strips.size()); - for (Strip *seq : strips) { - StripDrawContext strip_ctx = strip_draw_context_get(timeline_ctx, seq); - if ((seq->flag & SEQ_OVERLAP) == 0) { + for (Strip *strip : strips) { + StripDrawContext strip_ctx = strip_draw_context_get(timeline_ctx, strip); + if ((strip->flag & SEQ_OVERLAP) == 0) { r_bottom_layer.append(strip_ctx); } else { @@ -1307,7 +1310,7 @@ static void draw_strips_background(TimelineDrawContext *timeline_ctx, /* Background color. */ uchar col[4]; data.flags |= GPU_SEQ_FLAG_BACKGROUND; - color3ubv_from_seq(scene, strip.seq, strip.show_strip_color_tag, strip.is_muted, col); + color3ubv_from_seq(scene, strip.strip, strip.show_strip_color_tag, strip.is_muted, col); col[3] = strip.is_muted ? MUTE_ALPHA : 255; /* Muted strips: turn almost gray. */ if (strip.is_muted) { @@ -1317,24 +1320,24 @@ static void draw_strips_background(TimelineDrawContext *timeline_ctx, data.col_background = color_pack(col); /* Color band state. */ - if (show_overlay && (strip.seq->type == SEQ_TYPE_COLOR)) { + if (show_overlay && (strip.strip->type == STRIP_TYPE_COLOR)) { data.flags |= GPU_SEQ_FLAG_COLOR_BAND; - SolidColorVars *colvars = (SolidColorVars *)strip.seq->effectdata; + SolidColorVars *colvars = (SolidColorVars *)strip.strip->effectdata; rgb_float_to_uchar(col, colvars->col); data.col_color_band = color_pack(col); } /* Transition state. */ if (show_overlay && strip.can_draw_strip_content && - ELEM(strip.seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) + ELEM(strip.strip->type, STRIP_TYPE_CROSS, STRIP_TYPE_GAMCROSS, STRIP_TYPE_WIPE)) { data.flags |= GPU_SEQ_FLAG_TRANSITION; - const Strip *seq1 = strip.seq->seq1; - const Strip *seq2 = strip.seq->seq2; + const Strip *seq1 = strip.strip->seq1; + const Strip *seq2 = strip.strip->seq2; /* Left side. */ - if (seq1->type == SEQ_TYPE_COLOR) { + if (seq1->type == STRIP_TYPE_COLOR) { rgb_float_to_uchar(col, ((const SolidColorVars *)seq1->effectdata)->col); } else { @@ -1343,7 +1346,7 @@ static void draw_strips_background(TimelineDrawContext *timeline_ctx, data.col_transition_in = color_pack(col); /* Right side. */ - if (seq2->type == SEQ_TYPE_COLOR) { + if (seq2->type == STRIP_TYPE_COLOR) { rgb_float_to_uchar(col, ((const SolidColorVars *)seq2->effectdata)->col); } else { @@ -1370,7 +1373,7 @@ static void strip_data_missing_media_flags_set(const StripDrawContext &strip, data.flags |= GPU_SEQ_FLAG_MISSING_TITLE; } /* Do not tint content area for meta strips; we want to display children. */ - if (strip.seq->type != SEQ_TYPE_META) { + if (strip.strip->type != STRIP_TYPE_META) { data.flags |= GPU_SEQ_FLAG_MISSING_CONTENT; } } @@ -1380,7 +1383,7 @@ static void strip_data_lock_flags_set(const StripDrawContext &strip, const TimelineDrawContext *timeline_ctx, SeqStripDrawData &data) { - if (SEQ_transform_is_locked(timeline_ctx->channels, strip.seq)) { + if (SEQ_transform_is_locked(timeline_ctx->channels, strip.strip)) { data.flags |= GPU_SEQ_FLAG_LOCKED; } } @@ -1390,7 +1393,7 @@ static void strip_data_outline_params_set(const StripDrawContext &strip, SeqStripDrawData &data) { const bool active = strip.is_active_strip; - const bool selected = strip.seq->flag & SELECT; + const bool selected = strip.strip->flag & SELECT; uchar4 col{0, 0, 0, 255}; if (selected) { @@ -1413,7 +1416,7 @@ static void strip_data_outline_params_set(const StripDrawContext &strip, const eSeqOverlapMode overlap_mode = SEQ_tool_settings_overlap_mode_get(timeline_ctx->scene); const bool use_overwrite = overlap_mode == SEQ_OVERLAP_OVERWRITE; - const bool overlaps = (strip.seq->flag & SEQ_OVERLAP) && (G.moving & G_TRANSFORM_SEQ); + const bool overlaps = (strip.strip->flag & SEQ_OVERLAP) && (G.moving & G_TRANSFORM_SEQ); /* Outline while translating strips: * - Slightly lighter. @@ -1440,11 +1443,11 @@ static void strip_data_highlight_flags_set(const StripDrawContext &strip, const Strip *special_preview = ED_sequencer_special_preview_get(); /* Highlight if strip is an input of an active strip, or if the strip is solo preview. */ if (act_seq != nullptr && (act_seq->flag & SELECT) != 0) { - if (act_seq->seq1 == strip.seq || act_seq->seq2 == strip.seq) { + if (act_seq->seq1 == strip.strip || act_seq->seq2 == strip.strip) { data.flags |= GPU_SEQ_FLAG_HIGHLIGHT; } } - if (special_preview == strip.seq) { + if (special_preview == strip.strip) { data.flags |= GPU_SEQ_FLAG_HIGHLIGHT; } } @@ -1454,16 +1457,16 @@ static void strip_data_handle_flags_set(const StripDrawContext &strip, SeqStripDrawData &data) { const Scene *scene = timeline_ctx->scene; - const bool selected = strip.seq->flag & SELECT; + const bool selected = strip.strip->flag & SELECT; const bool show_handles = (U.sequencer_editor_flag & USER_SEQ_ED_SIMPLE_TWEAKING) == 0; /* Handles on left/right side. */ - if (!SEQ_transform_is_locked(timeline_ctx->channels, strip.seq) && - ED_sequencer_can_select_handle(scene, strip.seq, timeline_ctx->v2d)) + if (!SEQ_transform_is_locked(timeline_ctx->channels, strip.strip) && + ED_sequencer_can_select_handle(scene, strip.strip, timeline_ctx->v2d)) { const bool selected_l = selected && - ED_sequencer_handle_is_selected(strip.seq, SEQ_HANDLE_LEFT); + ED_sequencer_handle_is_selected(strip.strip, SEQ_HANDLE_LEFT); const bool selected_r = selected && - ED_sequencer_handle_is_selected(strip.seq, SEQ_HANDLE_RIGHT); + ED_sequencer_handle_is_selected(strip.strip, SEQ_HANDLE_RIGHT); const bool show_l = show_handles || selected_l; const bool show_r = show_handles || selected_r; if (show_l) { @@ -1685,7 +1688,10 @@ static bool draw_cache_view_init_fn(void * /*userdata*/, size_t item_count) } /* Called as a callback */ -static bool draw_cache_view_iter_fn(void *userdata, Strip *seq, int timeline_frame, int cache_type) +static bool draw_cache_view_iter_fn(void *userdata, + Strip *strip, + int timeline_frame, + int cache_type) { CacheDrawData *drawdata = static_cast(userdata); const View2D *v2d = drawdata->v2d; @@ -1717,20 +1723,20 @@ static bool draw_cache_view_iter_fn(void *userdata, Strip *seq, int timeline_fra return false; } if ((cache_type & SEQ_CACHE_STORE_RAW) && (drawdata->cache_flag & SEQ_CACHE_SHOW_RAW)) { - stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + drawdata->stripe_ofs_y; + stripe_bot = strip->machine + STRIP_OFSBOTTOM + drawdata->stripe_ofs_y; col = col_raw; } else if ((cache_type & SEQ_CACHE_STORE_PREPROCESSED) && (drawdata->cache_flag & SEQ_CACHE_SHOW_PREPROCESSED)) { - stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + drawdata->stripe_ht + + stripe_bot = strip->machine + STRIP_OFSBOTTOM + drawdata->stripe_ht + drawdata->stripe_ofs_y * 2; col = col_preproc; } else if ((cache_type & SEQ_CACHE_STORE_COMPOSITE) && (drawdata->cache_flag & SEQ_CACHE_SHOW_COMPOSITE)) { - stripe_bot = seq->machine + SEQ_STRIP_OFSTOP - drawdata->stripe_ofs_y - drawdata->stripe_ht; + stripe_bot = strip->machine + STRIP_OFSTOP - drawdata->stripe_ofs_y - drawdata->stripe_ht; col = col_composite; } else { @@ -1745,15 +1751,15 @@ static bool draw_cache_view_iter_fn(void *userdata, Strip *seq, int timeline_fra } static void draw_cache_stripe(const Scene *scene, - const Strip *seq, + const Strip *strip, SeqQuadsBatch &quads, const float stripe_bot, const float stripe_ht, const uchar color[4]) { - quads.add_quad(SEQ_time_left_handle_frame_get(scene, seq), + quads.add_quad(SEQ_time_left_handle_frame_get(scene, strip), stripe_bot, - SEQ_time_right_handle_frame_get(scene, seq), + SEQ_time_right_handle_frame_get(scene, strip), stripe_bot + stripe_ht, color); } @@ -1789,25 +1795,24 @@ static void draw_cache_background(const bContext *C, CacheDrawData *draw_data) } Vector strips = sequencer_visible_strips_get(C); - strips.remove_if([&](Strip *seq) { return seq->type == SEQ_TYPE_SOUND_RAM; }); + strips.remove_if([&](Strip *strip) { return strip->type == STRIP_TYPE_SOUND_RAM; }); - for (const Strip *seq : strips) { - stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + draw_data->stripe_ofs_y; + for (const Strip *strip : strips) { + stripe_bot = strip->machine + STRIP_OFSBOTTOM + draw_data->stripe_ofs_y; if (sseq->cache_overlay.flag & SEQ_CACHE_SHOW_RAW) { - draw_cache_stripe(scene, seq, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_raw); + draw_cache_stripe(scene, strip, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_raw); } if (sseq->cache_overlay.flag & SEQ_CACHE_SHOW_PREPROCESSED) { stripe_bot += draw_data->stripe_ht + draw_data->stripe_ofs_y; draw_cache_stripe( - scene, seq, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_preproc); + scene, strip, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_preproc); } if (sseq->cache_overlay.flag & SEQ_CACHE_SHOW_COMPOSITE) { - stripe_bot = seq->machine + SEQ_STRIP_OFSTOP - draw_data->stripe_ofs_y - - draw_data->stripe_ht; + stripe_bot = strip->machine + STRIP_OFSTOP - draw_data->stripe_ofs_y - draw_data->stripe_ht; draw_cache_stripe( - scene, seq, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_composite); + scene, strip, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_composite); } } } diff --git a/source/blender/editors/space_sequencer/sequencer_view.cc b/source/blender/editors/space_sequencer/sequencer_view.cc index 71f59d9d6edf..f1f3d0da01ad 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.cc +++ b/source/blender/editors/space_sequencer/sequencer_view.cc @@ -323,13 +323,13 @@ static void seq_view_collection_rect_timeline(const bContext *C, int ymax = 0; int xmargin = FPS; - for (Strip *seq : strips) { - xmin = min_ii(xmin, SEQ_time_left_handle_frame_get(scene, seq)); - xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(scene, seq)); + for (Strip *strip : strips) { + xmin = min_ii(xmin, SEQ_time_left_handle_frame_get(scene, strip)); + xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(scene, strip)); - ymin = min_ii(ymin, seq->machine); + ymin = min_ii(ymin, strip->machine); /* "+1" because each channel has a thickness of 1. */ - ymax = max_ii(ymax, seq->machine + 1); + ymax = max_ii(ymax, strip->machine + 1); } xmax += xmargin; diff --git a/source/blender/editors/space_sequencer/space_sequencer.cc b/source/blender/editors/space_sequencer/space_sequencer.cc index d0cc5c3f3371..0e39a26e1814 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.cc +++ b/source/blender/editors/space_sequencer/space_sequencer.cc @@ -641,18 +641,18 @@ static void sequencer_main_region_message_subscribe(const wmRegionMessageSubscri } static bool is_mouse_over_retiming_key(const Scene *scene, - const Strip *seq, + const Strip *strip, const View2D *v2d, const ScrArea *area, float mouse_co_region[2]) { const SpaceSeq *sseq = static_cast(area->spacedata.first); - if (!SEQ_retiming_data_is_editable(seq) || !retiming_keys_can_be_displayed(sseq)) { + if (!SEQ_retiming_data_is_editable(strip) || !retiming_keys_can_be_displayed(sseq)) { return false; } - rctf retiming_keys_box = seq_retiming_keys_box_get(scene, v2d, seq); + rctf retiming_keys_box = strip_retiming_keys_box_get(scene, v2d, strip); return BLI_rctf_isect_pt_v(&retiming_keys_box, mouse_co_region); } diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh index 8da72fa6a736..56d7373fedda 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh @@ -8,6 +8,9 @@ #include "spreadsheet_cache.hh" struct ARegionType; +struct Depsgraph; +struct Object; +struct SpaceSpreadsheet; namespace blender::ed::spreadsheet { diff --git a/source/blender/editors/space_text/text_format.hh b/source/blender/editors/space_text/text_format.hh index a7c7edeb4a2a..39ed1b8c2aff 100644 --- a/source/blender/editors/space_text/text_format.hh +++ b/source/blender/editors/space_text/text_format.hh @@ -12,7 +12,9 @@ using blender::Span; +struct SpaceText; struct Text; +struct TextLine; /* *** Flatten String *** */ struct FlattenString { diff --git a/source/blender/editors/space_view3d/view3d_gizmo_geometry_nodes.cc b/source/blender/editors/space_view3d/view3d_gizmo_geometry_nodes.cc index 411277e374bc..fdb571ba1b87 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_geometry_nodes.cc +++ b/source/blender/editors/space_view3d/view3d_gizmo_geometry_nodes.cc @@ -1072,7 +1072,7 @@ static void WIDGETGROUP_geometry_nodes_refresh(const bContext *C, wmGizmoGroup * modify_value); Main *main = CTX_data_main(C); - ED_node_tree_propagate_change(const_cast(C), main, nullptr); + ED_node_tree_propagate_change(main, nullptr); WM_main_add_notifier(NC_GEOM | ND_DATA, nullptr); }; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc b/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc index b40f6df6f0f7..adb8038d7a3d 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.cc @@ -193,13 +193,13 @@ static void ruler_item_remove(bContext *C, wmGizmoGroup *gzgroup, RulerItem *rul } static void ruler_item_as_string( - RulerItem *ruler_item, UnitSettings *unit, char *numstr, size_t numstr_size, int prec) + RulerItem *ruler_item, const UnitSettings &unit, char *numstr, size_t numstr_size, int prec) { if (ruler_item->flag & RULERITEM_USE_ANGLE) { const float ruler_angle = angle_v3v3v3( ruler_item->co[0], ruler_item->co[1], ruler_item->co[2]); - if (unit->system == USER_UNIT_NONE) { + if (unit.system == USER_UNIT_NONE) { BLI_snprintf( numstr, numstr_size, "%.*f" BLI_STR_UTF8_DEGREE_SIGN, prec, RAD2DEGF(ruler_angle)); } @@ -211,17 +211,11 @@ static void ruler_item_as_string( else { const float ruler_len = len_v3v3(ruler_item->co[0], ruler_item->co[2]); - if (unit->system == USER_UNIT_NONE) { + if (unit.system == USER_UNIT_NONE) { BLI_snprintf(numstr, numstr_size, "%.*f", prec, ruler_len); } else { - BKE_unit_value_as_string(numstr, - numstr_size, - double(ruler_len * unit->scale_length), - prec, - B_UNIT_LENGTH, - unit, - false); + BKE_unit_value_as_string(numstr, numstr_size, ruler_len, prec, B_UNIT_LENGTH, unit, false); } } } @@ -645,7 +639,7 @@ static bool view3d_ruler_from_gpencil(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) { Scene *scene = CTX_data_scene(C); - UnitSettings *unit = &scene->unit; + const UnitSettings &unit = scene->unit; RulerInfo *ruler_info = static_cast(gz->parent_gzgroup->customdata); RulerItem *ruler_item = (RulerItem *)gz; ARegion *region = ruler_info->region; diff --git a/source/blender/editors/space_view3d/view3d_navigate.hh b/source/blender/editors/space_view3d/view3d_navigate.hh index 22a309b19537..1e39162d6e4a 100644 --- a/source/blender/editors/space_view3d/view3d_navigate.hh +++ b/source/blender/editors/space_view3d/view3d_navigate.hh @@ -8,6 +8,9 @@ #pragma once +#include "MEM_guardedalloc.h" + +#include "BLI_math_vector_types.hh" #include "BLI_utildefines.h" /** @@ -23,6 +26,7 @@ struct RegionView3D; struct Scene; struct ScrArea; struct View3D; +struct ViewOpsData; struct bContext; struct Object; struct PointerRNA; diff --git a/source/blender/editors/space_view3d/view3d_navigate_smoothview.cc b/source/blender/editors/space_view3d/view3d_navigate_smoothview.cc index 9012dd5e6e70..696da77b195c 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_smoothview.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_smoothview.cc @@ -585,7 +585,7 @@ void ED_view3d_smooth_view_force_finish_no_camera_lock(const Depsgraph *depsgrap /* NOTE(@ideasman42): Ideally we would *always* apply the camera lock. * Failing to do so results in incorrect behavior when a user performs - * a camera-locked view-port manipulation & immediately enters enters local-view + * a camera-locked view-port manipulation & immediately enters local-view * before the operation is completed. * In this case the camera isn't key-framed when it should be. * diff --git a/source/blender/editors/space_view3d/view3d_navigate_view_axis.cc b/source/blender/editors/space_view3d/view3d_navigate_view_axis.cc index 2df582a0ebbe..9f5c6305fd0b 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_view_axis.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_view_axis.cc @@ -6,8 +6,7 @@ * \ingroup spview3d */ -#include "MEM_guardedalloc.h" - +#include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLT_translation.hh" diff --git a/source/blender/editors/space_view3d/view3d_navigate_view_orbit.cc b/source/blender/editors/space_view3d/view3d_navigate_view_orbit.cc index 96444d58105f..01cbd80a9eab 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_view_orbit.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_view_orbit.cc @@ -6,8 +6,7 @@ * \ingroup spview3d */ -#include "MEM_guardedalloc.h" - +#include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "WM_api.hh" diff --git a/source/blender/editors/space_view3d/view3d_navigate_view_pan.cc b/source/blender/editors/space_view3d/view3d_navigate_view_pan.cc index 115d91a61d7b..52953e3d0b29 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_view_pan.cc +++ b/source/blender/editors/space_view3d/view3d_navigate_view_pan.cc @@ -6,8 +6,6 @@ * \ingroup spview3d */ -#include "MEM_guardedalloc.h" - #include "WM_api.hh" #include "RNA_access.hh" diff --git a/source/blender/editors/transform/transform.hh b/source/blender/editors/transform/transform.hh index da2b66ab29b0..69d34ff28359 100644 --- a/source/blender/editors/transform/transform.hh +++ b/source/blender/editors/transform/transform.hh @@ -15,7 +15,6 @@ #include "ED_view3d.hh" #include "DNA_listBase.h" -#include "DNA_object_enums.h" #include "DNA_scene_types.h" #include "DEG_depsgraph.hh" diff --git a/source/blender/editors/transform/transform_constraints.hh b/source/blender/editors/transform/transform_constraints.hh index da79e87a3d50..8014f1bb7904 100644 --- a/source/blender/editors/transform/transform_constraints.hh +++ b/source/blender/editors/transform/transform_constraints.hh @@ -8,6 +8,8 @@ #pragma once +#include "BLI_math_vector_types.hh" + /* DRAWLINE options flags. */ #define DRAWLIGHT 1 diff --git a/source/blender/editors/transform/transform_convert.hh b/source/blender/editors/transform/transform_convert.hh index 38e80f75ed1c..03170168ac92 100644 --- a/source/blender/editors/transform/transform_convert.hh +++ b/source/blender/editors/transform/transform_convert.hh @@ -15,6 +15,8 @@ #include "BLI_index_mask.hh" +#include "transform.hh" + struct BMEditMesh; struct BMesh; struct BezTriple; diff --git a/source/blender/editors/transform/transform_convert_node.cc b/source/blender/editors/transform/transform_convert_node.cc index adb309e01aa0..02e1bafe24f0 100644 --- a/source/blender/editors/transform/transform_convert_node.cc +++ b/source/blender/editors/transform/transform_convert_node.cc @@ -280,7 +280,7 @@ static void special_aftertrans_update__node(bContext *C, TransInfo *t) bke::node_remove_node(bmain, ntree, node, true); } } - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } diff --git a/source/blender/editors/transform/transform_convert_sequencer.cc b/source/blender/editors/transform/transform_convert_sequencer.cc index 15efdfd8d5c3..c8b6890a17fa 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.cc +++ b/source/blender/editors/transform/transform_convert_sequencer.cc @@ -33,16 +33,16 @@ #include "transform_convert.hh" #include "transform_mode.hh" -#define SEQ_EDGE_PAN_INSIDE_PAD 3.5 -#define SEQ_EDGE_PAN_OUTSIDE_PAD 0 /* Disable clamping for panning, use whole screen. */ -#define SEQ_EDGE_PAN_SPEED_RAMP 1 -#define SEQ_EDGE_PAN_MAX_SPEED 4 /* In UI units per second, slower than default. */ -#define SEQ_EDGE_PAN_DELAY 1.0f -#define SEQ_EDGE_PAN_ZOOM_INFLUENCE 0.5f +#define STRIP_EDGE_PAN_INSIDE_PAD 3.5 +#define STRIP_EDGE_PAN_OUTSIDE_PAD 0 /* Disable clamping for panning, use whole screen. */ +#define STRIP_EDGE_PAN_SPEED_RAMP 1 +#define STRIP_EDGE_PAN_MAX_SPEED 4 /* In UI units per second, slower than default. */ +#define STRIP_EDGE_PAN_DELAY 1.0f +#define STRIP_EDGE_PAN_ZOOM_INFLUENCE 0.5f /** Used for sequencer transform. */ struct TransDataSeq { - Strip *seq; + Strip *strip; /** A copy of #Strip.flag that may be modified for nested strips. */ int flag; /** Use this so we can have transform data at the strips start, @@ -77,7 +77,7 @@ struct TransSeq { * * count and flag MUST be set. */ -static void SeqTransInfo(TransInfo *t, Strip *seq, int *r_count, int *r_flag) +static void SeqTransInfo(TransInfo *t, Strip *strip, int *r_count, int *r_flag) { Scene *scene = t->scene; Editing *ed = SEQ_editing_get(t->scene); @@ -88,16 +88,16 @@ static void SeqTransInfo(TransInfo *t, Strip *seq, int *r_count, int *r_flag) /* *** Extend Transform *** */ int cfra = scene->r.cfra; - int left = SEQ_time_left_handle_frame_get(scene, seq); - int right = SEQ_time_right_handle_frame_get(scene, seq); + int left = SEQ_time_left_handle_frame_get(scene, strip); + int right = SEQ_time_right_handle_frame_get(scene, strip); - if ((seq->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, seq)) { + if ((strip->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, strip)) { *r_count = 0; *r_flag = 0; } else { *r_count = 1; /* Unless its set to 0, extend will never set 2 handles at once. */ - *r_flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); + *r_flag = (strip->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); if (t->frame_side == 'R') { if (right <= cfra) { @@ -130,17 +130,17 @@ static void SeqTransInfo(TransInfo *t, Strip *seq, int *r_count, int *r_flag) /* Count. */ /* Non nested strips (reset selection and handles). */ - if ((seq->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, seq)) { + if ((strip->flag & SELECT) == 0 || SEQ_transform_is_locked(channels, strip)) { *r_count = 0; *r_flag = 0; } else { - if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) { - *r_flag = seq->flag; + if ((strip->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) { + *r_flag = strip->flag; *r_count = 2; /* We need 2 transdata's. */ } else { - *r_flag = seq->flag; + *r_flag = strip->flag; *r_count = 1; /* Selected or with a handle selected. */ } } @@ -151,8 +151,8 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase) { int tot = 0, count, flag; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - SeqTransInfo(t, seq, &count, &flag); /* Ignore the flag. */ + LISTBASE_FOREACH (Strip *, strip, seqbase) { + SeqTransInfo(t, strip, &count, &flag); /* Ignore the flag. */ tot += count; } @@ -163,7 +163,7 @@ static TransData *SeqToTransData(Scene *scene, TransData *td, TransData2D *td2d, TransDataSeq *tdsq, - Strip *seq, + Strip *strip, int flag, int sel_flag) { @@ -174,26 +174,26 @@ static TransData *SeqToTransData(Scene *scene, /* Use seq_tx_get_final_left() and an offset here * so transform has the left hand location of the strip. * `tdsq->start_offset` is used when flushing the tx data back. */ - start_left = SEQ_time_left_handle_frame_get(scene, seq); + start_left = SEQ_time_left_handle_frame_get(scene, strip); td2d->loc[0] = start_left; - tdsq->start_offset = start_left - seq->start; /* Use to apply the original location. */ + tdsq->start_offset = start_left - strip->start; /* Use to apply the original location. */ break; case SEQ_LEFTSEL: - start_left = SEQ_time_left_handle_frame_get(scene, seq); + start_left = SEQ_time_left_handle_frame_get(scene, strip); td2d->loc[0] = start_left; break; case SEQ_RIGHTSEL: - td2d->loc[0] = SEQ_time_right_handle_frame_get(scene, seq); + td2d->loc[0] = SEQ_time_right_handle_frame_get(scene, strip); break; } - td2d->loc[1] = seq->machine; /* Channel - Y location. */ + td2d->loc[1] = strip->machine; /* Channel - Y location. */ td2d->loc[2] = 0.0f; td2d->loc2d = nullptr; - tdsq->seq = seq; + tdsq->strip = strip; - /* Use instead of seq->flag for nested strips and other + /* Use instead of strip->flag for nested strips and other * cases where the selection may need to be modified. */ tdsq->flag = flag; tdsq->sel_flag = sel_flag; @@ -231,24 +231,24 @@ static int SeqToTransData_build( int count, flag; int tot = 0; - LISTBASE_FOREACH (Strip *, seq, seqbase) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { - SeqTransInfo(t, seq, &count, &flag); + SeqTransInfo(t, strip, &count, &flag); - /* Use 'flag' which is derived from seq->flag but modified for special cases. */ + /* Use 'flag' which is derived from strip->flag but modified for special cases. */ if (flag & SELECT) { if (flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) { if (flag & SEQ_LEFTSEL) { - SeqToTransData(scene, td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); + SeqToTransData(scene, td++, td2d++, tdsq++, strip, flag, SEQ_LEFTSEL); tot++; } if (flag & SEQ_RIGHTSEL) { - SeqToTransData(scene, td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); + SeqToTransData(scene, td++, td2d++, tdsq++, strip, flag, SEQ_RIGHTSEL); tot++; } } else { - SeqToTransData(scene, td++, td2d++, tdsq++, seq, flag, SELECT); + SeqToTransData(scene, td++, td2d++, tdsq++, strip, flag, SELECT); tot++; } } @@ -271,11 +271,11 @@ static void seq_transform_cancel(TransInfo *t, blender::Span transforme { ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(t->scene)); - for (Strip *seq : transformed_strips) { + for (Strip *strip : transformed_strips) { /* Handle pre-existing overlapping strips even when operator is canceled. * This is necessary for SEQUENCER_OT_duplicate_move macro for example. */ - if (SEQ_transform_test_overlap(t->scene, seqbase, seq)) { - SEQ_transform_seqbase_shuffle(seqbase, seq, t->scene); + if (SEQ_transform_test_overlap(t->scene, seqbase, strip)) { + SEQ_transform_seqbase_shuffle(seqbase, strip, t->scene); } } } @@ -288,8 +288,8 @@ static ListBase *seqbase_active_get(const TransInfo *t) bool seq_transform_check_overlap(blender::Span transformed_strips) { - for (Strip *seq : transformed_strips) { - if (seq->flag & SEQ_OVERLAP) { + for (Strip *strip : transformed_strips) { + if (strip->flag & SEQ_OVERLAP) { return true; } } @@ -301,8 +301,8 @@ static blender::VectorSet seq_transform_collection_from_transdata(Trans blender::VectorSet strips; TransData *td = tc->data; for (int a = 0; a < tc->data_len; a++, td++) { - Strip *seq = ((TransDataSeq *)td->extra)->seq; - strips.add(seq); + Strip *strip = ((TransDataSeq *)td->extra)->strip; + strips.add(strip); } return strips; } @@ -319,8 +319,8 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c SEQ_iterator_set_expand( t->scene, seqbase_active_get(t), transformed_strips, SEQ_query_strip_effect_chain); - for (Strip *seq : transformed_strips) { - seq->flag &= ~SEQ_IGNORE_CHANNEL_LOCK; + for (Strip *strip : transformed_strips) { + strip->flag &= ~SEQ_IGNORE_CHANNEL_LOCK; } if (t->state == TRANS_CANCEL) { @@ -346,9 +346,9 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c static blender::VectorSet query_selected_strips_no_handles(ListBase *seqbase) { blender::VectorSet strips; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if ((seq->flag & SELECT) != 0 && ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) { - strips.add(seq); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if ((strip->flag & SELECT) != 0 && ((strip->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) { + strips.add(strip); } } return strips; @@ -374,10 +374,10 @@ static Strip *effect_input_get(const Scene *scene, Strip *effect, SeqInputSide s static Strip *effect_base_input_get(const Scene *scene, Strip *effect, SeqInputSide side) { - Strip *input = effect, *seq_iter = effect; - while (seq_iter != nullptr) { - input = seq_iter; - seq_iter = effect_input_get(scene, seq_iter, side); + Strip *input = effect, *strip_iter = effect; + while (strip_iter != nullptr) { + input = strip_iter; + strip_iter = effect_input_get(scene, strip_iter, side); } return input; } @@ -404,18 +404,18 @@ static void query_time_dependent_strips_strips(TransInfo *t, while (strip_added) { strip_added = false; - for (Strip *seq : strips_no_handles) { - if (time_dependent_strips.contains(seq)) { + for (Strip *strip : strips_no_handles) { + if (time_dependent_strips.contains(strip)) { continue; /* Strip is already in collection, skip it. */ } /* If both seq1 and seq2 exist, both must be selected. */ - if (seq->seq1 && time_dependent_strips.contains(seq->seq1)) { - if (seq->seq2 && !time_dependent_strips.contains(seq->seq2)) { + if (strip->seq1 && time_dependent_strips.contains(strip->seq1)) { + if (strip->seq2 && !time_dependent_strips.contains(strip->seq2)) { continue; } strip_added = true; - time_dependent_strips.add(seq); + time_dependent_strips.add(strip); } } } @@ -426,24 +426,24 @@ static void query_time_dependent_strips_strips(TransInfo *t, blender::VectorSet selected_strips = SEQ_query_selected_strips(seqbase); SEQ_iterator_set_expand(t->scene, seqbase, selected_strips, SEQ_query_strip_effect_chain); - for (Strip *seq : selected_strips) { + for (Strip *strip : selected_strips) { /* Check only 2 input effects. */ - if (seq->seq1 == nullptr || seq->seq2 == nullptr) { + if (strip->seq1 == nullptr || strip->seq2 == nullptr) { continue; } /* Find immediate base inputs(left and right side). */ - Strip *input_left = effect_base_input_get(t->scene, seq, SEQ_INPUT_LEFT); - Strip *input_right = effect_base_input_get(t->scene, seq, SEQ_INPUT_RIGHT); + Strip *input_left = effect_base_input_get(t->scene, strip, SEQ_INPUT_LEFT); + Strip *input_right = effect_base_input_get(t->scene, strip, SEQ_INPUT_RIGHT); if ((input_left->flag & SEQ_RIGHTSEL) != 0 && (input_right->flag & SEQ_LEFTSEL) != 0) { - time_dependent_strips.add(seq); + time_dependent_strips.add(strip); } } /* Remove all non-effects. */ time_dependent_strips.remove_if( - [&](Strip *seq) { return SEQ_transform_sequence_can_be_translated(seq); }); + [&](Strip *strip) { return SEQ_transform_sequence_can_be_translated(strip); }); } static void createTransSeqData(bContext * /*C*/, TransInfo *t) @@ -494,12 +494,12 @@ static void createTransSeqData(bContext * /*C*/, TransInfo *t) /* Custom data to enable edge panning during transformation. */ UI_view2d_edge_pan_init(t->context, &ts->edge_pan, - SEQ_EDGE_PAN_INSIDE_PAD, - SEQ_EDGE_PAN_OUTSIDE_PAD, - SEQ_EDGE_PAN_SPEED_RAMP, - SEQ_EDGE_PAN_MAX_SPEED, - SEQ_EDGE_PAN_DELAY, - SEQ_EDGE_PAN_ZOOM_INFLUENCE); + STRIP_EDGE_PAN_INSIDE_PAD, + STRIP_EDGE_PAN_OUTSIDE_PAD, + STRIP_EDGE_PAN_SPEED_RAMP, + STRIP_EDGE_PAN_MAX_SPEED, + STRIP_EDGE_PAN_DELAY, + STRIP_EDGE_PAN_ZOOM_INFLUENCE); UI_view2d_edge_pan_set_limits(&ts->edge_pan, -FLT_MAX, FLT_MAX, 1, SEQ_MAX_CHANNELS + 1); ts->initial_v2d_cur = t->region->v2d.cur; @@ -507,10 +507,10 @@ static void createTransSeqData(bContext * /*C*/, TransInfo *t) SeqToTransData_build(t, ed->seqbasep, td, td2d, tdsq); ts->selection_channel_range_min = SEQ_MAX_CHANNELS + 1; - LISTBASE_FOREACH (Strip *, seq, SEQ_active_seqbase_get(ed)) { - if ((seq->flag & SELECT) != 0) { - ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, seq->machine); - ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, seq->machine); + LISTBASE_FOREACH (Strip *, strip, SEQ_active_seqbase_get(ed)) { + if ((strip->flag & SELECT) != 0) { + ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, strip->machine); + ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, strip->machine); } } @@ -562,7 +562,7 @@ static void flushTransSeq(TransInfo *t) TransData *td = nullptr; TransData2D *td2d = nullptr; TransDataSeq *tdsq = nullptr; - Strip *seq; + Strip *strip; Scene *scene = t->scene; @@ -583,21 +583,21 @@ static void flushTransSeq(TransInfo *t) /* Flush to 2D vector from internally used 3D vector. */ for (a = 0, td = tc->data, td2d = tc->data_2d; a < tc->data_len; a++, td++, td2d++) { tdsq = (TransDataSeq *)td->extra; - seq = tdsq->seq; + strip = tdsq->strip; new_frame = round_fl_to_int(td->loc[0] + edge_pan_offset[0]); switch (tdsq->sel_flag) { case SELECT: { - if (SEQ_transform_sequence_can_be_translated(seq)) { - offset = new_frame - tdsq->start_offset - seq->start; - SEQ_transform_translate_sequence(scene, seq, offset); + if (SEQ_transform_sequence_can_be_translated(strip)) { + offset = new_frame - tdsq->start_offset - strip->start; + SEQ_transform_translate_sequence(scene, strip, offset); if (abs(offset) > abs(max_offset)) { max_offset = offset; } } - seq->machine = round_fl_to_int(td->loc[1] + edge_pan_offset[1]); - CLAMP(seq->machine, 1, SEQ_MAX_CHANNELS); + strip->machine = round_fl_to_int(td->loc[1] + edge_pan_offset[1]); + CLAMP(strip->machine, 1, SEQ_MAX_CHANNELS); break; } case SEQ_LEFTSEL: { /* No vertical transform. */ @@ -605,25 +605,25 @@ static void flushTransSeq(TransInfo *t) * the old one to avoid unexpected left handle clamping when canceling. See #126191. */ bool both_handles_selected = (tdsq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL); - if (both_handles_selected && new_frame > SEQ_time_left_handle_frame_get(scene, seq)) { + if (both_handles_selected && new_frame > SEQ_time_left_handle_frame_get(scene, strip)) { a++, td++, td2d++; int new_right_frame = round_fl_to_int(td->loc[0] + edge_pan_offset[0]); - SEQ_time_right_handle_frame_set(scene, seq, new_right_frame); + SEQ_time_right_handle_frame_set(scene, strip, new_right_frame); } - int old_startdisp = SEQ_time_left_handle_frame_get(scene, seq); - SEQ_time_left_handle_frame_set(t->scene, seq, new_frame); + int old_startdisp = SEQ_time_left_handle_frame_get(scene, strip); + SEQ_time_left_handle_frame_set(t->scene, strip, new_frame); - if (abs(SEQ_time_left_handle_frame_get(scene, seq) - old_startdisp) > abs(max_offset)) { - max_offset = SEQ_time_left_handle_frame_get(scene, seq) - old_startdisp; + if (abs(SEQ_time_left_handle_frame_get(scene, strip) - old_startdisp) > abs(max_offset)) { + max_offset = SEQ_time_left_handle_frame_get(scene, strip) - old_startdisp; } break; } case SEQ_RIGHTSEL: { /* No vertical transform. */ - int old_enddisp = SEQ_time_right_handle_frame_get(scene, seq); - SEQ_time_right_handle_frame_set(t->scene, seq, new_frame); + int old_enddisp = SEQ_time_right_handle_frame_get(scene, strip); + SEQ_time_right_handle_frame_set(t->scene, strip, new_frame); - if (abs(SEQ_time_right_handle_frame_get(scene, seq) - old_enddisp) > abs(max_offset)) { - max_offset = SEQ_time_right_handle_frame_get(scene, seq) - old_enddisp; + if (abs(SEQ_time_right_handle_frame_get(scene, strip) - old_enddisp) > abs(max_offset)) { + max_offset = SEQ_time_right_handle_frame_get(scene, strip) - old_enddisp; } break; } @@ -633,8 +633,8 @@ static void flushTransSeq(TransInfo *t) TransSeq *ts = (TransSeq *)TRANS_DATA_CONTAINER_FIRST_SINGLE(t)->custom.type.data; /* Update animation for effects. */ - for (Strip *seq : ts->time_dependent_strips) { - SEQ_offset_animdata(t->scene, seq, max_offset); + for (Strip *strip : ts->time_dependent_strips) { + SEQ_offset_animdata(t->scene, strip, max_offset); } /* Need to do the overlap check in a new loop otherwise adjacent strips @@ -643,11 +643,11 @@ static void flushTransSeq(TransInfo *t) SEQ_iterator_set_expand( t->scene, seqbase_active_get(t), transformed_strips, SEQ_query_strip_effect_chain); - for (Strip *seq : transformed_strips) { + for (Strip *strip : transformed_strips) { /* Test overlap, displays red outline. */ - seq->flag &= ~SEQ_OVERLAP; - if (SEQ_transform_test_overlap(scene, seqbasep, seq)) { - seq->flag |= SEQ_OVERLAP; + strip->flag &= ~SEQ_OVERLAP; + if (SEQ_transform_test_overlap(scene, seqbasep, strip)) { + strip->flag |= SEQ_OVERLAP; } } } @@ -656,19 +656,19 @@ static void recalcData_sequencer(TransInfo *t) { TransData *td; int a; - Strip *seq_prev = nullptr; + Strip *strip_prev = nullptr; TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); for (a = 0, td = tc->data; a < tc->data_len; a++, td++) { TransDataSeq *tdsq = (TransDataSeq *)td->extra; - Strip *seq = tdsq->seq; + Strip *strip = tdsq->strip; - if (seq != seq_prev) { - SEQ_relations_invalidate_cache_composite(t->scene, seq); + if (strip != strip_prev) { + SEQ_relations_invalidate_cache_composite(t->scene, strip); } - seq_prev = seq; + strip_prev = strip; } DEG_id_tag_update(&t->scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -690,8 +690,8 @@ static void special_aftertrans_update__sequencer(bContext * /*C*/, TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); blender::VectorSet strips = seq_transform_collection_from_transdata(tc); - for (Strip *seq : strips) { - seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); + for (Strip *strip : strips) { + strip->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); } } diff --git a/source/blender/editors/transform/transform_convert_sequencer_image.cc b/source/blender/editors/transform/transform_convert_sequencer_image.cc index d3cea63b1ac0..a837a186805a 100644 --- a/source/blender/editors/transform/transform_convert_sequencer_image.cc +++ b/source/blender/editors/transform/transform_convert_sequencer_image.cc @@ -33,7 +33,7 @@ /** Used for sequencer transform. */ struct TransDataSeq { - Strip *seq; + Strip *strip; float orig_origin_position[2]; float orig_translation[2]; float orig_scale[2]; @@ -41,15 +41,15 @@ struct TransDataSeq { }; static TransData *SeqToTransData(const Scene *scene, - Strip *seq, + Strip *strip, TransData *td, TransData2D *td2d, TransDataSeq *tdseq, int vert_index) { - const StripTransform *transform = seq->data->transform; + const StripTransform *transform = strip->data->transform; float origin[2]; - SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, origin); + SEQ_image_transform_origin_offset_pixelspace_get(scene, strip, origin); float vertex[2] = {origin[0], origin[1]}; /* Add control vertex, so rotation and scale can be calculated. @@ -79,7 +79,7 @@ static TransData *SeqToTransData(const Scene *scene, axis_angle_to_mat3_single(td->axismtx, 'Z', transform->rotation); normalize_m3(td->axismtx); - tdseq->seq = seq; + tdseq->strip = strip; copy_v2_v2(tdseq->orig_origin_position, origin); tdseq->orig_translation[0] = transform->xofs; tdseq->orig_translation[1] = transform->yofs; @@ -123,7 +123,7 @@ static void createTransSeqImageData(bContext * /*C*/, TransInfo *t) ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( t->scene, channels, seqbase, t->scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); if (strips.is_empty()) { return; @@ -140,13 +140,13 @@ static void createTransSeqImageData(bContext * /*C*/, TransInfo *t) TransDataSeq *tdseq = static_cast( MEM_callocN(tc->data_len * sizeof(TransDataSeq), "TransSeq TransDataSeq")); - for (Strip *seq : strips) { + for (Strip *strip : strips) { /* One `Sequence` needs 3 `TransData` entries - center point placed in image origin, then 2 * points offset by 1 in X and Y direction respectively, so rotation and scale can be * calculated from these points. */ - SeqToTransData(t->scene, seq, td++, td2d++, tdseq++, 0); - SeqToTransData(t->scene, seq, td++, td2d++, tdseq++, 1); - SeqToTransData(t->scene, seq, td++, td2d++, tdseq++, 2); + SeqToTransData(t->scene, strip, td++, td2d++, tdseq++, 0); + SeqToTransData(t->scene, strip, td++, td2d++, tdseq++, 1); + SeqToTransData(t->scene, strip, td++, td2d++, tdseq++, 2); } } @@ -220,10 +220,10 @@ static void recalcData_sequencer_image(TransInfo *t) sub_v2_v2(handle_y, origin); TransDataSeq *tdseq = static_cast(td->extra); - Strip *seq = tdseq->seq; - StripTransform *transform = seq->data->transform; + Strip *strip = tdseq->strip; + StripTransform *transform = strip->data->transform; float mirror[2]; - SEQ_image_transform_mirror_factor_get(seq, mirror); + SEQ_image_transform_mirror_factor_get(strip, mirror); /* Calculate translation. */ float translation[2]; @@ -254,7 +254,7 @@ static void recalcData_sequencer_image(TransInfo *t) autokeyframe_sequencer_image(t->context, t->scene, transform, t->mode); } - SEQ_relations_invalidate_cache_preprocessed(t->scene, seq); + SEQ_relations_invalidate_cache_preprocessed(t->scene, strip); } } @@ -268,8 +268,8 @@ static void special_aftertrans_update__sequencer_image(bContext * /*C*/, TransIn for (i = 0, td = tc->data, td2d = tc->data_2d; i < tc->data_len; i++, td++, td2d++) { TransDataSeq *tdseq = static_cast(td->extra); - Strip *seq = tdseq->seq; - StripTransform *transform = seq->data->transform; + Strip *strip = tdseq->strip; + StripTransform *transform = strip->data->transform; if (t->state == TRANS_CANCEL) { if (t->mode == TFM_ROTATION) { transform->rotation = tdseq->orig_rotation; diff --git a/source/blender/editors/transform/transform_convert_sequencer_retiming.cc b/source/blender/editors/transform/transform_convert_sequencer_retiming.cc index 42966e7d4c09..9e3aa8a36832 100644 --- a/source/blender/editors/transform/transform_convert_sequencer_retiming.cc +++ b/source/blender/editors/transform/transform_convert_sequencer_retiming.cc @@ -28,20 +28,20 @@ /** Used for sequencer transform. */ typedef struct TransDataSeq { - Strip *seq; + Strip *strip; int orig_timeline_frame; int key_index; /* Some actions may need to destroy original data, use index to access it. */ } TransDataSeq; static TransData *SeqToTransData(const Scene *scene, - Strip *seq, + Strip *strip, const SeqRetimingKey *key, TransData *td, TransData2D *td2d, TransDataSeq *tdseq) { - td2d->loc[0] = SEQ_retiming_key_timeline_frame_get(scene, seq, key); + td2d->loc[0] = SEQ_retiming_key_timeline_frame_get(scene, strip, key); td2d->loc[1] = key->retiming_factor; td2d->loc2d = nullptr; td->loc = td2d->loc; @@ -52,9 +52,9 @@ static TransData *SeqToTransData(const Scene *scene, unit_m3(td->mtx); unit_m3(td->smtx); - tdseq->seq = seq; - tdseq->orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key); - tdseq->key_index = SEQ_retiming_key_index_get(seq, key); + tdseq->strip = strip; + tdseq->orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key); + tdseq->key_index = SEQ_retiming_key_index_get(strip, key); td->extra = static_cast(tdseq); td->ext = nullptr; @@ -74,8 +74,8 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData * blender::VectorSet transformed_strips; for (int i = 0; i < tc->data_len; i++) { - Strip *seq = ((TransDataSeq *)(td + i)->extra)->seq; - transformed_strips.add(seq); + Strip *strip = ((TransDataSeq *)(td + i)->extra)->strip; + transformed_strips.add(strip); } ListBase *seqbasep = SEQ_active_seqbase_get(ed); @@ -83,7 +83,8 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData * blender::VectorSet dependant; dependant.add_multiple(transformed_strips); - dependant.remove_if([&](Strip *seq) { return SEQ_transform_sequence_can_be_translated(seq); }); + dependant.remove_if( + [&](Strip *strip) { return SEQ_transform_sequence_can_be_translated(strip); }); if (seq_transform_check_overlap(transformed_strips)) { const bool use_sync_markers = (((SpaceSeq *)t->area->spacedata.first)->flag & @@ -133,35 +134,35 @@ static void recalcData_sequencer_retiming(TransInfo *t) for (i = 0, td = tc->data, td2d = tc->data_2d; i < tc->data_len; i++, td++, td2d++) { const TransDataSeq *tdseq = static_cast(td->extra); - Strip *seq = tdseq->seq; + Strip *strip = tdseq->strip; - transformed_strips.add(seq); + transformed_strips.add(strip); /* Calculate translation. */ - const blender::MutableSpan keys = SEQ_retiming_keys_get(seq); + const blender::MutableSpan keys = SEQ_retiming_keys_get(strip); SeqRetimingKey *key = &keys[tdseq->key_index]; if (SEQ_retiming_key_is_transition_type(key) && !SEQ_retiming_selection_has_whole_transition(SEQ_editing_get(t->scene), key)) { - SEQ_retiming_transition_key_frame_set(t->scene, seq, key, round_fl_to_int(td2d->loc[0])); + SEQ_retiming_transition_key_frame_set(t->scene, strip, key, round_fl_to_int(td2d->loc[0])); } else { - SEQ_retiming_key_timeline_frame_set(t->scene, seq, key, td2d->loc[0]); + SEQ_retiming_key_timeline_frame_set(t->scene, strip, key, td2d->loc[0]); } - SEQ_relations_invalidate_cache_preprocessed(t->scene, seq); + SEQ_relations_invalidate_cache_preprocessed(t->scene, strip); } /* Test overlap, displays red outline. */ Editing *ed = SEQ_editing_get(t->scene); SEQ_iterator_set_expand( t->scene, SEQ_active_seqbase_get(ed), transformed_strips, SEQ_query_strip_effect_chain); - for (Strip *seq : transformed_strips) { - seq->flag &= ~SEQ_OVERLAP; - if (SEQ_transform_test_overlap(t->scene, SEQ_active_seqbase_get(ed), seq)) { - seq->flag |= SEQ_OVERLAP; + for (Strip *strip : transformed_strips) { + strip->flag &= ~SEQ_OVERLAP; + if (SEQ_transform_test_overlap(t->scene, SEQ_active_seqbase_get(ed), strip)) { + strip->flag |= SEQ_OVERLAP; } } } diff --git a/source/blender/editors/transform/transform_draw_cursors.hh b/source/blender/editors/transform/transform_draw_cursors.hh index 6c2c3b5f99f4..0e510e1ce41e 100644 --- a/source/blender/editors/transform/transform_draw_cursors.hh +++ b/source/blender/editors/transform/transform_draw_cursors.hh @@ -8,6 +8,8 @@ #pragma once +struct bContext; + /* Callbacks for #WM_paint_cursor_activate. */ /** diff --git a/source/blender/editors/transform/transform_gizmo_2d.cc b/source/blender/editors/transform/transform_gizmo_2d.cc index 788fe238414e..b859d96009b5 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.cc +++ b/source/blender/editors/transform/transform_gizmo_2d.cc @@ -251,7 +251,7 @@ static bool gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); int selected_strips = strips.size(); if (selected_strips > 0) { has_select = true; @@ -303,7 +303,7 @@ static int gizmo2d_calc_transform_orientation(const bContext *C) ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); bool use_local_orient = strips.size() == 1; @@ -326,14 +326,14 @@ static float gizmo2d_calc_rotation(const bContext *C) ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); if (strips.size() == 1) { /* Only return the strip rotation if only one is selected. */ - for (Strip *seq : strips) { - StripTransform *transform = seq->data->transform; + for (Strip *strip : strips) { + StripTransform *transform = strip->data->transform; float mirror[2]; - SEQ_image_transform_mirror_factor_get(seq, mirror); + SEQ_image_transform_mirror_factor_get(strip, mirror); return transform->rotation * mirror[0] * mirror[1]; } } @@ -350,13 +350,13 @@ static bool seq_get_strip_pivot_median(const Scene *scene, float r_pivot[2]) ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); bool has_select = !strips.is_empty(); if (has_select) { - for (Strip *seq : strips) { + for (Strip *strip : strips) { float origin[2]; - SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, origin); + SEQ_image_transform_origin_offset_pixelspace_get(scene, strip, origin); add_v2_v2(r_pivot, origin); } mul_v2_fl(r_pivot, 1.0f / strips.size()); @@ -388,7 +388,7 @@ static bool gizmo2d_calc_transform_pivot(const bContext *C, float r_pivot[2]) ListBase *channels = SEQ_channels_displayed_get(ed); blender::VectorSet strips = SEQ_query_rendered_strips( scene, channels, seqbase, scene->r.cfra, 0); - strips.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + strips.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); has_select = !strips.is_empty(); } else if (pivot_point == V3D_AROUND_CENTER_BOUNDS) { diff --git a/source/blender/editors/transform/transform_input.cc b/source/blender/editors/transform/transform_input.cc index 0aa0d91c459f..40029cd9f288 100644 --- a/source/blender/editors/transform/transform_input.cc +++ b/source/blender/editors/transform/transform_input.cc @@ -295,12 +295,12 @@ static void calcSpringFactor(MouseInput *mi) } } -static int transform_seq_slide_strip_cursor_get(const Strip *seq) +static int transform_seq_slide_strip_cursor_get(const Strip *strip) { - if ((seq->flag & SEQ_LEFTSEL) != 0) { + if ((strip->flag & SEQ_LEFTSEL) != 0) { return WM_CURSOR_LEFT_HANDLE; } - if ((seq->flag & SEQ_RIGHTSEL) != 0) { + if ((strip->flag & SEQ_RIGHTSEL) != 0) { return WM_CURSOR_RIGHT_HANDLE; } return WM_CURSOR_NSEW_SCROLL; diff --git a/source/blender/editors/transform/transform_mode.cc b/source/blender/editors/transform/transform_mode.cc index 300b9d4a0c7b..fbd7cb7c441b 100644 --- a/source/blender/editors/transform/transform_mode.cc +++ b/source/blender/editors/transform/transform_mode.cc @@ -540,7 +540,7 @@ void headerRotation(TransInfo *t, char *str, const int str_size, float final) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); ofs += BLI_snprintf_rlen( str + ofs, str_size - ofs, IFACE_("Rotation: %s %s %s"), &c[0], t->con.text, t->proptext); @@ -841,7 +841,7 @@ void headerResize(TransInfo *t, const float vec[3], char *str, const int str_siz char tvec[NUM_STR_REP_LEN * 3]; size_t ofs = 0; if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]); diff --git a/source/blender/editors/transform/transform_mode.hh b/source/blender/editors/transform/transform_mode.hh index 69b68dc047d5..b159d812b050 100644 --- a/source/blender/editors/transform/transform_mode.hh +++ b/source/blender/editors/transform/transform_mode.hh @@ -9,6 +9,10 @@ #pragma once +#include "ED_transform.hh" + +#include "transform.hh" + struct BMVert; struct LinkNode; struct TransData; diff --git a/source/blender/editors/transform/transform_mode_baketime.cc b/source/blender/editors/transform/transform_mode_baketime.cc index 72d58b58362e..44c513fdf107 100644 --- a/source/blender/editors/transform/transform_mode_baketime.cc +++ b/source/blender/editors/transform/transform_mode_baketime.cc @@ -59,7 +59,7 @@ static void applyBakeTime(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); if (time >= 0.0f) { SNPRINTF(str, IFACE_("Time: +%s %s"), c, t->proptext); diff --git a/source/blender/editors/transform/transform_mode_bbone_resize.cc b/source/blender/editors/transform/transform_mode_bbone_resize.cc index 2eac2750c5bc..9ad0bbce7a67 100644 --- a/source/blender/editors/transform/transform_mode_bbone_resize.cc +++ b/source/blender/editors/transform/transform_mode_bbone_resize.cc @@ -35,7 +35,7 @@ static void headerBoneSize(TransInfo *t, const float vec[3], char str[UI_MAX_DRA { char tvec[NUM_STR_REP_LEN * 3]; if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]); diff --git a/source/blender/editors/transform/transform_mode_bend.cc b/source/blender/editors/transform/transform_mode_bend.cc index 10fa783cd5f8..923ceb0270d7 100644 --- a/source/blender/editors/transform/transform_mode_bend.cc +++ b/source/blender/editors/transform/transform_mode_bend.cc @@ -225,7 +225,7 @@ static void Bend(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN * 2]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Bend Angle: %s, Radius: %s, Alt: Clamp %s"), diff --git a/source/blender/editors/transform/transform_mode_boneenvelope.cc b/source/blender/editors/transform/transform_mode_boneenvelope.cc index 02ed24540d7c..0b245cb79118 100644 --- a/source/blender/editors/transform/transform_mode_boneenvelope.cc +++ b/source/blender/editors/transform/transform_mode_boneenvelope.cc @@ -47,7 +47,7 @@ static void applyBoneEnvelope(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Envelope: %s"), c); } else { diff --git a/source/blender/editors/transform/transform_mode_boneroll.cc b/source/blender/editors/transform/transform_mode_boneroll.cc index 554c80a42e61..10787650af3d 100644 --- a/source/blender/editors/transform/transform_mode_boneroll.cc +++ b/source/blender/editors/transform/transform_mode_boneroll.cc @@ -48,7 +48,7 @@ static void applyBoneRoll(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Roll: %s"), &c[0]); } diff --git a/source/blender/editors/transform/transform_mode_curveshrinkfatten.cc b/source/blender/editors/transform/transform_mode_curveshrinkfatten.cc index 65e88ee5d8b3..7cda07aef97c 100644 --- a/source/blender/editors/transform/transform_mode_curveshrinkfatten.cc +++ b/source/blender/editors/transform/transform_mode_curveshrinkfatten.cc @@ -48,7 +48,7 @@ static void applyCurveShrinkFatten(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Shrink/Fatten: %s"), c); } else { diff --git a/source/blender/editors/transform/transform_mode_customdata.cc b/source/blender/editors/transform/transform_mode_customdata.cc index 2757e46a703e..f339a179c874 100644 --- a/source/blender/editors/transform/transform_mode_customdata.cc +++ b/source/blender/editors/transform/transform_mode_customdata.cc @@ -90,7 +90,7 @@ static void apply_value_impl(TransInfo *t, const char *value_name) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); if (value >= 0.0f) { SNPRINTF(str, "%s: +%s %s", value_name, c, t->proptext); diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.cc b/source/blender/editors/transform/transform_mode_edge_seq_slide.cc index 8beb093024c9..21b9415d0fd1 100644 --- a/source/blender/editors/transform/transform_mode_edge_seq_slide.cc +++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.cc @@ -43,7 +43,7 @@ static void headerSeqSlide(TransInfo *t, const float val[2], char str[UI_MAX_DRA size_t ofs = 0; if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.0f, %.0f", val[0], val[1]); diff --git a/source/blender/editors/transform/transform_mode_edge_slide.cc b/source/blender/editors/transform/transform_mode_edge_slide.cc index af0dac6c00bc..544e37208f2c 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.cc +++ b/source/blender/editors/transform/transform_mode_edge_slide.cc @@ -793,7 +793,7 @@ static void applyEdgeSlide(TransInfo *t) ofs += BLI_strncpy_rlen(str + ofs, RPT_("Edge Slide: "), sizeof(str) - ofs); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); ofs += BLI_strncpy_rlen(str + ofs, &c[0], sizeof(str) - ofs); } else { diff --git a/source/blender/editors/transform/transform_mode_gpopacity.cc b/source/blender/editors/transform/transform_mode_gpopacity.cc index 2c3c8559422d..a3eb4dce164e 100644 --- a/source/blender/editors/transform/transform_mode_gpopacity.cc +++ b/source/blender/editors/transform/transform_mode_gpopacity.cc @@ -49,7 +49,7 @@ static void applyGPOpacity(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Opacity: %s"), c); } else { diff --git a/source/blender/editors/transform/transform_mode_maskshrinkfatten.cc b/source/blender/editors/transform/transform_mode_maskshrinkfatten.cc index 616bfb5d7654..9790bbf2f665 100644 --- a/source/blender/editors/transform/transform_mode_maskshrinkfatten.cc +++ b/source/blender/editors/transform/transform_mode_maskshrinkfatten.cc @@ -48,7 +48,7 @@ static void applyMaskShrinkFatten(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Feather Shrink/Fatten: %s"), c); } else { diff --git a/source/blender/editors/transform/transform_mode_push_pull.cc b/source/blender/editors/transform/transform_mode_push_pull.cc index b4ee87c5fd22..e4e635a84b63 100644 --- a/source/blender/editors/transform/transform_mode_push_pull.cc +++ b/source/blender/editors/transform/transform_mode_push_pull.cc @@ -121,7 +121,7 @@ static void applyPushPull(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext); } diff --git a/source/blender/editors/transform/transform_mode_shear.cc b/source/blender/editors/transform/transform_mode_shear.cc index 16e0506abb6d..034ad438abf1 100644 --- a/source/blender/editors/transform/transform_mode_shear.cc +++ b/source/blender/editors/transform/transform_mode_shear.cc @@ -304,7 +304,7 @@ static void apply_shear(TransInfo *t) /* Header print for NumInput. */ if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("Shear: %s %s"), c, t->proptext); } else { diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.cc b/source/blender/editors/transform/transform_mode_shrink_fatten.cc index bfc5d326fc4e..af33d9a0643e 100644 --- a/source/blender/editors/transform/transform_mode_shrink_fatten.cc +++ b/source/blender/editors/transform/transform_mode_shrink_fatten.cc @@ -95,7 +95,7 @@ static void applyShrinkFatten(TransInfo *t) float distance; int i; fmt::memory_buffer str; - UnitSettings *unit = &t->scene->unit; + const UnitSettings &unit = t->scene->unit; distance = t->values[0] + t->values_modal_offset[0]; @@ -114,10 +114,10 @@ static void applyShrinkFatten(TransInfo *t) } else { /* Default header print. */ - if (unit != nullptr) { + if (unit.system != USER_UNIT_NONE) { char unit_str[64]; - BKE_unit_value_as_string( - unit_str, sizeof(unit_str), distance * unit->scale_length, 4, B_UNIT_LENGTH, unit, true); + BKE_unit_value_as_string_scaled( + unit_str, sizeof(unit_str), distance, 4, B_UNIT_LENGTH, unit, true); fmt::format_to(fmt::appender(str), "{}", unit_str); } else { diff --git a/source/blender/editors/transform/transform_mode_tilt.cc b/source/blender/editors/transform/transform_mode_tilt.cc index 6002108056f6..37ef84592850 100644 --- a/source/blender/editors/transform/transform_mode_tilt.cc +++ b/source/blender/editors/transform/transform_mode_tilt.cc @@ -48,7 +48,7 @@ static void applyTilt(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, "%s %s" BLI_STR_UTF8_DEGREE_SIGN " %s", IFACE_("Tilt:"), &c[0], t->proptext); diff --git a/source/blender/editors/transform/transform_mode_timescale.cc b/source/blender/editors/transform/transform_mode_timescale.cc index e63f13640afa..4d740500aec5 100644 --- a/source/blender/editors/transform/transform_mode_timescale.cc +++ b/source/blender/editors/transform/transform_mode_timescale.cc @@ -44,7 +44,7 @@ static void headerTimeScale(TransInfo *t, char str[UI_MAX_DRAW_STR]) char tvec[NUM_STR_REP_LEN * 3]; if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values_final[0]); diff --git a/source/blender/editors/transform/transform_mode_timeslide.cc b/source/blender/editors/transform/transform_mode_timeslide.cc index e61417aa5565..47300934d975 100644 --- a/source/blender/editors/transform/transform_mode_timeslide.cc +++ b/source/blender/editors/transform/transform_mode_timeslide.cc @@ -38,7 +38,7 @@ static void headerTimeSlide(TransInfo *t, const float sval, char str[UI_MAX_DRAW char tvec[NUM_STR_REP_LEN * 3]; if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { const float *range = static_cast(t->custom.mode.data); diff --git a/source/blender/editors/transform/transform_mode_timetranslate.cc b/source/blender/editors/transform/transform_mode_timetranslate.cc index 2820922237a3..9e490d217ef8 100644 --- a/source/blender/editors/transform/transform_mode_timetranslate.cc +++ b/source/blender/editors/transform/transform_mode_timetranslate.cc @@ -37,7 +37,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR]) /* If numeric input is active, use results from that, otherwise apply snapping to result. */ if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), tvec, t->scene->unit); } else { eSnapMode snap_mode = t->tsnap.mode; diff --git a/source/blender/editors/transform/transform_mode_tosphere.cc b/source/blender/editors/transform/transform_mode_tosphere.cc index a104d4e4998e..b57dad2d2c4a 100644 --- a/source/blender/editors/transform/transform_mode_tosphere.cc +++ b/source/blender/editors/transform/transform_mode_tosphere.cc @@ -193,7 +193,7 @@ static void applyToSphere(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); SNPRINTF(str, IFACE_("To Sphere: %s %s"), c, t->proptext); } diff --git a/source/blender/editors/transform/transform_mode_trackball.cc b/source/blender/editors/transform/transform_mode_trackball.cc index 7550b2e5e380..491d639a8db3 100644 --- a/source/blender/editors/transform/transform_mode_trackball.cc +++ b/source/blender/editors/transform/transform_mode_trackball.cc @@ -140,7 +140,7 @@ static void applyTrackball(TransInfo *t) if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN * 2]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); ofs += BLI_snprintf_rlen(str + ofs, sizeof(str) - ofs, diff --git a/source/blender/editors/transform/transform_mode_translate.cc b/source/blender/editors/transform/transform_mode_translate.cc index d7829a8b20f3..f5e90fcfadbf 100644 --- a/source/blender/editors/transform/transform_mode_translate.cc +++ b/source/blender/editors/transform/transform_mode_translate.cc @@ -187,9 +187,8 @@ static void translate_dist_to_str(char *r_str, const float val, const UnitSettings *unit) { - if (unit) { - BKE_unit_value_as_string( - r_str, r_str_maxncpy, val * unit->scale_length, 4, B_UNIT_LENGTH, unit, false); + if (unit && (unit->system != USER_UNIT_NONE)) { + BKE_unit_value_as_string_scaled(r_str, r_str_maxncpy, val, 4, B_UNIT_LENGTH, *unit, false); } else { /* Check range to prevent string buffer overflow. */ @@ -210,7 +209,7 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_ } if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), dvec_str[0], &t->scene->unit); + outputNumInput(&(t->num), dvec_str[0], t->scene->unit); dist = len_v3(t->num.val); } else { diff --git a/source/blender/editors/transform/transform_mode_vert_slide.cc b/source/blender/editors/transform/transform_mode_vert_slide.cc index 8ea60def06fb..a4c2db332897 100644 --- a/source/blender/editors/transform/transform_mode_vert_slide.cc +++ b/source/blender/editors/transform/transform_mode_vert_slide.cc @@ -507,7 +507,7 @@ static void applyVertSlide(TransInfo *t) ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Vertex Slide: "), sizeof(str) - ofs); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c, &t->scene->unit); + outputNumInput(&(t->num), c, t->scene->unit); ofs += BLI_strncpy_rlen(str + ofs, &c[0], sizeof(str) - ofs); } else { diff --git a/source/blender/editors/transform/transform_orientations.cc b/source/blender/editors/transform/transform_orientations.cc index 153d47f14f06..85b097f8283d 100644 --- a/source/blender/editors/transform/transform_orientations.cc +++ b/source/blender/editors/transform/transform_orientations.cc @@ -735,9 +735,9 @@ short transform_orientation_matrix_get(bContext *C, if (t->spacetype == SPACE_SEQ && t->options & CTX_SEQUENCER_IMAGE) { Scene *scene = t->scene; - Strip *seq = SEQ_select_active_get(scene); - if (seq && seq->data->transform && orient_index == V3D_ORIENT_LOCAL) { - axis_angle_to_mat3_single(r_spacemtx, 'Z', seq->data->transform->rotation); + Strip *strip = SEQ_select_active_get(scene); + if (strip && strip->data->transform && orient_index == V3D_ORIENT_LOCAL) { + axis_angle_to_mat3_single(r_spacemtx, 'Z', strip->data->transform->rotation); return orient_index; } } diff --git a/source/blender/editors/transform/transform_snap.hh b/source/blender/editors/transform/transform_snap.hh index 629ae6aa22fc..c1e424f42c67 100644 --- a/source/blender/editors/transform/transform_snap.hh +++ b/source/blender/editors/transform/transform_snap.hh @@ -14,6 +14,8 @@ #include "DNA_scene_types.h" #include "DNA_space_types.h" +#include "transform.hh" + bool peelObjectsTransform(TransInfo *t, const float mval[2], bool use_peel_object, diff --git a/source/blender/editors/transform/transform_snap_object.hh b/source/blender/editors/transform/transform_snap_object.hh index 2f7771f40f6b..41a49f84993e 100644 --- a/source/blender/editors/transform/transform_snap_object.hh +++ b/source/blender/editors/transform/transform_snap_object.hh @@ -8,8 +8,15 @@ #pragma once +#include "DNA_scene_types.h" + +#include "BLI_kdopbvh.hh" #include "BLI_map.hh" #include "BLI_math_geom.h" +#include "BLI_math_matrix_types.hh" +#include "BLI_math_vector_types.hh" + +#include "ED_transform_snap_object_context.hh" #define MAX_CLIPPLANE_LEN 6 @@ -17,6 +24,17 @@ (SCE_SNAP_TO_EDGE | SCE_SNAP_TO_EDGE_ENDPOINT | SCE_SNAP_TO_EDGE_MIDPOINT | \ SCE_SNAP_TO_EDGE_PERPENDICULAR) +struct BMEdge; +struct BMFace; +struct BMVert; +struct Depsgraph; +struct ID; +struct ListBase; +struct Object; +struct RegionView3D; +struct Scene; +struct View3D; + struct SnapObjectContext { Scene *scene; diff --git a/source/blender/editors/transform/transform_snap_sequencer.cc b/source/blender/editors/transform/transform_snap_sequencer.cc index fe8e70547d16..b1c8249cdab3 100644 --- a/source/blender/editors/transform/transform_snap_sequencer.cc +++ b/source/blender/editors/transform/transform_snap_sequencer.cc @@ -56,8 +56,8 @@ static blender::VectorSet query_snap_sources_timeline( snap_sources = SEQ_query_selected_strips(seqbase); /* Add strips owned by retiming keys to exclude these from targets */ - for (Strip *seq : retiming_selection.values()) { - snap_sources.add(seq); + for (Strip *strip : retiming_selection.values()) { + snap_sources.add(strip); } return snap_sources; @@ -71,7 +71,7 @@ static blender::VectorSet query_snap_sources_preview(const Scene *scene ListBase *channels = SEQ_channels_displayed_get(ed); snap_sources = SEQ_query_rendered_strips(scene, channels, ed->seqbasep, scene->r.cfra, 0); - snap_sources.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 0; }); + snap_sources.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); return snap_sources; } @@ -104,17 +104,17 @@ static void seq_snap_source_points_build_timeline_strips(const Scene *scene, snap_data->source_snap_points.reinitialize(point_count_source); int i = 0; - for (Strip *seq : snap_sources) { + for (Strip *strip : snap_sources) { int left = 0, right = 0; - if (seq->flag & SEQ_LEFTSEL && !(seq->flag & SEQ_RIGHTSEL)) { - left = right = SEQ_time_left_handle_frame_get(scene, seq); + if (strip->flag & SEQ_LEFTSEL && !(strip->flag & SEQ_RIGHTSEL)) { + left = right = SEQ_time_left_handle_frame_get(scene, strip); } - else if (seq->flag & SEQ_RIGHTSEL && !(seq->flag & SEQ_LEFTSEL)) { - left = right = SEQ_time_right_handle_frame_get(scene, seq); + else if (strip->flag & SEQ_RIGHTSEL && !(strip->flag & SEQ_LEFTSEL)) { + left = right = SEQ_time_right_handle_frame_get(scene, strip); } else { - left = SEQ_time_left_handle_frame_get(scene, seq); - right = SEQ_time_right_handle_frame_get(scene, seq); + left = SEQ_time_left_handle_frame_get(scene, strip); + right = SEQ_time_right_handle_frame_get(scene, strip); } /* Set only the x-positions when snapping in the timeline. */ @@ -167,9 +167,9 @@ static bool seq_snap_source_points_build_preview(const Scene *scene, snap_data->source_snap_points.reinitialize(point_count_source); int i = 0; - for (Strip *seq : snap_sources) { + for (Strip *strip : snap_sources) { float seq_image_quad[4][2]; - SEQ_image_transform_final_quad_get(scene, seq, seq_image_quad); + SEQ_image_transform_final_quad_get(scene, strip, seq_image_quad); for (int j = 0; j < 4; j++) { snap_data->source_snap_points[i][0] = seq_image_quad[j][0]; @@ -179,7 +179,7 @@ static bool seq_snap_source_points_build_preview(const Scene *scene, /* Add origins last */ float image_origin[2]; - SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, image_origin); + SEQ_image_transform_origin_offset_pixelspace_get(scene, strip, image_origin); snap_data->source_snap_points[i][0] = image_origin[0]; snap_data->source_snap_points[i][1] = image_origin[1]; i++; @@ -196,21 +196,21 @@ static bool seq_snap_source_points_build_preview(const Scene *scene, /** \name Snap targets * \{ */ -/* Add effect strips directly or indirectly connected to `seq_reference` to `collection`. */ +/* Add effect strips directly or indirectly connected to `strip_reference` to `collection`. */ static void query_strip_effects_fn(const Scene *scene, - Strip *seq_reference, + Strip *strip_reference, ListBase *seqbase, blender::VectorSet &strips) { - if (strips.contains(seq_reference)) { + if (strips.contains(strip_reference)) { return; /* Strip is already in set, so all effects connected to it are as well. */ } - strips.add(seq_reference); + strips.add(strip_reference); - /* Find all strips connected to `seq_reference`. */ - LISTBASE_FOREACH (Strip *, seq_test, seqbase) { - if (SEQ_relation_is_effect_of_strip(seq_test, seq_reference)) { - query_strip_effects_fn(scene, seq_test, seqbase, strips); + /* Find all strips connected to `strip_reference`. */ + LISTBASE_FOREACH (Strip *, strip_test, seqbase) { + if (SEQ_relation_is_effect_of_strip(strip_test, strip_reference)) { + query_strip_effects_fn(scene, strip_test, seqbase, strips); } } } @@ -227,26 +227,26 @@ static blender::VectorSet query_snap_targets_timeline( * have to be selected. Remove such strips from `snap_targets` collection. */ blender::VectorSet effects_of_snap_sources = snap_sources; SEQ_iterator_set_expand(scene, seqbase, effects_of_snap_sources, query_strip_effects_fn); - effects_of_snap_sources.remove_if([&](Strip *seq) { - return (seq->type & SEQ_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(seq->type) == 0; + effects_of_snap_sources.remove_if([&](Strip *strip) { + return (strip->type & STRIP_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(strip->type) == 0; }); blender::VectorSet snap_targets; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (exclude_selected && seq->flag & SELECT) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (exclude_selected && strip->flag & SELECT) { continue; /* Selected are being transformed if there is no drag and drop. */ } - if (SEQ_render_is_muted(channels, seq) && (snap_flag & SEQ_SNAP_IGNORE_MUTED)) { + if (SEQ_render_is_muted(channels, strip) && (snap_flag & SEQ_SNAP_IGNORE_MUTED)) { continue; } - if (seq->type == SEQ_TYPE_SOUND_RAM && (snap_flag & SEQ_SNAP_IGNORE_SOUND)) { + if (strip->type == STRIP_TYPE_SOUND_RAM && (snap_flag & SEQ_SNAP_IGNORE_SOUND)) { continue; } - if (effects_of_snap_sources.contains(seq)) { + if (effects_of_snap_sources.contains(strip)) { continue; } - snap_targets.add(seq); + snap_targets.add(strip); } return snap_targets; @@ -265,7 +265,7 @@ static blender::VectorSet query_snap_targets_preview(Scene *scene, cons ListBase *channels = SEQ_channels_displayed_get(ed); snap_targets = SEQ_query_rendered_strips(scene, channels, ed->seqbasep, scene->r.cfra, 0); - snap_targets.remove_if([&](Strip *seq) { return (seq->flag & SELECT) == 1; }); + snap_targets.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 1; }); return snap_targets; } @@ -275,11 +275,11 @@ static blender::Map visible_retiming_keys_get( { blender::Map visible_keys; - for (Strip *seq : snap_strip_targets) { - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { - const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, &key); - if (SEQ_time_strip_intersects_frame(scene, seq, key_frame)) { - visible_keys.add(&key, seq); + for (Strip *strip : snap_strip_targets) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { + const int key_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, &key); + if (SEQ_time_strip_intersects_frame(scene, strip, key_frame)) { + visible_keys.add(&key, strip); } } } @@ -369,27 +369,27 @@ static void seq_snap_target_points_build_timeline(const Scene *scene, } } - for (Strip *seq : strip_targets) { - snap_data->target_snap_points[i][0] = SEQ_time_left_handle_frame_get(scene, seq); - snap_data->target_snap_points[i + 1][0] = SEQ_time_right_handle_frame_get(scene, seq); + for (Strip *strip : strip_targets) { + snap_data->target_snap_points[i][0] = SEQ_time_left_handle_frame_get(scene, strip); + snap_data->target_snap_points[i + 1][0] = SEQ_time_right_handle_frame_get(scene, strip); i += 2; if (snap_mode & SEQ_SNAP_TO_STRIP_HOLD) { - int content_start = SEQ_time_start_frame_get(seq); - int content_end = SEQ_time_content_end_frame_get(scene, seq); + int content_start = SEQ_time_start_frame_get(strip); + int content_end = SEQ_time_content_end_frame_get(scene, strip); /* Effects and single image strips produce incorrect content length. Skip these strips. */ - if ((seq->type & SEQ_TYPE_EFFECT) != 0 || seq->len == 1) { - content_start = SEQ_time_left_handle_frame_get(scene, seq); - content_end = SEQ_time_right_handle_frame_get(scene, seq); + if ((strip->type & STRIP_TYPE_EFFECT) != 0 || strip->len == 1) { + content_start = SEQ_time_left_handle_frame_get(scene, strip); + content_end = SEQ_time_right_handle_frame_get(scene, strip); } CLAMP(content_start, - SEQ_time_left_handle_frame_get(scene, seq), - SEQ_time_right_handle_frame_get(scene, seq)); + SEQ_time_left_handle_frame_get(scene, strip), + SEQ_time_right_handle_frame_get(scene, strip)); CLAMP(content_end, - SEQ_time_left_handle_frame_get(scene, seq), - SEQ_time_right_handle_frame_get(scene, seq)); + SEQ_time_left_handle_frame_get(scene, strip), + SEQ_time_right_handle_frame_get(scene, strip)); snap_data->target_snap_points[i][0] = content_start; snap_data->target_snap_points[i + 1][0] = content_end; @@ -446,18 +446,18 @@ static bool seq_snap_target_points_build_preview(const Scene *scene, } if (snap_mode & SEQ_SNAP_TO_STRIPS_PREVIEW) { - for (Strip *seq : snap_targets) { - float seq_image_quad[4][2]; - SEQ_image_transform_final_quad_get(scene, seq, seq_image_quad); + for (Strip *strip : snap_targets) { + float strip_image_quad[4][2]; + SEQ_image_transform_final_quad_get(scene, strip, strip_image_quad); for (int j = 0; j < 4; j++) { - snap_data->target_snap_points[i][0] = seq_image_quad[j][0]; - snap_data->target_snap_points[i][1] = seq_image_quad[j][1]; + snap_data->target_snap_points[i][0] = strip_image_quad[j][0]; + snap_data->target_snap_points[i][1] = strip_image_quad[j][1]; i++; } float image_origin[2]; - SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, image_origin); + SEQ_image_transform_origin_offset_pixelspace_get(scene, strip, image_origin); snap_data->target_snap_points[i][0] = image_origin[0]; snap_data->target_snap_points[i][1] = image_origin[1]; diff --git a/source/blender/editors/util/numinput.cc b/source/blender/editors/util/numinput.cc index e23dc8572abf..df2efe615a45 100644 --- a/source/blender/editors/util/numinput.cc +++ b/source/blender/editors/util/numinput.cc @@ -85,7 +85,7 @@ void initNumInput(NumInput *n) n->str_cur = 0; } -void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings) +void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings) { short j; const int ln = NUM_STR_REP_LEN; @@ -98,7 +98,7 @@ void outputNumInput(NumInput *n, char *str, const UnitSettings *unit_settings) j; /* Use scale_length if needed! */ - const float fac = float(BKE_scene_unit_scale(unit_settings, n->unit_type[j], 1.0)); + const float fac = float(BKE_unit_value_scale(unit_settings, n->unit_type[j], 1.0)); if (n->val_flag[i] & NUM_EDITED) { /* Get the best precision, allows us to draw '10.0001' as '10' instead! */ @@ -265,7 +265,7 @@ static bool editstr_insert_at_cursor(NumInput *n, const char *buf, const int buf bool user_string_to_number(bContext *C, const char *str, - const UnitSettings *unit, + const UnitSettings &unit, int type, double *r_value, const bool use_single_line_error, @@ -276,12 +276,12 @@ bool user_string_to_number(bContext *C, err_info.use_single_line_error = use_single_line_error; err_info.r_string = r_error; - double unit_scale = BKE_scene_unit_scale(unit, type, 1.0); + const double unit_scale = BKE_unit_value_scale(unit, type, 1.0); if (BKE_unit_string_contains_unit(str, type)) { char str_unit_convert[256]; STRNCPY(str_unit_convert, str); BKE_unit_replace_string( - str_unit_convert, sizeof(str_unit_convert), str, unit_scale, unit->system, type); + str_unit_convert, sizeof(str_unit_convert), str, unit_scale, unit.system, type); return BPY_run_string_as_number(C, nullptr, str_unit_convert, &err_info, r_value); } @@ -583,7 +583,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) double val; int success = user_string_to_number( - C, n->str, &sce->unit, n->unit_type[idx], &val, false, &error); + C, n->str, sce->unit, n->unit_type[idx], &val, false, &error); if (error) { ReportList *reports = CTX_wm_reports(C); diff --git a/source/blender/editors/uvedit/uvedit_ops.cc b/source/blender/editors/uvedit/uvedit_ops.cc index 2b1bb808dde4..3d32cdb82783 100644 --- a/source/blender/editors/uvedit/uvedit_ops.cc +++ b/source/blender/editors/uvedit/uvedit_ops.cc @@ -170,7 +170,7 @@ void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *i if (node && is_image_texture_node(node)) { node->id = &ima->id; - ED_node_tree_propagate_change(nullptr, bmain, ma->nodetree); + ED_node_tree_propagate_change(bmain, ma->nodetree); } } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc index cf26ebb02d82..47de6b2c314d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc @@ -126,6 +126,22 @@ static bool ED_uvedit_ensure_uvs(Object *obedit) /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Shared Properties + * \{ */ + +static void uv_map_operator_property_correct_aspect(wmOperatorType *ot) +{ + RNA_def_boolean( + ot->srna, + "correct_aspect", + true, + "Correct Aspect", + "Map UVs taking aspect ratio of the image associated with the material into account"); +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name UDIM Access * \{ */ @@ -2532,11 +2548,7 @@ static void correct_uv_aspect_per_face(Object *ob, BMEditMesh *em) static void uv_map_clip_correct_properties_ex(wmOperatorType *ot, bool clip_to_bounds) { - RNA_def_boolean(ot->srna, - "correct_aspect", - true, - "Correct Aspect", - "Map UVs taking image aspect ratio into account"); + uv_map_operator_property_correct_aspect(ot); /* Optional, since not all unwrapping types need to be clipped. */ if (clip_to_bounds) { RNA_def_boolean(ot->srna, @@ -2947,11 +2959,9 @@ void UV_OT_unwrap(wmOperatorType *ot) "Fill Holes", "Virtually fill holes in mesh before unwrapping, to better avoid overlaps and " "preserve symmetry"); - RNA_def_boolean(ot->srna, - "correct_aspect", - !(tool_settings_default->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT), - "Correct Aspect", - "Map UVs taking image aspect ratio into account"); + + uv_map_operator_property_correct_aspect(ot); + RNA_def_boolean( ot->srna, "use_subsurf_data", diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index b0cbd6283ce9..64a78f68f984 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -10,6 +10,7 @@ #include "WXEdge.h" #include "BLI_sys_types.h" +#include "BLI_utildefines.h" #include "BKE_global.hh" diff --git a/source/blender/geometry/GEO_mesh_boolean.hh b/source/blender/geometry/GEO_mesh_boolean.hh index bf365c4264a2..5060e7caeb31 100644 --- a/source/blender/geometry/GEO_mesh_boolean.hh +++ b/source/blender/geometry/GEO_mesh_boolean.hh @@ -7,6 +7,7 @@ #include "BLI_array.hh" #include "BLI_math_matrix_types.hh" #include "BLI_span.hh" +#include "BLI_vector.hh" struct Mesh; diff --git a/source/blender/geometry/GEO_smooth_curves.hh b/source/blender/geometry/GEO_smooth_curves.hh index a9dfe7eb1f6f..60f8c09df69d 100644 --- a/source/blender/geometry/GEO_smooth_curves.hh +++ b/source/blender/geometry/GEO_smooth_curves.hh @@ -8,6 +8,8 @@ #include "BLI_index_mask.hh" #include "BLI_offset_indices.hh" +#include "BKE_curves.hh" + namespace blender::geometry { /** diff --git a/source/blender/geometry/intern/mesh_primitive_cylinder_cone.cc b/source/blender/geometry/intern/mesh_primitive_cylinder_cone.cc index dfad74079e2f..02a1cb3d5728 100644 --- a/source/blender/geometry/intern/mesh_primitive_cylinder_cone.cc +++ b/source/blender/geometry/intern/mesh_primitive_cylinder_cone.cc @@ -2,6 +2,8 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_math_base.h" + #include "BKE_attribute.hh" #include "BKE_mesh.hh" diff --git a/source/blender/geometry/intern/mesh_primitive_uv_sphere.cc b/source/blender/geometry/intern/mesh_primitive_uv_sphere.cc index 5583d0a00656..0bfc118fdf12 100644 --- a/source/blender/geometry/intern/mesh_primitive_uv_sphere.cc +++ b/source/blender/geometry/intern/mesh_primitive_uv_sphere.cc @@ -2,6 +2,8 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_math_base.h" + #include "BKE_attribute.hh" #include "BKE_mesh.hh" diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 37e6d8aa0aed..5ed9d4a6ff7e 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -820,7 +820,8 @@ if(WITH_GTESTS) endif() # Enable shader validation on build-bot for Metal - if(WITH_METAL_BACKEND AND NOT WITH_GPU_DRAW_TESTS) + if(WITH_METAL_BACKEND AND NOT WITH_GPU_DRAW_TESTS AND + NOT (WITH_GTESTS AND WITH_GPU_BACKEND_TESTS)) # Avoid duplicate source file list(APPEND TEST_SRC tests/shader_create_info_test.cc ) diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc index f5a337b843f3..a5100f9d22b6 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.cc +++ b/source/blender/gpu/intern/gpu_shader_create_info.cc @@ -28,6 +28,9 @@ #undef GPU_SHADER_NAMED_INTERFACE_INFO #undef GPU_SHADER_INTERFACE_INFO #undef GPU_SHADER_CREATE_INFO +#undef GPU_SHADER_NAMED_INTERFACE_END +#undef GPU_SHADER_INTERFACE_END +#undef GPU_SHADER_CREATE_END namespace blender::gpu::shader { @@ -464,6 +467,10 @@ void gpu_shader_create_info_init() g_create_infos->add_new(#_info, ptr_##_info); \ _info +#define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ; +#define GPU_SHADER_INTERFACE_END() ; +#define GPU_SHADER_CREATE_END() ; + /* Declare, register and construct the infos. */ #include "gpu_shader_create_info_list.hh" diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 58877118288d..9faae6739787 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -81,18 +81,30 @@ #elif !defined(GPU_SHADER_CREATE_INFO) /* Helps intellisense / auto-completion inside info files. */ # define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \ - StageInterfaceInfo _interface(#_interface, _inst_name); \ - _interface + static inline void autocomplete_helper_interface_##_interface() \ + { \ + StageInterfaceInfo _interface(#_interface, _inst_name); \ + _interface # define GPU_SHADER_INTERFACE_INFO(_interface) \ - StageInterfaceInfo _interface(#_interface); \ - _interface + static inline void autocomplete_helper_interface_##_interface() \ + { \ + StageInterfaceInfo _interface(#_interface); \ + _interface # define GPU_SHADER_CREATE_INFO(_info) \ - ShaderCreateInfo _info(#_info); \ - _info + static inline void autocomplete_helper_info_##_info() \ + { \ + ShaderCreateInfo _info(#_info); \ + _info -# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ; -# define GPU_SHADER_INTERFACE_END() ; -# define GPU_SHADER_CREATE_END() ; +# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \ + ; \ + } +# define GPU_SHADER_INTERFACE_END() \ + ; \ + } +# define GPU_SHADER_CREATE_END() \ + ; \ + } #endif diff --git a/source/blender/gpu/intern/gpu_shader_create_info_list.hh b/source/blender/gpu/intern/gpu_shader_create_info_list.hh index eeb013ac9033..ce9c7b708783 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info_list.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info_list.hh @@ -107,6 +107,7 @@ #include "compositor_symmetric_separable_blur_variable_size_info.hh" #include "compositor_tone_map_photoreceptor_info.hh" #include "compositor_tone_map_simple_info.hh" +#include "compositor_translate_wrapped_info.hh" #include "compositor_van_vliet_gaussian_blur_info.hh" #include "compositor_write_output_info.hh" #include "compositor_z_combine_info.hh" diff --git a/source/blender/gpu/opengl/gl_index_buffer.cc b/source/blender/gpu/opengl/gl_index_buffer.cc index c32634a5d1f4..a2de6a990643 100644 --- a/source/blender/gpu/opengl/gl_index_buffer.cc +++ b/source/blender/gpu/opengl/gl_index_buffer.cc @@ -59,8 +59,27 @@ void GLIndexBuf::bind_as_ssbo(uint binding) glBindVertexArray(0); bind(); } - BLI_assert(ibo_id_ != 0); - glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, ibo_id_); + + if (!is_subrange_) { + BLI_assert(ibo_id_ != 0); + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, ibo_id_); + } + else { + GLuint src_ibo_id = static_cast(src_)->ibo_id_; + BLI_assert(src_ibo_id != 0); + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, src_ibo_id); +#if 0 + /* TODO(pragma37): Check with @fclem. + * I think this would be the correct behavior, but + * overlay::Prepass::use_material_slot_selection_ seems to rely on binding the full index + * buffer? */ + glBindBufferRange(GL_SHADER_STORAGE_BUFFER, + binding, + src_ibo_id, + index_start_, + index_len_ * to_bytesize(index_type_)); +#endif + } #ifndef NDEBUG BLI_assert(binding < 16); diff --git a/source/blender/gpu/vulkan/vk_pipeline_pool.cc b/source/blender/gpu/vulkan/vk_pipeline_pool.cc index 8c8f3122afff..5bdabd07b550 100644 --- a/source/blender/gpu/vulkan/vk_pipeline_pool.cc +++ b/source/blender/gpu/vulkan/vk_pipeline_pool.cc @@ -282,6 +282,10 @@ VkPipeline VKPipelinePool::get_or_create_graphics_pipeline(VKGraphicsInfo &graph vk_pipeline_rasterization_state_create_info_.frontFace = graphics_info.state.invert_facing ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; + vk_pipeline_rasterization_provoking_vertex_state_info_.provokingVertexMode = + graphics_info.state.provoking_vert == GPU_VERTEX_LAST ? + VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT : + VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT; /* Viewport state */ vk_pipeline_viewport_state_create_info_.pViewports = @@ -601,6 +605,8 @@ VkPipeline VKPipelinePool::get_or_create_graphics_pipeline(VKGraphicsInfo &graph vk_pipeline_rasterization_state_create_info_.depthBiasConstantFactor = 0.0f; vk_pipeline_rasterization_state_create_info_.depthBiasClamp = 0.0f; vk_pipeline_rasterization_state_create_info_.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; + vk_pipeline_rasterization_provoking_vertex_state_info_.provokingVertexMode = + VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT; vk_pipeline_viewport_state_create_info_.pScissors = nullptr; vk_pipeline_viewport_state_create_info_.scissorCount = 0; vk_pipeline_viewport_state_create_info_.pViewports = nullptr; diff --git a/source/blender/imbuf/IMB_metadata.hh b/source/blender/imbuf/IMB_metadata.hh index ebbde1bd375e..3e49abb46fd9 100644 --- a/source/blender/imbuf/IMB_metadata.hh +++ b/source/blender/imbuf/IMB_metadata.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct IDProperty; struct ImBuf; diff --git a/source/blender/imbuf/IMB_thumbs.hh b/source/blender/imbuf/IMB_thumbs.hh index 778bb23915ba..3962b5640350 100644 --- a/source/blender/imbuf/IMB_thumbs.hh +++ b/source/blender/imbuf/IMB_thumbs.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct ImBuf; /** diff --git a/source/blender/imbuf/intern/colormanagement.cc b/source/blender/imbuf/intern/colormanagement.cc index cddd9a25ece8..82e0381b8a57 100644 --- a/source/blender/imbuf/intern/colormanagement.cc +++ b/source/blender/imbuf/intern/colormanagement.cc @@ -1285,10 +1285,10 @@ static void colormanage_check_colorspace_settings( (void)what; } -static bool seq_callback(Strip *seq, void * /*user_data*/) +static bool strip_callback(Strip *strip, void * /*user_data*/) { - if (seq->data) { - colormanage_check_colorspace_settings(&seq->data->colorspace_settings, "sequencer strip"); + if (strip->data) { + colormanage_check_colorspace_settings(&strip->data->colorspace_settings, "sequencer strip"); } return true; } @@ -1318,7 +1318,7 @@ void IMB_colormanagement_check_file_config(Main *bmain) /* check sequencer strip input color space settings */ if (scene->ed != nullptr) { - SEQ_for_each_callback(&scene->ed->seqbase, seq_callback, nullptr); + SEQ_for_each_callback(&scene->ed->seqbase, strip_callback, nullptr); } } diff --git a/source/blender/imbuf/intern/divers.cc b/source/blender/imbuf/intern/divers.cc index f353172eea90..704fee2fae4a 100644 --- a/source/blender/imbuf/intern/divers.cc +++ b/source/blender/imbuf/intern/divers.cc @@ -518,7 +518,7 @@ static void imb_buffer_float_from_float_thread_do(void *data_v, int scanline) const int num_scanlines = 1; FloatToFloatThreadData *data = (FloatToFloatThreadData *)data_v; size_t offset_from = size_t(scanline) * data->stride_from * data->channels_from; - size_t offset_to = size_t(scanline) * data->stride_to * data->channels_from; + size_t offset_to = size_t(scanline) * data->stride_to * 4; IMB_buffer_float_from_float(data->rect_to + offset_to, data->rect_from + offset_from, data->channels_from, diff --git a/source/blender/imbuf/intern/scaling.cc b/source/blender/imbuf/intern/scaling.cc index 84ed4a9d955f..3c602215a87a 100644 --- a/source/blender/imbuf/intern/scaling.cc +++ b/source/blender/imbuf/intern/scaling.cc @@ -879,6 +879,7 @@ ImBuf *IMB_scale_into_new( /* Create result image. */ ImBuf *dst = IMB_allocImBuf(newx, newy, ibuf->planes, IB_uninitialized_pixels); + dst->channels = ibuf->channels; IMB_metadata_copy(dst, ibuf); dst->colormanage_flag = ibuf->colormanage_flag; if (dst_byte != nullptr) { diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc index 87270a6e207b..683d9f151ef5 100644 --- a/source/blender/imbuf/intern/transform.cc +++ b/source/blender/imbuf/intern/transform.cc @@ -9,7 +9,7 @@ #include -#include "BLI_math_color_blend.h" +#include "BLI_math_color.h" #include "BLI_math_interp.hh" #include "BLI_math_matrix.hh" #include "BLI_math_vector.h" diff --git a/source/blender/imbuf/movie/intern/movie_read.cc b/source/blender/imbuf/movie/intern/movie_read.cc index cea0ded00d85..b7e0462e246d 100644 --- a/source/blender/imbuf/movie/intern/movie_read.cc +++ b/source/blender/imbuf/movie/intern/movie_read.cc @@ -230,68 +230,111 @@ static int calc_pix_fmt_max_component_bits(AVPixelFormat fmt) return bits; } -static int startffmpeg(MovieReader *anim) +static AVFormatContext *init_format_context(const char *filepath, + int video_stream_index, + int &r_stream_index, + const AVCodec *forced_video_decoder) { - const AVCodec *pCodec; - AVFormatContext *pFormatCtx = nullptr; - AVCodecContext *pCodecCtx; - AVStream *video_stream; - int video_stream_index; - int frs_num; - double frs_den; - int streamcount; + AVFormatContext *format_ctx = nullptr; + if (forced_video_decoder != nullptr) { + format_ctx = avformat_alloc_context(); + format_ctx->video_codec_id = forced_video_decoder->id; + format_ctx->video_codec = forced_video_decoder; + } - /* The following for color space determination */ - int srcRange, dstRange, brightness, contrast, saturation; - int *table; - const int *inv_table; + if (avformat_open_input(&format_ctx, filepath, nullptr, nullptr) != 0) { + return nullptr; + } - if (anim == nullptr) { - return (-1); + if (avformat_find_stream_info(format_ctx, nullptr) < 0) { + avformat_close_input(&format_ctx); + return nullptr; } - streamcount = anim->streamindex; + av_dump_format(format_ctx, 0, filepath, 0); - if (avformat_open_input(&pFormatCtx, anim->filepath, nullptr, nullptr) != 0) { - return -1; + /* Find the video stream */ + r_stream_index = -1; + for (int i = 0; i < format_ctx->nb_streams; i++) { + if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + if (video_stream_index > 0) { + video_stream_index--; + continue; + } + r_stream_index = i; + break; + } } - if (avformat_find_stream_info(pFormatCtx, nullptr) < 0) { - avformat_close_input(&pFormatCtx); - return -1; + if (r_stream_index == -1) { + avformat_close_input(&format_ctx); + return nullptr; } - av_dump_format(pFormatCtx, 0, anim->filepath, 0); + return format_ctx; +} - /* Find the video stream */ - video_stream_index = -1; +static AVFormatContext *init_format_context_vpx_workarounds(const char *filepath, + int video_stream_index, + int &r_stream_index, + const AVCodec *&r_codec) +{ + AVFormatContext *format_ctx = init_format_context( + filepath, video_stream_index, r_stream_index, nullptr); + if (format_ctx == nullptr) { + return nullptr; + } - for (int i = 0; i < pFormatCtx->nb_streams; i++) { - if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { - if (streamcount > 0) { - streamcount--; - continue; + /* By default ffmpeg uses built-in VP8/VP9 decoders, however those do not detect + * alpha channel (see ffmpeg trac issue #8344 https://trac.ffmpeg.org/ticket/8344). + * The trick for VP8/VP9 is to explicitly force use of libvpx decoder. + * Only do this where alpha_mode=1 metadata is set. Note that in order to work, + * the previously initialized format context must be closed and a fresh one + * with explicitly requested codec must be created. */ + r_codec = nullptr; + const AVStream *video_stream = format_ctx->streams[r_stream_index]; + if (ELEM(video_stream->codecpar->codec_id, AV_CODEC_ID_VP8, AV_CODEC_ID_VP9)) { + AVDictionaryEntry *tag = nullptr; + tag = av_dict_get(video_stream->metadata, "alpha_mode", tag, AV_DICT_IGNORE_SUFFIX); + if (tag && strcmp(tag->value, "1") == 0) { + r_codec = avcodec_find_decoder_by_name( + video_stream->codecpar->codec_id == AV_CODEC_ID_VP8 ? "libvpx" : "libvpx-vp9"); + if (r_codec != nullptr) { + avformat_close_input(&format_ctx); + format_ctx = avformat_alloc_context(); + format_ctx = init_format_context(filepath, video_stream_index, r_stream_index, r_codec); + if (format_ctx == nullptr) { + return nullptr; + } } - video_stream_index = i; - break; } } - if (video_stream_index == -1) { - avformat_close_input(&pFormatCtx); - return -1; + if (r_codec == nullptr) { + /* Use default decoder. */ + r_codec = avcodec_find_decoder(video_stream->codecpar->codec_id); } - video_stream = pFormatCtx->streams[video_stream_index]; + return format_ctx; +} + +static int startffmpeg(MovieReader *anim) +{ + if (anim == nullptr) { + return -1; + } - /* Find the decoder for the video stream */ - pCodec = avcodec_find_decoder(video_stream->codecpar->codec_id); - if (pCodec == nullptr) { + int video_stream_index; + const AVCodec *pCodec = nullptr; + AVFormatContext *pFormatCtx = init_format_context_vpx_workarounds( + anim->filepath, anim->streamindex, video_stream_index, pCodec); + if (pFormatCtx == nullptr || pCodec == nullptr) { avformat_close_input(&pFormatCtx); return -1; } - pCodecCtx = avcodec_alloc_context3(nullptr); + AVCodecContext *pCodecCtx = avcodec_alloc_context3(nullptr); + AVStream *video_stream = pFormatCtx->streams[video_stream_index]; avcodec_parameters_to_context(pCodecCtx, video_stream->codecpar); pCodecCtx->workaround_bugs = FF_BUG_AUTODETECT; @@ -320,8 +363,8 @@ static int startffmpeg(MovieReader *anim) } const AVRational frame_rate = av_guess_frame_rate(pFormatCtx, video_stream, nullptr); - frs_num = frame_rate.num; - frs_den = frame_rate.den; + int frs_num = frame_rate.num; + double frs_den = frame_rate.den; frs_den *= AV_TIME_BASE; @@ -430,6 +473,9 @@ static int startffmpeg(MovieReader *anim) } /* Try do detect if input has 0-255 YCbCR range (JFIF, JPEG, Motion-JPEG). */ + int srcRange, dstRange, brightness, contrast, saturation; + int *table; + const int *inv_table; if (!sws_getColorspaceDetails(anim->img_convert_ctx, (int **)&inv_table, &srcRange, diff --git a/source/blender/imbuf/movie/intern/movie_write.cc b/source/blender/imbuf/movie/intern/movie_write.cc index 4ad2cf19e0d1..5ec592e9858f 100644 --- a/source/blender/imbuf/movie/intern/movie_write.cc +++ b/source/blender/imbuf/movie/intern/movie_write.cc @@ -790,7 +790,7 @@ static AVStream *alloc_video_stream(MovieWriter *context, if (codec_id == AV_CODEC_ID_VP9 && rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = AV_PIX_FMT_YUVA420P; } - else if (ELEM(codec_id, AV_CODEC_ID_H264, AV_CODEC_ID_H265, AV_CODEC_ID_VP9) && + else if (ELEM(codec_id, AV_CODEC_ID_H264, AV_CODEC_ID_H265, AV_CODEC_ID_VP9, AV_CODEC_ID_AV1) && (context->ffmpeg_crf == 0)) { /* Use 4:4:4 instead of 4:2:0 pixel format for lossless rendering. */ diff --git a/source/blender/io/collada/ArmatureExporter.h b/source/blender/io/collada/ArmatureExporter.h index a3552254d540..b533e74cac27 100644 --- a/source/blender/io/collada/ArmatureExporter.h +++ b/source/blender/io/collada/ArmatureExporter.h @@ -12,10 +12,11 @@ #include // #include -#include "COLLADASWInputList.h" -#include "COLLADASWLibraryControllers.h" -#include "COLLADASWNode.h" -#include "COLLADASWStreamWriter.h" +#include +#include +#include +#include +#include #include "DNA_armature_types.h" #include "DNA_constraint_types.h" diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index 3a885780ba6d..a719f0421e35 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -13,6 +13,8 @@ #include "COLLADAFWUniqueId.h" +#include "DNA_key_types.h" + #include "BKE_action.hh" #include "BKE_armature.hh" #include "BKE_object.hh" diff --git a/source/blender/io/collada/ArmatureImporter.h b/source/blender/io/collada/ArmatureImporter.h index 85343fac98ca..ae35c7ef7c5e 100644 --- a/source/blender/io/collada/ArmatureImporter.h +++ b/source/blender/io/collada/ArmatureImporter.h @@ -16,7 +16,6 @@ #include "BKE_key.hh" #include "DNA_armature_types.h" -#include "DNA_key_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/io/collada/MeshImporter.h b/source/blender/io/collada/MeshImporter.h index 04d553e7cd85..0b2248bdadbe 100644 --- a/source/blender/io/collada/MeshImporter.h +++ b/source/blender/io/collada/MeshImporter.h @@ -18,11 +18,9 @@ #include "COLLADAFWMeshVertexData.h" #include "COLLADAFWNode.h" #include "COLLADAFWPolygons.h" -#include "COLLADAFWTextureCoordinateBinding.h" #include "COLLADAFWTypes.h" #include "COLLADAFWUniqueId.h" -#include "ArmatureImporter.h" #include "collada_utils.h" #include "BLI_math_vector_types.hh" @@ -32,6 +30,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +class ArmatureImporter; struct MLoopCol; /* only for ArmatureImporter to "see" MeshImporter::get_object_by_geom_uid */ diff --git a/source/blender/io/stl/exporter/stl_export_writer.hh b/source/blender/io/stl/exporter/stl_export_writer.hh index a600ca8da440..7def77390c20 100644 --- a/source/blender/io/stl/exporter/stl_export_writer.hh +++ b/source/blender/io/stl/exporter/stl_export_writer.hh @@ -8,6 +8,7 @@ #pragma once +#include #include namespace blender::io::stl { diff --git a/source/blender/io/stl/importer/stl_import.hh b/source/blender/io/stl/importer/stl_import.hh index 89c6aafa35aa..9509d150e071 100644 --- a/source/blender/io/stl/importer/stl_import.hh +++ b/source/blender/io/stl/importer/stl_import.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "IO_stl.hh" struct bContext; diff --git a/source/blender/io/usd/hydra/object.cc b/source/blender/io/usd/hydra/object.cc index f8c3fa462e0b..ea89e594f74f 100644 --- a/source/blender/io/usd/hydra/object.cc +++ b/source/blender/io/usd/hydra/object.cc @@ -16,7 +16,8 @@ namespace blender::io::hydra { ObjectData::ObjectData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id) - : IdData(scene_delegate, &object->id, prim_id), transform(pxr::GfMatrix4d(1.0)) + : IdData(scene_delegate, (object) ? &object->id : nullptr, prim_id), + transform(pxr::GfMatrix4d(1.0)) { } diff --git a/source/blender/io/usd/intern/usd_asset_utils.cc b/source/blender/io/usd/intern/usd_asset_utils.cc index a5f1e792e9b9..8bf78e050150 100644 --- a/source/blender/io/usd/intern/usd_asset_utils.cc +++ b/source/blender/io/usd/intern/usd_asset_utils.cc @@ -568,8 +568,7 @@ std::string get_relative_path(const std::string &path, const std::string &anchor return rel_path + 2; } - /* if we got here, the paths may be URIs or files on on the - * file system. */ + /* If we got here, the paths may be URIs or files on the file system. */ /* We don't have a library to compute relative paths for URIs * so we use the standard file-system calls to do so. This diff --git a/source/blender/io/usd/intern/usd_hook.cc b/source/blender/io/usd/intern/usd_hook.cc index bced8d62bb1e..c0ce4ff8bedf 100644 --- a/source/blender/io/usd/intern/usd_hook.cc +++ b/source/blender/io/usd/intern/usd_hook.cc @@ -619,7 +619,7 @@ void call_import_hooks(USDStageReader *archive, ReportList *reports) /* Resize based on the typical scenario where there will be both Object and Data entries * in the map in addition to each material. */ - prim_map.reserve((readers.size() * 2) + settings.usd_path_to_mat_name.size()); + prim_map.reserve((readers.size() * 2) + settings.usd_path_to_mat.size()); for (const USDPrimReader *reader : readers) { if (!reader) { @@ -636,12 +636,9 @@ void call_import_hooks(USDStageReader *archive, ReportList *reports) } } - settings.usd_path_to_mat_name.foreach_item( - [&](const std::string &path, const std::string &name) { - if (Material *mat = settings.mat_name_to_mat.lookup_default(name, nullptr)) { - prim_map.lookup_or_add_default(path).append(RNA_id_pointer_create(&mat->id)); - } - }); + settings.usd_path_to_mat.foreach_item([&prim_map](const std::string &path, Material *mat) { + prim_map.lookup_or_add_default(path).append(RNA_id_pointer_create(&mat->id)); + }); OnImportInvoker on_import(archive->stage(), prim_map, reports); on_import.call(); diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc index 3bfa4fa43056..34e6f227d4b7 100644 --- a/source/blender/io/usd/intern/usd_reader_material.cc +++ b/source/blender/io/usd/intern/usd_reader_material.cc @@ -1495,22 +1495,14 @@ void build_material_map(const Main *bmain, blender::Map } } -Material *find_existing_material( - const pxr::SdfPath &usd_mat_path, - const USDImportParams ¶ms, - const blender::Map &mat_map, - const blender::Map &usd_path_to_mat_name) +Material *find_existing_material(const pxr::SdfPath &usd_mat_path, + const USDImportParams ¶ms, + const blender::Map &mat_map, + const blender::Map &usd_path_to_mat) { if (params.mtl_name_collision_mode == USD_MTL_NAME_COLLISION_MAKE_UNIQUE) { /* Check if we've already created the Blender material with a modified name. */ - const std::string *mat_name = usd_path_to_mat_name.lookup_ptr(usd_mat_path.GetAsString()); - if (mat_name == nullptr) { - return nullptr; - } - - Material *mat = mat_map.lookup_default(*mat_name, nullptr); - BLI_assert_msg(mat != nullptr, "Previously created material cannot be found any more"); - return mat; + return usd_path_to_mat.lookup_default(usd_mat_path.GetAsString(), nullptr); } return mat_map.lookup_default(usd_mat_path.GetName(), nullptr); diff --git a/source/blender/io/usd/intern/usd_reader_material.hh b/source/blender/io/usd/intern/usd_reader_material.hh index 08f5ddefa9d5..67435486f588 100644 --- a/source/blender/io/usd/intern/usd_reader_material.hh +++ b/source/blender/io/usd/intern/usd_reader_material.hh @@ -196,16 +196,15 @@ void build_material_map(const Main *bmain, blender::Map * \param mat_map: Map a material name to a Blender material. Note that the name key * might be the Blender material name modified to be a valid USD identifier, * to match the material names in the imported USD. - * \param usd_path_to_mat_name: Map a USD material path to the imported Blender material name. + * \param usd_path_to_mat: Map a USD material path to the imported Blender material. * - * The usd_path_to_mat_name is needed to determine the name of the Blender + * The usd_path_to_mat is needed to determine the name of the Blender * material imported from a USD path in the case when a unique name was generated * for the material due to a name collision. */ -Material *find_existing_material( - const pxr::SdfPath &usd_mat_path, - const USDImportParams ¶ms, - const blender::Map &mat_map, - const blender::Map &usd_path_to_mat_name); +Material *find_existing_material(const pxr::SdfPath &usd_mat_path, + const USDImportParams ¶ms, + const blender::Map &mat_map, + const blender::Map &usd_path_to_mat); } // namespace blender::io::usd diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 9a7b89ce38e7..00f4097450ea 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -110,7 +110,7 @@ static void assign_materials(Main *bmain, for (const auto item : mat_index_map.items()) { Material *assigned_mat = find_existing_material( - item.key, params, settings.mat_name_to_mat, settings.usd_path_to_mat_name); + item.key, params, settings.mat_name_to_mat, settings.usd_path_to_mat); if (!assigned_mat) { /* Blender material doesn't exist, so create it now. */ @@ -142,9 +142,8 @@ static void assign_materials(Main *bmain, settings.mat_name_to_mat.lookup_or_add_default(mat_name) = assigned_mat; if (params.mtl_name_collision_mode == USD_MTL_NAME_COLLISION_MAKE_UNIQUE) { - /* Record the name of the Blender material we created for the USD material - * with the given path. */ - settings.usd_path_to_mat_name.lookup_or_add_default(item.key.GetAsString()) = mat_name; + /* Record the Blender material we created for the USD material with the given path. */ + settings.usd_path_to_mat.lookup_or_add_default(item.key.GetAsString()) = assigned_mat; } if (have_import_hook) { diff --git a/source/blender/io/usd/intern/usd_reader_prim.hh b/source/blender/io/usd/intern/usd_reader_prim.hh index 9540532c3871..a18cf5d96e07 100644 --- a/source/blender/io/usd/intern/usd_reader_prim.hh +++ b/source/blender/io/usd/intern/usd_reader_prim.hh @@ -42,9 +42,9 @@ struct ImportSettings { * the other import settings are to remain const. */ - /* Map a USD material prim path to a Blender material name. + /* Map a USD material prim path to a Blender material. * This map is updated by readers during stage traversal. */ - mutable blender::Map usd_path_to_mat_name{}; + mutable blender::Map usd_path_to_mat{}; /* Map a material name to Blender material. * This map is updated by readers during stage traversal. */ mutable blender::Map mat_name_to_mat{}; diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc index 6c501b092555..171e6e80a764 100644 --- a/source/blender/io/usd/intern/usd_reader_stage.cc +++ b/source/blender/io/usd/intern/usd_reader_stage.cc @@ -607,7 +607,7 @@ void USDStageReader::import_all_materials(Main *bmain) } if (blender::io::usd::find_existing_material( - prim.GetPath(), params_, settings_.mat_name_to_mat, settings_.usd_path_to_mat_name)) + prim.GetPath(), params_, settings_.mat_name_to_mat, settings_.usd_path_to_mat)) { /* The material already exists. */ continue; @@ -625,11 +625,10 @@ void USDStageReader::import_all_materials(Main *bmain) settings_.mat_name_to_mat.lookup_or_add_default(mtl_name) = new_mtl; if (params_.mtl_name_collision_mode == USD_MTL_NAME_COLLISION_MAKE_UNIQUE) { - /* Record the unique name of the Blender material we created for the USD material - * with the given path, so we don't import the material again when assigning - * materials to objects elsewhere in the code. */ - settings_.usd_path_to_mat_name.lookup_or_add_default( - prim.GetPath().GetAsString()) = mtl_name; + /* Record the Blender material we created for the USD material with the given path. + * This is to prevent importing the material again when assigning materials to objects + * elsewhere in the code. */ + settings_.usd_path_to_mat.lookup_or_add_default(prim.GetPath().GetAsString()) = new_mtl; } if (have_import_hook) { @@ -644,12 +643,7 @@ void USDStageReader::fake_users_for_unused_materials() { /* Iterate over the imported materials and set a fake user for any unused * materials. */ - for (const auto path_mat_pair : settings_.usd_path_to_mat_name.items()) { - Material *mat = settings_.mat_name_to_mat.lookup_default(path_mat_pair.value, nullptr); - if (mat == nullptr) { - continue; - } - + for (Material *mat : settings_.usd_path_to_mat.values()) { if (mat->id.us == 0) { id_fake_user_set(&mat->id); } 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 92fc636cade9..daa6ef7001af 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc @@ -18,7 +18,6 @@ #include "BLI_array_utils.hh" #include "BLI_listbase.h" #include "BLI_map.hh" -#include "BLI_math_matrix.h" #include "BLI_math_matrix.hh" #include "BLI_math_rotation.h" #include "BLI_sort.hh" @@ -26,7 +25,6 @@ #include "DEG_depsgraph_query.hh" -#include "DNA_material_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc index 2cca77aa33a6..5c5f571d6fe3 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc @@ -11,14 +11,12 @@ #include "BKE_node_runtime.hh" #include "BLI_math_vector.h" -#include "BLI_math_vector.hh" #include "BLI_path_utils.hh" #include "BLI_string.h" #include "DNA_material_types.h" #include "DNA_node_types.h" -#include "obj_export_mesh.hh" #include "obj_export_mtl.hh" #include "CLG_log.h" diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh index 6dbc81f7fbdc..133ee536dab1 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh @@ -8,10 +8,15 @@ #pragma once +#include "BLI_math_vector_types.hh" #include "BLI_utility_mixins.hh" #include "DNA_curve_types.h" +#include "IO_orientation.hh" + +struct OBJExportParams; + namespace blender::io::obj { /** diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh b/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh index 86c97a883721..e0d306b70fbb 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh +++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.hh @@ -17,6 +17,7 @@ struct Main; struct Mesh; struct Material; struct Object; +struct OBJImportParams; namespace blender::io::obj { diff --git a/source/blender/io/wavefront_obj/importer/obj_import_nurbs.hh b/source/blender/io/wavefront_obj/importer/obj_import_nurbs.hh index b1ce1ed90aa4..8bdb8e67ae8a 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_nurbs.hh +++ b/source/blender/io/wavefront_obj/importer/obj_import_nurbs.hh @@ -16,6 +16,8 @@ #include "obj_import_objects.hh" +struct OBJImportParams; + namespace blender::io::obj { /** diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc index 001bfef9eb29..22f1f360f857 100644 --- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc @@ -16,7 +16,6 @@ #include "BLI_fileops.h" #include "BLI_string.h" -#include "BLI_vector.hh" #include "BLO_readfile.hh" diff --git a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc index 7a93660f6b9e..21b51953584d 100644 --- a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc @@ -16,7 +16,7 @@ #include "BKE_scene.hh" #include "BLI_listbase.h" -#include "BLI_math_base.hh" +#include "BLI_math_base.h" #include "BLI_math_vector_types.hh" #include "BLI_string.h" @@ -28,8 +28,6 @@ #include "DNA_curve_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_scene_types.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index d840e51c2c4b..9d8df0638ade 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -8,6 +8,8 @@ #pragma once +#include + /** * FileGlobal stores a part of the current user-interface settings at * the moment of saving, and the file-specific settings. diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 8a133f8c796e..f42f6cc9008f 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -267,12 +267,12 @@ typedef struct Ipo { /* ******** Sequence (ID_SEQ) ********** */ -#define SEQ_TOTIPO 1 -#define SEQ_TOTNAM 1 +#define STRIP_TOTIPO 1 +#define STRIP_TOTNAM 1 -#define SEQ_FAC1 1 -#define SEQ_FAC_SPEED 2 -#define SEQ_FAC_OPACITY 3 +#define STRIP_FAC1 1 +#define STRIP_FAC_SPEED 2 +#define STRIP_FAC_OPACITY 3 /* ********* Curve (ID_CU_LEGACY) *********** */ diff --git a/source/blender/makesdna/DNA_node_tree_interface_types.h b/source/blender/makesdna/DNA_node_tree_interface_types.h index a5ba886a31a6..2c5100f13a1a 100644 --- a/source/blender/makesdna/DNA_node_tree_interface_types.h +++ b/source/blender/makesdna/DNA_node_tree_interface_types.h @@ -90,7 +90,7 @@ typedef struct bNodeTreeInterfaceSocket { /* Socket default value and associated data, e.g. bNodeSocketValueFloat. */ void *socket_data; - IDProperty *properties; + struct IDProperty *properties; #ifdef __cplusplus bNodeSocketTypeHandle *socket_typeinfo() const; @@ -100,7 +100,7 @@ typedef struct bNodeTreeInterfaceSocket { * Set the \a socket_type and replace the \a socket_data. * \param new_socket_type: Socket type idname, e.g. "NodeSocketFloat" */ - bool set_socket_type(const char *new_socket_type); + bool set_socket_type(blender::StringRef new_socket_type); /** * Use an existing socket to define an interface socket. diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 43f825b1b112..494e8003c602 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -1223,12 +1223,19 @@ typedef struct NodeScriptDict { /** glare node. */ typedef struct NodeGlare { - char quality, type, iter; - /* XXX angle is only kept for backward/forward compatibility, - * was used for two different things, see #50736. */ - char angle DNA_DEPRECATED, _pad0, size, star_45, streaks; - float colmod, mix, threshold, fade; - float angle_ofs; + char type; + char quality; + char iter DNA_DEPRECATED; + char angle DNA_DEPRECATED; + char _pad0; + char size DNA_DEPRECATED; + char star_45; + char streaks DNA_DEPRECATED; + float colmod DNA_DEPRECATED; + float mix DNA_DEPRECATED; + float threshold DNA_DEPRECATED; + float fade DNA_DEPRECATED; + float angle_ofs DNA_DEPRECATED; char _pad1[4]; } NodeGlare; diff --git a/source/blender/makesdna/DNA_scene_enums.h b/source/blender/makesdna/DNA_scene_enums.h index 0c65e2bdeb1f..1b7949057fbb 100644 --- a/source/blender/makesdna/DNA_scene_enums.h +++ b/source/blender/makesdna/DNA_scene_enums.h @@ -8,6 +8,8 @@ #pragma once +#include "BLI_utildefines.h" + /** #ToolSettings.vgroupsubset */ typedef enum eVGroupSelect { WT_VGROUP_ALL = 0, diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 7f30eb8589de..a5f3693fd9e2 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1971,7 +1971,13 @@ typedef struct ToolSettings { /** Display/Editing unit options for each scene. */ typedef struct UnitSettings { - /** Maybe have other unit conversions? */ + /* Maybe have other unit conversions? */ + /** + * Spatial scale. + * - This must not be used when `system == USER_UNIT_NONE`. + * - Typically the scale should be applied using #BKE_unit_value_scale + * which supports different kinds of users and checks a none unit system. + */ float scale_length; /** Imperial, metric etc. */ char system; diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index 4e57b6329318..93ed9518f31a 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -7,6 +7,8 @@ #pragma once +#include "BLI_sys_types.h" + struct MemArena; # diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index a7f1c7b4c5fb..2c88a764bf5f 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -10,7 +10,7 @@ * - #Strip: video/effect/audio data you can select and manipulate in the sequencer. * - #Strip.machine: Strange name for the channel. * - #StripData: The data referenced by the #Strip - * - Meta Strip (SEQ_TYPE_META): Support for nesting Sequences. + * - Meta Strip (STRIP_TYPE_META): Support for nesting Sequences. */ #pragma once @@ -24,7 +24,7 @@ struct Ipo; struct MovieClip; struct Scene; -struct SequenceLookup; +struct StripLookup; struct VFont; struct bSound; @@ -170,7 +170,7 @@ typedef struct Strip { void *_pad; /** Needed (to be like ipo), else it will raise libdata warnings, this should never be used. */ void *lib; - /** SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths. */ + /** STRIP_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths. */ char name[64]; /** Flags bitmap (see below) and the type of sequence. */ @@ -323,7 +323,7 @@ typedef struct SeqConnection { } SeqConnection; typedef struct EditingRuntime { - struct SequenceLookup *sequence_lookup; + struct StripLookup *strip_lookup; MediaPresence *media_presence; ThumbnailCache *thumbnail_cache; void *_pad; @@ -490,10 +490,10 @@ enum { SEQ_TEXT_ALIGN_Y_BOTTOM = 2, }; -#define SEQ_FONT_NOT_LOADED -2 +#define STRIP_FONT_NOT_LOADED -2 typedef struct ColorMixVars { - /** Value from SEQ_TYPE_XXX enumeration. */ + /** Value from STRIP_TYPE_XXX enumeration. */ int blend_effect; /** Blend factor [0.0f, 1.0f]. */ float factor; @@ -606,8 +606,8 @@ enum { SEQ_EDIT_SHOW_MISSING_MEDIA = 1 << 0, }; -#define SEQ_STRIP_OFSBOTTOM 0.05f -#define SEQ_STRIP_OFSTOP 0.95f +#define STRIP_OFSBOTTOM 0.05f +#define STRIP_OFSTOP 0.95f /** #Editor::proxy_storage */ enum { @@ -623,7 +623,7 @@ enum { SEQ_SPEED_USE_INTERPOLATION = 1 << 3, }; -#define SEQ_NAME_MAXSTR 64 +#define STRIP_NAME_MAXSTR 64 /* From: `DNA_object_types.h`, see it's doc-string there. */ #define SELECT 1 @@ -678,10 +678,10 @@ enum { }; /* convenience define for all selection flags */ -#define SEQ_ALLSEL (SELECT + SEQ_LEFTSEL + SEQ_RIGHTSEL) +#define STRIP_ALLSEL (SELECT + SEQ_LEFTSEL + SEQ_RIGHTSEL) /* Deprecated, don't use a flag anymore. */ -// #define SEQ_ACTIVE 1048576 +// #define STRIP_ACTIVE 1048576 enum { SEQ_COLOR_BALANCE_INVERSE_GAIN = 1 << 0, @@ -725,61 +725,61 @@ enum { /** * #Strip.type * - * \warning #SEQ_TYPE_EFFECT BIT is used to determine if this is an effect strip! + * \warning #STRIP_TYPE_EFFECT BIT is used to determine if this is an effect strip! */ -typedef enum SequenceType { - SEQ_TYPE_IMAGE = 0, - SEQ_TYPE_META = 1, - SEQ_TYPE_SCENE = 2, - SEQ_TYPE_MOVIE = 3, - SEQ_TYPE_SOUND_RAM = 4, - SEQ_TYPE_SOUND_HD = 5, /* DEPRECATED */ - SEQ_TYPE_MOVIECLIP = 6, - SEQ_TYPE_MASK = 7, - - SEQ_TYPE_EFFECT = 8, - SEQ_TYPE_CROSS = 8, - SEQ_TYPE_ADD = 9, - SEQ_TYPE_SUB = 10, - SEQ_TYPE_ALPHAOVER = 11, - SEQ_TYPE_ALPHAUNDER = 12, - SEQ_TYPE_GAMCROSS = 13, - SEQ_TYPE_MUL = 14, - SEQ_TYPE_OVERDROP = 15, - /* SEQ_TYPE_PLUGIN = 24, */ /* Deprecated */ - SEQ_TYPE_WIPE = 25, - SEQ_TYPE_GLOW = 26, - SEQ_TYPE_TRANSFORM = 27, - SEQ_TYPE_COLOR = 28, - SEQ_TYPE_SPEED = 29, - SEQ_TYPE_MULTICAM = 30, - SEQ_TYPE_ADJUSTMENT = 31, - SEQ_TYPE_GAUSSIAN_BLUR = 40, - SEQ_TYPE_TEXT = 41, - SEQ_TYPE_COLORMIX = 42, +typedef enum StripType { + STRIP_TYPE_IMAGE = 0, + STRIP_TYPE_META = 1, + STRIP_TYPE_SCENE = 2, + STRIP_TYPE_MOVIE = 3, + STRIP_TYPE_SOUND_RAM = 4, + STRIP_TYPE_SOUND_HD = 5, /* DEPRECATED */ + STRIP_TYPE_MOVIECLIP = 6, + STRIP_TYPE_MASK = 7, + + STRIP_TYPE_EFFECT = 8, + STRIP_TYPE_CROSS = 8, + STRIP_TYPE_ADD = 9, + STRIP_TYPE_SUB = 10, + STRIP_TYPE_ALPHAOVER = 11, + STRIP_TYPE_ALPHAUNDER = 12, + STRIP_TYPE_GAMCROSS = 13, + STRIP_TYPE_MUL = 14, + STRIP_TYPE_OVERDROP = 15, + /* STRIP_TYPE_PLUGIN = 24, */ /* Deprecated */ + STRIP_TYPE_WIPE = 25, + STRIP_TYPE_GLOW = 26, + STRIP_TYPE_TRANSFORM = 27, + STRIP_TYPE_COLOR = 28, + STRIP_TYPE_SPEED = 29, + STRIP_TYPE_MULTICAM = 30, + STRIP_TYPE_ADJUSTMENT = 31, + STRIP_TYPE_GAUSSIAN_BLUR = 40, + STRIP_TYPE_TEXT = 41, + STRIP_TYPE_COLORMIX = 42, /* Blend modes */ - SEQ_TYPE_SCREEN = 43, - SEQ_TYPE_LIGHTEN = 44, - SEQ_TYPE_DODGE = 45, - SEQ_TYPE_DARKEN = 46, - SEQ_TYPE_COLOR_BURN = 47, - SEQ_TYPE_LINEAR_BURN = 48, - SEQ_TYPE_OVERLAY = 49, - SEQ_TYPE_HARD_LIGHT = 50, - SEQ_TYPE_SOFT_LIGHT = 51, - SEQ_TYPE_PIN_LIGHT = 52, - SEQ_TYPE_LIN_LIGHT = 53, - SEQ_TYPE_VIVID_LIGHT = 54, - SEQ_TYPE_HUE = 55, - SEQ_TYPE_SATURATION = 56, - SEQ_TYPE_VALUE = 57, - SEQ_TYPE_BLEND_COLOR = 58, - SEQ_TYPE_DIFFERENCE = 59, - SEQ_TYPE_EXCLUSION = 60, - - SEQ_TYPE_MAX = 60, -} SequenceType; + STRIP_TYPE_SCREEN = 43, + STRIP_TYPE_LIGHTEN = 44, + STRIP_TYPE_DODGE = 45, + STRIP_TYPE_DARKEN = 46, + STRIP_TYPE_COLOR_BURN = 47, + STRIP_TYPE_LINEAR_BURN = 48, + STRIP_TYPE_OVERLAY = 49, + STRIP_TYPE_HARD_LIGHT = 50, + STRIP_TYPE_SOFT_LIGHT = 51, + STRIP_TYPE_PIN_LIGHT = 52, + STRIP_TYPE_LIN_LIGHT = 53, + STRIP_TYPE_VIVID_LIGHT = 54, + STRIP_TYPE_HUE = 55, + STRIP_TYPE_SATURATION = 56, + STRIP_TYPE_VALUE = 57, + STRIP_TYPE_BLEND_COLOR = 58, + STRIP_TYPE_DIFFERENCE = 59, + STRIP_TYPE_EXCLUSION = 60, + + STRIP_TYPE_MAX = 60, +} StripType; enum { SEQ_MOVIECLIP_RENDER_UNDISTORTED = 1 << 0, @@ -789,13 +789,17 @@ enum { enum { SEQ_BLEND_REPLACE = 0, }; -/* all other BLEND_MODEs are simple SEQ_TYPE_EFFECT ids and therefore identical +/* all other BLEND_MODEs are simple STRIP_TYPE_EFFECT ids and therefore identical * to the table above. (Only those effects that handle _exactly_ two inputs, * otherwise, you can't really blend, right :) !) */ -#define SEQ_HAS_PATH(_seq) \ - (ELEM((_seq)->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) +#define STRIP_HAS_PATH(_seq) \ + (ELEM((_seq)->type, \ + STRIP_TYPE_MOVIE, \ + STRIP_TYPE_IMAGE, \ + STRIP_TYPE_SOUND_RAM, \ + STRIP_TYPE_SOUND_HD)) /* modifiers */ @@ -864,20 +868,20 @@ enum { }; /** #Strip.color_tag. */ -typedef enum SequenceColorTag { - SEQUENCE_COLOR_NONE = -1, - SEQUENCE_COLOR_01, - SEQUENCE_COLOR_02, - SEQUENCE_COLOR_03, - SEQUENCE_COLOR_04, - SEQUENCE_COLOR_05, - SEQUENCE_COLOR_06, - SEQUENCE_COLOR_07, - SEQUENCE_COLOR_08, - SEQUENCE_COLOR_09, - - SEQUENCE_COLOR_TOT, -} SequenceColorTag; +typedef enum StripColorTag { + STRIP_COLOR_NONE = -1, + STRIP_COLOR_01, + STRIP_COLOR_02, + STRIP_COLOR_03, + STRIP_COLOR_04, + STRIP_COLOR_05, + STRIP_COLOR_06, + STRIP_COLOR_07, + STRIP_COLOR_08, + STRIP_COLOR_09, + + STRIP_COLOR_TOT, +} StripColorTag; /* Strip->StripTransform->filter */ enum { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 3aa968bed10b..3aab90ec933d 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -541,7 +541,7 @@ typedef struct bTheme { /* See COLLECTION_COLOR_TOT for the number of collection colors. */ ThemeCollectionColor collection_color[8]; - /* See SEQUENCE_COLOR_TOT for the total number of strip colors. */ + /* See STRIP_COLOR_TOT for the total number of strip colors. */ ThemeStripColor strip_color[9]; int active_theme_area; diff --git a/source/blender/makesdna/intern/dna_defaults.c b/source/blender/makesdna/intern/dna_defaults.c index 2fa60fe21dea..2a4c0208be49 100644 --- a/source/blender/makesdna/intern/dna_defaults.c +++ b/source/blender/makesdna/intern/dna_defaults.c @@ -61,6 +61,7 @@ #define DNA_DEPRECATED_ALLOW +#include #include #include #include @@ -69,6 +70,7 @@ #include "MEM_guardedalloc.h" #include "BLI_endian_switch.h" +#include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLI_memarena.h" #include "BLI_utildefines.h" diff --git a/source/blender/makesdna/intern/dna_genfile.cc b/source/blender/makesdna/intern/dna_genfile.cc index ccd02361f6b6..0a658e643618 100644 --- a/source/blender/makesdna/intern/dna_genfile.cc +++ b/source/blender/makesdna/intern/dna_genfile.cc @@ -23,7 +23,6 @@ #include "BLI_endian_switch.h" #include "BLI_math_matrix_types.hh" #include "BLI_memarena.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/makesdna/intern/dna_utils.h b/source/blender/makesdna/intern/dna_utils.h index f5cd01749c28..f0363e9f21e2 100644 --- a/source/blender/makesdna/intern/dna_utils.h +++ b/source/blender/makesdna/intern/dna_utils.h @@ -8,6 +8,8 @@ #pragma once +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/makesrna/intern/rna_ID.cc b/source/blender/makesrna/intern/rna_ID.cc index 6c2c576567da..c20428c1c059 100644 --- a/source/blender/makesrna/intern/rna_ID.cc +++ b/source/blender/makesrna/intern/rna_ID.cc @@ -6,22 +6,13 @@ * \ingroup RNA */ -#include #include #include "DNA_ID.h" #include "DNA_material_types.h" -#include "DNA_object_types.h" -#include "DNA_vfont_types.h" -#include "BLI_utildefines.h" - -#include "BKE_icons.h" #include "BKE_lib_id.hh" -#include "BKE_main_namemap.hh" -#include "BKE_object.hh" -#include "RNA_access.hh" #include "RNA_define.hh" #include "RNA_enum_types.hh" @@ -219,6 +210,7 @@ const IDFilterEnumPropertyItem rna_enum_id_type_filter_items[] = { # include "BKE_anim_data.hh" # include "BKE_global.hh" /* XXX, remove me */ +# include "BKE_icons.h" # include "BKE_idprop.hh" # include "BKE_idtype.hh" # include "BKE_lib_override.hh" diff --git a/source/blender/makesrna/intern/rna_access.cc b/source/blender/makesrna/intern/rna_access.cc index 7f101e7ad9e0..54f6e0271298 100644 --- a/source/blender/makesrna/intern/rna_access.cc +++ b/source/blender/makesrna/intern/rna_access.cc @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -19,19 +18,15 @@ #include "DNA_ID.h" #include "DNA_anim_types.h" -#include "DNA_constraint_types.h" -#include "DNA_modifier_types.h" #include "DNA_scene_types.h" #include "DNA_windowmanager_types.h" -#include "BLI_alloca.h" -#include "BLI_blenlib.h" #include "BLI_dynstr.h" #include "BLI_ghash.h" +#include "BLI_string.h" #include "BLI_threads.h" #include "BLI_utildefines.h" -#include "BLF_api.hh" #include "BLT_translation.hh" #include "BKE_anim_data.hh" @@ -3874,9 +3869,18 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) int RNA_property_enum_get_default(PointerRNA * /*ptr*/, PropertyRNA *prop) { EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop); - BLI_assert(RNA_property_type(prop) == PROP_ENUM); + if (prop->magic != RNA_MAGIC) { + const IDProperty *idprop = reinterpret_cast(prop); + if (idprop->ui_data) { + BLI_assert(idprop->type == IDP_INT); + const IDPropertyUIDataInt *ui_data = reinterpret_cast( + idprop->ui_data); + return ui_data->default_value; + } + } + return eprop->defaultvalue; } diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index 6638ff721b1e..98b5e00adea6 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -18,13 +18,11 @@ #include "DNA_anim_types.h" #include "DNA_camera_types.h" #include "DNA_constraint_types.h" -#include "DNA_gpencil_modifier_types.h" #include "DNA_key_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "BLI_listbase.h" -#include "BLI_string.h" #include "BLI_utildefines.h" // #define DEBUG_OVERRIDE_TIMEIT @@ -41,7 +39,6 @@ #include "BKE_main.hh" #include "RNA_access.hh" -#include "RNA_define.hh" #include "RNA_enum_types.hh" #include "RNA_path.hh" #include "RNA_prototypes.hh" diff --git a/source/blender/makesrna/intern/rna_action.cc b/source/blender/makesrna/intern/rna_action.cc index 13f178dd7281..79e95ad3a78c 100644 --- a/source/blender/makesrna/intern/rna_action.cc +++ b/source/blender/makesrna/intern/rna_action.cc @@ -12,10 +12,6 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" -#include "MEM_guardedalloc.h" - -#include "BLI_utildefines.h" - #include "BLT_translation.hh" #include "BKE_action.hh" @@ -28,7 +24,6 @@ #include "rna_internal.hh" #include "ANIM_action.hh" -#include "ANIM_action_legacy.hh" #include "WM_types.hh" diff --git a/source/blender/makesrna/intern/rna_action_api.cc b/source/blender/makesrna/intern/rna_action_api.cc index bf79f190a27e..65c0a2685efa 100644 --- a/source/blender/makesrna/intern/rna_action_api.cc +++ b/source/blender/makesrna/intern/rna_action_api.cc @@ -6,17 +6,12 @@ * \ingroup RNA */ -#include #include #include #include -#include "BLI_utildefines.h" - #include "RNA_define.hh" -#include "DNA_action_types.h" - #include "rna_internal.hh" /* own include */ #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_animation.cc b/source/blender/makesrna/intern/rna_animation.cc index ddb7e3eb1a20..fe7d8f7b86e8 100644 --- a/source/blender/makesrna/intern/rna_animation.cc +++ b/source/blender/makesrna/intern/rna_animation.cc @@ -8,20 +8,12 @@ #include -#include "DNA_action_types.h" #include "DNA_anim_types.h" -#include "DNA_scene_types.h" - -#include "BLI_listbase_wrapper.hh" -#include "BLI_utildefines.h" #include "BLT_translation.hh" -#include "MEM_guardedalloc.h" - #include "BKE_nla.hh" -#include "RNA_access.hh" #include "RNA_define.hh" #include "RNA_enum_types.hh" @@ -32,9 +24,6 @@ #include "ED_keyframing.hh" -#include "ANIM_action.hh" -#include "ANIM_keyingsets.hh" - using namespace blender; /* exported for use in API */ @@ -117,7 +106,9 @@ const EnumPropertyItem rna_enum_keying_flag_api_items[] = { # include "BKE_fcurve.hh" # include "BKE_nla.hh" +# include "ANIM_action.hh" # include "ANIM_action_legacy.hh" +# include "ANIM_keyingsets.hh" # include "DEG_depsgraph.hh" # include "DEG_depsgraph_build.hh" diff --git a/source/blender/makesrna/intern/rna_attribute.cc b/source/blender/makesrna/intern/rna_attribute.cc index 60be568beeee..b4d24f55e1f7 100644 --- a/source/blender/makesrna/intern/rna_attribute.cc +++ b/source/blender/makesrna/intern/rna_attribute.cc @@ -642,7 +642,7 @@ int rna_AttributeGroup_length(PointerRNA *ptr) bool rna_AttributeGroup_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) { - AttributeOwner owner = owner_from_attribute_pointer_rna(ptr); + AttributeOwner owner = owner_from_pointer_rna(ptr); if (CustomDataLayer *layer = BKE_attribute_search_for_write( owner, key, CD_MASK_PROP_ALL, ATTR_DOMAIN_MASK_ALL)) diff --git a/source/blender/makesrna/intern/rna_color.cc b/source/blender/makesrna/intern/rna_color.cc index 9c49ca3029c8..a87bf8d2cf78 100644 --- a/source/blender/makesrna/intern/rna_color.cc +++ b/source/blender/makesrna/intern/rna_color.cc @@ -72,6 +72,38 @@ const EnumPropertyItem rna_enum_color_space_convert_default_items[] = { # include "SEQ_relations.hh" # include "SEQ_thumbnail_cache.hh" +struct SeqCurveMappingUpdateData { + Scene *scene; + CurveMapping *curve; +}; + +static bool seq_update_modifier_curve(Strip *strip, void *user_data) +{ + /* Invalidate cache of any strips that have modifiers using this + * curve mapping. */ + SeqCurveMappingUpdateData *data = static_cast(user_data); + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { + if (smd->type == seqModifierType_Curves) { + CurvesModifierData *cmd = reinterpret_cast(smd); + if (&cmd->curve_mapping == data->curve) { + SEQ_relations_invalidate_cache_preprocessed(data->scene, strip); + } + } + } + return true; +} + +static void seq_notify_curve_update(CurveMapping *curve, ID *id) +{ + if (id && GS(id->name) == ID_SCE) { + Scene *scene = (Scene *)id; + if (scene->ed) { + SeqCurveMappingUpdateData data{scene, curve}; + SEQ_for_each_callback(&scene->ed->seqbase, seq_update_modifier_curve, &data); + } + } +} + static int rna_CurveMapping_curves_length(PointerRNA *ptr) { CurveMapping *cumap = (CurveMapping *)ptr->data; @@ -141,6 +173,7 @@ static void rna_CurveMapping_tone_update(Main * /*bmain*/, Scene * /*scene*/, Po curve_mapping->cur = 3; } + seq_notify_curve_update(curve_mapping, ptr->owner_id); WM_main_add_notifier(NC_NODE | NA_EDITED, nullptr); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); } @@ -326,7 +359,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr for (node = static_cast(ntree->nodes.first); node; node = node->next) { if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } break; @@ -630,11 +663,11 @@ struct Seq_colorspace_cb_data { * If property pointer matches one of strip, set `r_seq`, * so not all cached images have to be invalidated. */ -static bool seq_find_colorspace_settings_cb(Strip *seq, void *user_data) +static bool strip_find_colorspace_settings_cb(Strip *strip, void *user_data) { Seq_colorspace_cb_data *cd = (Seq_colorspace_cb_data *)user_data; - if (seq->data && &seq->data->colorspace_settings == cd->colorspace_settings) { - cd->r_seq = seq; + if (strip->data && &strip->data->colorspace_settings == cd->colorspace_settings) { + cd->r_seq = strip; return false; } return true; @@ -687,18 +720,18 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, } else { /* Strip colorspace was likely changed. */ - SEQ_for_each_callback(&scene->ed->seqbase, seq_find_colorspace_settings_cb, &cb_data); - Strip *seq = cb_data.r_seq; + SEQ_for_each_callback(&scene->ed->seqbase, strip_find_colorspace_settings_cb, &cb_data); + Strip *strip = cb_data.r_seq; - if (seq) { - SEQ_relations_sequence_free_anim(seq); + if (strip) { + SEQ_relations_sequence_free_anim(strip); - if (seq->data->proxy && seq->data->proxy->anim) { - MOV_close(seq->data->proxy->anim); - seq->data->proxy->anim = nullptr; + if (strip->data->proxy && strip->data->proxy->anim) { + MOV_close(strip->data->proxy->anim); + strip->data->proxy->anim = nullptr; } - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); } } diff --git a/source/blender/makesrna/intern/rna_image.cc b/source/blender/makesrna/intern/rna_image.cc index 6acba2014259..74078d3848ee 100644 --- a/source/blender/makesrna/intern/rna_image.cc +++ b/source/blender/makesrna/intern/rna_image.cc @@ -254,7 +254,7 @@ static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr) if (GS(id->name) == ID_NT) { /* Special update for node-trees. */ BKE_ntree_update_tag_image_user_changed((bNodeTree *)id, iuser); - ED_node_tree_propagate_change(nullptr, bmain, nullptr); + ED_node_tree_propagate_change(bmain, nullptr); } else { /* Update material or texture for render preview. */ diff --git a/source/blender/makesrna/intern/rna_main_api.cc b/source/blender/makesrna/intern/rna_main_api.cc index 27e976061146..ba562c6949b5 100644 --- a/source/blender/makesrna/intern/rna_main_api.cc +++ b/source/blender/makesrna/intern/rna_main_api.cc @@ -293,7 +293,7 @@ static bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type) blender::bke::bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type); if (typeinfo) { bNodeTree *ntree = blender::bke::node_tree_add_tree(bmain, safe_name, typeinfo->idname); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); id_us_min(&ntree->id); return ntree; diff --git a/source/blender/makesrna/intern/rna_modifier.cc b/source/blender/makesrna/intern/rna_modifier.cc index b76d3eb8aa7b..b8e25de20f94 100644 --- a/source/blender/makesrna/intern/rna_modifier.cc +++ b/source/blender/makesrna/intern/rna_modifier.cc @@ -22,6 +22,9 @@ #include "MEM_guardedalloc.h" +#include "BLI_math_base.h" +#include "BLI_math_rotation.h" + #include "BLT_translation.hh" #include "BKE_animsys.h" diff --git a/source/blender/makesrna/intern/rna_node_socket.cc b/source/blender/makesrna/intern/rna_node_socket.cc index 858c42e50d35..0a032289f751 100644 --- a/source/blender/makesrna/intern/rna_node_socket.cc +++ b/source/blender/makesrna/intern/rna_node_socket.cc @@ -156,12 +156,12 @@ static StructRNA *rna_NodeSocket_register(Main * /*bmain*/, StructCallbackFunc call, StructFreeFunc free) { - blender::bke::bNodeSocketType *st, dummy_st; + blender::bke::bNodeSocketType *st; bNodeSocket dummy_sock; bool have_function[3]; /* setup dummy socket & socket type to store static properties in */ - memset(&dummy_st, 0, sizeof(blender::bke::bNodeSocketType)); + blender::bke::bNodeSocketType dummy_st = {}; dummy_st.type = SOCK_CUSTOM; memset(&dummy_sock, 0, sizeof(bNodeSocket)); @@ -186,14 +186,11 @@ static StructRNA *rna_NodeSocket_register(Main * /*bmain*/, st = blender::bke::node_socket_type_find(dummy_st.idname); if (!st) { /* create a new node socket type */ - st = static_cast( - MEM_mallocN(sizeof(blender::bke::bNodeSocketType), "node socket type")); - memcpy(st, &dummy_st, sizeof(dummy_st)); - + st = MEM_new(__func__, dummy_st); blender::bke::node_register_socket_type(st); } - st->free_self = (void (*)(blender::bke::bNodeSocketType *stype))MEM_freeN; + st->free_self = [](blender::bke::bNodeSocketType *stype) { MEM_delete(stype); }; /* if RNA type is already registered, unregister first */ if (st->ext_socket.srna) { @@ -201,7 +198,7 @@ static StructRNA *rna_NodeSocket_register(Main * /*bmain*/, RNA_struct_free_extension(srna, &st->ext_socket); RNA_struct_free(&BLENDER_RNA, srna); } - st->ext_socket.srna = RNA_def_struct_ptr(&BLENDER_RNA, st->idname, &RNA_NodeSocket); + st->ext_socket.srna = RNA_def_struct_ptr(&BLENDER_RNA, st->idname.c_str(), &RNA_NodeSocket); st->ext_socket.data = data; st->ext_socket.call = call; st->ext_socket.free = free; @@ -276,6 +273,69 @@ static void rna_NodeSocket_type_set(PointerRNA *ptr, int value) blender::bke::node_modify_socket_type_static(ntree, &node, sock, value, 0); } +static void rna_NodeSocket_bl_idname_get(PointerRNA *ptr, char *value) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + blender::StringRef(ntype->idname).unsafe_copy(value); +} + +static int rna_NodeSocket_bl_idname_length(PointerRNA *ptr) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + return ntype->idname.size(); +} + +static void rna_NodeSocket_bl_idname_set(PointerRNA *ptr, const char *value) +{ + bNodeSocket *node = static_cast(ptr->data); + blender::bke::bNodeSocketType *ntype = node->typeinfo; + ntype->idname = value; +} + +static void rna_NodeSocket_bl_label_get(PointerRNA *ptr, char *value) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + blender::StringRef(ntype->label).unsafe_copy(value); +} + +static int rna_NodeSocket_bl_label_length(PointerRNA *ptr) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + return ntype->label.size(); +} + +static void rna_NodeSocket_bl_label_set(PointerRNA *ptr, const char *value) +{ + bNodeSocket *node = static_cast(ptr->data); + blender::bke::bNodeSocketType *ntype = node->typeinfo; + ntype->label = value; +} + +static void rna_NodeSocket_bl_subtype_label_get(PointerRNA *ptr, char *value) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + blender::StringRef(ntype->subtype_label).unsafe_copy(value); +} + +static int rna_NodeSocket_bl_subtype_label_length(PointerRNA *ptr) +{ + const bNodeSocket *node = static_cast(ptr->data); + const blender::bke::bNodeSocketType *ntype = node->typeinfo; + return ntype->subtype_label.size(); +} + +static void rna_NodeSocket_bl_subtype_label_set(PointerRNA *ptr, const char *value) +{ + bNodeSocket *node = static_cast(ptr->data); + blender::bke::bNodeSocketType *ntype = node->typeinfo; + ntype->subtype_label = value; +} + static bool rna_NodeSocket_is_linked_get(PointerRNA *ptr) { bNodeTree *ntree = reinterpret_cast(ptr->owner_id); @@ -290,7 +350,7 @@ static void rna_NodeSocket_update(Main *bmain, Scene * /*scene*/, PointerRNA *pt bNodeSocket *sock = static_cast(ptr->data); BKE_ntree_update_tag_socket_property(ntree, sock); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static void rna_NodeSocket_enabled_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) @@ -299,7 +359,7 @@ static void rna_NodeSocket_enabled_update(Main *bmain, Scene * /*scene*/, Pointe bNodeSocket *sock = static_cast(ptr->data); BKE_ntree_update_tag_socket_availability(ntree, sock); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static bool rna_NodeSocket_is_output_get(PointerRNA *ptr) @@ -680,17 +740,26 @@ static void rna_def_node_socket(BlenderRNA *brna) /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->idname"); + RNA_def_property_string_funcs(prop, + "rna_NodeSocket_bl_idname_get", + "rna_NodeSocket_bl_idname_length", + "rna_NodeSocket_bl_idname_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "ID Name", ""); prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->label"); + RNA_def_property_string_funcs(prop, + "rna_NodeSocket_bl_label_get", + "rna_NodeSocket_bl_label_length", + "rna_NodeSocket_bl_label_set"); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_ui_text(prop, "Type Label", "Label to display for the socket type in the UI"); prop = RNA_def_property(srna, "bl_subtype_label", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->subtype_label"); + RNA_def_property_string_funcs(prop, + "rna_NodeSocket_bl_subtype_label_get", + "rna_NodeSocket_bl_subtype_label_length", + "rna_NodeSocket_bl_subtype_label_set"); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_ui_text( prop, "Subtype Label", "Label to display for the socket subtype in the UI"); diff --git a/source/blender/makesrna/intern/rna_node_tree_interface.cc b/source/blender/makesrna/intern/rna_node_tree_interface.cc index 35fce42052f0..e90bad9488d8 100644 --- a/source/blender/makesrna/intern/rna_node_tree_interface.cc +++ b/source/blender/makesrna/intern/rna_node_tree_interface.cc @@ -62,7 +62,7 @@ static void rna_NodeTreeInterfaceItem_update(Main *bmain, Scene * /*scene*/, Poi return; } ntree->tree_interface.tag_items_changed(); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static StructRNA *rna_NodeTreeInterfaceItem_refine(PointerRNA *ptr) @@ -286,13 +286,13 @@ static StructRNA *rna_NodeTreeInterfaceSocket_register(Main * /*bmain*/, } else { /* Create a new node socket type. */ - st = MEM_cnew(__func__); - BLI_strncpy(st->idname, dummy_socket.socket_type, sizeof(st->idname)); + st = MEM_new(__func__); + st->idname = dummy_socket.socket_type; blender::bke::node_register_socket_type(st); } - st->free_self = (void (*)(blender::bke::bNodeSocketType *stype))MEM_freeN; + st->free_self = [](blender::bke::bNodeSocketType *type) { MEM_delete(type); }; /* if RNA type is already registered, unregister first */ if (st->ext_interface.srna) { @@ -535,7 +535,7 @@ static bNodeTreeInterfaceSocket *rna_NodeTreeInterfaceItems_new_socket( return nullptr; } } - const char *socket_type = typeinfo->idname; + const blender::StringRef socket_type = typeinfo->idname; NodeTreeInterfaceSocketFlag flag = NodeTreeInterfaceSocketFlag(in_out); bNodeTreeInterfaceSocket *socket = interface->add_socket( name, description, socket_type, flag, parent); @@ -544,7 +544,7 @@ static bNodeTreeInterfaceSocket *rna_NodeTreeInterfaceItems_new_socket( BKE_report(reports, RPT_ERROR, "Unable to create socket"); } else { - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -570,7 +570,7 @@ static bNodeTreeInterfacePanel *rna_NodeTreeInterfaceItems_new_panel(ID *id, } else { bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -607,7 +607,7 @@ static bNodeTreeInterfaceItem *rna_NodeTreeInterfaceItems_copy_to_parent( } else { bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -634,7 +634,7 @@ static void rna_NodeTreeInterfaceItems_remove(ID *id, interface->remove_item(*item, move_content_to_parent); bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -643,7 +643,7 @@ static void rna_NodeTreeInterfaceItems_clear(ID *id, bNodeTreeInterface *interfa interface->clear_items(); bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -656,7 +656,7 @@ static void rna_NodeTreeInterfaceItems_move(ID *id, interface->move_item(*item, to_position); bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -671,7 +671,7 @@ static void rna_NodeTreeInterfaceItems_move_to_parent(ID *id, interface->move_item_to_parent(*item, parent, to_position); bNodeTree *ntree = reinterpret_cast(id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index fd0b6c6d1932..f680c0dc8c47 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -14,6 +15,7 @@ #include "BLI_function_ref.hh" #include "BLI_linear_allocator.hh" +#include "BLI_math_base.hh" #include "BLI_math_rotation.h" #include "BLI_string.h" #include "BLI_string_utf8_symbols.h" @@ -693,7 +695,7 @@ int rna_node_tree_idname_to_enum(const char *idname) Span types = bke::node_tree_types_get(); for (const int i : types.index_range()) { const bke::bNodeTreeType *nt = types[i]; - if (STREQ(nt->idname, idname)) { + if (nt->idname == idname) { return i; } } @@ -722,10 +724,10 @@ const EnumPropertyItem *rna_node_tree_type_itemf( } tmp.value = i; - tmp.identifier = nt->idname; + tmp.identifier = nt->idname.c_str(); tmp.icon = nt->ui_icon; - tmp.name = nt->ui_name; - tmp.description = nt->ui_description; + tmp.name = nt->ui_name.c_str(); + tmp.description = nt->ui_description.c_str(); RNA_enum_item_add(&item, &totitem, &tmp); } @@ -747,7 +749,7 @@ int rna_node_socket_idname_to_enum(const char *idname) Span types = bke::node_socket_types_get(); for (const int i : types.index_range()) { const bke::bNodeSocketType *nt = types[i]; - if (STREQ(nt->idname, idname)) { + if (nt->idname == idname) { return i; } } @@ -778,7 +780,7 @@ const EnumPropertyItem *rna_node_socket_type_itemf( srna = stype->ext_socket.srna; tmp.value = i; - tmp.identifier = stype->idname; + tmp.identifier = stype->idname.c_str(); tmp.icon = RNA_struct_ui_icon(srna); tmp.name = blender::bke::node_socket_type_label(stype).c_str(); tmp.description = RNA_struct_ui_description(srna); @@ -813,7 +815,7 @@ static const char *get_legacy_node_type(const PointerRNA *ptr) if (ntype->enum_name_legacy) { return ntype->enum_name_legacy; } - return ntype->idname; + return ntype->idname.c_str(); } static int rna_node_type_length(PointerRNA *ptr) @@ -830,6 +832,69 @@ static void rna_node_type_get(PointerRNA *ptr, char *value) strcpy(value, legacy_type); } +static void rna_Node_bl_idname_get(PointerRNA *ptr, char *value) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + blender::StringRef(ntype->idname).unsafe_copy(value); +} + +static int rna_Node_bl_idname_length(PointerRNA *ptr) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + return ntype->idname.size(); +} + +static void rna_Node_bl_idname_set(PointerRNA *ptr, const char *value) +{ + bNode *node = static_cast(ptr->data); + blender::bke::bNodeType *ntype = node->typeinfo; + ntype->idname = value; +} + +static void rna_Node_bl_label_get(PointerRNA *ptr, char *value) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + blender::StringRef(ntype->ui_name).unsafe_copy(value); +} + +static int rna_Node_bl_label_length(PointerRNA *ptr) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + return ntype->ui_name.size(); +} + +static void rna_Node_bl_label_set(PointerRNA *ptr, const char *value) +{ + bNode *node = static_cast(ptr->data); + blender::bke::bNodeType *ntype = node->typeinfo; + ntype->ui_name = value; +} + +static void rna_Node_bl_description_get(PointerRNA *ptr, char *value) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + blender::StringRef(ntype->ui_description).unsafe_copy(value); +} + +static int rna_Node_bl_description_length(PointerRNA *ptr) +{ + const bNode *node = static_cast(ptr->data); + const blender::bke::bNodeType *ntype = node->typeinfo; + return ntype->ui_description.size(); +} + +static void rna_Node_bl_description_set(PointerRNA *ptr, const char *value) +{ + bNode *node = static_cast(ptr->data); + blender::bke::bNodeType *ntype = node->typeinfo; + ntype->ui_description = value; +} + static float2 node_parent_offset(const bNode &node) { return node.parent ? float2(node.parent->location[0], node.parent->location[1]) : float2(0); @@ -991,12 +1056,12 @@ static StructRNA *rna_NodeTree_register(Main *bmain, StructCallbackFunc call, StructFreeFunc free) { - blender::bke::bNodeTreeType *nt, dummy_nt; + blender::bke::bNodeTreeType *nt; bNodeTree dummy_ntree; bool have_function[4]; /* setup dummy tree & tree type to store static properties in */ - memset(&dummy_nt, 0, sizeof(blender::bke::bNodeTreeType)); + blender::bke::bNodeTreeType dummy_nt = {}; memset(&dummy_ntree, 0, sizeof(bNodeTree)); dummy_ntree.typeinfo = &dummy_nt; PointerRNA dummy_ntree_ptr = RNA_pointer_create(nullptr, &RNA_NodeTree, &dummy_ntree); @@ -1006,12 +1071,12 @@ static StructRNA *rna_NodeTree_register(Main *bmain, return nullptr; } - if (strlen(identifier) >= sizeof(dummy_nt.idname)) { + if (strlen(identifier) >= sizeof(dummy_ntree.idname)) { BKE_reportf(reports, RPT_ERROR, "Registering node tree class: '%s' is too long, maximum length is %d", identifier, - int(sizeof(dummy_nt.idname))); + int(sizeof(dummy_ntree.idname))); return nullptr; } @@ -1023,7 +1088,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain, "Registering node tree class: '%s', bl_idname '%s' has been registered before, " "unregistering previous", identifier, - dummy_nt.idname); + dummy_nt.idname.c_str()); /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */ if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) { @@ -1031,25 +1096,23 @@ static StructRNA *rna_NodeTree_register(Main *bmain, RPT_ERROR, "Registering node tree class: '%s', bl_idname '%s' could not be unregistered", identifier, - dummy_nt.idname); + dummy_nt.idname.c_str()); return nullptr; } } /* create a new node tree type */ - nt = static_cast( - MEM_mallocN(sizeof(blender::bke::bNodeTreeType), "node tree type")); - memcpy(nt, &dummy_nt, sizeof(dummy_nt)); + nt = MEM_new(__func__, dummy_nt); nt->type = NTREE_CUSTOM; - nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, &RNA_NodeTree); + nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname.c_str(), &RNA_NodeTree); nt->rna_ext.data = data; nt->rna_ext.call = call; nt->rna_ext.free = free; RNA_struct_blender_type_set(nt->rna_ext.srna, nt); - RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name, nt->ui_description); + RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name.c_str(), nt->ui_description.c_str()); RNA_def_struct_ui_icon(nt->rna_ext.srna, nt->ui_icon); nt->poll = (have_function[0]) ? rna_NodeTree_poll : nullptr; @@ -1089,7 +1152,7 @@ static void rna_NodeTree_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) WM_main_add_notifier(NC_NODE | NA_EDITED, &ntree->id); WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static void rna_NodeTree_update_asset(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -1201,7 +1264,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, } Main *bmain = CTX_data_main(C); - ED_node_tree_propagate_change(C, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return node; @@ -1227,7 +1290,7 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, RNA_POINTER_INVALIDATE(node_ptr); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -1247,7 +1310,7 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *r node = next_node; } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -1369,7 +1432,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, fromsock->flag &= ~SOCK_HIDDEN; tosock->flag &= ~SOCK_HIDDEN; - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } return ret; @@ -1394,7 +1457,7 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, blender::bke::node_remove_link(ntree, link); RNA_POINTER_INVALIDATE(link_ptr); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -1413,7 +1476,7 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *r link = next_link; } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -1422,6 +1485,69 @@ static bool rna_NodeTree_contains_tree(bNodeTree *tree, bNodeTree *sub_tree) return blender::bke::node_tree_contains_tree(tree, sub_tree); } +static void rna_NodeTree_bl_idname_get(PointerRNA *ptr, char *value) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + blender::StringRef(ntype->idname).unsafe_copy(value); +} + +static int rna_NodeTree_bl_idname_length(PointerRNA *ptr) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + return ntype->idname.size(); +} + +static void rna_NodeTree_bl_idname_set(PointerRNA *ptr, const char *value) +{ + bNodeTree *node = static_cast(ptr->data); + blender::bke::bNodeTreeType *ntype = node->typeinfo; + ntype->idname = value; +} + +static void rna_NodeTree_bl_label_get(PointerRNA *ptr, char *value) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + blender::StringRef(ntype->ui_name).unsafe_copy(value); +} + +static int rna_NodeTree_bl_label_length(PointerRNA *ptr) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + return ntype->ui_name.size(); +} + +static void rna_NodeTree_bl_label_set(PointerRNA *ptr, const char *value) +{ + bNodeTree *node = static_cast(ptr->data); + blender::bke::bNodeTreeType *ntype = node->typeinfo; + ntype->ui_name = value; +} + +static void rna_NodeTree_bl_description_get(PointerRNA *ptr, char *value) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + blender::StringRef(ntype->ui_description).unsafe_copy(value); +} + +static int rna_NodeTree_bl_description_length(PointerRNA *ptr) +{ + const bNodeTree *node = static_cast(ptr->data); + const blender::bke::bNodeTreeType *ntype = node->typeinfo; + return ntype->ui_description.size(); +} + +static void rna_NodeTree_bl_description_set(PointerRNA *ptr, const char *value) +{ + bNodeTree *node = static_cast(ptr->data); + blender::bke::bNodeTreeType *ntype = node->typeinfo; + ntype->ui_description = value; +} + static void rna_NodeTree_debug_lazy_function_graph(bNodeTree *tree, bContext *C, const char **r_str, @@ -1503,7 +1629,7 @@ static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C) { Main *bmain = CTX_data_main(C); ntree->tree_interface.tag_items_changed(); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } /* ******** NodeLink ******** */ @@ -1526,7 +1652,7 @@ static void rna_NodeLink_swap_multi_input_sort_id( bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_link_changed(ntree); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -1831,14 +1957,14 @@ static blender::bke::bNodeType *rna_Node_register_base(Main *bmain, StructCallbackFunc call, StructFreeFunc free) { - blender::bke::bNodeType *nt, dummy_nt; + blender::bke::bNodeType *nt; bNode dummy_node; FunctionRNA *func; PropertyRNA *parm; bool have_function[10]; /* setup dummy node & node type to store static properties in */ - memset(&dummy_nt, 0, sizeof(blender::bke::bNodeType)); + blender::bke::bNodeType dummy_nt = {}; /* this does some additional initialization of default values */ blender::bke::node_type_base_custom(&dummy_nt, identifier, "", "CUSTOM", 0); @@ -1851,12 +1977,12 @@ static blender::bke::bNodeType *rna_Node_register_base(Main *bmain, return nullptr; } - if (strlen(identifier) >= sizeof(dummy_nt.idname)) { + if (strlen(identifier) >= sizeof(dummy_node.idname)) { BKE_reportf(reports, RPT_ERROR, "Registering node class: '%s' is too long, maximum length is %d", identifier, - int(sizeof(dummy_nt.idname))); + int(sizeof(dummy_node.idname))); return nullptr; } @@ -1869,7 +1995,7 @@ static blender::bke::bNodeType *rna_Node_register_base(Main *bmain, RPT_ERROR, "Registering node class: '%s', bl_idname '%s' is a builtin node", identifier, - dummy_nt.idname); + dummy_nt.idname.c_str()); return nullptr; } @@ -1878,7 +2004,7 @@ static blender::bke::bNodeType *rna_Node_register_base(Main *bmain, "Registering node class: '%s', bl_idname '%s' has been registered before, " "unregistering previous", identifier, - dummy_nt.idname); + dummy_nt.idname.c_str()); /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for nullptr. */ if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) { @@ -1886,24 +2012,22 @@ static blender::bke::bNodeType *rna_Node_register_base(Main *bmain, RPT_ERROR, "Registering node class: '%s', bl_idname '%s' could not be unregistered", identifier, - dummy_nt.idname); + dummy_nt.idname.c_str()); return nullptr; } } /* create a new node type */ - nt = static_cast( - MEM_mallocN(sizeof(blender::bke::bNodeType), "node type")); - memcpy(nt, &dummy_nt, sizeof(dummy_nt)); - nt->free_self = reinterpret_cast(MEM_freeN); + nt = MEM_new(__func__, dummy_nt); + nt->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); }; - nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype); + nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname.c_str(), basetype); nt->rna_ext.data = data; nt->rna_ext.call = call; nt->rna_ext.free = free; RNA_struct_blender_type_set(nt->rna_ext.srna, nt); - RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name, nt->ui_description); + RNA_def_struct_ui_text(nt->rna_ext.srna, nt->ui_name.c_str(), nt->ui_description.c_str()); RNA_def_struct_ui_icon(nt->rna_ext.srna, nt->ui_icon); func = RNA_def_function_runtime( @@ -2376,7 +2500,71 @@ void rna_Node_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) bNodeTree *ntree = reinterpret_cast(ptr->owner_id); bNode *node = static_cast(ptr->data); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); +} + +static void rna_NodeCrop_min_x_set(PointerRNA *ptr, int value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->x1 = value; + CLAMP_MAX(data->x1, data->x2); +} + +static void rna_NodeCrop_max_x_set(PointerRNA *ptr, int value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->x2 = value; + CLAMP_MIN(data->x2, data->x1); +} + +static void rna_NodeCrop_min_y_set(PointerRNA *ptr, int value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->y1 = value; + CLAMP_MIN(data->y1, data->y2); +} + +static void rna_NodeCrop_max_y_set(PointerRNA *ptr, int value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->y2 = value; + CLAMP_MAX(data->y2, data->y1); +} + +static void rna_NodeCrop_rel_min_x_set(PointerRNA *ptr, float value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->fac_x1 = value; + CLAMP_MAX(data->fac_x1, data->fac_x2); +} + +static void rna_NodeCrop_rel_max_x_set(PointerRNA *ptr, float value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->fac_x2 = value; + CLAMP_MIN(data->fac_x2, data->fac_x1); +} + +static void rna_NodeCrop_rel_min_y_set(PointerRNA *ptr, float value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->fac_y1 = value; + CLAMP_MIN(data->fac_y1, data->fac_y2); +} + +static void rna_NodeCrop_rel_max_y_set(PointerRNA *ptr, float value) +{ + bNode *node = static_cast(ptr->data); + NodeTwoXYs *data = static_cast(node->storage); + data->fac_y2 = value; + CLAMP_MAX(data->fac_y2, data->fac_y1); } void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -2388,7 +2576,7 @@ void rna_Node_update_relations(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Node_socket_value_update(ID *id, bNode * /*node*/, bContext *C) { BKE_ntree_update_tag_all(reinterpret_cast(id)); - ED_node_tree_propagate_change(C, CTX_data_main(C), reinterpret_cast(id)); + ED_node_tree_propagate_change(CTX_data_main(C), reinterpret_cast(id)); } static void rna_Node_select_set(PointerRNA *ptr, bool value) @@ -2494,7 +2682,7 @@ static bNodeSocket *rna_Node_inputs_new(ID *id, if (use_multi_input) { sock->flag |= SOCK_MULTI_INPUT; } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2532,7 +2720,7 @@ static bNodeSocket *rna_Node_outputs_new(ID *id, BKE_report(reports, RPT_ERROR, "Unable to create socket"); } else { - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2555,7 +2743,7 @@ static void rna_Node_socket_remove( else { blender::bke::node_remove_socket(ntree, node, sock); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } } @@ -2575,7 +2763,7 @@ static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain, ReportList * blender::bke::node_remove_socket(ntree, node, sock); } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2594,7 +2782,7 @@ static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain, ReportList blender::bke::node_remove_socket(ntree, node, sock); } - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2633,7 +2821,7 @@ static void rna_Node_inputs_move( } BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2672,7 +2860,7 @@ static void rna_Node_outputs_move( } BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -2798,7 +2986,7 @@ static void rna_NodeInternal_update(ID *id, bNode *node, Main *bmain) { bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, bContext *C, uiLayout *layout) @@ -2933,7 +3121,7 @@ static void rna_Node_tex_image_update(Main *bmain, Scene * /*scene*/, PointerRNA bNode *node = static_cast(ptr->data); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_IMAGE, nullptr); } @@ -2943,7 +3131,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr bNode *node = static_cast(ptr->data); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); DEG_relations_tag_update(bmain); } @@ -3379,6 +3567,152 @@ static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRN rna_Node_update(bmain, scene, ptr); } +/* -------------------------------------------------------------------- + * Glare Node Compatibility Setters/Getters. + * + * The Glare node properties are now deprecated and replaced corresponding inputs. So we provide + * setters/getters for compatibility until those are removed in 5.0. See the + * do_version_glare_node_options_to_inputs function for conversion + */ + +static float rna_NodeGlare_threshold_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Threshold"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return RNA_float_get(&input_rna_pointer, "default_value"); +} + +static void rna_NodeGlare_threshold_set(PointerRNA *ptr, const float value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Threshold"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_float_set(&input_rna_pointer, "default_value", value); +} + +static float rna_NodeGlare_mix_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Strength"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return RNA_float_get(&input_rna_pointer, "default_value") - 1; +} + +static void rna_NodeGlare_mix_set(PointerRNA *ptr, const float value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Strength"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + const float mix_value = 1.0f - blender::math::clamp(-value, 0.0f, 1.0f); + RNA_float_set(&input_rna_pointer, "default_value", mix_value); +} + +static int rna_NodeGlare_size_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Size"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + const float size_value = RNA_float_get(&input_rna_pointer, "default_value"); + if (size_value == 0.0f) { + return 1; + } + return blender::math::max(1, 9 - int(-std::log2(size_value))); +} + +static void rna_NodeGlare_size_set(PointerRNA *ptr, const int value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Size"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + const float size_value = blender::math::pow(2.0f, float(value - 9)); + RNA_float_set(&input_rna_pointer, "default_value", size_value); +} + +static int rna_NodeGlare_streaks_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Streaks"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return blender::math::clamp(RNA_int_get(&input_rna_pointer, "default_value"), 1, 16); +} + +static void rna_NodeGlare_streaks_set(PointerRNA *ptr, const int value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Streaks"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_int_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 1, 16)); +} + +static float rna_NodeGlare_angle_offset_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Streaks Angle"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return RNA_float_get(&input_rna_pointer, "default_value"); +} + +static void rna_NodeGlare_angle_offset_set(PointerRNA *ptr, const float value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Streaks Angle"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_float_set(&input_rna_pointer, "default_value", value); +} + +static int rna_NodeGlare_iterations_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Iterations"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return blender::math::clamp(RNA_int_get(&input_rna_pointer, "default_value"), 2, 5); +} + +static void rna_NodeGlare_iterations_set(PointerRNA *ptr, const int value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Iterations"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_int_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 2, 5)); +} + +static float rna_NodeGlare_fade_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Fade"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return blender::math::clamp(RNA_float_get(&input_rna_pointer, "default_value"), 0.75f, 1.0f); +} + +static void rna_NodeGlare_fade_set(PointerRNA *ptr, const float value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Fade"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_float_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 0.75f, 1.0f)); +} + +static float rna_NodeGlare_color_modulation_get(PointerRNA *ptr) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Color Modulation"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + return blender::math::clamp(RNA_float_get(&input_rna_pointer, "default_value"), 0.0f, 1.0f); +} + +static void rna_NodeGlare_color_modulation_set(PointerRNA *ptr, const float value) +{ + bNode *node = static_cast(ptr->data); + bNodeSocket *input = blender::bke::node_find_socket(node, SOCK_IN, "Color Modulation"); + PointerRNA input_rna_pointer = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, input); + RNA_float_set(&input_rna_pointer, "default_value", blender::math::clamp(value, 0.0f, 1.0f)); +} + +/* -------------------------------------------------------------------- + * White Balance Node. + */ + static void rna_NodeColorBalance_input_whitepoint_get(PointerRNA *ptr, float value[3]) { bNode *node = static_cast(ptr->data); @@ -3596,7 +3930,7 @@ static bool rna_Node_pair_with_output( output_node_id = output_node->identifier; BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(C, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return true; } @@ -3628,7 +3962,7 @@ static void rna_Node_ItemArray_remove(ID *id, bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -3639,7 +3973,7 @@ template static void rna_Node_ItemArray_clear(ID *id, bNode * bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -3656,7 +3990,7 @@ static void rna_Node_ItemArray_move( bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } @@ -3697,7 +4031,7 @@ static void rna_Node_ItemArray_item_update(Main *bmain, Scene * /*scene*/, Point BLI_assert(node != nullptr); BKE_ntree_update_tag_node_property(&ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, &ntree); + ED_node_tree_propagate_change(bmain, &ntree); } template @@ -3748,7 +4082,7 @@ typename Accessor::ItemT *rna_Node_ItemArray_new_with_socket_and_name( bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return new_item; @@ -3761,7 +4095,7 @@ static IndexSwitchItem *rna_NodeIndexSwitchItems_new(ID *id, bNode *node, Main * bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return new_item; @@ -3855,7 +4189,7 @@ static bNodeSocket *rna_NodeOutputFile_slots_new( sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format); - ED_node_tree_propagate_change(C, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return sock; @@ -3971,7 +4305,7 @@ static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *p } BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -4267,7 +4601,7 @@ static NodeEnumItem *rna_NodeMenuSwitchItems_new(ID *id, bNodeTree *ntree = reinterpret_cast(id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); return new_item; @@ -7657,48 +7991,56 @@ static void def_cmp_crop(StructRNA *srna) prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, nullptr, "x1"); + RNA_def_property_int_funcs(prop, nullptr, "rna_NodeCrop_min_x_set", nullptr); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "X1", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, nullptr, "x2"); + RNA_def_property_int_funcs(prop, nullptr, "rna_NodeCrop_max_x_set", nullptr); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "X2", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, nullptr, "y1"); + RNA_def_property_int_funcs(prop, nullptr, "rna_NodeCrop_min_y_set", nullptr); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Y1", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, nullptr, "y2"); + RNA_def_property_int_funcs(prop, nullptr, "rna_NodeCrop_max_y_set", nullptr); RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Y2", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "fac_x1"); + RNA_def_property_float_funcs(prop, nullptr, "rna_NodeCrop_rel_min_x_set", nullptr); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "X1", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "fac_x2"); + RNA_def_property_float_funcs(prop, nullptr, "rna_NodeCrop_rel_max_x_set", nullptr); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "X2", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "fac_y1"); + RNA_def_property_float_funcs(prop, nullptr, "rna_NodeCrop_rel_min_y_set", nullptr); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Y1", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "fac_y2"); + RNA_def_property_float_funcs(prop, nullptr, "rna_NodeCrop_rel_max_y_set", nullptr); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Y2", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); @@ -7835,54 +8177,57 @@ static void def_cmp_glare(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, nullptr, "iter"); + RNA_def_property_int_funcs( + prop, "rna_NodeGlare_iterations_get", "rna_NodeGlare_iterations_set", nullptr); RNA_def_property_range(prop, 2, 5); - RNA_def_property_ui_text(prop, "Iterations", ""); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text(prop, "Iterations", "(Deprecated: Use Iterations input instead)"); prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "colmod"); + RNA_def_property_float_funcs( + prop, "rna_NodeGlare_color_modulation_get", "rna_NodeGlare_color_modulation_set", nullptr); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text( prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for " - "a spectral dispersion effect"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + "a spectral dispersion effect. (Deprecated: Use Color Modulation input instead)"); prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "mix"); + RNA_def_property_float_funcs(prop, "rna_NodeGlare_mix_get", "rna_NodeGlare_mix_set", nullptr); RNA_def_property_range(prop, -1.0f, 1.0f); - RNA_def_property_ui_text( - prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text(prop, + "Mix", + "1 is original image only, 0 is exact 50/50 mix, 1 is processed image " + "only. (Deprecated: Use Strength input instead)"); prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "threshold"); + RNA_def_property_float_funcs( + prop, "rna_NodeGlare_threshold_get", "rna_NodeGlare_threshold_set", nullptr); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_text( - prop, - "Threshold", - "The glare filter will only be applied to pixels brighter than this value"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text(prop, + "Threshold", + "The glare filter will only be applied to pixels brighter than this " + "value. (Deprecated: Use Threshold input instead)"); prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, nullptr, "streaks"); + RNA_def_property_int_funcs( + prop, "rna_NodeGlare_streaks_get", "rna_NodeGlare_streaks_set", nullptr); RNA_def_property_range(prop, 1, 16); - RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text( + prop, "Streaks", "Total number of streaks. (Deprecated: Use Streaks input instead)"); prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, nullptr, "angle_ofs"); + RNA_def_property_float_funcs( + prop, "rna_NodeGlare_angle_offset_get", "rna_NodeGlare_angle_offset_set", nullptr); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text( + prop, "Angle Offset", "Streak angle offset. (Deprecated: Use Streaks Angle input instead)"); prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, nullptr, "fade"); + RNA_def_property_float_funcs(prop, "rna_NodeGlare_fade_get", "rna_NodeGlare_fade_set", nullptr); RNA_def_property_range(prop, 0.75f, 1.0f); - RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_ui_text( + prop, "Fade", "Streak fade-out factor. (Deprecated: Use Fade input instead)"); prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "star_45", 0); @@ -7890,15 +8235,12 @@ static void def_cmp_glare(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, nullptr, "size"); + RNA_def_property_int_funcs(prop, "rna_NodeGlare_size_get", "rna_NodeGlare_size_set", nullptr); RNA_def_property_range(prop, 1, 9); - RNA_def_property_ui_text( - prop, - "Size", - "Glow/glare size (not actual size; relative to initial size of bright area of pixels)"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - - /* TODO */ + RNA_def_property_ui_text(prop, + "Size", + "Glow/glare size (not actual size; relative to initial size of bright " + "area of pixels). (Deprecated: Use Size input instead)"); } static void def_cmp_tonemap(StructRNA *srna) @@ -10950,17 +11292,22 @@ static void rna_def_node(BlenderRNA *brna) /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->idname"); + RNA_def_property_string_funcs( + prop, "rna_Node_bl_idname_get", "rna_Node_bl_idname_length", "rna_Node_bl_idname_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "ID Name", ""); prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_name"); + RNA_def_property_string_funcs( + prop, "rna_Node_bl_label_get", "rna_Node_bl_label_length", "rna_Node_bl_label_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The node label"); prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_description"); + RNA_def_property_string_funcs(prop, + "rna_Node_bl_description_get", + "rna_Node_bl_description_length", + "rna_Node_bl_description_set"); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE); @@ -11394,17 +11741,26 @@ static void rna_def_nodetree(BlenderRNA *brna) /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->idname"); + RNA_def_property_string_funcs(prop, + "rna_NodeTree_bl_idname_get", + "rna_NodeTree_bl_idname_length", + "rna_NodeTree_bl_idname_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "ID Name", ""); prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_name"); + RNA_def_property_string_funcs(prop, + "rna_NodeTree_bl_label_get", + "rna_NodeTree_bl_label_length", + "rna_NodeTree_bl_label_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The node tree label"); prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION); - RNA_def_property_string_sdna(prop, nullptr, "typeinfo->ui_description"); + RNA_def_property_string_funcs(prop, + "rna_NodeTree_bl_description_get", + "rna_NodeTree_bl_description_length", + "rna_NodeTree_bl_description_set"); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE); @@ -11711,7 +12067,7 @@ void RNA_def_nodetree(BlenderRNA *brna) rna_def_geo_bake_item(brna); rna_def_geo_capture_attribute_item(brna); -# define DefNode(Category, ID, DefFunc, StructName, UIName, UIDesc) \ +# define DefNode(Category, ID, DefFunc, StructName) \ { \ srna = define_specific_node(brna, #Category #StructName, #Category, DefFunc); \ if (ID == CMP_NODE_OUTPUT_FILE) { \ diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index 4588fc06313f..fa33f20c1792 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -1812,7 +1812,7 @@ void rna_Scene_compositor_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr bNodeTree *ntree = reinterpret_cast(scene->nodetree); WM_main_add_notifier(NC_NODE | NA_EDITED, &ntree->id); WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id); - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index 4adf44a8969d..21a1def2c777 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -98,16 +98,16 @@ const EnumPropertyItem rna_enum_sequence_sound_modifier_type_items[] = { }; const EnumPropertyItem rna_enum_strip_color_items[] = { - {SEQUENCE_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"}, - {SEQUENCE_COLOR_01, "COLOR_01", ICON_SEQUENCE_COLOR_01, "Color 01", ""}, - {SEQUENCE_COLOR_02, "COLOR_02", ICON_SEQUENCE_COLOR_02, "Color 02", ""}, - {SEQUENCE_COLOR_03, "COLOR_03", ICON_SEQUENCE_COLOR_03, "Color 03", ""}, - {SEQUENCE_COLOR_04, "COLOR_04", ICON_SEQUENCE_COLOR_04, "Color 04", ""}, - {SEQUENCE_COLOR_05, "COLOR_05", ICON_SEQUENCE_COLOR_05, "Color 05", ""}, - {SEQUENCE_COLOR_06, "COLOR_06", ICON_SEQUENCE_COLOR_06, "Color 06", ""}, - {SEQUENCE_COLOR_07, "COLOR_07", ICON_SEQUENCE_COLOR_07, "Color 07", ""}, - {SEQUENCE_COLOR_08, "COLOR_08", ICON_SEQUENCE_COLOR_08, "Color 08", ""}, - {SEQUENCE_COLOR_09, "COLOR_09", ICON_SEQUENCE_COLOR_09, "Color 09", ""}, + {STRIP_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"}, + {STRIP_COLOR_01, "COLOR_01", ICON_STRIP_COLOR_01, "Color 01", ""}, + {STRIP_COLOR_02, "COLOR_02", ICON_STRIP_COLOR_02, "Color 02", ""}, + {STRIP_COLOR_03, "COLOR_03", ICON_STRIP_COLOR_03, "Color 03", ""}, + {STRIP_COLOR_04, "COLOR_04", ICON_STRIP_COLOR_04, "Color 04", ""}, + {STRIP_COLOR_05, "COLOR_05", ICON_STRIP_COLOR_05, "Color 05", ""}, + {STRIP_COLOR_06, "COLOR_06", ICON_STRIP_COLOR_06, "Color 06", ""}, + {STRIP_COLOR_07, "COLOR_07", ICON_STRIP_COLOR_07, "Color 07", ""}, + {STRIP_COLOR_08, "COLOR_08", ICON_STRIP_COLOR_08, "Color 08", ""}, + {STRIP_COLOR_09, "COLOR_09", ICON_STRIP_COLOR_09, "Color 09", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -134,7 +134,7 @@ const EnumPropertyItem rna_enum_strip_color_items[] = { # include "SEQ_edit.hh" struct SequenceSearchData { - Strip *seq; + Strip *strip; void *data; SequenceModifierData *smd; }; @@ -146,12 +146,12 @@ static void rna_SequenceElement_update(Main * /*bmain*/, Scene * /*scene*/, Poin if (ed) { StripElem *se = (StripElem *)ptr->data; - Strip *seq; + Strip *strip; /* slow but we can't avoid! */ - seq = SEQ_sequence_from_strip_elem(&ed->seqbase, se); - if (seq) { - SEQ_relations_invalidate_cache_raw(scene, seq); + strip = SEQ_sequence_from_strip_elem(&ed->seqbase, se); + if (strip) { + SEQ_relations_invalidate_cache_raw(scene, strip); } } } @@ -164,9 +164,9 @@ static void rna_Sequence_invalidate_raw_update(Main * /*bmain*/, Editing *ed = SEQ_editing_get(scene); if (ed) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); } } @@ -178,9 +178,9 @@ static void rna_Sequence_invalidate_preprocessed_update(Main * /*bmain*/, Editing *ed = SEQ_editing_get(scene); if (ed) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -192,9 +192,9 @@ static void UNUSED_FUNCTION(rna_Sequence_invalidate_composite_update)(Main * /*b Editing *ed = SEQ_editing_get(scene); if (ed) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_relations_invalidate_cache_composite(scene, strip); } } @@ -215,9 +215,9 @@ static void rna_Sequence_use_sequence(Main *bmain, Scene * /*scene*/, PointerRNA * the only way for this currently is to tag the ID for ID_RECALC_SYNC_TO_EVAL. */ Editing *ed = SEQ_editing_get(scene); if (ed) { - Strip *seq = (Strip *)ptr->data; - if (seq->scene != nullptr) { - DEG_id_tag_update(&seq->scene->id, ID_RECALC_SYNC_TO_EVAL); + Strip *strip = (Strip *)ptr->data; + if (strip->scene != nullptr) { + DEG_id_tag_update(&strip->scene->id, ID_RECALC_SYNC_TO_EVAL); } } /* The sequencer scene is to be updated as well, including new relations from the nested @@ -228,11 +228,11 @@ static void rna_Sequence_use_sequence(Main *bmain, Scene * /*scene*/, PointerRNA static void add_strips_from_seqbase(const ListBase *seqbase, blender::Vector &strips) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - strips.append(seq); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + strips.append(strip); - if (seq->type == SEQ_TYPE_META) { - add_strips_from_seqbase(&seq->seqbase, strips); + if (strip->type == STRIP_TYPE_META) { + add_strips_from_seqbase(&strip->seqbase, strips); } } } @@ -262,8 +262,8 @@ static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *i iter->internal.custom = bli_iter; bli_iter->data = seq_iter; - Strip **seq_arr = seq_iter->strips.begin(); - bli_iter->current = *seq_arr; + Strip **strip_arr = seq_iter->strips.begin(); + bli_iter->current = *strip_arr; iter->valid = bli_iter->current != nullptr; } @@ -273,16 +273,16 @@ static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *it SequencesAllIterator *seq_iter = static_cast(bli_iter->data); seq_iter->index++; - Strip **seq_arr = seq_iter->strips.begin(); - bli_iter->current = *(seq_arr + seq_iter->index); + Strip **strip_arr = seq_iter->strips.begin(); + bli_iter->current = *(strip_arr + seq_iter->index); iter->valid = bli_iter->current != nullptr && seq_iter->index < seq_iter->strips.size(); } static PointerRNA rna_SequenceEditor_sequences_all_get(CollectionPropertyIterator *iter) { - Strip *seq = static_cast(((BLI_Iterator *)iter->internal.custom)->current); - return rna_pointer_inherit_refine(&iter->parent, &RNA_Strip, seq); + Strip *strip = static_cast(((BLI_Iterator *)iter->internal.custom)->current); + return rna_pointer_inherit_refine(&iter->parent, &RNA_Strip, strip); } static void rna_SequenceEditor_sequences_all_end(CollectionPropertyIterator *iter) @@ -301,9 +301,9 @@ static bool rna_SequenceEditor_sequences_all_lookup_string(PointerRNA *ptr, ID *id = ptr->owner_id; Scene *scene = (Scene *)id; - Strip *seq = SEQ_sequence_lookup_seq_by_name(scene, key); - if (seq) { - *r_ptr = RNA_pointer_create(ptr->owner_id, &RNA_Strip, seq); + Strip *strip = SEQ_lookup_strip_by_name(scene, key); + if (strip) { + *r_ptr = RNA_pointer_create(ptr->owner_id, &RNA_Strip, strip); return true; } return false; @@ -320,21 +320,21 @@ static void rna_SequenceEditor_update_cache(Main * /*bmain*/, Scene *scene, Poin /* internal use */ static int rna_SequenceEditor_elements_length(PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; /* Hack? copied from `sequencer.cc`, #reload_sequence_new_file(). */ - size_t olen = MEM_allocN_len(seq->data->stripdata) / sizeof(StripElem); + size_t olen = MEM_allocN_len(strip->data->stripdata) / sizeof(StripElem); - /* The problem with `seq->data->len` and `seq->len` is that it's discounted from the offset + /* The problem with `strip->data->len` and `strip->len` is that it's discounted from the offset * (hard cut trim). */ return int(olen); } static void rna_Sequence_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; rna_iterator_array_begin(iter, - (void *)seq->data->stripdata, + (void *)strip->data->stripdata, sizeof(StripElem), rna_SequenceEditor_elements_length(ptr), 0, @@ -349,11 +349,11 @@ static int rna_Sequence_retiming_keys_length(PointerRNA *ptr) static void rna_SequenceEditor_retiming_keys_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; rna_iterator_array_begin(iter, - (void *)seq->retiming_keys, + (void *)strip->retiming_keys, sizeof(SeqRetimingKey), - SEQ_retiming_keys_count(seq), + SEQ_retiming_keys_count(strip), 0, nullptr); } @@ -363,13 +363,13 @@ static Strip *strip_by_key_find(Scene *scene, SeqRetimingKey *key) Editing *ed = SEQ_editing_get(scene); blender::VectorSet strips = SEQ_query_all_strips_recursive(&ed->seqbase); - for (Strip *seq : strips) { - const int retiming_keys_count = SEQ_retiming_keys_count(seq); - SeqRetimingKey *first = seq->retiming_keys; - SeqRetimingKey *last = seq->retiming_keys + retiming_keys_count - 1; + for (Strip *strip : strips) { + const int retiming_keys_count = SEQ_retiming_keys_count(strip); + SeqRetimingKey *first = strip->retiming_keys; + SeqRetimingKey *last = strip->retiming_keys + retiming_keys_count - 1; if (key >= first && key <= last) { - return seq; + return strip; } } @@ -379,15 +379,15 @@ static Strip *strip_by_key_find(Scene *scene, SeqRetimingKey *key) static void rna_Sequence_retiming_key_remove(ID *id, SeqRetimingKey *key) { Scene *scene = (Scene *)id; - Strip *seq = strip_by_key_find(scene, key); + Strip *strip = strip_by_key_find(scene, key); - if (seq == nullptr) { + if (strip == nullptr) { return; } - SEQ_retiming_remove_key(seq, key); + SEQ_retiming_remove_key(strip, key); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); } @@ -395,27 +395,27 @@ static int rna_Sequence_retiming_key_frame_get(PointerRNA *ptr) { SeqRetimingKey *key = (SeqRetimingKey *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - Strip *seq = strip_by_key_find(scene, key); + Strip *strip = strip_by_key_find(scene, key); - if (seq == nullptr) { + if (strip == nullptr) { return 0; } - return SEQ_time_start_frame_get(seq) + key->strip_frame_index; + return SEQ_time_start_frame_get(strip) + key->strip_frame_index; } static void rna_Sequence_retiming_key_frame_set(PointerRNA *ptr, int value) { SeqRetimingKey *key = (SeqRetimingKey *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - Strip *seq = strip_by_key_find(scene, key); + Strip *strip = strip_by_key_find(scene, key); - if (seq == nullptr) { + if (strip == nullptr) { return; } - SEQ_retiming_key_timeline_frame_set(scene, seq, key, value); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_retiming_key_timeline_frame_set(scene, strip, key, value); + SEQ_relations_invalidate_cache_raw(scene, strip); } static bool rna_SequenceEditor_selected_retiming_key_get(PointerRNA *ptr) @@ -429,15 +429,15 @@ static void rna_Sequence_views_format_update(Main *bmain, Scene *scene, PointerR rna_Sequence_invalidate_raw_update(bmain, scene, ptr); } -static void do_sequence_frame_change_update(Scene *scene, Strip *seq) +static void do_sequence_frame_change_update(Scene *scene, Strip *strip) { - ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, strip); - if (SEQ_transform_test_overlap(scene, seqbase, seq)) { - SEQ_transform_seqbase_shuffle(seqbase, seq, scene); + if (SEQ_transform_test_overlap(scene, seqbase, strip)) { + SEQ_transform_seqbase_shuffle(seqbase, strip, scene); } - if (seq->type == SEQ_TYPE_SOUND_RAM) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); } } @@ -465,167 +465,169 @@ static int rna_Sequence_frame_final_end_get(PointerRNA *ptr) static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_left_handle_frame_set(scene, seq, value); - do_sequence_frame_change_update(scene, seq); - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_time_left_handle_frame_set(scene, strip, value); + do_sequence_frame_change_update(scene, strip); + SEQ_relations_invalidate_cache_composite(scene, strip); } static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_right_handle_frame_set(scene, seq, value); - do_sequence_frame_change_update(scene, seq); - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_time_right_handle_frame_set(scene, strip, value); + do_sequence_frame_change_update(scene, strip); + SEQ_relations_invalidate_cache_composite(scene, strip); } static void rna_Sequence_start_frame_set(PointerRNA *ptr, float value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_transform_translate_sequence(scene, seq, value - seq->start); - do_sequence_frame_change_update(scene, seq); - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_transform_translate_sequence(scene, strip, value - strip->start); + do_sequence_frame_change_update(scene, strip); + SEQ_relations_invalidate_cache_composite(scene, strip); } static void rna_Sequence_frame_offset_start_set(PointerRNA *ptr, float value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_relations_invalidate_cache_composite(scene, seq); - seq->startofs = value; + SEQ_relations_invalidate_cache_composite(scene, strip); + strip->startofs = value; } static void rna_Sequence_frame_offset_end_set(PointerRNA *ptr, float value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_relations_invalidate_cache_composite(scene, seq); - seq->endofs = value; + SEQ_relations_invalidate_cache_composite(scene, strip); + strip->endofs = value; } static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - seq->anim_startofs = std::min(value, seq->len + seq->anim_startofs); + strip->anim_startofs = std::min(value, strip->len + strip->anim_startofs); - SEQ_add_reload_new_file(G.main, scene, seq, false); - do_sequence_frame_change_update(scene, seq); + SEQ_add_reload_new_file(G.main, scene, strip, false); + do_sequence_frame_change_update(scene, strip); } static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - seq->anim_endofs = std::min(value, seq->len + seq->anim_endofs); + strip->anim_endofs = std::min(value, strip->len + strip->anim_endofs); - SEQ_add_reload_new_file(G.main, scene, seq, false); - do_sequence_frame_change_update(scene, seq); + SEQ_add_reload_new_file(G.main, scene, strip, false); + do_sequence_frame_change_update(scene, strip); } static void rna_Sequence_anim_endofs_final_range( PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; *min = 0; - *max = seq->len + seq->anim_endofs - seq->startofs - seq->endofs - 1; + *max = strip->len + strip->anim_endofs - strip->startofs - strip->endofs - 1; } static void rna_Sequence_anim_startofs_final_range( PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; *min = 0; - *max = seq->len + seq->anim_startofs - seq->startofs - seq->endofs - 1; + *max = strip->len + strip->anim_startofs - strip->startofs - strip->endofs - 1; } static void rna_Sequence_frame_offset_start_range( PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/) { - Strip *seq = (Strip *)ptr->data; - *min = (seq->type == SEQ_TYPE_SOUND_RAM) ? 0 : INT_MIN; - *max = seq->len - seq->endofs - 1; + Strip *strip = (Strip *)ptr->data; + *min = (strip->type == STRIP_TYPE_SOUND_RAM) ? 0 : INT_MIN; + *max = strip->len - strip->endofs - 1; } static void rna_Sequence_frame_offset_end_range( PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/) { - Strip *seq = (Strip *)ptr->data; - *min = (seq->type == SEQ_TYPE_SOUND_RAM) ? 0 : INT_MIN; - *max = seq->len - seq->startofs - 1; + Strip *strip = (Strip *)ptr->data; + *min = (strip->type == STRIP_TYPE_SOUND_RAM) ? 0 : INT_MIN; + *max = strip->len - strip->startofs - 1; } static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - SEQ_time_right_handle_frame_set(scene, seq, SEQ_time_left_handle_frame_get(scene, seq) + value); - do_sequence_frame_change_update(scene, seq); - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_time_right_handle_frame_set( + scene, strip, SEQ_time_left_handle_frame_get(scene, strip) + value); + do_sequence_frame_change_update(scene, strip); + SEQ_relations_invalidate_cache_composite(scene, strip); } static int rna_Sequence_frame_length_get(PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - return SEQ_time_right_handle_frame_get(scene, seq) - SEQ_time_left_handle_frame_get(scene, seq); + return SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip); } static int rna_Sequence_frame_duration_get(PointerRNA *ptr) { - Strip *seq = static_cast(ptr->data); + Strip *strip = static_cast(ptr->data); Scene *scene = reinterpret_cast(ptr->owner_id); - return SEQ_time_strip_length_get(scene, seq); + return SEQ_time_strip_length_get(scene, strip); } static int rna_Sequence_frame_editable(const PointerRNA *ptr, const char ** /*r_info*/) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; /* Effect sequences' start frame and length must be readonly! */ - return (SEQ_effect_get_num_inputs(seq->type)) ? PropertyFlag(0) : PROP_EDITABLE; + return (SEQ_effect_get_num_inputs(strip->type)) ? PropertyFlag(0) : PROP_EDITABLE; } static void rna_Sequence_channel_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; Scene *scene = (Scene *)ptr->owner_id; - ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, strip); /* check channel increment or decrement */ - const int channel_delta = (value >= seq->machine) ? 1 : -1; - seq->machine = value; + const int channel_delta = (value >= strip->machine) ? 1 : -1; + strip->machine = value; - if (SEQ_transform_test_overlap(scene, seqbase, seq)) { - SEQ_transform_seqbase_shuffle_ex(seqbase, seq, scene, channel_delta); + if (SEQ_transform_test_overlap(scene, seqbase, strip)) { + SEQ_transform_seqbase_shuffle_ex(seqbase, strip, scene, channel_delta); } - SEQ_relations_invalidate_cache_composite(scene, seq); + SEQ_relations_invalidate_cache_composite(scene, strip); } static void rna_Sequence_use_proxy_set(PointerRNA *ptr, bool value) { - Strip *seq = (Strip *)ptr->data; - SEQ_proxy_set(seq, value != 0); + Strip *strip = (Strip *)ptr->data; + SEQ_proxy_set(strip, value != 0); } -static bool transform_seq_cmp_fn(Strip *seq, void *arg_pt) +static bool transform_seq_cmp_fn(Strip *strip, void *arg_pt) { SequenceSearchData *data = static_cast(arg_pt); - if (seq->data && seq->data->transform == data->data) { - data->seq = seq; + if (strip->data && strip->data->transform == data->data) { + data->strip = strip; return false; /* done so bail out */ } return true; @@ -635,24 +637,24 @@ static Strip *sequence_get_by_transform(Editing *ed, StripTransform *transform) { SequenceSearchData data; - data.seq = nullptr; + data.strip = nullptr; data.data = transform; /* irritating we need to search for our sequence! */ SEQ_for_each_callback(&ed->seqbase, transform_seq_cmp_fn, &data); - return data.seq; + return data.strip; } static std::optional rna_SequenceTransform_path(const PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_transform(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_transform(ed, static_cast(ptr->data)); - if (seq) { - char name_esc[(sizeof(seq->name) - 2) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + if (strip) { + char name_esc[(sizeof(strip->name) - 2) * 2]; + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); return fmt::format("sequence_editor.sequences_all[\"{}\"].transform", name_esc); } return ""; @@ -662,17 +664,17 @@ static void rna_SequenceTransform_update(Main * /*bmain*/, Scene * /*scene*/, Po { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_transform(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_transform(ed, static_cast(ptr->data)); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } -static bool crop_seq_cmp_fn(Strip *seq, void *arg_pt) +static bool crop_seq_cmp_fn(Strip *strip, void *arg_pt) { SequenceSearchData *data = static_cast(arg_pt); - if (seq->data && seq->data->crop == data->data) { - data->seq = seq; + if (strip->data && strip->data->crop == data->data) { + data->strip = strip; return false; /* done so bail out */ } return true; @@ -682,24 +684,24 @@ static Strip *sequence_get_by_crop(Editing *ed, StripCrop *crop) { SequenceSearchData data; - data.seq = nullptr; + data.strip = nullptr; data.data = crop; /* irritating we need to search for our sequence! */ SEQ_for_each_callback(&ed->seqbase, crop_seq_cmp_fn, &data); - return data.seq; + return data.strip; } static std::optional rna_SequenceCrop_path(const PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_crop(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_crop(ed, static_cast(ptr->data)); - if (seq) { - char name_esc[(sizeof(seq->name) - 2) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + if (strip) { + char name_esc[(sizeof(strip->name) - 2) * 2]; + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); return fmt::format("sequence_editor.sequences_all[\"{}\"].crop", name_esc); } return ""; @@ -709,62 +711,62 @@ static void rna_SequenceCrop_update(Main * /*bmain*/, Scene * /*scene*/, Pointer { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_crop(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_crop(ed, static_cast(ptr->data)); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } static void rna_Sequence_text_font_set(PointerRNA *ptr, PointerRNA ptr_value, ReportList * /*reports*/) { - Strip *seq = static_cast(ptr->data); - TextVars *data = static_cast(seq->effectdata); + Strip *strip = static_cast(ptr->data); + TextVars *data = static_cast(strip->effectdata); VFont *value = static_cast(ptr_value.data); SEQ_effect_text_font_unload(data, true); id_us_plus(&value->id); - data->text_blf_id = SEQ_FONT_NOT_LOADED; + data->text_blf_id = STRIP_FONT_NOT_LOADED; data->text_font = value; } /* name functions that ignore the first two characters */ static void rna_Sequence_name_get(PointerRNA *ptr, char *value) { - Strip *seq = (Strip *)ptr->data; - strcpy(value, seq->name + 2); + Strip *strip = (Strip *)ptr->data; + strcpy(value, strip->name + 2); } static int rna_Sequence_name_length(PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; - return strlen(seq->name + 2); + Strip *strip = (Strip *)ptr->data; + return strlen(strip->name + 2); } static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) { Scene *scene = (Scene *)ptr->owner_id; - Strip *seq = (Strip *)ptr->data; - char oldname[sizeof(seq->name)]; + Strip *strip = (Strip *)ptr->data; + char oldname[sizeof(strip->name)]; AnimData *adt; SEQ_prefetch_stop(scene); /* make a copy of the old name first */ - BLI_strncpy(oldname, seq->name + 2, sizeof(seq->name) - 2); + BLI_strncpy(oldname, strip->name + 2, sizeof(strip->name) - 2); /* copy the new name into the name slot */ - SEQ_edit_sequence_name_set(scene, seq, value); + SEQ_edit_sequence_name_set(scene, strip, value); /* make sure the name is unique */ - SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq); + SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, strip); /* fix all the animation data which may link to this */ /* Don't rename everywhere because these are per scene. */ # if 0 BKE_animdata_fix_paths_rename_all( - nullptr, "sequence_editor.sequences_all", oldname, seq->name + 2); + nullptr, "sequence_editor.sequences_all", oldname, strip->name + 2); # endif adt = BKE_animdata_from_id(&scene->id); if (adt) { @@ -773,7 +775,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) nullptr, "sequence_editor.sequences_all", oldname, - seq->name + 2, + strip->name + 2, 0, 0, 1); @@ -782,58 +784,58 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) static StructRNA *rna_Sequence_refine(PointerRNA *ptr) { - Strip *seq = (Strip *)ptr->data; + Strip *strip = (Strip *)ptr->data; - switch (seq->type) { - case SEQ_TYPE_IMAGE: + switch (strip->type) { + case STRIP_TYPE_IMAGE: return &RNA_ImageSequence; - case SEQ_TYPE_META: + case STRIP_TYPE_META: return &RNA_MetaSequence; - case SEQ_TYPE_SCENE: + case STRIP_TYPE_SCENE: return &RNA_SceneSequence; - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: return &RNA_MovieSequence; - case SEQ_TYPE_MOVIECLIP: + case STRIP_TYPE_MOVIECLIP: return &RNA_MovieClipSequence; - case SEQ_TYPE_MASK: + case STRIP_TYPE_MASK: return &RNA_MaskSequence; - case SEQ_TYPE_SOUND_RAM: + case STRIP_TYPE_SOUND_RAM: return &RNA_SoundSequence; - case SEQ_TYPE_CROSS: + case STRIP_TYPE_CROSS: return &RNA_CrossSequence; - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: return &RNA_AddSequence; - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: return &RNA_SubtractSequence; - case SEQ_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAOVER: return &RNA_AlphaOverSequence; - case SEQ_TYPE_ALPHAUNDER: + case STRIP_TYPE_ALPHAUNDER: return &RNA_AlphaUnderSequence; - case SEQ_TYPE_GAMCROSS: + case STRIP_TYPE_GAMCROSS: return &RNA_GammaCrossSequence; - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: return &RNA_MultiplySequence; - case SEQ_TYPE_OVERDROP: + case STRIP_TYPE_OVERDROP: return &RNA_OverDropSequence; - case SEQ_TYPE_MULTICAM: + case STRIP_TYPE_MULTICAM: return &RNA_MulticamSequence; - case SEQ_TYPE_ADJUSTMENT: + case STRIP_TYPE_ADJUSTMENT: return &RNA_AdjustmentSequence; - case SEQ_TYPE_WIPE: + case STRIP_TYPE_WIPE: return &RNA_WipeSequence; - case SEQ_TYPE_GLOW: + case STRIP_TYPE_GLOW: return &RNA_GlowSequence; - case SEQ_TYPE_TRANSFORM: + case STRIP_TYPE_TRANSFORM: return &RNA_TransformSequence; - case SEQ_TYPE_COLOR: + case STRIP_TYPE_COLOR: return &RNA_ColorSequence; - case SEQ_TYPE_SPEED: + case STRIP_TYPE_SPEED: return &RNA_SpeedControlSequence; - case SEQ_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_GAUSSIAN_BLUR: return &RNA_GaussianBlurSequence; - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: return &RNA_TextSequence; - case SEQ_TYPE_COLORMIX: + case STRIP_TYPE_COLORMIX: return &RNA_ColorMixSequence; default: return &RNA_Strip; @@ -842,34 +844,34 @@ static StructRNA *rna_Sequence_refine(PointerRNA *ptr) static std::optional rna_Sequence_path(const PointerRNA *ptr) { - const Strip *seq = (Strip *)ptr->data; + const Strip *strip = (Strip *)ptr->data; /* sequencer data comes from scene... * TODO: would be nice to make SequenceEditor data a data-block of its own (for shorter paths) */ - char name_esc[(sizeof(seq->name) - 2) * 2]; + char name_esc[(sizeof(strip->name) - 2) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); return fmt::format("sequence_editor.sequences_all[\"{}\"]", name_esc); } static IDProperty **rna_Sequence_idprops(PointerRNA *ptr) { - Strip *seq = static_cast(ptr->data); - return &seq->prop; + Strip *strip = static_cast(ptr->data); + return &strip->prop; } -static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Strip *seq, Main *bmain) +static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Strip *strip, Main *bmain) { Scene *scene = (Scene *)scene_id; bool has_reloaded; bool can_produce_frames; - SEQ_add_movie_reload_if_needed(bmain, scene, seq, &has_reloaded, &can_produce_frames); + SEQ_add_movie_reload_if_needed(bmain, scene, strip, &has_reloaded, &can_produce_frames); if (has_reloaded && can_produce_frames) { - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); @@ -878,13 +880,13 @@ static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Strip *seq, Main *b return can_produce_frames; } -static PointerRNA rna_MovieSequence_metadata_get(ID *scene_id, Strip *seq) +static PointerRNA rna_MovieSequence_metadata_get(ID *scene_id, Strip *strip) { - if (seq == nullptr || seq->anims.first == nullptr) { + if (strip == nullptr || strip->anims.first == nullptr) { return PointerRNA_NULL; } - StripAnim *sanim = static_cast(seq->anims.first); + StripAnim *sanim = static_cast(strip->anims.first); if (sanim->anim == nullptr) { return PointerRNA_NULL; } @@ -906,32 +908,34 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator * return rna_pointer_inherit_refine(&iter->parent, &RNA_Strip, ms->parseq); } -/* TODO: expose seq path setting as a higher level sequencer BKE function. */ +/* TODO: expose strip path setting as a higher level sequencer BKE function. */ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); BLI_path_split_dir_file(value, - seq->data->dirpath, - sizeof(seq->data->dirpath), - seq->data->stripdata->filename, - sizeof(seq->data->stripdata->filename)); + strip->data->dirpath, + sizeof(strip->data->dirpath), + strip->data->stripdata->filename, + sizeof(strip->data->stripdata->filename)); } static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); char filepath[FILE_MAX]; - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join( + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); strcpy(value, filepath); } static int rna_Sequence_filepath_length(PointerRNA *ptr) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); char filepath[FILE_MAX]; - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join( + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); return strlen(filepath); } @@ -982,9 +986,9 @@ static void rna_Sequence_pan_range( static int rna_Sequence_input_count_get(PointerRNA *ptr) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); - return SEQ_effect_get_num_inputs(seq->type); + return SEQ_effect_get_num_inputs(strip->type); } static void rna_Sequence_input_set(PointerRNA *ptr, @@ -993,20 +997,20 @@ static void rna_Sequence_input_set(PointerRNA *ptr, int input_num) { - Strip *seq = static_cast(ptr->data); + Strip *strip = static_cast(ptr->data); Strip *input = static_cast(ptr_value.data); - if (SEQ_relations_render_loop_check(input, seq)) { + if (SEQ_relations_render_loop_check(input, strip)) { BKE_report(reports, RPT_ERROR, "Cannot reassign inputs: recursion detected"); return; } switch (input_num) { case 1: - seq->seq1 = input; + strip->seq1 = input; break; case 2: - seq->seq2 = input; + strip->seq2 = input; break; } } @@ -1023,12 +1027,12 @@ static void rna_Sequence_input_2_set(PointerRNA *ptr, PointerRNA ptr_value, Repo # if 0 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); BLI_path_split_dir_file(value, - seq->data->dirpath, - sizeof(seq->data->dirpath), - seq->data->stripdata->name, - sizeof(seq->data->stripdata->name)); + strip->data->dirpath, + sizeof(strip->data->dirpath), + strip->data->stripdata->name, + sizeof(strip->data->stripdata->name)); } static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) @@ -1054,8 +1058,8 @@ static void rna_Sequence_reopen_files_update(Main *bmain, Scene * /*scene*/, Poi static void rna_Sequence_filepath_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; - Strip *seq = (Strip *)(ptr->data); - SEQ_add_reload_new_file(bmain, scene, seq, true); + Strip *strip = (Strip *)(ptr->data); + SEQ_add_reload_new_file(bmain, scene, strip, true); rna_Sequence_invalidate_raw_update(bmain, scene, ptr); } @@ -1066,12 +1070,12 @@ static void rna_Sequence_sound_update(Main *bmain, Scene * /*active_scene*/, Poi DEG_relations_tag_update(bmain); } -static bool seqproxy_seq_cmp_fn(Strip *seq, void *arg_pt) +static bool seqproxy_seq_cmp_fn(Strip *strip, void *arg_pt) { SequenceSearchData *data = static_cast(arg_pt); - if (seq->data && seq->data->proxy == data->data) { - data->seq = seq; + if (strip->data && strip->data->proxy == data->data) { + data->strip = strip; return false; /* done so bail out */ } return true; @@ -1081,68 +1085,69 @@ static Strip *sequence_get_by_proxy(Editing *ed, StripProxy *proxy) { SequenceSearchData data; - data.seq = nullptr; + data.strip = nullptr; data.data = proxy; SEQ_for_each_callback(&ed->seqbase, seqproxy_seq_cmp_fn, &data); - return data.seq; + return data.strip; } static void rna_Sequence_tcindex_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_proxy(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_proxy(ed, static_cast(ptr->data)); - SEQ_add_reload_new_file(bmain, scene, seq, false); - do_sequence_frame_change_update(scene, seq); + SEQ_add_reload_new_file(bmain, scene, strip, false); + do_sequence_frame_change_update(scene, strip); } static void rna_SequenceProxy_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_proxy(ed, static_cast(ptr->data)); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + Strip *strip = sequence_get_by_proxy(ed, static_cast(ptr->data)); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } /* do_versions? */ static float rna_Sequence_opacity_get(PointerRNA *ptr) { - Strip *seq = (Strip *)(ptr->data); - return seq->blend_opacity / 100.0f; + Strip *strip = (Strip *)(ptr->data); + return strip->blend_opacity / 100.0f; } static void rna_Sequence_opacity_set(PointerRNA *ptr, float value) { - Strip *seq = (Strip *)(ptr->data); + Strip *strip = (Strip *)(ptr->data); CLAMP(value, 0.0f, 1.0f); - seq->blend_opacity = value * 100.0f; + strip->blend_opacity = value * 100.0f; } static int rna_Sequence_color_tag_get(PointerRNA *ptr) { - Strip *seq = (Strip *)(ptr->data); - return seq->color_tag; + Strip *strip = (Strip *)(ptr->data); + return strip->color_tag; } static void rna_Sequence_color_tag_set(PointerRNA *ptr, int value) { - Strip *seq = (Strip *)(ptr->data); - seq->color_tag = value; + Strip *strip = (Strip *)(ptr->data); + strip->color_tag = value; } -static bool colbalance_seq_cmp_fn(Strip *seq, void *arg_pt) +static bool colbalance_seq_cmp_fn(Strip *strip, void *arg_pt) { SequenceSearchData *data = static_cast(arg_pt); - for (SequenceModifierData *smd = static_cast(seq->modifiers.first); smd; + for (SequenceModifierData *smd = static_cast(strip->modifiers.first); + smd; smd = smd->next) { if (smd->type == seqModifierType_ColorBalance) { ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; if (&cbmd->color_balance == data->data) { - data->seq = seq; + data->strip = strip; data->smd = smd; return false; /* done so bail out */ } @@ -1158,7 +1163,7 @@ static Strip *sequence_get_by_colorbalance(Editing *ed, { SequenceSearchData data; - data.seq = nullptr; + data.strip = nullptr; data.smd = nullptr; data.data = cb; @@ -1167,7 +1172,7 @@ static Strip *sequence_get_by_colorbalance(Editing *ed, *r_smd = data.smd; - return data.seq; + return data.strip; } static std::optional rna_SequenceColorBalance_path(const PointerRNA *ptr) @@ -1175,12 +1180,13 @@ static std::optional rna_SequenceColorBalance_path(const PointerRNA Scene *scene = (Scene *)ptr->owner_id; SequenceModifierData *smd; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_colorbalance(ed, static_cast(ptr->data), &smd); + Strip *strip = sequence_get_by_colorbalance( + ed, static_cast(ptr->data), &smd); - if (seq) { - char name_esc[(sizeof(seq->name) - 2) * 2]; + if (strip) { + char name_esc[(sizeof(strip->name) - 2) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); if (!smd) { /* Path to old filter color balance. */ @@ -1202,9 +1208,10 @@ static void rna_SequenceColorBalance_update(Main * /*bmain*/, Scene * /*scene*/, Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); SequenceModifierData *smd; - Strip *seq = sequence_get_by_colorbalance(ed, static_cast(ptr->data), &smd); + Strip *strip = sequence_get_by_colorbalance( + ed, static_cast(ptr->data), &smd); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, bool value) @@ -1264,7 +1271,8 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value) static void rna_SequenceEditor_display_stack(ID *id, Editing *ed, ReportList *reports, Strip *seqm) { /* Check for non-meta sequence */ - if (seqm != nullptr && seqm->type != SEQ_TYPE_META && SEQ_exists_in_seqbase(seqm, &ed->seqbase)) + if (seqm != nullptr && seqm->type != STRIP_TYPE_META && + SEQ_exists_in_seqbase(seqm, &ed->seqbase)) { BKE_report(reports, RPT_ERROR, "Strip type must be 'META'"); return; @@ -1279,12 +1287,12 @@ static void rna_SequenceEditor_display_stack(ID *id, Editing *ed, ReportList *re WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } -static bool modifier_seq_cmp_fn(Strip *seq, void *arg_pt) +static bool modifier_seq_cmp_fn(Strip *strip, void *arg_pt) { SequenceSearchData *data = static_cast(arg_pt); - if (BLI_findindex(&seq->modifiers, data->data) != -1) { - data->seq = seq; + if (BLI_findindex(&strip->modifiers, data->data) != -1) { + data->strip = strip; return false; /* done so bail out */ } @@ -1295,13 +1303,13 @@ static Strip *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd) { SequenceSearchData data; - data.seq = nullptr; + data.strip = nullptr; data.data = smd; /* irritating we need to search for our sequence! */ SEQ_for_each_callback(&ed->seqbase, modifier_seq_cmp_fn, &data); - return data.seq; + return data.strip; } static StructRNA *rna_SequenceModifier_refine(PointerRNA *ptr) @@ -1333,13 +1341,13 @@ static std::optional rna_SequenceModifier_path(const PointerRNA *pt Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); SequenceModifierData *smd = static_cast(ptr->data); - Strip *seq = sequence_get_by_modifier(ed, smd); + Strip *strip = sequence_get_by_modifier(ed, smd); - if (seq) { - char name_esc[(sizeof(seq->name) - 2) * 2]; + if (strip) { + char name_esc[(sizeof(strip->name) - 2) * 2]; char name_esc_smd[sizeof(smd->name) * 2]; - BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); + BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); BLI_str_escape(name_esc_smd, smd->name, sizeof(name_esc_smd)); return fmt::format( "sequence_editor.sequences_all[\"{}\"].modifiers[\"{}\"]", name_esc, name_esc_smd); @@ -1352,7 +1360,7 @@ static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value) SequenceModifierData *smd = static_cast(ptr->data); Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_modifier(ed, smd); + Strip *strip = sequence_get_by_modifier(ed, smd); AnimData *adt; char oldname[sizeof(smd->name)]; @@ -1363,17 +1371,17 @@ static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value) STRNCPY_UTF8(smd->name, value); /* make sure the name is truly unique */ - SEQ_modifier_unique_name(seq, smd); + SEQ_modifier_unique_name(strip, smd); /* fix all the animation data which may link to this */ adt = BKE_animdata_from_id(&scene->id); if (adt) { char rna_path_prefix[1024]; - char seq_name_esc[(sizeof(seq->name) - 2) * 2]; - BLI_str_escape(seq_name_esc, seq->name + 2, sizeof(seq_name_esc)); + char strip_name_esc[(sizeof(strip->name) - 2) * 2]; + BLI_str_escape(strip_name_esc, strip->name + 2, sizeof(strip_name_esc)); - SNPRINTF(rna_path_prefix, "sequence_editor.sequences_all[\"%s\"].modifiers", seq_name_esc); + SNPRINTF(rna_path_prefix, "sequence_editor.sequences_all[\"%s\"].modifiers", strip_name_esc); BKE_animdata_fix_paths_rename( &scene->id, adt, nullptr, rna_path_prefix, oldname, smd->name, 0, 0, 1); } @@ -1384,14 +1392,14 @@ static void rna_SequenceModifier_update(Main *bmain, Scene * /*scene*/, PointerR /* strip from other scenes could be modified, so using active scene is not reliable */ Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_modifier(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_modifier(ed, static_cast(ptr->data)); - if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { + if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SOUND_HD)) { DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); DEG_relations_tag_update(bmain); } else { - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -1413,10 +1421,10 @@ static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_modifier(ed, static_cast(ptr->data)); + Strip *strip = sequence_get_by_modifier(ed, static_cast(ptr->data)); Strip *cur = (Strip *)value.data; - if ((seq == cur) || (cur->type == SEQ_TYPE_SOUND_RAM)) { + if ((strip == cur) || (cur->type == STRIP_TYPE_SOUND_RAM)) { return false; } @@ -1424,9 +1432,9 @@ static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA } static SequenceModifierData *rna_Sequence_modifier_new( - Strip *seq, bContext *C, ReportList *reports, const char *name, int type) + Strip *strip, bContext *C, ReportList *reports, const char *name, int type) { - if (!SEQ_sequence_supports_modifiers(seq)) { + if (!SEQ_sequence_supports_modifiers(strip)) { BKE_report(reports, RPT_ERROR, "Strip type does not support modifiers"); return nullptr; @@ -1435,9 +1443,9 @@ static SequenceModifierData *rna_Sequence_modifier_new( Scene *scene = CTX_data_scene(C); SequenceModifierData *smd; - smd = SEQ_modifier_new(seq, name, type); + smd = SEQ_modifier_new(strip, name, type); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); @@ -1445,7 +1453,7 @@ static SequenceModifierData *rna_Sequence_modifier_new( } } -static void rna_Sequence_modifier_remove(Strip *seq, +static void rna_Sequence_modifier_remove(Strip *strip, bContext *C, ReportList *reports, PointerRNA *smd_ptr) @@ -1453,24 +1461,24 @@ static void rna_Sequence_modifier_remove(Strip *seq, SequenceModifierData *smd = static_cast(smd_ptr->data); Scene *scene = CTX_data_scene(C); - if (SEQ_modifier_remove(seq, smd) == false) { + if (SEQ_modifier_remove(strip, smd) == false) { BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack"); return; } RNA_POINTER_INVALIDATE(smd_ptr); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); } -static void rna_Sequence_modifier_clear(Strip *seq, bContext *C) +static void rna_Sequence_modifier_clear(Strip *strip, bContext *C) { Scene *scene = CTX_data_scene(C); - SEQ_modifier_clear(seq); + SEQ_modifier_clear(strip); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); } @@ -1480,10 +1488,10 @@ static void rna_SequenceModifier_strip_set(PointerRNA *ptr, PointerRNA value, Re SequenceModifierData *smd = static_cast(ptr->data); Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *seq = sequence_get_by_modifier(ed, smd); + Strip *strip = sequence_get_by_modifier(ed, smd); Strip *target = (Strip *)value.data; - if (target != nullptr && SEQ_relations_render_loop_check(target, seq)) { + if (target != nullptr && SEQ_relations_render_loop_check(target, strip)) { BKE_report(reports, RPT_ERROR, "Recursion detected, cannot use this strip"); return; } @@ -1494,8 +1502,8 @@ static void rna_SequenceModifier_strip_set(PointerRNA *ptr, PointerRNA value, Re static float rna_Sequence_fps_get(PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; - Strip *seq = (Strip *)(ptr->data); - return SEQ_time_sequence_get_fps(scene, seq); + Strip *strip = (Strip *)(ptr->data); + return SEQ_time_sequence_get_fps(scene, strip); } static void rna_Sequence_separate(ID *id, Strip *seqm, Main *bmain) @@ -1505,8 +1513,8 @@ static void rna_Sequence_separate(ID *id, Strip *seqm, Main *bmain) /* Find the appropriate seqbase */ ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seqm); - LISTBASE_FOREACH_MUTABLE (Strip *, seq, &seqm->seqbase) { - SEQ_edit_move_strip_to_seqbase(scene, &seqm->seqbase, seq, seqbase); + LISTBASE_FOREACH_MUTABLE (Strip *, strip, &seqm->seqbase) { + SEQ_edit_move_strip_to_seqbase(scene, &seqm->seqbase, strip, seqbase); } SEQ_edit_flag_for_removal(scene, seqbase, seqm); @@ -1525,7 +1533,7 @@ static void rna_SequenceTimelineChannel_name_set(PointerRNA *ptr, const char *va Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene); - Strip *channel_owner = SEQ_sequence_lookup_owner_by_channel(scene, channel); + Strip *channel_owner = SEQ_lookup_strip_by_channel_owner(scene, channel); ListBase *channels_base = &ed->channels; if (channel_owner != nullptr) { @@ -1549,7 +1557,7 @@ static void rna_SequenceTimelineChannel_mute_update(Main *bmain, Editing *ed = SEQ_editing_get(scene); SeqTimelineChannel *channel = (SeqTimelineChannel *)ptr; - Strip *channel_owner = SEQ_sequence_lookup_owner_by_channel(scene, channel); + Strip *channel_owner = SEQ_lookup_strip_by_channel_owner(scene, channel); ListBase *seqbase; if (channel_owner == nullptr) { seqbase = &ed->seqbase; @@ -1558,8 +1566,8 @@ static void rna_SequenceTimelineChannel_mute_update(Main *bmain, seqbase = &channel_owner->seqbase; } - LISTBASE_FOREACH (Strip *, seq, seqbase) { - SEQ_relations_invalidate_cache_composite(scene, seq); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + SEQ_relations_invalidate_cache_composite(scene, strip); } rna_Sequence_sound_update(bmain, active_scene, ptr); @@ -1570,7 +1578,7 @@ static std::optional rna_SeqTimelineChannel_path(const PointerRNA * Scene *scene = (Scene *)ptr->owner_id; SeqTimelineChannel *channel = (SeqTimelineChannel *)ptr->data; - Strip *channel_owner = SEQ_sequence_lookup_owner_by_channel(scene, channel); + Strip *channel_owner = SEQ_lookup_strip_by_channel_owner(scene, channel); char channel_name_esc[(sizeof(channel->name)) * 2]; BLI_str_escape(channel_name_esc, channel->name, sizeof(channel_name_esc)); @@ -1783,7 +1791,7 @@ static void rna_def_strip_proxy(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem seq_tc_items[] = { + static const EnumPropertyItem strip_tc_items[] = { {SEQ_PROXY_TC_NONE, "NONE", 0, @@ -1854,7 +1862,7 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, nullptr, "tc"); - RNA_def_property_enum_items(prop, seq_tc_items); + RNA_def_property_enum_items(prop, strip_tc_items); RNA_def_property_ui_text(prop, "Timecode", "Method for reading the inputs timecode"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update"); @@ -1992,38 +2000,38 @@ static void rna_def_strip_color_balance(BlenderRNA *brna) static const EnumPropertyItem blend_mode_items[] = { {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""}, - {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, + {STRIP_TYPE_CROSS, "CROSS", 0, "Cross", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, - {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, - {SEQ_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, - {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, + {STRIP_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, + {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, + {STRIP_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, + {STRIP_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, - {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, - {SEQ_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, - {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, + {STRIP_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, + {STRIP_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, + {STRIP_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, + {STRIP_TYPE_ADD, "ADD", 0, "Add", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, - {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, - {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""}, - {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""}, - {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, - {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, + {STRIP_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, + {STRIP_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, + {STRIP_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""}, + {STRIP_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""}, + {STRIP_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, + {STRIP_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, - {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {STRIP_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, + {STRIP_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, + {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""}, - {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""}, - {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, - {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""}, + {STRIP_TYPE_HUE, "HUE", 0, "Hue", ""}, + {STRIP_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""}, + {STRIP_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, + {STRIP_TYPE_VALUE, "VALUE", 0, "Value", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, - {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, - {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, - {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, + {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, + {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, + {STRIP_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, + {STRIP_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -2077,32 +2085,32 @@ static void rna_def_sequence(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem seq_type_items[] = { - {SEQ_TYPE_IMAGE, "IMAGE", 0, "Image", ""}, - {SEQ_TYPE_META, "META", 0, "Meta", ""}, - {SEQ_TYPE_SCENE, "SCENE", 0, "Scene", ""}, - {SEQ_TYPE_MOVIE, "MOVIE", 0, "Movie", ""}, - {SEQ_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""}, - {SEQ_TYPE_MASK, "MASK", 0, "Mask", ""}, - {SEQ_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""}, - {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, - {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, - {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, - {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, - {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, - {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, - {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, - {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, - {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""}, - {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, - {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""}, - {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""}, - {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, - {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, - {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, - {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""}, - {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, + static const EnumPropertyItem strip_type_items[] = { + {STRIP_TYPE_IMAGE, "IMAGE", 0, "Image", ""}, + {STRIP_TYPE_META, "META", 0, "Meta", ""}, + {STRIP_TYPE_SCENE, "SCENE", 0, "Scene", ""}, + {STRIP_TYPE_MOVIE, "MOVIE", 0, "Movie", ""}, + {STRIP_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""}, + {STRIP_TYPE_MASK, "MASK", 0, "Mask", ""}, + {STRIP_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""}, + {STRIP_TYPE_CROSS, "CROSS", 0, "Cross", ""}, + {STRIP_TYPE_ADD, "ADD", 0, "Add", ""}, + {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, + {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, + {STRIP_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, + {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, + {STRIP_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, + {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, + {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", ""}, + {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, + {STRIP_TYPE_COLOR, "COLOR", 0, "Color", ""}, + {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", ""}, + {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {STRIP_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, + {STRIP_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, + {STRIP_TYPE_TEXT, "TEXT", 0, "Text", ""}, + {STRIP_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -2122,7 +2130,7 @@ static void rna_def_sequence(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_enum_items(prop, seq_type_items); + RNA_def_property_enum_items(prop, strip_type_items); RNA_def_property_ui_text(prop, "Type", ""); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); @@ -2260,6 +2268,7 @@ static void rna_def_sequence(BlenderRNA *brna) prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, nullptr, "blend_mode"); RNA_def_property_enum_items(prop, blend_mode_items); + RNA_def_property_enum_default(prop, STRIP_TYPE_ALPHAOVER); RNA_def_property_ui_text( prop, "Blending Mode", "Method for controlling how the strip combines with other strips"); RNA_def_property_update( @@ -2267,6 +2276,7 @@ static void rna_def_sequence(BlenderRNA *brna) prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text( prop, "Blend Opacity", "Percentage of how much the strip's colors affect other strips"); /* stupid 0-100 -> 0-1 */ @@ -2791,6 +2801,7 @@ static void rna_def_audio_options(StructRNA *srna) prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "volume"); RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_audio_update"); @@ -3495,31 +3506,31 @@ static void rna_def_text(StructRNA *srna) static void rna_def_color_mix(StructRNA *srna) { static const EnumPropertyItem blend_color_items[] = { - {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, - {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, - {SEQ_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, - {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, + {STRIP_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, + {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, + {STRIP_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, + {STRIP_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, - {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, - {SEQ_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, - {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, + {STRIP_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, + {STRIP_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, + {STRIP_TYPE_DODGE, "DODGE", 0, "Color Dodge", ""}, + {STRIP_TYPE_ADD, "ADD", 0, "Add", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, - {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, - {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""}, - {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""}, - {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, - {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, + {STRIP_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, + {STRIP_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, + {STRIP_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""}, + {STRIP_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""}, + {STRIP_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""}, + {STRIP_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, - {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {STRIP_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, + {STRIP_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""}, + {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, RNA_ENUM_ITEM_SEPR, - {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""}, - {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""}, - {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, - {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""}, + {STRIP_TYPE_HUE, "HUE", 0, "Hue", ""}, + {STRIP_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""}, + {STRIP_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""}, + {STRIP_TYPE_VALUE, "VALUE", 0, "Value", ""}, {0, nullptr, 0, nullptr, nullptr}, }; diff --git a/source/blender/makesrna/intern/rna_sequencer_api.cc b/source/blender/makesrna/intern/rna_sequencer_api.cc index c555b79ae1ca..619e21b94d0b 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.cc +++ b/source/blender/makesrna/intern/rna_sequencer_api.cc @@ -59,26 +59,26 @@ static StripElem *rna_Sequence_strip_elem_from_frame(ID *id, Strip *self, int ti } static void rna_Sequence_swap_internal(ID *id, - Strip *seq_self, + Strip *strip_self, ReportList *reports, - Strip *seq_other) + Strip *strip_other) { const char *error_msg; Scene *scene = (Scene *)id; - if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == false) { + if (SEQ_edit_sequence_swap(scene, strip_self, strip_other, &error_msg) == false) { BKE_report(reports, RPT_ERROR, error_msg); } } static void rna_Sequences_move_strip_to_meta( - ID *id, Strip *seq_self, Main *bmain, ReportList *reports, Strip *meta_dst) + ID *id, Strip *strip_self, Main *bmain, ReportList *reports, Strip *meta_dst) { Scene *scene = (Scene *)id; const char *error_msg; /* Move strip to meta. */ - if (!SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst, &error_msg)) { + if (!SEQ_edit_move_strip_to_meta(scene, strip_self, meta_dst, &error_msg)) { BKE_report(reports, RPT_ERROR, error_msg); } @@ -86,20 +86,20 @@ static void rna_Sequences_move_strip_to_meta( DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); - SEQ_sequence_lookup_invalidate(scene); + SEQ_strip_lookup_invalidate(scene); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } static Strip *rna_Sequence_split( - ID *id, Strip *seq, Main *bmain, ReportList *reports, int frame, int split_method) + ID *id, Strip *strip, Main *bmain, ReportList *reports, int frame, int split_method) { Scene *scene = (Scene *)id; - ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, seq); + ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, strip); const char *error_msg = nullptr; Strip *r_seq = SEQ_edit_strip_split( - bmain, scene, seqbase, seq, frame, eSeqSplitMethod(split_method), &error_msg); + bmain, scene, seqbase, strip, frame, eSeqSplitMethod(split_method), &error_msg); if (error_msg != nullptr) { BKE_report(reports, RPT_ERROR, error_msg); } @@ -113,12 +113,12 @@ static Strip *rna_Sequence_split( return r_seq; } -static Strip *rna_Sequence_parent_meta(ID *id, Strip *seq_self) +static Strip *rna_Sequence_parent_meta(ID *id, Strip *strip_self) { Scene *scene = (Scene *)id; Editing *ed = SEQ_editing_get(scene); - return SEQ_find_metastrip_by_sequence(&ed->seqbase, nullptr, seq_self); + return SEQ_find_metastrip_by_sequence(&ed->seqbase, nullptr, strip_self); } static Strip *rna_Sequences_new_clip(ID *id, @@ -133,13 +133,13 @@ static Strip *rna_Sequences_new_clip(ID *id, SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, nullptr, frame_start, channel); load_data.clip = clip; - Strip *seq = SEQ_add_movieclip_strip(scene, seqbase, &load_data); + Strip *strip = SEQ_add_movieclip_strip(scene, seqbase, &load_data); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_clip(ID *id, @@ -154,14 +154,14 @@ static Strip *rna_Sequences_editing_new_clip(ID *id, } static Strip *rna_Sequences_meta_new_clip(ID *id, - Strip *seq, + Strip *strip, Main *bmain, const char *name, MovieClip *clip, int channel, int frame_start) { - return rna_Sequences_new_clip(id, &seq->seqbase, bmain, name, clip, channel, frame_start); + return rna_Sequences_new_clip(id, &strip->seqbase, bmain, name, clip, channel, frame_start); } static Strip *rna_Sequences_new_mask(ID *id, @@ -176,13 +176,13 @@ static Strip *rna_Sequences_new_mask(ID *id, SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, nullptr, frame_start, channel); load_data.mask = mask; - Strip *seq = SEQ_add_mask_strip(scene, seqbase, &load_data); + Strip *strip = SEQ_add_mask_strip(scene, seqbase, &load_data); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_mask( ID *id, Editing *ed, Main *bmain, const char *name, Mask *mask, int channel, int frame_start) @@ -191,9 +191,9 @@ static Strip *rna_Sequences_editing_new_mask( } static Strip *rna_Sequences_meta_new_mask( - ID *id, Strip *seq, Main *bmain, const char *name, Mask *mask, int channel, int frame_start) + ID *id, Strip *strip, Main *bmain, const char *name, Mask *mask, int channel, int frame_start) { - return rna_Sequences_new_mask(id, &seq->seqbase, bmain, name, mask, channel, frame_start); + return rna_Sequences_new_mask(id, &strip->seqbase, bmain, name, mask, channel, frame_start); } static Strip *rna_Sequences_new_scene(ID *id, @@ -208,13 +208,13 @@ static Strip *rna_Sequences_new_scene(ID *id, SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, nullptr, frame_start, channel); load_data.scene = sce_seq; - Strip *seq = SEQ_add_scene_strip(scene, seqbase, &load_data); + Strip *strip = SEQ_add_scene_strip(scene, seqbase, &load_data); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_scene(ID *id, @@ -229,14 +229,14 @@ static Strip *rna_Sequences_editing_new_scene(ID *id, } static Strip *rna_Sequences_meta_new_scene(ID *id, - Strip *seq, + Strip *strip, Main *bmain, const char *name, Scene *sce_seq, int channel, int frame_start) { - return rna_Sequences_new_scene(id, &seq->seqbase, bmain, name, sce_seq, channel, frame_start); + return rna_Sequences_new_scene(id, &strip->seqbase, bmain, name, sce_seq, channel, frame_start); } static Strip *rna_Sequences_new_image(ID *id, @@ -255,19 +255,19 @@ static Strip *rna_Sequences_new_image(ID *id, SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.image.len = 1; load_data.fit_method = eSeqImageFitMethod(fit_method); - Strip *seq = SEQ_add_image_strip(bmain, scene, seqbase, &load_data); + Strip *strip = SEQ_add_image_strip(bmain, scene, seqbase, &load_data); char dirpath[FILE_MAX], filename[FILE_MAXFILE]; BLI_path_split_dir_file(file, dirpath, sizeof(dirpath), filename, sizeof(filename)); - SEQ_add_image_set_directory(seq, dirpath); - SEQ_add_image_load_file(scene, seq, 0, filename); - SEQ_add_image_init_alpha_mode(seq); + SEQ_add_image_set_directory(strip, dirpath); + SEQ_add_image_load_file(scene, strip, 0, filename); + SEQ_add_image_init_alpha_mode(strip); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_image(ID *id, @@ -285,7 +285,7 @@ static Strip *rna_Sequences_editing_new_image(ID *id, } static Strip *rna_Sequences_meta_new_image(ID *id, - Strip *seq, + Strip *strip, Main *bmain, ReportList *reports, const char *name, @@ -295,7 +295,7 @@ static Strip *rna_Sequences_meta_new_image(ID *id, int fit_method) { return rna_Sequences_new_image( - id, &seq->seqbase, bmain, reports, name, file, channel, frame_start, fit_method); + id, &strip->seqbase, bmain, reports, name, file, channel, frame_start, fit_method); } static Strip *rna_Sequences_new_movie(ID *id, @@ -312,13 +312,13 @@ static Strip *rna_Sequences_new_movie(ID *id, SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.fit_method = eSeqImageFitMethod(fit_method); load_data.allow_invalid_file = true; - Strip *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data); + Strip *strip = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_movie(ID *id, @@ -335,7 +335,7 @@ static Strip *rna_Sequences_editing_new_movie(ID *id, } static Strip *rna_Sequences_meta_new_movie(ID *id, - Strip *seq, + Strip *strip, Main *bmain, const char *name, const char *file, @@ -344,7 +344,7 @@ static Strip *rna_Sequences_meta_new_movie(ID *id, int fit_method) { return rna_Sequences_new_movie( - id, &seq->seqbase, bmain, name, file, channel, frame_start, fit_method); + id, &strip->seqbase, bmain, name, file, channel, frame_start, fit_method); } # ifdef WITH_AUDASPACE @@ -361,9 +361,9 @@ static Strip *rna_Sequences_new_sound(ID *id, SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.allow_invalid_file = true; - Strip *seq = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data); + Strip *strip = SEQ_add_sound_strip(bmain, scene, seqbase, &load_data); - if (seq == nullptr) { + if (strip == nullptr) { BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file"); return nullptr; } @@ -372,7 +372,7 @@ static Strip *rna_Sequences_new_sound(ID *id, DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } # else /* WITH_AUDASPACE */ static Strip *rna_Sequences_new_sound(ID * /*id*/, @@ -403,7 +403,7 @@ static Strip *rna_Sequences_editing_new_sound(ID *id, } static Strip *rna_Sequences_meta_new_sound(ID *id, - Strip *seq, + Strip *strip, Main *bmain, ReportList *reports, const char *name, @@ -412,7 +412,7 @@ static Strip *rna_Sequences_meta_new_sound(ID *id, int frame_start) { return rna_Sequences_new_sound( - id, &seq->seqbase, bmain, reports, name, file, channel, frame_start); + id, &strip->seqbase, bmain, reports, name, file, channel, frame_start); } /* Meta sequence @@ -436,9 +436,9 @@ static Strip *rna_Sequences_editing_new_meta( } static Strip *rna_Sequences_meta_new_meta( - ID *id, Strip *seq, const char *name, int channel, int frame_start) + ID *id, Strip *strip, const char *name, int channel, int frame_start) { - return rna_Sequences_new_meta(id, &seq->seqbase, name, channel, frame_start); + return rna_Sequences_new_meta(id, &strip->seqbase, name, channel, frame_start); } static Strip *rna_Sequences_new_effect(ID *id, @@ -453,7 +453,7 @@ static Strip *rna_Sequences_new_effect(ID *id, Strip *seq2) { Scene *scene = (Scene *)id; - Strip *seq; + Strip *strip; const int num_inputs = SEQ_effect_get_num_inputs(type); switch (num_inputs) { @@ -490,12 +490,12 @@ static Strip *rna_Sequences_new_effect(ID *id, load_data.effect.type = type; load_data.effect.seq1 = seq1; load_data.effect.seq2 = seq2; - seq = SEQ_add_effect_strip(scene, seqbase, &load_data); + strip = SEQ_add_effect_strip(scene, seqbase, &load_data); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); - return seq; + return strip; } static Strip *rna_Sequences_editing_new_effect(ID *id, @@ -514,7 +514,7 @@ static Strip *rna_Sequences_editing_new_effect(ID *id, } static Strip *rna_Sequences_meta_new_effect(ID *id, - Strip *seq, + Strip *strip, ReportList *reports, const char *name, int type, @@ -525,24 +525,24 @@ static Strip *rna_Sequences_meta_new_effect(ID *id, Strip *seq2) { return rna_Sequences_new_effect( - id, &seq->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2); + id, &strip->seqbase, reports, name, type, channel, frame_start, frame_end, seq1, seq2); } static void rna_Sequences_remove( - ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *seq_ptr) + ID *id, ListBase *seqbase, Main *bmain, ReportList *reports, PointerRNA *strip_ptr) { - Strip *seq = static_cast(seq_ptr->data); + Strip *strip = static_cast(strip_ptr->data); Scene *scene = (Scene *)id; - if (BLI_findindex(seqbase, seq) == -1) { + if (BLI_findindex(seqbase, strip) == -1) { BKE_reportf( - reports, RPT_ERROR, "Strip '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2); + reports, RPT_ERROR, "Strip '%s' not in scene '%s'", strip->name + 2, scene->id.name + 2); return; } - SEQ_edit_flag_for_removal(scene, seqbase, seq); + SEQ_edit_flag_for_removal(scene, seqbase, strip); SEQ_edit_remove_flagged_sequences(scene, seqbase); - RNA_POINTER_INVALIDATE(seq_ptr); + RNA_POINTER_INVALIDATE(strip_ptr); DEG_relations_tag_update(bmain); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -550,74 +550,74 @@ static void rna_Sequences_remove( } static void rna_Sequences_editing_remove( - ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *seq_ptr) + ID *id, Editing *ed, Main *bmain, ReportList *reports, PointerRNA *strip_ptr) { - rna_Sequences_remove(id, &ed->seqbase, bmain, reports, seq_ptr); + rna_Sequences_remove(id, &ed->seqbase, bmain, reports, strip_ptr); } static void rna_Sequences_meta_remove( - ID *id, Strip *seq, Main *bmain, ReportList *reports, PointerRNA *seq_ptr) + ID *id, Strip *strip, Main *bmain, ReportList *reports, PointerRNA *strip_ptr) { - rna_Sequences_remove(id, &seq->seqbase, bmain, reports, seq_ptr); + rna_Sequences_remove(id, &strip->seqbase, bmain, reports, strip_ptr); } -static StripElem *rna_SequenceElements_append(ID *id, Strip *seq, const char *filename) +static StripElem *rna_SequenceElements_append(ID *id, Strip *strip, const char *filename) { Scene *scene = (Scene *)id; StripElem *se; - seq->data->stripdata = se = static_cast( - MEM_reallocN(seq->data->stripdata, sizeof(StripElem) * (seq->len + 1))); - se += seq->len; + strip->data->stripdata = se = static_cast( + MEM_reallocN(strip->data->stripdata, sizeof(StripElem) * (strip->len + 1))); + se += strip->len; STRNCPY(se->filename, filename); - seq->len++; + strip->len++; - seq->flag &= ~SEQ_SINGLE_FRAME_CONTENT; + strip->flag &= ~SEQ_SINGLE_FRAME_CONTENT; WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); return se; } -static void rna_SequenceElements_pop(ID *id, Strip *seq, ReportList *reports, int index) +static void rna_SequenceElements_pop(ID *id, Strip *strip, ReportList *reports, int index) { Scene *scene = (Scene *)id; StripElem *new_seq, *se; - if (seq->len == 1) { + if (strip->len == 1) { BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element"); return; } /* python style negative indexing */ if (index < 0) { - index += seq->len; + index += strip->len; } - if (seq->len <= index || index < 0) { + if (strip->len <= index || index < 0) { BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range"); return; } new_seq = static_cast( - MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop")); - seq->len--; + MEM_callocN(sizeof(StripElem) * (strip->len - 1), "SequenceElements_pop")); + strip->len--; - if (seq->len == 1) { - seq->flag |= SEQ_SINGLE_FRAME_CONTENT; + if (strip->len == 1) { + strip->flag |= SEQ_SINGLE_FRAME_CONTENT; } - se = seq->data->stripdata; + se = strip->data->stripdata; if (index > 0) { memcpy(new_seq, se, sizeof(StripElem) * index); } - if (index < seq->len) { - memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index)); + if (index < strip->len) { + memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (strip->len - index)); } - MEM_freeN(seq->data->stripdata); - seq->data->stripdata = new_seq; + MEM_freeN(strip->data->stripdata); + strip->data->stripdata = new_seq; WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } @@ -637,24 +637,24 @@ static void rna_Sequence_invalidate_cache_rnafunc(ID *id, Strip *self, int type) } } -static SeqRetimingKey *rna_Sequence_retiming_keys_add(ID *id, Strip *seq, int timeline_frame) +static SeqRetimingKey *rna_Sequence_retiming_keys_add(ID *id, Strip *strip, int timeline_frame) { Scene *scene = (Scene *)id; - SeqRetimingKey *key = SEQ_retiming_add_key(scene, seq, timeline_frame); + SeqRetimingKey *key = SEQ_retiming_add_key(scene, strip, timeline_frame); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); return key; } -static void rna_Sequence_retiming_keys_reset(ID *id, Strip *seq) +static void rna_Sequence_retiming_keys_reset(ID *id, Strip *strip) { Scene *scene = (Scene *)id; - SEQ_retiming_data_clear(seq); + SEQ_retiming_data_clear(strip); - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, nullptr); } @@ -665,14 +665,14 @@ void RNA_api_sequence_strip(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - static const EnumPropertyItem seq_cahce_type_items[] = { + static const EnumPropertyItem strip_cache_type_items[] = { {SEQ_CACHE_STORE_RAW, "RAW", 0, "Raw", ""}, {SEQ_CACHE_STORE_PREPROCESSED, "PREPROCESSED", 0, "Preprocessed", ""}, {SEQ_CACHE_STORE_COMPOSITE, "COMPOSITE", 0, "Composite", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static const EnumPropertyItem seq_split_method_items[] = { + static const EnumPropertyItem strip_split_method_items[] = { {SEQ_SPLIT_SOFT, "SOFT", 0, "Soft", ""}, {SEQ_SPLIT_HARD, "HARD", 0, "Hard", ""}, {0, nullptr, 0, nullptr, nullptr}, @@ -718,7 +718,7 @@ void RNA_api_sequence_strip(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Invalidate cached images for strip and all dependent strips"); - parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type"); + parm = RNA_def_enum(func, "type", strip_cache_type_items, 0, "Type", "Cache Type"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); func = RNA_def_function(srna, "split", "rna_Sequence_split"); @@ -727,7 +727,7 @@ void RNA_api_sequence_strip(StructRNA *srna) parm = RNA_def_int( func, "frame", 0, INT_MIN, INT_MAX, "", "Frame where to split the strip", INT_MIN, INT_MAX); RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED); - parm = RNA_def_enum(func, "split_method", seq_split_method_items, 0, "", ""); + parm = RNA_def_enum(func, "split_method", strip_split_method_items, 0, "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* Return type. */ parm = RNA_def_pointer(func, "sequence", "Strip", "", "Right side Sequence"); @@ -791,25 +791,25 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri PropertyRNA *parm; FunctionRNA *func; - static const EnumPropertyItem seq_effect_items[] = { - {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, - {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, - {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, - {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, - {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, - {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, - {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, - {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, - {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, - {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""}, - {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, - {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""}, - {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""}, - {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, - {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, - {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, - {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""}, - {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, + static const EnumPropertyItem strip_effect_items[] = { + {STRIP_TYPE_CROSS, "CROSS", 0, "Cross", ""}, + {STRIP_TYPE_ADD, "ADD", 0, "Add", ""}, + {STRIP_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, + {STRIP_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, + {STRIP_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, + {STRIP_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, + {STRIP_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, + {STRIP_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, + {STRIP_TYPE_WIPE, "WIPE", 0, "Wipe", ""}, + {STRIP_TYPE_GLOW, "GLOW", 0, "Glow", ""}, + {STRIP_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, + {STRIP_TYPE_COLOR, "COLOR", 0, "Color", ""}, + {STRIP_TYPE_SPEED, "SPEED", 0, "Speed", ""}, + {STRIP_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {STRIP_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, + {STRIP_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, + {STRIP_TYPE_TEXT, "TEXT", 0, "Text", ""}, + {STRIP_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -1084,7 +1084,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri RNA_def_function_ui_description(func, "Add a new effect sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED); - parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence"); + parm = RNA_def_enum(func, "type", strip_effect_items, 0, "Type", "type for the new sequence"); RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED); parm = RNA_def_int(func, "channel", diff --git a/source/blender/makesrna/intern/rna_space.cc b/source/blender/makesrna/intern/rna_space.cc index 55e70e620be3..af7370866963 100644 --- a/source/blender/makesrna/intern/rna_space.cc +++ b/source/blender/makesrna/intern/rna_space.cc @@ -2456,17 +2456,18 @@ static void seq_build_proxy(bContext *C, PointerRNA *ptr) wmJob *wm_job = ED_seq_proxy_wm_job_get(C); ProxyJob *pj = ED_seq_proxy_job_get(C, wm_job); - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type != SEQ_TYPE_MOVIE || seq->data == nullptr || seq->data->proxy == nullptr) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type != STRIP_TYPE_MOVIE || strip->data == nullptr || strip->data->proxy == nullptr) + { continue; } /* Add new proxy size. */ - seq->data->proxy->build_size_flags |= SEQ_rendersize_to_proxysize(sseq->render_size); + strip->data->proxy->build_size_flags |= SEQ_rendersize_to_proxysize(sseq->render_size); /* Build proxy. */ SEQ_proxy_rebuild_context( - pj->main, pj->depsgraph, pj->scene, seq, &processed_paths, &pj->queue, true); + pj->main, pj->depsgraph, pj->scene, strip, &processed_paths, &pj->queue, true); } if (!WM_jobs_is_running(wm_job)) { diff --git a/source/blender/makesrna/intern/rna_texture.cc b/source/blender/makesrna/intern/rna_texture.cc index b30bbd831162..34fc77ac1d60 100644 --- a/source/blender/makesrna/intern/rna_texture.cc +++ b/source/blender/makesrna/intern/rna_texture.cc @@ -193,7 +193,7 @@ static void rna_Texture_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) } else if (GS(id->name) == ID_NT) { bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - ED_node_tree_propagate_change(nullptr, bmain, ntree); + ED_node_tree_propagate_change(bmain, ntree); } } diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index fb5ebf863d51..89f88c2b73ba 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -4418,12 +4418,14 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna) prop = RNA_def_property(srna, "path_keyframe_before", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame"); + RNA_def_property_ui_text( + prop, "Path Keyframe Before", "Color of keyframes on a path before current frame"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "path_keyframe_after", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame"); + RNA_def_property_ui_text( + prop, "Path Keyframe After", "Color of keyframes on a path after current frame"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -5214,6 +5216,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop = RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_SPLASH_DISABLE); RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_SHOW_FPS); @@ -5519,6 +5522,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, nullptr, "text_render", USER_TEXT_DISABLE_AA); RNA_def_property_ui_text( prop, "Text Anti-Aliasing", "Smooth jagged edges of user interface text"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_text_update"); prop = RNA_def_property(srna, "use_text_render_subpixelaa", PROP_BOOLEAN, PROP_NONE); @@ -5755,6 +5759,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop, "Show Auto Keying Warning", "Show warning indicators when transforming objects and bones if auto keying is enabled"); + RNA_def_property_boolean_default(prop, true); /* keyframing settings */ prop = RNA_def_property(srna, "key_insert_channels", PROP_ENUM, PROP_NONE); @@ -5764,6 +5769,10 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Default Key Channels", "Which channels to insert keys at when no keying set is active"); + RNA_def_property_enum_default(prop, + USER_ANIM_KEY_CHANNEL_LOCATION | USER_ANIM_KEY_CHANNEL_ROTATION | + USER_ANIM_KEY_CHANNEL_SCALE | + USER_ANIM_KEY_CHANNEL_CUSTOM_PROPERTIES); prop = RNA_def_property(srna, "use_auto_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "keying_flag", AUTOKEY_FLAG_INSERTNEEDED); @@ -5794,7 +5803,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop = RNA_def_property(srna, "use_anim_channel_group_colors", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna( prop, nullptr, "animation_flag", USER_ANIM_SHOW_CHANNEL_GROUP_COLORS); - RNA_def_property_boolean_default(prop, true); RNA_def_property_ui_text( prop, "Channel Group Colors", @@ -6278,6 +6286,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop, "Edit Mode Smooth Wires", "Enable edit mode edge smoothing, reducing aliasing (requires restart)"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_gpu_update"); prop = RNA_def_property(srna, "use_region_overlap", PROP_BOOLEAN, PROP_NONE); @@ -6331,7 +6340,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, nullptr, "anisotropic_filter"); RNA_def_property_enum_items(prop, anisotropic_items); - RNA_def_property_enum_default(prop, 1); RNA_def_property_ui_text(prop, "Anisotropic Filtering", "Quality of anisotropic filtering"); RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update"); @@ -6384,6 +6392,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) "GPU Depth Picking", "When making a selection in 3D View, use the GPU depth buffer to " "ensure the frontmost object is selected first"); + RNA_def_property_boolean_default(prop, true); /* GPU subdivision evaluation. */ @@ -7274,11 +7283,13 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_HIDE_RECENT); RNA_def_property_ui_text( prop, "Show Recent Locations", "Show Recent locations list in the File Browser"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "show_system_bookmarks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS); RNA_def_property_ui_text( prop, "Show System Locations", "Show System locations list in the File Browser"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "flag", USER_RELPATHS); @@ -7295,6 +7306,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_FILENOUI); RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files"); + RNA_def_property_boolean_default(prop, true); RNA_def_property_update(prop, 0, "rna_userdef_load_ui_update"); prop = RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE); @@ -7311,6 +7323,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop, "Tabs as Spaces", "Automatically convert all new tabs into spaces for new and loaded text files"); + RNA_def_property_boolean_default(prop, true); prop = RNA_def_property(srna, "use_extension_online_access_handled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna( @@ -7740,6 +7753,7 @@ void RNA_def_userdef(BlenderRNA *brna) prop = RNA_def_property(srna, "use_recent_searches", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_FLAG_RECENT_SEARCHES_DISABLE); RNA_def_property_ui_text(prop, "Recent Searches", "Sort the recently searched items at the top"); + RNA_def_property_boolean_default(prop, true); /* nested structs */ prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm.cc b/source/blender/makesrna/intern/rna_wm.cc index 2d6539c6b23a..1aa27330d6b5 100644 --- a/source/blender/makesrna/intern/rna_wm.cc +++ b/source/blender/makesrna/intern/rna_wm.cc @@ -1719,7 +1719,7 @@ static StructRNA *rna_Operator_register(Main *bmain, dummy_ot.description = *strings_table[2] ? strings_table[2] : nullptr; dummy_ot.translation_context = strings_table[3]; dummy_ot.undo_group = strings_table[4]; - BLI_assert(ARRAY_SIZE(strings) == 5); + BLI_STATIC_ASSERT(ARRAY_SIZE(strings) == 5, "Unexpected number of strings") } /* XXX, this doubles up with the operator name #29666. @@ -1892,7 +1892,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, dummy_ot.description = *strings_table[2] ? strings_table[2] : nullptr; dummy_ot.translation_context = strings_table[3]; dummy_ot.undo_group = strings_table[4]; - BLI_assert(ARRAY_SIZE(strings) == 5); + BLI_STATIC_ASSERT(ARRAY_SIZE(strings) == 5, "Unexpected number of strings") } /* XXX, this doubles up with the operator name #29666. diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.cc b/source/blender/makesrna/intern/rna_wm_gizmo.cc index 980f838d7064..8d9b1fc29637 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.cc +++ b/source/blender/makesrna/intern/rna_wm_gizmo.cc @@ -885,7 +885,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain, dummy_wgt.idname = strings_table[0]; /* allocated string stored here */ dummy_wgt.name = strings_table[1]; - BLI_assert(ARRAY_SIZE(strings) == 2); + BLI_STATIC_ASSERT(ARRAY_SIZE(strings) == 2, "Unexpected number of strings") } /* create a new gizmogroup type */ diff --git a/source/blender/modifiers/MOD_nodes.hh b/source/blender/modifiers/MOD_nodes.hh index 08e60a022555..827c4476d1d9 100644 --- a/source/blender/modifiers/MOD_nodes.hh +++ b/source/blender/modifiers/MOD_nodes.hh @@ -4,7 +4,10 @@ #pragma once +#include + struct NodesModifierData; +struct NodesModifierDataBlock; struct Object; struct NodesModifierPackedBake; diff --git a/source/blender/modifiers/intern/MOD_datatransfer.cc b/source/blender/modifiers/intern/MOD_datatransfer.cc index 475e464e0477..7bdb32af88a0 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.cc +++ b/source/blender/modifiers/intern/MOD_datatransfer.cc @@ -6,6 +6,8 @@ * \ingroup modifiers */ +#include + #include "BLI_utildefines.h" #include "BLT_translation.hh" @@ -20,7 +22,6 @@ #include "BKE_lib_id.hh" #include "BKE_lib_query.hh" #include "BKE_mesh.hh" -#include "BKE_mesh_mapping.hh" #include "BKE_mesh_remap.hh" #include "BKE_modifier.hh" #include "BKE_report.hh" diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.hh b/source/blender/modifiers/intern/MOD_meshcache_util.hh index 41ec6a0fa945..f99dd1391491 100644 --- a/source/blender/modifiers/intern/MOD_meshcache_util.hh +++ b/source/blender/modifiers/intern/MOD_meshcache_util.hh @@ -8,6 +8,8 @@ #pragma once +#include + /* `MOD_meshcache_mdd.cc` */ bool MOD_meshcache_read_mdd_index(FILE *fp, diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 12d838b6235a..16f7e3adb59f 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -2090,27 +2090,31 @@ static void add_attribute_search_or_value_buttons(DrawGroupInputsContext &ctx, uiLayout *name_row = uiLayoutRow(split, false); uiLayoutSetAlignment(name_row, UI_LAYOUT_ALIGN_RIGHT); + uiLayout *prop_row = nullptr; + const std::optional attribute_name = nodes::input_attribute_name_get( *ctx.nmd.settings.properties, socket); if (type == SOCK_BOOLEAN && !attribute_name) { uiItemL(name_row, "", ICON_NONE); + prop_row = uiLayoutRow(split, true); } else { - uiItemL(name_row, socket.name ? IFACE_(socket.name) : "", ICON_NONE); + prop_row = uiLayoutRow(layout, true); } - uiLayout *prop_row = uiLayoutRow(split, true); if (type == SOCK_BOOLEAN) { uiLayoutSetPropSep(prop_row, false); uiLayoutSetAlignment(prop_row, UI_LAYOUT_ALIGN_EXPAND); } if (attribute_name) { + uiItemL(name_row, socket.name ? IFACE_(socket.name) : "", ICON_NONE); + prop_row = uiLayoutRow(split, true); add_attribute_search_button(ctx, prop_row, rna_path_attribute_name, socket, false); uiItemL(layout, "", ICON_BLANK1); } else { - const char *name = type == SOCK_BOOLEAN ? (socket.name ? IFACE_(socket.name) : "") : ""; + const char *name = socket.name ? IFACE_(socket.name) : ""; uiItemR(prop_row, ctx.md_ptr, rna_path, UI_ITEM_NONE, name, ICON_NONE); uiItemDecoratorR(layout, ctx.md_ptr, rna_path.c_str(), -1); } diff --git a/source/blender/modifiers/intern/MOD_ocean.cc b/source/blender/modifiers/intern/MOD_ocean.cc index a86d6cf58e79..79c3d311496b 100644 --- a/source/blender/modifiers/intern/MOD_ocean.cc +++ b/source/blender/modifiers/intern/MOD_ocean.cc @@ -6,9 +6,9 @@ * \ingroup modifiers */ -#include "BLI_utildefines.h" - +#include "BLI_math_base.h" #include "BLI_task.h" +#include "BLI_utildefines.h" #include "BLT_translation.hh" diff --git a/source/blender/modifiers/intern/MOD_solidify_util.hh b/source/blender/modifiers/intern/MOD_solidify_util.hh index 82c1f4951689..75f79ce6b061 100644 --- a/source/blender/modifiers/intern/MOD_solidify_util.hh +++ b/source/blender/modifiers/intern/MOD_solidify_util.hh @@ -8,6 +8,10 @@ #pragma once +struct Mesh; +struct ModifierData; +struct ModifierEvalContext; + /* MOD_solidify_extrude.cc */ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.hh b/source/blender/modifiers/intern/MOD_weightvg_util.hh index ac152bcd50bc..736cbb1fcd21 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.hh +++ b/source/blender/modifiers/intern/MOD_weightvg_util.hh @@ -8,6 +8,9 @@ #pragma once +#include "DNA_object_types.h" + +struct bContext; struct CurveMapping; struct MDeformVert; struct MDeformWeight; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.cc b/source/blender/modifiers/intern/MOD_weightvgmix.cc index 2793e5659e86..7387a85c71ec 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.cc +++ b/source/blender/modifiers/intern/MOD_weightvgmix.cc @@ -6,6 +6,8 @@ * \ingroup modifiers */ +#include + #include "BLI_utildefines.h" #include "BLI_listbase.h" diff --git a/source/blender/modifiers/intern/lineart/lineart_intern.hh b/source/blender/modifiers/intern/lineart/lineart_intern.hh index c925bfc764c4..762fabd5f15b 100644 --- a/source/blender/modifiers/intern/lineart/lineart_intern.hh +++ b/source/blender/modifiers/intern/lineart/lineart_intern.hh @@ -10,6 +10,7 @@ #include "BLI_linklist.h" #include "BLI_listbase.h" +#include "BLI_set.hh" #include "BLI_threads.h" #include "DNA_lineart_types.h" @@ -21,6 +22,7 @@ extern "C" { #endif +struct LineartBoundingArea; struct LineartEdge; struct LineartData; struct LineartStaticMemPool; diff --git a/source/blender/nodes/NOD_geometry_nodes_dependencies.hh b/source/blender/nodes/NOD_geometry_nodes_dependencies.hh index 617cf3309963..f5511497acd8 100644 --- a/source/blender/nodes/NOD_geometry_nodes_dependencies.hh +++ b/source/blender/nodes/NOD_geometry_nodes_dependencies.hh @@ -63,7 +63,7 @@ struct GeometryNodesEvalDependencies { void add_object(Object *object, const ObjectDependencyInfo &object_deps = all_object_deps); /** - * Add all the given given dependencies to this one. + * Add all the given dependencies to this one. */ void merge(const GeometryNodesEvalDependencies &other); diff --git a/source/blender/nodes/NOD_socket_items_ops.hh b/source/blender/nodes/NOD_socket_items_ops.hh index fb21ca128b2e..79220ed94316 100644 --- a/source/blender/nodes/NOD_socket_items_ops.hh +++ b/source/blender/nodes/NOD_socket_items_ops.hh @@ -60,7 +60,7 @@ inline void update_after_node_change(bContext *C, const PointerRNA node_ptr) bNodeTree *ntree = reinterpret_cast(node_ptr.owner_id); BKE_ntree_update_tag_node_property(ntree, node); - ED_node_tree_propagate_change(nullptr, CTX_data_main(C), ntree); + ED_node_tree_propagate_change(CTX_data_main(C), ntree); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } diff --git a/source/blender/nodes/NOD_socket_items_ui.hh b/source/blender/nodes/NOD_socket_items_ui.hh index 4108c15afb29..cb9d7acf15c7 100644 --- a/source/blender/nodes/NOD_socket_items_ui.hh +++ b/source/blender/nodes/NOD_socket_items_ui.hh @@ -4,6 +4,8 @@ #pragma once +#include "DNA_node_types.h" + #include "WM_api.hh" #include "UI_interface.hh" @@ -13,6 +15,8 @@ #include "BKE_screen.hh" +#include "NOD_socket_items.hh" + namespace blender::nodes::socket_items::ui { template diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 6845e999a62d..4fe9a5637404 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -13,507 +13,507 @@ /* Empty definitions for undefined macros to avoid warnings */ #ifndef DefNode -#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) +#define DefNode(Category, ID, EnumName, StructName) #endif /* WARNING! If you edit those strings, please do the same in relevant nodes files (under blender/nodes/...)! */ -/* Tree type Node ID RNA def function Struct name UI Name UI Description */ -DefNode(Node, NODE_FRAME, def_frame, Frame, "Frame", "Collect related nodes together in a common area. Useful for organization when the re-usability of a node group is not required") -DefNode(Node, NODE_GROUP_INPUT, def_group_input, GroupInput, "Group Input", "Expose connected data from inside a node group as inputs to its interface") -DefNode(Node, NODE_GROUP_OUTPUT, def_group_output, GroupOutput, "Group Output", "Output data from inside of a node group") -DefNode(Node, NODE_GROUP, def_group, Group, "Group", "") -DefNode(Node, NODE_REROUTE, def_reroute, Reroute, "Reroute", "A single-socket organization tool that supports one input and multiple outputs") +/* Tree type Node ID RNA def function Struct name */ +DefNode(Node, NODE_FRAME, def_frame, Frame) +DefNode(Node, NODE_GROUP_INPUT, def_group_input, GroupInput) +DefNode(Node, NODE_GROUP_OUTPUT, def_group_output, GroupOutput) +DefNode(Node, NODE_GROUP, def_group, Group) +DefNode(Node, NODE_REROUTE, def_reroute, Reroute) -DefNode(ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, BrightContrast, "Brightness/Contrast","Control the brightness and contrast of the input color") -DefNode(ShaderNode, SH_NODE_CAMERA, 0, CameraData, "Camera Data", "Retrieve information about the camera and how it relates to the current shading point's position") -DefNode(ShaderNode, SH_NODE_CLAMP, def_clamp, Clamp, "Clamp", "Clamp a value between a minimum and a maximum") -DefNode(ShaderNode, SH_NODE_COMBRGB_LEGACY, 0, CombineRGB, "Combine RGB", "Generate a color from its red, green, and blue channels (Deprecated)") -DefNode(ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, RGBCurve, "RGB Curves", "Apply color corrections for each color channel") -DefNode(ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, VectorCurve, "Vector Curves", "Map input vector components with curves") -DefNode(ShaderNode, SH_NODE_GAMMA, 0, Gamma, "Gamma", "Apply a gamma correction") -DefNode(ShaderNode, SH_NODE_HUE_SAT, 0, HueSaturation, "Hue/Saturation/Value","Apply a color transformation in the HSV color model") -DefNode(ShaderNode, SH_NODE_INVERT, 0, Invert, "Invert Color", "Invert a color, producing a negative") -DefNode(ShaderNode, SH_NODE_MAP_RANGE, def_map_range, MapRange, "Map Range", "Remap a value from a range to a target range") -DefNode(ShaderNode, SH_NODE_MAPPING, def_sh_mapping, Mapping, "Mapping", "Transform the input vector by applying translation, rotation, and scale") -DefNode(ShaderNode, SH_NODE_MATH, def_math, Math, "Math", "Perform math operations") -DefNode(ShaderNode, SH_NODE_MIX_RGB_LEGACY, def_mix_rgb, MixRGB, "MixRGB", "Mix two input colors") -DefNode(ShaderNode, SH_NODE_NORMAL, 0, Normal, "Normal", "Generate a normal vector and a dot product") -DefNode(ShaderNode, SH_NODE_RGB, 0, RGB, "RGB", "A color picker") -DefNode(ShaderNode, SH_NODE_RGBTOBW, 0, RGBToBW, "RGB to BW", "Convert a color's luminance to a grayscale value") -DefNode(ShaderNode, SH_NODE_SEPRGB_LEGACY, 0, SeparateRGB, "Separate RGB", "Split a color into its red, green, and blue channels (Deprecated)") -DefNode(ShaderNode, SH_NODE_SHADERTORGB, 0, ShaderToRGB, "Shader to RGB", "Convert rendering effect (such as light and shadow) to color. Typically used for non-photorealistic rendering, to apply additional effects on the output of BSDFs.\nNote: only supported in EEVEE") -DefNode(ShaderNode, SH_NODE_SQUEEZE, 0, Squeeze, "Squeeze Value", "") -DefNode(ShaderNode, SH_NODE_VALTORGB, def_colorramp, ValToRGB, "Color Ramp", "Map values to colors with the use of a gradient") -DefNode(ShaderNode, SH_NODE_VALUE, 0, Value, "Value", "Input numerical values to other nodes in the tree") -DefNode(ShaderNode, SH_NODE_VECTOR_MATH, def_vector_math, VectorMath, "Vector Math", "Perform vector math operation") +DefNode(ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, BrightContrast) +DefNode(ShaderNode, SH_NODE_CAMERA, 0, CameraData) +DefNode(ShaderNode, SH_NODE_CLAMP, def_clamp, Clamp) +DefNode(ShaderNode, SH_NODE_COMBRGB_LEGACY, 0, CombineRGB) +DefNode(ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, RGBCurve) +DefNode(ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, VectorCurve) +DefNode(ShaderNode, SH_NODE_GAMMA, 0, Gamma) +DefNode(ShaderNode, SH_NODE_HUE_SAT, 0, HueSaturation) +DefNode(ShaderNode, SH_NODE_INVERT, 0, Invert) +DefNode(ShaderNode, SH_NODE_MAP_RANGE, def_map_range, MapRange) +DefNode(ShaderNode, SH_NODE_MAPPING, def_sh_mapping, Mapping) +DefNode(ShaderNode, SH_NODE_MATH, def_math, Math) +DefNode(ShaderNode, SH_NODE_MIX_RGB_LEGACY, def_mix_rgb, MixRGB) +DefNode(ShaderNode, SH_NODE_NORMAL, 0, Normal) +DefNode(ShaderNode, SH_NODE_RGB, 0, RGB) +DefNode(ShaderNode, SH_NODE_RGBTOBW, 0, RGBToBW) +DefNode(ShaderNode, SH_NODE_SEPRGB_LEGACY, 0, SeparateRGB) +DefNode(ShaderNode, SH_NODE_SHADERTORGB, 0, ShaderToRGB) +DefNode(ShaderNode, SH_NODE_SQUEEZE, 0, Squeeze) +DefNode(ShaderNode, SH_NODE_VALTORGB, def_colorramp, ValToRGB) +DefNode(ShaderNode, SH_NODE_VALUE, 0, Value) +DefNode(ShaderNode, SH_NODE_VECTOR_MATH, def_vector_math, VectorMath) -DefNode(ShaderNode, SH_NODE_ADD_SHADER, 0, AddShader, "Add Shader", "Add two Shaders together") -DefNode(ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,AmbientOcclusion, "Ambient Occlusion", "Compute how much the hemisphere above the shading point is occluded, for example to add weathering effects to corners.\nNote: For Cycles, this may slow down renders significantly") -DefNode(ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, Attribute, "Attribute", "Retrieve attributes attached to objects or geometry") -DefNode(ShaderNode, SH_NODE_BACKGROUND, 0, Background, "Background", "Add background light emission.\nNote: This node should only be used for the world surface output") -DefNode(ShaderNode, SH_NODE_BEVEL, def_sh_bevel, Bevel, "Bevel", "Generates normals with round corners.\nNote: only supported in Cycles, and may slow down renders") -DefNode(ShaderNode, SH_NODE_BLACKBODY, 0, Blackbody, "Blackbody", "Convert a blackbody temperature to an RGB value") -DefNode(ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, BsdfDiffuse, "Diffuse BSDF", "Lambertian and Oren-Nayar diffuse reflection") -DefNode(ShaderNode, SH_NODE_BSDF_GLASS, def_glass, BsdfGlass, "Glass BSDF", "Glass-like shader mixing refraction and reflection at grazing angles") -DefNode(ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, BsdfAnisotropic, "Glossy BSDF", "Reflection with microfacet distribution, used for materials such as metal or mirrors") -DefNode(ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, BsdfHairPrincipled,"Principled Hair BSDF", "Physically-based, easy-to-use shader for rendering hair and fur") -DefNode(ShaderNode, SH_NODE_BSDF_HAIR, def_hair, BsdfHair, "Hair BSDF", "Reflection and transmission shaders optimized for hair rendering") -DefNode(ShaderNode, SH_NODE_BSDF_METALLIC, def_metallic, BsdfMetallic, "Metallic BSDF", "Metallic reflection with microfacet distribution, and metallic fresnel") -DefNode(ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, BsdfPrincipled, "Principled BSDF", "Physically-based, easy-to-use shader for rendering surface materials, based on the OpenPBR model") -DefNode(ShaderNode, SH_NODE_BSDF_RAY_PORTAL, 0, BsdfRayPortal, "Ray Portal BSDF", "Continue tracing from an arbitrary new position and in a new direction") -DefNode(ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, BsdfRefraction, "Refraction BSDF", "Glossy refraction with sharp or microfacet distribution, typically used for materials that transmit light") -DefNode(ShaderNode, SH_NODE_BSDF_SHEEN, def_sheen, BsdfSheen, "Sheen BSDF", "Reflection for materials such as cloth.\nTypically mixed with other shaders (such as a Diffuse Shader) and is not particularly useful on its own") -DefNode(ShaderNode, SH_NODE_BSDF_TOON, def_toon, BsdfToon, "Toon BSDF", "Diffuse and Glossy shaders with cartoon light effects") -DefNode(ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, BsdfTranslucent, "Translucent BSDF", "Lambertian diffuse transmission") -DefNode(ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, BsdfTransparent, "Transparent BSDF", "Transparency without refraction, passing straight through the surface as if there were no geometry") -DefNode(ShaderNode, SH_NODE_BUMP, def_sh_bump, Bump, "Bump", "Generate a perturbed normal from a height texture for bump mapping. Typically used for faking highly detailed surfaces") -DefNode(ShaderNode, SH_NODE_COMBHSV_LEGACY, 0, CombineHSV, "Combine HSV", "Create a color from its hue, saturation, and value channels") -DefNode(ShaderNode, SH_NODE_COMBINE_COLOR, def_sh_combsep_color, CombineColor, "Combine Color", "Create a color from individual components using multiple models") -DefNode(ShaderNode, SH_NODE_COMBXYZ, 0, CombineXYZ, "Combine XYZ", "Create a vector from X, Y, and Z components") -DefNode(ShaderNode, SH_NODE_CURVE_FLOAT, def_float_curve, FloatCurve, "Float Curve", "Map an input float to a curve and outputs a float value") -DefNode(ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, Displacement, "Displacement", "Displace the surface along the surface normal") -DefNode(ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, EeveeSpecular, "Specular BSDF", "Similar to the Principled BSDF node but uses the specular workflow instead of metallic, which functions by specifying the facing (along normal) reflection color. Energy is not conserved, so the result may not be physically accurate") -DefNode(ShaderNode, SH_NODE_EMISSION, 0, Emission, "Emission", "Lambertian emission shader") -DefNode(ShaderNode, SH_NODE_FRESNEL, 0, Fresnel, "Fresnel", "Produce a blending factor depending on the angle between the surface normal and the view direction using Fresnel equations.\nTypically used for mixing reflections at grazing angles") -DefNode(ShaderNode, SH_NODE_HAIR_INFO, 0, HairInfo, "Curves Info", "Retrieve hair curve information") -DefNode(ShaderNode, SH_NODE_HOLDOUT, 0, Holdout, "Holdout", "Create a \"hole\" in the image with zero alpha transparency, which is useful for compositing.\nNote: the holdout shader can only create alpha when transparency is enabled in the film settings") -DefNode(ShaderNode, SH_NODE_LAYER_WEIGHT, 0, LayerWeight, "Layer Weight", "Produce a blending factor depending on the angle between the surface normal and the view direction.\nTypically used for layering shaders with the Mix Shader node") -DefNode(ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, LightFalloff, "Light Falloff", "Manipulate how light intensity decreases over distance. Typically used for non-physically-based effects; in reality light always falls off quadratically") -DefNode(ShaderNode, SH_NODE_LIGHT_PATH, 0, LightPath, "Light Path", "Retrieve the type of incoming ray for which the shader is being executed.\nTypically used for non-physically-based tricks") -DefNode(ShaderNode, SH_NODE_MIX_SHADER, 0, MixShader, "Mix Shader", "Mix two shaders together. Typically used for material layering") -DefNode(ShaderNode, SH_NODE_MIX, def_sh_mix, Mix, "Mix", "Mix values by a factor") -DefNode(ShaderNode, SH_NODE_NEW_GEOMETRY, 0, NewGeometry, "Geometry", "Retrieve geometric information about the current shading point") -DefNode(ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, NormalMap, "Normal Map", "Generate a perturbed normal from an RGB normal map image. Typically used for faking highly detailed surfaces") -DefNode(ShaderNode, SH_NODE_OBJECT_INFO, 0, ObjectInfo, "Object Info", "Retrieve information about the object instance") -DefNode(ShaderNode, SH_NODE_OUTPUT_AOV, def_sh_output_aov, OutputAOV, "AOV Output", "Arbitrary Output Variables.\nProvide custom render passes for arbitrary shader node outputs") -DefNode(ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, OutputLight, "Light Output", "Output light information to a light object") -DefNode(ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,OutputLineStyle, "Line Style Output", "") -DefNode(ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, OutputMaterial, "Material Output", "Output surface material information for use in rendering") -DefNode(ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, OutputWorld, "World Output", "Output light color information to the scene's World") -DefNode(ShaderNode, SH_NODE_PARTICLE_INFO, 0, ParticleInfo, "Particle Info", "Retrieve the data of the particle that spawned the object instance, for example to give variation to multiple instances of an object") -DefNode(ShaderNode, SH_NODE_POINT_INFO, 0, PointInfo, "Point Info", "Retrieve information about points in a point cloud") -DefNode(ShaderNode, SH_NODE_SCRIPT, def_sh_script, Script, "Script", "Generate an OSL shader from a file or text data-block.\nNote: OSL shaders are not supported on all GPU backends") -DefNode(ShaderNode, SH_NODE_SEPARATE_COLOR, def_sh_combsep_color, SeparateColor, "Separate Color", "Split a color into its individual components using multiple models") -DefNode(ShaderNode, SH_NODE_SEPHSV_LEGACY, 0, SeparateHSV, "Separate HSV", "Split a color into its hue, saturation, and value channels") -DefNode(ShaderNode, SH_NODE_SEPXYZ, 0, SeparateXYZ, "Separate XYZ", "Split a vector into its X, Y, and Z components") -DefNode(ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, SubsurfaceScattering,"Subsurface Scattering","Subsurface multiple scattering shader to simulate light entering the surface and bouncing internally.\nTypically used for materials such as skin, wax, marble or milk") -DefNode(ShaderNode, SH_NODE_TANGENT, def_sh_tangent, Tangent, "Tangent", "Generate a tangent direction for the Anisotropic BSDF") -DefNode(ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, TexBrick, "Brick Texture", "Generate a procedural texture producing bricks") -DefNode(ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, TexChecker, "Checker Texture", "Generate a checkerboard texture") -DefNode(ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, TexCoord, "Texture Coordinate","Retrieve multiple types of texture coordinates.\nTypically used as inputs for texture nodes") -DefNode(ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, TexEnvironment, "Environment Texture","Sample an image file as an environment texture. Typically used to light the scene with the background node") -DefNode(ShaderNode, SH_NODE_TEX_GABOR, def_sh_tex_gabor, TexGabor, "Gabor Texture", "Generate Gabor noise") -DefNode(ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, TexGradient, "Gradient Texture", "Generate interpolated color and intensity values based on the input vector") -DefNode(ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, TexIES, "IES Texture", "Match real world lights with IES files, which store the directional intensity distribution of light sources") -DefNode(ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, TexImage, "Image Texture", "Sample an image file as a texture") -DefNode(ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, TexMagic, "Magic Texture", "Generate a psychedelic color texture") -DefNode(ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, TexNoise, "Noise Texture", "Generate fractal Perlin noise") -DefNode(ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,TexPointDensity, "Point Density", "Generate a volumetric point for each particle or vertex of another object") -DefNode(ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, TexSky, "Sky Texture", "Generate a procedural sky texture") -DefNode(ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, TexVoronoi, "Voronoi Texture", "Generate Worley noise based on the distance to random points. Typically used to generate textures such as stones, water, or biological cells") -DefNode(ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, TexWave, "Wave Texture", "Generate procedural bands or rings with noise") -DefNode(ShaderNode, SH_NODE_TEX_WHITE_NOISE, def_sh_tex_white_noise, TexWhiteNoise, "White Noise Texture","Return a random value or color based on an input seed") -DefNode(ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, UVAlongStroke, "UV Along Stroke", "") -DefNode(ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, UVMap, "UV Map", "Retrieve a UV map from the geometry, or the default fallback if none is specified") -DefNode(ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, VectorTransform, "Vector Transform", "Convert a vector, point, or normal between world, camera, and object coordinate space") -DefNode(ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,VectorDisplacement,"Vector Displacement","Displace the surface along an arbitrary direction") -DefNode(ShaderNode, SH_NODE_VECTOR_ROTATE, def_sh_vector_rotate, VectorRotate, "Vector Rotate", "Rotate a vector around a pivot point (center)") -DefNode(ShaderNode, SH_NODE_VERTEX_COLOR, def_sh_vertex_color, VertexColor, "Color Attribute", "Retrieve a color attribute, or the default fallback if none is specified") -DefNode(ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, VolumeAbsorption, "Volume Absorption", "Absorb light as it passes through the volume") -DefNode(ShaderNode, SH_NODE_VOLUME_INFO, 0, VolumeInfo, "Volume Info", "Read volume data attributes from volume grids") -DefNode(ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, VolumePrincipled, "Principled Volume", "Combine all volume shading components into a single easy to use node") -DefNode(ShaderNode, SH_NODE_VOLUME_SCATTER, def_scatter, VolumeScatter, "Volume Scatter", "Scatter light as it passes through the volume, often used to add fog to a scene") -DefNode(ShaderNode, SH_NODE_WAVELENGTH, 0, Wavelength, "Wavelength", "Convert a wavelength value to an RGB value") -DefNode(ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, Wireframe, "Wireframe", "Retrieve the edges of an object as it appears to Cycles.\nNote: as meshes are triangulated before being processed by Cycles, topology will always appear triangulated") +DefNode(ShaderNode, SH_NODE_ADD_SHADER, 0, AddShader) +DefNode(ShaderNode, SH_NODE_AMBIENT_OCCLUSION, def_sh_ambient_occlusion,AmbientOcclusion) +DefNode(ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, Attribute) +DefNode(ShaderNode, SH_NODE_BACKGROUND, 0, Background) +DefNode(ShaderNode, SH_NODE_BEVEL, def_sh_bevel, Bevel) +DefNode(ShaderNode, SH_NODE_BLACKBODY, 0, Blackbody) +DefNode(ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, BsdfDiffuse) +DefNode(ShaderNode, SH_NODE_BSDF_GLASS, def_glass, BsdfGlass) +DefNode(ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, BsdfAnisotropic) +DefNode(ShaderNode, SH_NODE_BSDF_HAIR_PRINCIPLED, def_hair_principled, BsdfHairPrincipled) +DefNode(ShaderNode, SH_NODE_BSDF_HAIR, def_hair, BsdfHair) +DefNode(ShaderNode, SH_NODE_BSDF_METALLIC, def_metallic, BsdfMetallic) +DefNode(ShaderNode, SH_NODE_BSDF_PRINCIPLED, def_principled, BsdfPrincipled) +DefNode(ShaderNode, SH_NODE_BSDF_RAY_PORTAL, 0, BsdfRayPortal) +DefNode(ShaderNode, SH_NODE_BSDF_REFRACTION, def_refraction, BsdfRefraction) +DefNode(ShaderNode, SH_NODE_BSDF_SHEEN, def_sheen, BsdfSheen) +DefNode(ShaderNode, SH_NODE_BSDF_TOON, def_toon, BsdfToon) +DefNode(ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, BsdfTranslucent) +DefNode(ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, BsdfTransparent) +DefNode(ShaderNode, SH_NODE_BUMP, def_sh_bump, Bump) +DefNode(ShaderNode, SH_NODE_COMBHSV_LEGACY, 0, CombineHSV) +DefNode(ShaderNode, SH_NODE_COMBINE_COLOR, def_sh_combsep_color, CombineColor) +DefNode(ShaderNode, SH_NODE_COMBXYZ, 0, CombineXYZ) +DefNode(ShaderNode, SH_NODE_CURVE_FLOAT, def_float_curve, FloatCurve) +DefNode(ShaderNode, SH_NODE_DISPLACEMENT, def_sh_displacement, Displacement) +DefNode(ShaderNode, SH_NODE_EEVEE_SPECULAR, 0, EeveeSpecular) +DefNode(ShaderNode, SH_NODE_EMISSION, 0, Emission) +DefNode(ShaderNode, SH_NODE_FRESNEL, 0, Fresnel) +DefNode(ShaderNode, SH_NODE_HAIR_INFO, 0, HairInfo) +DefNode(ShaderNode, SH_NODE_HOLDOUT, 0, Holdout) +DefNode(ShaderNode, SH_NODE_LAYER_WEIGHT, 0, LayerWeight) +DefNode(ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, LightFalloff) +DefNode(ShaderNode, SH_NODE_LIGHT_PATH, 0, LightPath) +DefNode(ShaderNode, SH_NODE_MIX_SHADER, 0, MixShader) +DefNode(ShaderNode, SH_NODE_MIX, def_sh_mix, Mix) +DefNode(ShaderNode, SH_NODE_NEW_GEOMETRY, 0, NewGeometry) +DefNode(ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, NormalMap) +DefNode(ShaderNode, SH_NODE_OBJECT_INFO, 0, ObjectInfo) +DefNode(ShaderNode, SH_NODE_OUTPUT_AOV, def_sh_output_aov, OutputAOV) +DefNode(ShaderNode, SH_NODE_OUTPUT_LIGHT, def_sh_output, OutputLight) +DefNode(ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,OutputLineStyle) +DefNode(ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, OutputMaterial) +DefNode(ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, OutputWorld) +DefNode(ShaderNode, SH_NODE_PARTICLE_INFO, 0, ParticleInfo) +DefNode(ShaderNode, SH_NODE_POINT_INFO, 0, PointInfo) +DefNode(ShaderNode, SH_NODE_SCRIPT, def_sh_script, Script) +DefNode(ShaderNode, SH_NODE_SEPARATE_COLOR, def_sh_combsep_color, SeparateColor) +DefNode(ShaderNode, SH_NODE_SEPHSV_LEGACY, 0, SeparateHSV) +DefNode(ShaderNode, SH_NODE_SEPXYZ, 0, SeparateXYZ) +DefNode(ShaderNode, SH_NODE_SUBSURFACE_SCATTERING, def_sh_subsurface, SubsurfaceScattering) +DefNode(ShaderNode, SH_NODE_TANGENT, def_sh_tangent, Tangent) +DefNode(ShaderNode, SH_NODE_TEX_BRICK, def_sh_tex_brick, TexBrick) +DefNode(ShaderNode, SH_NODE_TEX_CHECKER, def_sh_tex_checker, TexChecker) +DefNode(ShaderNode, SH_NODE_TEX_COORD, def_sh_tex_coord, TexCoord) +DefNode(ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, TexEnvironment) +DefNode(ShaderNode, SH_NODE_TEX_GABOR, def_sh_tex_gabor, TexGabor) +DefNode(ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, TexGradient) +DefNode(ShaderNode, SH_NODE_TEX_IES, def_sh_tex_ies, TexIES) +DefNode(ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, TexImage) +DefNode(ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, TexMagic) +DefNode(ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, TexNoise) +DefNode(ShaderNode, SH_NODE_TEX_POINTDENSITY, def_sh_tex_pointdensity,TexPointDensity) +DefNode(ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, TexSky) +DefNode(ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, TexVoronoi) +DefNode(ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, TexWave) +DefNode(ShaderNode, SH_NODE_TEX_WHITE_NOISE, def_sh_tex_white_noise, TexWhiteNoise) +DefNode(ShaderNode, SH_NODE_UVALONGSTROKE, def_sh_uvalongstroke, UVAlongStroke) +DefNode(ShaderNode, SH_NODE_UVMAP, def_sh_uvmap, UVMap) +DefNode(ShaderNode, SH_NODE_VECT_TRANSFORM, def_sh_vect_transform, VectorTransform) +DefNode(ShaderNode, SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,VectorDisplacement) +DefNode(ShaderNode, SH_NODE_VECTOR_ROTATE, def_sh_vector_rotate, VectorRotate) +DefNode(ShaderNode, SH_NODE_VERTEX_COLOR, def_sh_vertex_color, VertexColor) +DefNode(ShaderNode, SH_NODE_VOLUME_ABSORPTION, 0, VolumeAbsorption) +DefNode(ShaderNode, SH_NODE_VOLUME_INFO, 0, VolumeInfo) +DefNode(ShaderNode, SH_NODE_VOLUME_PRINCIPLED, 0, VolumePrincipled) +DefNode(ShaderNode, SH_NODE_VOLUME_SCATTER, def_scatter, VolumeScatter) +DefNode(ShaderNode, SH_NODE_WAVELENGTH, 0, Wavelength) +DefNode(ShaderNode, SH_NODE_WIREFRAME, def_sh_tex_wireframe, Wireframe) /* UPBGE*/ DefNode(ShaderNode, SH_NODE_SPRITES_ANIMATION, 0, SpritesAnimation, "Sprites Animation", "") /* NOTE: #OutputFile node has special RNA setup function called in `rna_nodetree.cc`. */ -DefNode(CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, AlphaOver, "Alpha Over", "Overlay a foreground image onto a background image") -DefNode(CompositorNode, CMP_NODE_ANTIALIASING, def_cmp_antialiasing, AntiAliasing, "Anti-Aliasing", "Smooth away jagged edges") -DefNode(CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, Bilateralblur, "Bilateral Blur", "Adaptively blur image, while retaining sharp edges") -DefNode(CompositorNode, CMP_NODE_BLUR, def_cmp_blur, Blur, "Blur", "Blur an image, using several blur modes") -DefNode(CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, BokehBlur, "Bokeh Blur", "Generate a bokeh type blur similar to Defocus. Unlike defocus an in-focus region is defined in the compositor") -DefNode(CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, BokehImage, "Bokeh Image", "Generate image with bokeh shape for use with the Bokeh Blur filter node") -DefNode(CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, BrightContrast, "Brightness/Contrast", "Adjust brightness and contrast") -DefNode(CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, ChannelMatte, "Channel Key", "Create matte based on differences in color channels") -DefNode(CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, ChromaMatte, "Chroma Key", "Create matte based on chroma values") -DefNode(CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, ColorMatte, "Color Key", "Create matte using a given color, for green or blue screen footage") -DefNode(CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, ColorSpill, "Color Spill", "Remove colors from a blue or green screen, by reducing one RGB channel compared to the others") -DefNode(CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, ColorBalance, "Color Balance", "Adjust color and values") -DefNode(CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection, ColorCorrection, "Color Correction", "Adjust the color of an image, separately in several tonal ranges (highlights, midtones and shadows)") -DefNode(CompositorNode, CMP_NODE_COMBHSVA_LEGACY,0, CombHSVA, "Combine HSVA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_COMBINE_COLOR, def_cmp_combsep_color, CombineColor, "Combine Color", "Combine an image from its composite color channels") -DefNode(CompositorNode, CMP_NODE_COMBINE_XYZ, 0, CombineXYZ, "Combine XYZ", "Combine a vector from its individual components") -DefNode(CompositorNode, CMP_NODE_COMBRGBA_LEGACY,0, CombRGBA, "Combine RGBA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_COMBYCCA_LEGACY,def_cmp_ycc, CombYCCA, "Combine YCbCrA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_COMBYUVA_LEGACY,0, CombYUVA, "Combine YUVA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, Composite, "Composite", "Final render output") -DefNode(CompositorNode, CMP_NODE_CONVERT_COLOR_SPACE,def_cmp_convert_color_space,ConvertColorSpace,"Convert Colorspace","Convert between color spaces") -DefNode(CompositorNode, CMP_NODE_CORNERPIN, 0, CornerPin, "Corner Pin", "Plane warp transformation using explicit corner values") -DefNode(CompositorNode, CMP_NODE_CROP, def_cmp_crop, Crop, "Crop", "Crops image to a smaller region, either making the cropped area transparent or resizing the image") -DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE_LEGACY, def_cmp_cryptomatte_legacy,Cryptomatte, "Cryptomatte (Legacy)","Deprecated. Use Cryptomatte Node instead") -DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, CryptomatteV2, "Cryptomatte", "Generate matte for individual objects and materials using Cryptomatte render passes") -DefNode(CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, CurveRGB, "RGB Curves", "Perform level adjustments on each color channel of an image") -DefNode(CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, CurveVec, "Vector Curves", "Map input vector components with curves") -DefNode(CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, DBlur, "Directional Blur", "Blur an image along a direction") -DefNode(CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, Defocus, "Defocus", "Apply depth of field in 2D, using a Z depth map or mask") -DefNode(CompositorNode, CMP_NODE_DENOISE, def_cmp_denoise, Denoise, "Denoise", "Denoise renders from Cycles and other ray tracing renderers") -DefNode(CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, Despeckle, "Despeckle", "Smooth areas of an image in which noise is noticeable, while leaving complex areas untouched") -DefNode(CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, DiffMatte, "Difference Key", "Produce a matte that isolates foreground content by comparing it with a reference background image") -DefNode(CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, DilateErode, "Dilate/Erode", "Expand and shrink masks") -DefNode(CompositorNode, CMP_NODE_DISPLACE, 0, Displace, "Displace", "Displace pixel position using an offset vector") -DefNode(CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, DistanceMatte, "Distance Key", "Create matte based on 3D distance between colors") -DefNode(CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask, DoubleEdgeMask, "Double Edge Mask", "Create a gradient between two masks") -DefNode(CompositorNode, CMP_NODE_EXPOSURE, 0, Exposure, "Exposure", "Adjust brightness using a camera exposure parameter") -DefNode(CompositorNode, CMP_NODE_FILTER, def_cmp_filter, Filter, "Filter", "Apply common image enhancement filters") -DefNode(CompositorNode, CMP_NODE_FLIP, def_cmp_flip, Flip, "Flip", "Flip an image along a defined axis") -DefNode(CompositorNode, CMP_NODE_GAMMA, 0, Gamma, "Gamma", "Apply gamma correction") -DefNode(CompositorNode, CMP_NODE_GLARE, def_cmp_glare, Glare, "Glare", "Add lens flares, fog and glows around bright parts of the image") -DefNode(CompositorNode, CMP_NODE_HUE_SAT, 0, HueSat, "Hue/Saturation/Value","Apply a color transformation in the HSV color model") -DefNode(CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, HueCorrect, "Hue Correct", "Adjust hue, saturation, and value with a curve") -DefNode(CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, IDMask, "ID Mask", "Create a matte from an object or material index pass") -DefNode(CompositorNode, CMP_NODE_IMAGE, def_cmp_image, Image, "Image", "Input image or movie file") -DefNode(CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, Inpaint, "Inpaint", "Extend borders of an image into transparent or masked regions") -DefNode(CompositorNode, CMP_NODE_INVERT, def_cmp_invert, Invert, "Invert Color", "Invert colors, producing a negative") -DefNode(CompositorNode, CMP_NODE_KEYING, def_cmp_keying, Keying, "Keying", "Perform both chroma keying (to remove the backdrop) and despill (to correct color cast from the backdrop)") -DefNode(CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, KeyingScreen, "Keying Screen", "Create plates for use as a color reference for keying nodes") -DefNode(CompositorNode, CMP_NODE_KUWAHARA, def_cmp_kuwahara, Kuwahara, "Kuwahara", "Apply smoothing filter that preserves edges, for stylized and painterly effects") -DefNode(CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, Lensdist, "Lens Distortion", "Simulate distortion and dispersion from camera lenses") -DefNode(CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, LumaMatte, "Luminance Key", "Create a matte based on luminance (brightness) difference") -DefNode(CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, MapRange, "Map Range", "Map an input value range into a destination range") -DefNode(CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, MapUV, "Map UV", "Map a texture using UV coordinates, to apply a texture to objects in compositing") -DefNode(CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, MapValue, "Map Value", "Scale, offset and clamp values") -DefNode(CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, BoxMask, "Box Mask", "Create rectangular mask suitable for use as a simple matte") -DefNode(CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, EllipseMask, "Ellipse Mask", "Create elliptical mask suitable for use as a simple matte or vignette mask") -DefNode(CompositorNode, CMP_NODE_MASK, def_cmp_mask, Mask, "Mask", "Input mask from a mask datablock, created in the image editor") -DefNode(CompositorNode, CMP_NODE_MATH, def_math, Math, "Math", "Perform math operations") -DefNode(CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, MixRGB, "Mix", "Blend two images together using various blending modes") -DefNode(CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, MovieClip, "Movie Clip", "Input image or movie from a movie clip datablock, typically used for motion tracking") -DefNode(CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion, MovieDistortion, "Movie Distortion", "Remove lens distortion from footage, using motion tracking camera lens settings") -DefNode(CompositorNode, CMP_NODE_NORMAL, 0, Normal, "Normal", "Generate a normal vector and a dot product") -DefNode(CompositorNode, CMP_NODE_NORMALIZE, 0, Normalize, "Normalize", "Map values to 0 to 1 range, based on the minimum and maximum pixel values") -DefNode(CompositorNode, CMP_NODE_OUTPUT_FILE, 0, OutputFile, "File Output", "Write image file to disk") -DefNode(CompositorNode, CMP_NODE_PIXELATE, def_cmp_pixelate, Pixelate, "Pixelate", "Reduce detail in an image by making individual pixels more prominent, for a blocky or mosaic-like appearance") -DefNode(CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform, PlaneTrackDeform, "Plane Track Deform", "Replace flat planes in footage by another image, detected by plane tracks from motion tracking") -DefNode(CompositorNode, CMP_NODE_POSTERIZE, 0, Posterize, "Posterize", "Reduce number of colors in an image, converting smooth gradients into sharp transitions") -DefNode(CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, PremulKey, "Alpha Convert", "Convert to and from premultiplied (associated) alpha") -DefNode(CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, RLayers, "Render Layers", "Input render passes from a scene render") -DefNode(CompositorNode, CMP_NODE_RGB, 0, RGB, "RGB", "A color picker") -DefNode(CompositorNode, CMP_NODE_RGBTOBW, 0, RGBToBW, "RGB to BW", "Convert RGB input into grayscale using luminance") -DefNode(CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, Rotate, "Rotate", "Rotate image by specified angle") -DefNode(CompositorNode, CMP_NODE_SCALE, def_cmp_scale, Scale, "Scale", "Change the size of the image") -DefNode(CompositorNode, CMP_NODE_SCENE_TIME, 0, SceneTime, "Scene Time", "Input the current scene time in seconds or frames") -DefNode(CompositorNode, CMP_NODE_SEPARATE_COLOR, def_cmp_combsep_color, SeparateColor, "Separate Color", "Split an image into its composite color channels") -DefNode(CompositorNode, CMP_NODE_SEPARATE_XYZ, 0, SeparateXYZ, "Separate XYZ", "Split a vector into its individual components") -DefNode(CompositorNode, CMP_NODE_SEPHSVA_LEGACY, 0, SepHSVA, "Separate HSVA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_SEPRGBA_LEGACY, 0, SepRGBA, "Separate RGBA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_SEPYCCA_LEGACY, def_cmp_ycc, SepYCCA, "Separate YCbCrA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_SEPYUVA_LEGACY, 0, SepYUVA, "Separate YUVA", "Deprecated") -DefNode(CompositorNode, CMP_NODE_SETALPHA, def_cmp_set_alpha, SetAlpha, "Set Alpha", "Add an alpha channel to an image") -DefNode(CompositorNode, CMP_NODE_SPLIT, def_cmp_split, Split, "Split", "Combine two images for side-by-side display. Typically used in combination with a Viewer node") -DefNode(CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, Stabilize, "Stabilize 2D", "Stabilize footage using 2D stabilization motion tracking settings") -DefNode(CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, SunBeams, "Sun Beams", "Create sun beams based on image brightness") -DefNode(CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, SwitchView, "Switch View", "Combine the views (left and right) into a single stereo 3D output") -DefNode(CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, Switch, "Switch", "Switch between two images using a checkbox") -DefNode(CompositorNode, CMP_NODE_TEXTURE, def_texture, Texture, "Texture", "Generate texture pattern from texture datablock") -DefNode(CompositorNode, CMP_NODE_TIME, def_time, Time, "Time Curve", "Generate a factor value (from 0.0 to 1.0) between scene start and end time, using a curve mapping") -DefNode(CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, Tonemap, "Tonemap", "Map one set of colors to another in order to approximate the appearance of high dynamic range") -DefNode(CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, TrackPos, "Track Position", "Provide information about motion tracking points, such as x and y values") -DefNode(CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, Transform, "Transform", "Scale, translate and rotate an image") -DefNode(CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, Translate, "Translate", "Offset an image") -DefNode(CompositorNode, CMP_NODE_VALTORGB, def_colorramp, ValToRGB, "Color Ramp", "Map values to colors with the use of a gradient") -DefNode(CompositorNode, CMP_NODE_VALUE, 0, Value, "Value", "Input numerical values to other nodes in the node graph") -DefNode(CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, VecBlur, "Vector Blur", "Uses the vector speed render pass to blur the image pixels in 2D") -DefNode(CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, Levels, "Levels", "Compute average and standard deviation of pixel values") -DefNode(CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, Viewer, "Viewer", "Visualize data from inside a node graph, in the image editor or as a backdrop") -DefNode(CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, Zcombine, "Z Combine", "Combine two images using depth maps") +DefNode(CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, AlphaOver) +DefNode(CompositorNode, CMP_NODE_ANTIALIASING, def_cmp_antialiasing, AntiAliasing) +DefNode(CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, Bilateralblur) +DefNode(CompositorNode, CMP_NODE_BLUR, def_cmp_blur, Blur) +DefNode(CompositorNode, CMP_NODE_BOKEHBLUR, def_cmp_bokehblur, BokehBlur) +DefNode(CompositorNode, CMP_NODE_BOKEHIMAGE, def_cmp_bokehimage, BokehImage) +DefNode(CompositorNode, CMP_NODE_BRIGHTCONTRAST, def_cmp_brightcontrast, BrightContrast) +DefNode(CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, ChannelMatte) +DefNode(CompositorNode, CMP_NODE_CHROMA_MATTE, def_cmp_chroma_matte, ChromaMatte) +DefNode(CompositorNode, CMP_NODE_COLOR_MATTE, def_cmp_color_matte, ColorMatte) +DefNode(CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, ColorSpill) +DefNode(CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, ColorBalance) +DefNode(CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection, ColorCorrection) +DefNode(CompositorNode, CMP_NODE_COMBHSVA_LEGACY,0, CombHSVA) +DefNode(CompositorNode, CMP_NODE_COMBINE_COLOR, def_cmp_combsep_color, CombineColor) +DefNode(CompositorNode, CMP_NODE_COMBINE_XYZ, 0, CombineXYZ) +DefNode(CompositorNode, CMP_NODE_COMBRGBA_LEGACY,0, CombRGBA) +DefNode(CompositorNode, CMP_NODE_COMBYCCA_LEGACY,def_cmp_ycc, CombYCCA) +DefNode(CompositorNode, CMP_NODE_COMBYUVA_LEGACY,0, CombYUVA) +DefNode(CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, Composite) +DefNode(CompositorNode, CMP_NODE_CONVERT_COLOR_SPACE,def_cmp_convert_color_space,ConvertColorSpace) +DefNode(CompositorNode, CMP_NODE_CORNERPIN, 0, CornerPin) +DefNode(CompositorNode, CMP_NODE_CROP, def_cmp_crop, Crop) +DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE_LEGACY, def_cmp_cryptomatte_legacy,Cryptomatte) +DefNode(CompositorNode, CMP_NODE_CRYPTOMATTE, def_cmp_cryptomatte, CryptomatteV2) +DefNode(CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, CurveRGB) +DefNode(CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, CurveVec) +DefNode(CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, DBlur) +DefNode(CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, Defocus) +DefNode(CompositorNode, CMP_NODE_DENOISE, def_cmp_denoise, Denoise) +DefNode(CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, Despeckle) +DefNode(CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, DiffMatte) +DefNode(CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, DilateErode) +DefNode(CompositorNode, CMP_NODE_DISPLACE, 0, Displace) +DefNode(CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, DistanceMatte) +DefNode(CompositorNode, CMP_NODE_DOUBLEEDGEMASK, def_cmp_double_edge_mask, DoubleEdgeMask) +DefNode(CompositorNode, CMP_NODE_EXPOSURE, 0, Exposure) +DefNode(CompositorNode, CMP_NODE_FILTER, def_cmp_filter, Filter) +DefNode(CompositorNode, CMP_NODE_FLIP, def_cmp_flip, Flip) +DefNode(CompositorNode, CMP_NODE_GAMMA, 0, Gamma) +DefNode(CompositorNode, CMP_NODE_GLARE, def_cmp_glare, Glare) +DefNode(CompositorNode, CMP_NODE_HUE_SAT, 0, HueSat) +DefNode(CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, HueCorrect) +DefNode(CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, IDMask) +DefNode(CompositorNode, CMP_NODE_IMAGE, def_cmp_image, Image) +DefNode(CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, Inpaint) +DefNode(CompositorNode, CMP_NODE_INVERT, def_cmp_invert, Invert) +DefNode(CompositorNode, CMP_NODE_KEYING, def_cmp_keying, Keying) +DefNode(CompositorNode, CMP_NODE_KEYINGSCREEN, def_cmp_keyingscreen, KeyingScreen) +DefNode(CompositorNode, CMP_NODE_KUWAHARA, def_cmp_kuwahara, Kuwahara) +DefNode(CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, Lensdist) +DefNode(CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, LumaMatte) +DefNode(CompositorNode, CMP_NODE_MAP_RANGE, def_cmp_map_range, MapRange) +DefNode(CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, MapUV) +DefNode(CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, MapValue) +DefNode(CompositorNode, CMP_NODE_MASK_BOX, def_cmp_boxmask, BoxMask) +DefNode(CompositorNode, CMP_NODE_MASK_ELLIPSE, def_cmp_ellipsemask, EllipseMask) +DefNode(CompositorNode, CMP_NODE_MASK, def_cmp_mask, Mask) +DefNode(CompositorNode, CMP_NODE_MATH, def_math, Math) +DefNode(CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, MixRGB) +DefNode(CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, MovieClip) +DefNode(CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion, MovieDistortion) +DefNode(CompositorNode, CMP_NODE_NORMAL, 0, Normal) +DefNode(CompositorNode, CMP_NODE_NORMALIZE, 0, Normalize) +DefNode(CompositorNode, CMP_NODE_OUTPUT_FILE, 0, OutputFile) +DefNode(CompositorNode, CMP_NODE_PIXELATE, def_cmp_pixelate, Pixelate) +DefNode(CompositorNode, CMP_NODE_PLANETRACKDEFORM,def_cmp_planetrackdeform, PlaneTrackDeform) +DefNode(CompositorNode, CMP_NODE_POSTERIZE, 0, Posterize) +DefNode(CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, PremulKey) +DefNode(CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, RLayers) +DefNode(CompositorNode, CMP_NODE_RGB, 0, RGB) +DefNode(CompositorNode, CMP_NODE_RGBTOBW, 0, RGBToBW) +DefNode(CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, Rotate) +DefNode(CompositorNode, CMP_NODE_SCALE, def_cmp_scale, Scale) +DefNode(CompositorNode, CMP_NODE_SCENE_TIME, 0, SceneTime) +DefNode(CompositorNode, CMP_NODE_SEPARATE_COLOR, def_cmp_combsep_color, SeparateColor) +DefNode(CompositorNode, CMP_NODE_SEPARATE_XYZ, 0, SeparateXYZ) +DefNode(CompositorNode, CMP_NODE_SEPHSVA_LEGACY, 0, SepHSVA) +DefNode(CompositorNode, CMP_NODE_SEPRGBA_LEGACY, 0, SepRGBA) +DefNode(CompositorNode, CMP_NODE_SEPYCCA_LEGACY, def_cmp_ycc, SepYCCA) +DefNode(CompositorNode, CMP_NODE_SEPYUVA_LEGACY, 0, SepYUVA) +DefNode(CompositorNode, CMP_NODE_SETALPHA, def_cmp_set_alpha, SetAlpha) +DefNode(CompositorNode, CMP_NODE_SPLIT, def_cmp_split, Split) +DefNode(CompositorNode, CMP_NODE_STABILIZE2D, def_cmp_stabilize2d, Stabilize) +DefNode(CompositorNode, CMP_NODE_SUNBEAMS, def_cmp_sunbeams, SunBeams) +DefNode(CompositorNode, CMP_NODE_SWITCH_VIEW, def_cmp_switch_view, SwitchView) +DefNode(CompositorNode, CMP_NODE_SWITCH, def_cmp_switch, Switch) +DefNode(CompositorNode, CMP_NODE_TEXTURE, def_texture, Texture) +DefNode(CompositorNode, CMP_NODE_TIME, def_time, Time) +DefNode(CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, Tonemap) +DefNode(CompositorNode, CMP_NODE_TRACKPOS, def_cmp_trackpos, TrackPos) +DefNode(CompositorNode, CMP_NODE_TRANSFORM, dev_cmd_transform, Transform) +DefNode(CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, Translate) +DefNode(CompositorNode, CMP_NODE_VALTORGB, def_colorramp, ValToRGB) +DefNode(CompositorNode, CMP_NODE_VALUE, 0, Value) +DefNode(CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, VecBlur) +DefNode(CompositorNode, CMP_NODE_VIEW_LEVELS, def_cmp_levels, Levels) +DefNode(CompositorNode, CMP_NODE_VIEWER, def_cmp_viewer, Viewer) +DefNode(CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, Zcombine) -DefNode(TextureNode, TEX_NODE_AT, 0, At, "At", "" ) -DefNode(TextureNode, TEX_NODE_BRICKS, def_tex_bricks, Bricks, "Bricks", "" ) -DefNode(TextureNode, TEX_NODE_CHECKER, 0, Checker, "Checker", "" ) -DefNode(TextureNode, TEX_NODE_COMBINE_COLOR, def_tex_combsep_color, CombineColor, "Combine Color", "" ) -DefNode(TextureNode, TEX_NODE_COMPOSE_LEGACY, 0, Compose, "Combine RGBA", "" ) -DefNode(TextureNode, TEX_NODE_COORD, 0, Coordinates, "Coordinates", "" ) -DefNode(TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, CurveRGB, "RGB Curves", "" ) -DefNode(TextureNode, TEX_NODE_CURVE_TIME, def_time, CurveTime, "Curve Time", "" ) -DefNode(TextureNode, TEX_NODE_DECOMPOSE_LEGACY,0, Decompose, "Separate RGBA", "" ) -DefNode(TextureNode, TEX_NODE_DISTANCE, 0, Distance, "Distance", "" ) -DefNode(TextureNode, TEX_NODE_HUE_SAT, 0, HueSaturation, "Hue/Saturation/Value", "" ) -DefNode(TextureNode, TEX_NODE_IMAGE, def_tex_image, Image, "Image", "" ) -DefNode(TextureNode, TEX_NODE_INVERT, 0, Invert, "Invert Color", "" ) -DefNode(TextureNode, TEX_NODE_MATH, def_math, Math, "Math", "" ) -DefNode(TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, MixRGB, "Mix RGB", "" ) -DefNode(TextureNode, TEX_NODE_OUTPUT, def_tex_output, Output, "Output", "" ) -DefNode(TextureNode, TEX_NODE_RGBTOBW, 0, RGBToBW, "RGB to BW", "" ) -DefNode(TextureNode, TEX_NODE_ROTATE, 0, Rotate, "Rotate", "" ) -DefNode(TextureNode, TEX_NODE_SCALE, 0, Scale, "Scale", "" ) -DefNode(TextureNode, TEX_NODE_SEPARATE_COLOR, def_tex_combsep_color, SeparateColor, "Separate Color", "" ) -DefNode(TextureNode, TEX_NODE_TEXTURE, def_texture, Texture, "Texture", "" ) -DefNode(TextureNode, TEX_NODE_TRANSLATE, 0, Translate, "Translate", "" ) -DefNode(TextureNode, TEX_NODE_VALTONOR, 0, ValToNor, "Value to Normal", "" ) -DefNode(TextureNode, TEX_NODE_VALTORGB, def_colorramp, ValToRGB, "Color Ramp", "" ) -DefNode(TextureNode, TEX_NODE_VIEWER, 0, Viewer, "Viewer", "" ) +DefNode(TextureNode, TEX_NODE_AT, 0, At) +DefNode(TextureNode, TEX_NODE_BRICKS, def_tex_bricks, Bricks) +DefNode(TextureNode, TEX_NODE_CHECKER, 0, Checker) +DefNode(TextureNode, TEX_NODE_COMBINE_COLOR, def_tex_combsep_color, CombineColor) +DefNode(TextureNode, TEX_NODE_COMPOSE_LEGACY, 0, Compose) +DefNode(TextureNode, TEX_NODE_COORD, 0, Coordinates) +DefNode(TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, CurveRGB) +DefNode(TextureNode, TEX_NODE_CURVE_TIME, def_time, CurveTime) +DefNode(TextureNode, TEX_NODE_DECOMPOSE_LEGACY,0, Decompose) +DefNode(TextureNode, TEX_NODE_DISTANCE, 0, Distance) +DefNode(TextureNode, TEX_NODE_HUE_SAT, 0, HueSaturation) +DefNode(TextureNode, TEX_NODE_IMAGE, def_tex_image, Image) +DefNode(TextureNode, TEX_NODE_INVERT, 0, Invert) +DefNode(TextureNode, TEX_NODE_MATH, def_math, Math) +DefNode(TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, MixRGB) +DefNode(TextureNode, TEX_NODE_OUTPUT, def_tex_output, Output) +DefNode(TextureNode, TEX_NODE_RGBTOBW, 0, RGBToBW) +DefNode(TextureNode, TEX_NODE_ROTATE, 0, Rotate) +DefNode(TextureNode, TEX_NODE_SCALE, 0, Scale) +DefNode(TextureNode, TEX_NODE_SEPARATE_COLOR, def_tex_combsep_color, SeparateColor) +DefNode(TextureNode, TEX_NODE_TEXTURE, def_texture, Texture) +DefNode(TextureNode, TEX_NODE_TRANSLATE, 0, Translate) +DefNode(TextureNode, TEX_NODE_VALTONOR, 0, ValToNor) +DefNode(TextureNode, TEX_NODE_VALTORGB, def_colorramp, ValToRGB) +DefNode(TextureNode, TEX_NODE_VIEWER, 0, Viewer) /* procedural textures */ -DefNode(TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, TexBlend, "Blend", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, TexClouds, "Clouds", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, TexDistNoise, "Distorted Noise", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, TexMagic, "Magic", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, TexMarble, "Marble", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, TexMusgrave, "Musgrave", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, TexNoise, "Noise", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, TexStucci, "Stucci", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, TexVoronoi, "Voronoi", "" ) -DefNode(TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, TexWood, "Wood", "" ) +DefNode(TextureNode, TEX_NODE_PROC+TEX_BLEND, 0, TexBlend) +DefNode(TextureNode, TEX_NODE_PROC+TEX_CLOUDS, 0, TexClouds) +DefNode(TextureNode, TEX_NODE_PROC+TEX_DISTNOISE, 0, TexDistNoise) +DefNode(TextureNode, TEX_NODE_PROC+TEX_MAGIC, 0, TexMagic) +DefNode(TextureNode, TEX_NODE_PROC+TEX_MARBLE, 0, TexMarble) +DefNode(TextureNode, TEX_NODE_PROC+TEX_MUSGRAVE, 0, TexMusgrave) +DefNode(TextureNode, TEX_NODE_PROC+TEX_NOISE, 0, TexNoise) +DefNode(TextureNode, TEX_NODE_PROC+TEX_STUCCI, 0, TexStucci) +DefNode(TextureNode, TEX_NODE_PROC+TEX_VORONOI, 0, TexVoronoi) +DefNode(TextureNode, TEX_NODE_PROC+TEX_WOOD, 0, TexWood) -DefNode(FunctionNode, FN_NODE_ALIGN_EULER_TO_VECTOR, 0, AlignEulerToVector, "Align Euler to Vector", "") -DefNode(FunctionNode, FN_NODE_ALIGN_ROTATION_TO_VECTOR, 0, AlignRotationToVector, "Align Rotation to Vector", "") -DefNode(FunctionNode, FN_NODE_AXES_TO_ROTATION, 0, AxesToRotation, "Axes to Rotation", "Create a rotation from a primary and (ideally orthogonal) secondary axis") -DefNode(FunctionNode, FN_NODE_AXIS_ANGLE_TO_ROTATION, 0, AxisAngleToRotation, "Axis Angle to Rotation", "") -DefNode(FunctionNode, FN_NODE_BOOLEAN_MATH, 0, BooleanMath, "Boolean Math", "") -DefNode(FunctionNode, FN_NODE_COMBINE_COLOR, 0, CombineColor, "Combine Color", "") -DefNode(FunctionNode, FN_NODE_COMBINE_MATRIX, 0, CombineMatrix, "Combine Matrix", "Construct a 4x4 matrix from its individual values") -DefNode(FunctionNode, FN_NODE_COMBINE_TRANSFORM, 0, CombineTransform, "Combine Transform", "") -DefNode(FunctionNode, FN_NODE_COMPARE, 0, Compare, "Compare", "") -DefNode(FunctionNode, FN_NODE_EULER_TO_ROTATION, 0, EulerToRotation, "Euler to Rotation", "") -DefNode(FunctionNode, FN_NODE_FLOAT_TO_INT, def_float_to_int, FloatToInt, "Float to Integer", "") -DefNode(FunctionNode, FN_NODE_HASH_VALUE, 0, HashValue, "Hash Value", "") -DefNode(FunctionNode, FN_NODE_INPUT_BOOL, def_fn_input_bool, InputBool, "Boolean", "") -DefNode(FunctionNode, FN_NODE_INPUT_COLOR, def_fn_input_color, InputColor, "Color", "") -DefNode(FunctionNode, FN_NODE_INPUT_INT, def_fn_input_int, InputInt, "Integer", "") -DefNode(FunctionNode, FN_NODE_INPUT_ROTATION, def_fn_input_rotation, InputRotation, "Rotation", "") -DefNode(FunctionNode, FN_NODE_INPUT_SPECIAL_CHARACTERS, 0, InputSpecialCharacters, "Special Characters", "") -DefNode(FunctionNode, FN_NODE_INPUT_STRING, def_fn_input_string, InputString, "String", "") -DefNode(FunctionNode, FN_NODE_INPUT_VECTOR, def_fn_input_vector, InputVector, "Vector", "") -DefNode(FunctionNode, FN_NODE_INTEGER_MATH, 0, IntegerMath, "Integer Math", "") -DefNode(FunctionNode, FN_NODE_INVERT_MATRIX, 0, InvertMatrix, "Invert Matrix", "") -DefNode(FunctionNode, FN_NODE_INVERT_ROTATION, 0, InvertRotation, "Invert Rotation", "") -DefNode(FunctionNode, FN_NODE_MATRIX_DETERMINANT, 0, MatrixDeterminant, "Matrix Determinant", "") -DefNode(FunctionNode, FN_NODE_MATRIX_MULTIPLY, 0, MatrixMultiply, "Multiply Matrices", "") -DefNode(FunctionNode, FN_NODE_PROJECT_POINT, 0, ProjectPoint, "Project Point", "Project a point using a matrix, using location, rotation, scale, and perspective divide") -DefNode(FunctionNode, FN_NODE_QUATERNION_TO_ROTATION, 0, QuaternionToRotation, "Quaternion to Rotation", "") -DefNode(FunctionNode, FN_NODE_RANDOM_VALUE, def_fn_random_value, RandomValue, "Random Value", "") -DefNode(FunctionNode, FN_NODE_REPLACE_STRING, 0, ReplaceString, "Replace String", "") -DefNode(FunctionNode, FN_NODE_ROTATE_EULER, def_fn_rotate_euler, RotateEuler, "Rotate Euler", "") -DefNode(FunctionNode, FN_NODE_ROTATE_ROTATION, 0, RotateRotation, "Rotate Rotation", "") -DefNode(FunctionNode, FN_NODE_ROTATE_VECTOR, 0, RotateVector, "Rotate Vector", "") -DefNode(FunctionNode, FN_NODE_ROTATION_TO_AXIS_ANGLE, 0, RotationToAxisAngle, "Rotation to Axis Angle", "") -DefNode(FunctionNode, FN_NODE_ROTATION_TO_EULER, 0, RotationToEuler, "Rotation to Euler", "") -DefNode(FunctionNode, FN_NODE_ROTATION_TO_QUATERNION, 0, RotationToQuaternion, "Rotation to Quaternion", "") -DefNode(FunctionNode, FN_NODE_SEPARATE_COLOR, 0, SeparateColor, "Separate Color", "") -DefNode(FunctionNode, FN_NODE_SEPARATE_MATRIX, 0, SeparateMatrix, "Separate Matrix", "Split a 4x4 matrix into its individual values") -DefNode(FunctionNode, FN_NODE_SEPARATE_TRANSFORM, 0, SeparateTransform, "Separate Transform", "") -DefNode(FunctionNode, FN_NODE_SLICE_STRING, 0, SliceString, "Slice String", "") -DefNode(FunctionNode, FN_NODE_STRING_LENGTH, 0, StringLength, "String Length", "") -DefNode(FunctionNode, FN_NODE_FIND_IN_STRING, 0, FindInString, "Find In String","") -DefNode(FunctionNode, FN_NODE_TRANSFORM_DIRECTION, 0, TransformDirection, "Transform Direction", "") -DefNode(FunctionNode, FN_NODE_TRANSFORM_POINT, 0, TransformPoint, "Transform Point", "") -DefNode(FunctionNode, FN_NODE_TRANSPOSE_MATRIX, 0, TransposeMatrix, "Transpose Matrix", "") -DefNode(FunctionNode, FN_NODE_VALUE_TO_STRING, 0, ValueToString, "Value to String", "") +DefNode(FunctionNode, FN_NODE_ALIGN_EULER_TO_VECTOR, 0, AlignEulerToVector) +DefNode(FunctionNode, FN_NODE_ALIGN_ROTATION_TO_VECTOR, 0, AlignRotationToVector) +DefNode(FunctionNode, FN_NODE_AXES_TO_ROTATION, 0, AxesToRotation) +DefNode(FunctionNode, FN_NODE_AXIS_ANGLE_TO_ROTATION, 0, AxisAngleToRotation) +DefNode(FunctionNode, FN_NODE_BOOLEAN_MATH, 0, BooleanMath) +DefNode(FunctionNode, FN_NODE_COMBINE_COLOR, 0, CombineColor) +DefNode(FunctionNode, FN_NODE_COMBINE_MATRIX, 0, CombineMatrix) +DefNode(FunctionNode, FN_NODE_COMBINE_TRANSFORM, 0, CombineTransform) +DefNode(FunctionNode, FN_NODE_COMPARE, 0, Compare) +DefNode(FunctionNode, FN_NODE_EULER_TO_ROTATION, 0, EulerToRotation) +DefNode(FunctionNode, FN_NODE_FLOAT_TO_INT, def_float_to_int, FloatToInt) +DefNode(FunctionNode, FN_NODE_HASH_VALUE, 0, HashValue) +DefNode(FunctionNode, FN_NODE_INPUT_BOOL, def_fn_input_bool, InputBool) +DefNode(FunctionNode, FN_NODE_INPUT_COLOR, def_fn_input_color, InputColor) +DefNode(FunctionNode, FN_NODE_INPUT_INT, def_fn_input_int, InputInt) +DefNode(FunctionNode, FN_NODE_INPUT_ROTATION, def_fn_input_rotation, InputRotation) +DefNode(FunctionNode, FN_NODE_INPUT_SPECIAL_CHARACTERS, 0, InputSpecialCharacters) +DefNode(FunctionNode, FN_NODE_INPUT_STRING, def_fn_input_string, InputString) +DefNode(FunctionNode, FN_NODE_INPUT_VECTOR, def_fn_input_vector, InputVector) +DefNode(FunctionNode, FN_NODE_INTEGER_MATH, 0, IntegerMath) +DefNode(FunctionNode, FN_NODE_INVERT_MATRIX, 0, InvertMatrix) +DefNode(FunctionNode, FN_NODE_INVERT_ROTATION, 0, InvertRotation) +DefNode(FunctionNode, FN_NODE_MATRIX_DETERMINANT, 0, MatrixDeterminant) +DefNode(FunctionNode, FN_NODE_MATRIX_MULTIPLY, 0, MatrixMultiply) +DefNode(FunctionNode, FN_NODE_PROJECT_POINT, 0, ProjectPoint) +DefNode(FunctionNode, FN_NODE_QUATERNION_TO_ROTATION, 0, QuaternionToRotation) +DefNode(FunctionNode, FN_NODE_RANDOM_VALUE, def_fn_random_value, RandomValue) +DefNode(FunctionNode, FN_NODE_REPLACE_STRING, 0, ReplaceString) +DefNode(FunctionNode, FN_NODE_ROTATE_EULER, def_fn_rotate_euler, RotateEuler) +DefNode(FunctionNode, FN_NODE_ROTATE_ROTATION, 0, RotateRotation) +DefNode(FunctionNode, FN_NODE_ROTATE_VECTOR, 0, RotateVector) +DefNode(FunctionNode, FN_NODE_ROTATION_TO_AXIS_ANGLE, 0, RotationToAxisAngle) +DefNode(FunctionNode, FN_NODE_ROTATION_TO_EULER, 0, RotationToEuler) +DefNode(FunctionNode, FN_NODE_ROTATION_TO_QUATERNION, 0, RotationToQuaternion) +DefNode(FunctionNode, FN_NODE_SEPARATE_COLOR, 0, SeparateColor) +DefNode(FunctionNode, FN_NODE_SEPARATE_MATRIX, 0, SeparateMatrix) +DefNode(FunctionNode, FN_NODE_SEPARATE_TRANSFORM, 0, SeparateTransform) +DefNode(FunctionNode, FN_NODE_SLICE_STRING, 0, SliceString) +DefNode(FunctionNode, FN_NODE_STRING_LENGTH, 0, StringLength) +DefNode(FunctionNode, FN_NODE_FIND_IN_STRING, 0, FindInString) +DefNode(FunctionNode, FN_NODE_TRANSFORM_DIRECTION, 0, TransformDirection) +DefNode(FunctionNode, FN_NODE_TRANSFORM_POINT, 0, TransformPoint) +DefNode(FunctionNode, FN_NODE_TRANSPOSE_MATRIX, 0, TransposeMatrix) +DefNode(FunctionNode, FN_NODE_VALUE_TO_STRING, 0, ValueToString) -DefNode(GeometryNode, GEO_NODE_ACCUMULATE_FIELD, 0, AccumulateField, "Accumulate Field", "Add the values of an evaluated field together and output the running total for each element") -DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, 0, AttributeDomainSize, "Domain Size", "Retrieve the number of elements in a geometry for each attribute domain") -DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 0,AttributeStatistic, "Attribute Statistic", "Calculate statistics about a data set from a field evaluated on a geometry") -DefNode(GeometryNode, GEO_NODE_BAKE, rna_def_geo_bake, Bake, "Bake", "Cache the incoming data so that it can be used without recomputation") -DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, 0, BlurAttribute, "Blur Attribute", "Mix attribute values of neighboring elements") -DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, BoundBox, "Bounding Box", "Calculate the limits of a geometry's positions and generate a box mesh with those dimensions") -DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, rna_def_geo_capture_attribute, CaptureAttribute, "Capture Attribute", "Store the result of a field on a geometry and output the data as a node socket. Allows remembering or interpolating data as the geometry changes, such as positions before deformation") -DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, 0, CollectionInfo, "Collection Info", "Retrieve geometry instances from a collection") -DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, ConvexHull, "Convex Hull", "Create a mesh that encloses all points in the input geometry with the smallest number of points") -DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, CurveEndpointSelection, "Endpoint Selection", "Provide a selection for an arbitrary number of endpoints in each spline") -DefNode(GeometryNode, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, def_geo_curve_handle_type_selection, CurveHandleTypeSelection, "Handle Type Selection", "Provide a selection based on the handle types of Bézier control points") -DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, CurveLength, "Curve Length", "Retrieve the length of all splines added together") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_ARC, 0,CurveArc, "Arc", "Generate a poly spline arc") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, 0, CurvePrimitiveBezierSegment, "Bézier Segment", "Generate a 2D Bézier spline from the given control points and handles") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_CIRCLE,0, CurvePrimitiveCircle, "Curve Circle", "Generate a poly spline circle") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_LINE, 0, CurvePrimitiveLine, "Curve Line", "Generate a poly spline line with two points") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, 0, CurveQuadraticBezier, "Quadratic Bézier", "Generate a poly spline in a parabola shape with control points positions") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, 0, CurvePrimitiveQuadrilateral, "Quadrilateral", "Generate a polygon with four points") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL,0, CurveSpiral, "Spiral", "Generate a poly spline in a spiral shape") -DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, CurveStar, "Star", "Generate a poly spline in a star pattern by connecting alternating points of two circles") -DefNode(GeometryNode, GEO_NODE_CURVE_SET_HANDLE_TYPE, def_geo_curve_set_handle_type, CurveSetHandles, "Set Handle Type", "Set the handle type for the control points of a Bézier curve") -DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_PARAMETER,0, SplineParameter, "Spline Parameter", "Retrieve how far along each spline a control point is") -DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_TYPE, 0, CurveSplineType, "Set Spline Type", "Change the type of curves") -DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, CurveToMesh, "Curve to Mesh", "Convert curves into a mesh, optionally with a custom profile shape defined by curves") -DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, 0, CurveToPoints, "Curve to Points", "Generate a point cloud by sampling positions along curves") -DefNode(GeometryNode, GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT, 0, CurveOfPoint, "Curve of Point", "Retrieve the curve a control point is part of") -DefNode(GeometryNode, GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE, 0, PointsOfCurve, "Points of Curve", "Retrieve a point index within a curve") -DefNode(GeometryNode, GEO_NODE_CURVES_TO_GREASE_PENCIL, 0, CurvesToGreasePencil, "Curves to Grease Pencil", "Convert the curves in each top-level instance into Grease Pencil layer") -DefNode(GeometryNode, GEO_NODE_DEFORM_CURVES_ON_SURFACE, 0, DeformCurvesOnSurface, "Deform Curves on Surface", "Translate and rotate curves based on changes between the object's original and evaluated surface mesh") -DefNode(GeometryNode, GEO_NODE_DELETE_GEOMETRY, 0, DeleteGeometry, "Delete Geometry", "Remove selected elements of a geometry") -DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_IN_GRID, 0, DistributePointsInGrid, "Distribute Points in Grid", "Generate points inside a volume grid") -DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME, 0, DistributePointsInVolume, "Distribute Points in Volume", "Generate points inside a volume") -DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, def_geo_distribute_points_on_faces, DistributePointsOnFaces, "Distribute Points on Faces", "Generate points spread out on the surface of a mesh") -DefNode(GeometryNode, GEO_NODE_DUAL_MESH, 0, DualMesh, "Dual Mesh", "Convert Faces into vertices and vertices into faces") -DefNode(GeometryNode, GEO_NODE_DUPLICATE_ELEMENTS, 0, DuplicateElements, "Duplicate Elements", "Generate an arbitrary number copies of each selected input element") -DefNode(GeometryNode, GEO_NODE_EDGE_PATHS_TO_CURVES, 0, EdgePathsToCurves, "Edge Paths to Curves", "Output curves following paths across mesh edges") -DefNode(GeometryNode, GEO_NODE_EDGE_PATHS_TO_SELECTION, 0, EdgePathsToSelection, "Edge Paths to Selection", "Output a selection of edges by following paths across mesh edges") -DefNode(GeometryNode, GEO_NODE_EDGES_TO_FACE_GROUPS, 0, EdgesToFaceGroups, "Edges to Face Groups", "Group faces into regions surrounded by the selected boundary edges") -DefNode(GeometryNode, GEO_NODE_EVALUATE_AT_INDEX, 0, FieldAtIndex, "Evaluate at Index", "Retrieve data of other elements in the context's geometry") -DefNode(GeometryNode, GEO_NODE_EVALUATE_ON_DOMAIN, 0, FieldOnDomain, "Evaluate on Domain", "Retrieve values from a field on a different domain besides the domain from the context") -DefNode(GeometryNode, GEO_NODE_EXTRUDE_MESH, 0, ExtrudeMesh, "Extrude Mesh", "Generate new vertices, edges, or faces from selected elements and move them based on an offset while keeping them connected by their boundary") -DefNode(GeometryNode, GEO_NODE_FILL_CURVE, 0, FillCurve, "Fill Curve", "Generate a mesh on the XY plane with faces on the inside of input curves") -DefNode(GeometryNode, GEO_NODE_FILLET_CURVE, 0, FilletCurve, "Fillet Curve", "Round corners by generating circular arcs on each control point") -DefNode(GeometryNode, GEO_NODE_FLIP_FACES, 0, FlipFaces, "Flip Faces", "Reverse the order of the vertices and edges of selected faces, flipping their normal direction") -DefNode(GeometryNode, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT, def_geo_foreach_geometry_element_input, ForeachGeometryElementInput, "For Each Geometry Element Input", "") -DefNode(GeometryNode, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, def_geo_foreach_geometry_element_output, ForeachGeometryElementOutput, "For Each Geometry Element Output", "") -DefNode(GeometryNode, GEO_NODE_GEOMETRY_TO_INSTANCE, 0, GeometryToInstance, "Geometry to Instance", "Convert each input geometry into an instance, which can be much faster than the Join Geometry node when the inputs are large") -DefNode(GeometryNode, GEO_NODE_GET_NAMED_GRID, 0, GetNamedGrid, "Get Named Grid", "Get volume grid from a volume geometry with the specified name") -DefNode(GeometryNode, GEO_NODE_GIZMO_DIAL, 0, GizmoDial, "Dial Gizmo", "Show a dial gizmo in the viewport for a value") -DefNode(GeometryNode, GEO_NODE_GIZMO_LINEAR, 0, GizmoLinear, "Linear Gizmo", "Show a linear gizmo in the viewport for a value") -DefNode(GeometryNode, GEO_NODE_GIZMO_TRANSFORM, rna_def_geo_gizmo_transform, GizmoTransform, "Transform Gizmo", "Show a transform gizmo in the viewport") -DefNode(GeometryNode, GEO_NODE_GREASE_PENCIL_TO_CURVES, 0, GreasePencilToCurves, "Grease Pencil to Curves", "Convert Grease Pencil layers into curve instances") -DefNode(GeometryNode, GEO_NODE_GRID_TO_MESH, 0, GridToMesh, "Grid to Mesh", "Generate a mesh on the \"surface\" of a volume grid") -DefNode(GeometryNode, GEO_NODE_IMAGE_INFO, 0, ImageInfo, "Image Info", "Retrieve information about an image") -DefNode(GeometryNode, GEO_NODE_IMAGE_TEXTURE, def_geo_image_texture, ImageTexture, "Image Texture", "Sample values from an image texture") -DefNode(GeometryNode, GEO_NODE_IMAGE, def_geo_image, InputImage, "Image", "Input image") -DefNode(GeometryNode, GEO_NODE_IMPORT_OBJ, 0, ImportOBJ, "Import OBJ", "Import geometry from an OBJ file") -DefNode(GeometryNode, GEO_NODE_IMPORT_PLY, 0, ImportPLY, "Import PLY", "Import a point cloud from a PLY file") -DefNode(GeometryNode, GEO_NODE_IMPORT_STL, 0, ImportSTL, "Import STL", "Import a mesh from an STL file") -DefNode(GeometryNode, GEO_NODE_INDEX_OF_NEAREST, 0, IndexOfNearest, "Index of Nearest", "Find the nearest element in a group. Similar to the \"Sample Nearest\" node") -DefNode(GeometryNode, GEO_NODE_INDEX_SWITCH, def_geo_index_switch, IndexSwitch, "Index Switch", "Choose between an arbitrary number of values with an index") -DefNode(GeometryNode, GEO_NODE_INPUT_ACTIVE_CAMERA, 0, InputActiveCamera, "Active Camera", "Retrieve the scene's active camera") -DefNode(GeometryNode, GEO_NODE_INPUT_COLLECTION, def_geo_input_collection, InputCollection, "Collection", "Output a single collection") -DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_HANDLES, 0, InputCurveHandlePositions, "Curve Handle Positions", "Retrieve the position of each Bézier control point's handles") -DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_TILT, 0, InputCurveTilt, "Curve Tilt", "Retrieve the angle at each control point used to twist the curve's normal around its tangent") -DefNode(GeometryNode, GEO_NODE_INPUT_EDGE_SMOOTH, 0, InputEdgeSmooth, "Is Edge Smooth", "Retrieve whether each edge is marked for smooth or split normals") -DefNode(GeometryNode, GEO_NODE_INPUT_FACE_SMOOTH, 0, InputShadeSmooth, "Is Face Smooth", "Retrieve whether each face is marked for smooth or sharp normals") -DefNode(GeometryNode, GEO_NODE_INPUT_ID, 0, InputID, "ID", "Retrieve a stable random identifier value from the \"id\" attribute on the point domain, or the index if the attribute does not exist") -DefNode(GeometryNode, GEO_NODE_INPUT_INDEX, 0, InputIndex, "Index", "Retrieve an integer value indicating the position of each element in the list, starting at zero") -DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_ROTATION, 0, InputInstanceRotation, "Instance Rotation", "Retrieve the rotation of each instance in the geometry") -DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_SCALE, 0, InputInstanceScale, "Instance Scale", "Retrieve the scale of each instance in the geometry") -DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_TRANSFORM, 0, InstanceTransform, "Instance Transform", "Retrieve the full transformation of each instance in the geometry") -DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL_INDEX, 0, InputMaterialIndex, "Material Index", "Retrieve the index of the material used for each element in the geometry's list of materials") -DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL, def_geo_input_material, InputMaterial, "Material", "Output a single material") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_ANGLE, 0, InputMeshEdgeAngle, "Edge Angle", "The angle between the normals of connected manifold faces") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, 0,InputMeshEdgeNeighbors, "Edge Neighbors", "Retrieve the number of faces that use each edge as one of their sides") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_VERTICES, 0, InputMeshEdgeVertices, "Edge Vertices", "Retrieve topology information relating to each edge of a mesh") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_AREA, 0, InputMeshFaceArea, "Face Area", "Calculate the surface area of a mesh's faces") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_IS_PLANAR, 0, InputMeshFaceIsPlanar, "Is Face Planar", "Retrieve whether all triangles in a face are on the same plane, i.e. whether they have the same normal") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, 0,InputMeshFaceNeighbors, "Face Neighbors", "Retrieve topology information relating to each face of a mesh") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_ISLAND, 0, InputMeshIsland, "Mesh Island", "Retrieve information about separate connected regions in a mesh") -DefNode(GeometryNode, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, 0, InputMeshVertexNeighbors, "Vertex Neighbors", "Retrieve topology information relating to each vertex of a mesh") -DefNode(GeometryNode, GEO_NODE_INPUT_NAMED_ATTRIBUTE, 0, InputNamedAttribute, "Named Attribute", "Retrieve the data of a specified attribute") -DefNode(GeometryNode, GEO_NODE_INPUT_NAMED_LAYER_SELECTION, 0, InputNamedLayerSelection, "Named Layer Selection", "Output a selection of a Grease Pencil layer") -DefNode(GeometryNode, GEO_NODE_INPUT_NORMAL, 0, InputNormal, "Normal", "Retrieve a unit length vector indicating the direction pointing away from the geometry at each element") -DefNode(GeometryNode, GEO_NODE_INPUT_OBJECT, def_geo_input_object, InputObject, "Object", "Output a single object") -DefNode(GeometryNode, GEO_NODE_INPUT_POSITION, 0, InputPosition, "Position", "Retrieve a vector indicating the location of each element") -DefNode(GeometryNode, GEO_NODE_INPUT_RADIUS, 0, InputRadius, "Radius", "Retrieve the radius at each point on curve or point cloud geometry") -DefNode(GeometryNode, GEO_NODE_INPUT_SCENE_TIME, 0, InputSceneTime, "Scene Time", "Retrieve the current time in the scene's animation in units of seconds or frames") -DefNode(GeometryNode, GEO_NODE_INPUT_SHORTEST_EDGE_PATHS, 0, InputShortestEdgePaths, "Shortest Edge Paths", "Find the shortest paths along mesh edges to selected end vertices, with customizable cost per edge") -DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_CYCLIC, 0,InputSplineCyclic, "Is Spline Cyclic", "Retrieve whether each spline endpoint connects to the beginning") -DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_LENGTH, 0, SplineLength, "Spline Length", "Retrieve the total length of each spline, as a distance or as a number of points") -DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_RESOLUTION, 0, InputSplineResolution, "Spline Resolution", "Retrieve the number of evaluated points that will be generated for every control point on curves") -DefNode(GeometryNode, GEO_NODE_INPUT_TANGENT, 0, InputTangent, "Curve Tangent", "Retrieve the direction of curves at each control point") -DefNode(GeometryNode, GEO_NODE_INSTANCE_ON_POINTS, 0, InstanceOnPoints, "Instance on Points", "Generate a reference to geometry at each of the input points, without duplicating its underlying data") -DefNode(GeometryNode, GEO_NODE_INSTANCES_TO_POINTS, 0,InstancesToPoints, "Instances to Points", "Generate points at the origins of instances.\nNote: Nested instances are not affected by this node") -DefNode(GeometryNode, GEO_NODE_INTERPOLATE_CURVES, 0, InterpolateCurves, "Interpolate Curves", "Generate new curves on points by interpolating between existing curves") -DefNode(GeometryNode, GEO_NODE_IS_VIEWPORT, 0, IsViewport, "Is Viewport", "Retrieve whether the nodes are being evaluated for the viewport rather than the final render") -DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, JoinGeometry, "Join Geometry", "Merge separately generated geometries into a single one") -DefNode(GeometryNode, GEO_NODE_MATERIAL_SELECTION, 0, MaterialSelection, "Material Selection", "Provide a selection of faces that use the specified material") -DefNode(GeometryNode, GEO_NODE_MENU_SWITCH, def_geo_menu_switch, MenuSwitch, "Menu Switch", "Select from multiple inputs by name") -DefNode(GeometryNode, GEO_NODE_MERGE_BY_DISTANCE, 0, MergeByDistance, "Merge by Distance", "Merge vertices or points within a given distance") -DefNode(GeometryNode, GEO_NODE_MERGE_LAYERS, 0, MergeLayers, "Merge Layers", "Join groups of Grease Pencil layers into one") -DefNode(GeometryNode, GEO_NODE_MESH_BOOLEAN, 0, MeshBoolean, "Mesh Boolean", "Cut, subtract, or join multiple mesh inputs") -DefNode(GeometryNode, GEO_NODE_MESH_FACE_GROUP_BOUNDARIES, 0, MeshFaceSetBoundaries, "Face Group Boundaries", "Find edges on the boundaries between groups of faces with the same ID value") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CIRCLE, 0, MeshCircle, "Mesh Circle", "Generate a circular ring of edges") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CONE, 0,MeshCone, "Cone", "Generate a cone mesh") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CUBE, 0,MeshCube, "Cube", "Generate a cuboid mesh with variable side lengths and subdivisions") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CYLINDER, 0, MeshCylinder, "Cylinder", "Generate a cylinder mesh") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_GRID, 0,MeshGrid, "Grid", "Generate a planar mesh on the XY plane") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, 0, MeshIcoSphere, "Ico Sphere", "Generate a spherical mesh that consists of equally sized triangles") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_LINE, 0,MeshLine, "Mesh Line", "Generate vertices in a line and connect them with edges") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, 0, MeshUVSphere, "UV Sphere", "Generate a spherical mesh with quads, except for triangles at the top and bottom") -DefNode(GeometryNode, GEO_NODE_MESH_TO_CURVE, 0, MeshToCurve, "Mesh to Curve", "Generate a curve from a mesh") -DefNode(GeometryNode, GEO_NODE_MESH_TO_DENSITY_GRID, 0, MeshToDensityGrid, "Mesh to Density Grid", "Create a filled volume grid from a mesh") -DefNode(GeometryNode, GEO_NODE_MESH_TO_POINTS, 0, MeshToPoints, "Mesh to Points", "Generate a point cloud from a mesh's vertices") -DefNode(GeometryNode, GEO_NODE_MESH_TO_SDF_GRID, 0, MeshToSDFGrid, "Mesh to SDF Grid", "Create a signed distance volume grid from a mesh") -DefNode(GeometryNode, GEO_NODE_MESH_TO_VOLUME, 0, MeshToVolume, "Mesh to Volume", "Create a fog volume with the shape of the input mesh's surface") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE, 0, CornersOfEdge, "Corners of Edge", "Retrieve face corners connected to edges") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_FACE, 0, CornersOfFace, "Corners of Face", "Retrieve corners that make up a face") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX, 0, CornersOfVertex, "Corners of Vertex", "Retrieve face corners connected to vertices") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_CORNER, 0, EdgesOfCorner, "Edges of Corner", "Retrieve the edges on both sides of a face corner") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX, 0, EdgesOfVertex, "Edges of Vertex", "Retrieve the edges connected to each vertex") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER, 0, FaceOfCorner, "Face of Corner", "Retrieve the face each face corner is part of") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE, 0, OffsetCornerInFace, "Offset Corner in Face", "Retrieve corners in the same face as another") -DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, 0, VertexOfCorner, "Vertex of Corner", "Retrieve the vertex each face corner is attached to") -DefNode(GeometryNode, GEO_NODE_OBJECT_INFO, 0, ObjectInfo, "Object Info", "Retrieve information from an object") -DefNode(GeometryNode, GEO_NODE_OFFSET_POINT_IN_CURVE, 0, OffsetPointInCurve, "Offset Point in Curve", "Offset a control point index within its curve") -DefNode(GeometryNode, GEO_NODE_POINTS_TO_CURVES, 0, PointsToCurves, "Points to Curves", "Split all points to curve by its group ID and reorder by weight") -DefNode(GeometryNode, GEO_NODE_POINTS_TO_SDF_GRID, 0, PointsToSDFGrid, "Points to SDF Grid", "Create a signed distance volume grid from points") -DefNode(GeometryNode, GEO_NODE_POINTS_TO_VERTICES, 0, PointsToVertices, "Points to Vertices", "Generate a mesh vertex for each point cloud point") -DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, 0, PointsToVolume, "Points to Volume", "Generate a fog volume sphere around every point") -DefNode(GeometryNode, GEO_NODE_POINTS, 0, Points, "Points", "Generate a point cloud with positions and radii defined by fields") -DefNode(GeometryNode, GEO_NODE_PROXIMITY, 0, Proximity, "Geometry Proximity", "Compute the closest location on the target geometry") -DefNode(GeometryNode, GEO_NODE_RAYCAST, 0, Raycast, "Raycast", "Cast rays from the context geometry onto a target geometry, and retrieve information from each hit point") -DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, 0, RealizeInstances, "Realize Instances", "Convert instances into real geometry data") -DefNode(GeometryNode, GEO_NODE_REMOVE_ATTRIBUTE, 0, RemoveAttribute, "Remove Named Attribute", "Delete an attribute with a specified name from a geometry. Typically used to optimize performance") -DefNode(GeometryNode, GEO_NODE_REPEAT_INPUT, def_geo_repeat_input, RepeatInput, "Repeat Input", "") -DefNode(GeometryNode, GEO_NODE_REPEAT_OUTPUT, def_geo_repeat_output, RepeatOutput, "Repeat Output", "") -DefNode(GeometryNode, GEO_NODE_REPLACE_MATERIAL, 0, ReplaceMaterial, "Replace Material", "Swap one material with another") -DefNode(GeometryNode, GEO_NODE_RESAMPLE_CURVE, 0, ResampleCurve, "Resample Curve", "Generate a poly spline for each input spline") -DefNode(GeometryNode, GEO_NODE_REVERSE_CURVE, 0, ReverseCurve, "Reverse Curve", "Change the direction of curves by swapping their start and end data") -DefNode(GeometryNode, GEO_NODE_ROTATE_INSTANCES, 0, RotateInstances, "Rotate Instances", "Rotate geometry instances in local or global space") -DefNode(GeometryNode, GEO_NODE_SAMPLE_CURVE, def_geo_curve_sample, SampleCurve, "Sample Curve", "Retrieve data from a point on a curve at a certain distance from its start") -DefNode(GeometryNode, GEO_NODE_SAMPLE_GRID_INDEX, 0, SampleGridIndex, "Sample Grid Index", "Retrieve volume grid values at specific voxels") -DefNode(GeometryNode, GEO_NODE_SAMPLE_GRID, 0, SampleGrid, "Sample Grid", "") -DefNode(GeometryNode, GEO_NODE_SAMPLE_INDEX, def_geo_sample_index, SampleIndex, "Sample Index", "Retrieve values from specific geometry elements") -DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST_SURFACE, 0, SampleNearestSurface, "Sample Nearest Surface", "Calculate the interpolated value of a mesh attribute on the closest point of its surface") -DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST, 0, SampleNearest, "Sample Nearest", "Find the element of a geometry closest to a position. Similar to the \"Index of Nearest\" node") -DefNode(GeometryNode, GEO_NODE_SAMPLE_UV_SURFACE, 0, SampleUVSurface, "Sample UV Surface", "Calculate the interpolated values of a mesh attribute at a UV coordinate") -DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, 0, ScaleElements, "Scale Elements", "Scale groups of connected edges and faces") -DefNode(GeometryNode, GEO_NODE_SCALE_INSTANCES, 0, ScaleInstances, "Scale Instances", "Scale geometry instances in local or global space") -DefNode(GeometryNode, GEO_NODE_SDF_GRID_BOOLEAN, 0, SDFGridBoolean, "SDF Grid Boolean", "Cut, subtract, or join multiple SDF volume grid inputs") -DefNode(GeometryNode, GEO_NODE_SELF_OBJECT, 0, SelfObject, "Self Object", "Retrieve the object that contains the geometry nodes modifier currently being executed") -DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0,SeparateComponents, "Separate Components", "Split a geometry into a separate output for each type of data in the geometry") -DefNode(GeometryNode, GEO_NODE_SEPARATE_GEOMETRY, 0, SeparateGeometry, "Separate Geometry", "Split a geometry into two geometry outputs based on a selection") -DefNode(GeometryNode, GEO_NODE_SET_CURVE_HANDLES, 0, SetCurveHandlePositions, "Set Handle Positions", "Set the positions for the handles of Bézier curves") -DefNode(GeometryNode, GEO_NODE_SET_CURVE_NORMAL, 0, SetCurveNormal, "Set Curve Normal", "Set the evaluation mode for curve normals") -DefNode(GeometryNode, GEO_NODE_SET_CURVE_RADIUS, 0, SetCurveRadius, "Set Curve Radius", "Set the radius of the curve at each control point") -DefNode(GeometryNode, GEO_NODE_SET_CURVE_TILT, 0, SetCurveTilt, "Set Curve Tilt", "Set the tilt angle at each curve control point") -DefNode(GeometryNode, GEO_NODE_SET_GEOMETRY_NAME, 0, SetGeometryName, "Set Geometry Name", "Set the name of a geometry for easier debugging") -DefNode(GeometryNode, GEO_NODE_SET_ID, 0, SetID, "Set ID", "Set the id attribute on the input geometry, mainly used internally for randomizing") -DefNode(GeometryNode, GEO_NODE_SET_INSTANCE_TRANSFORM, 0, SetInstanceTransform, "Set Instance Transform", "Set the transformation matrix of every instance") -DefNode(GeometryNode, GEO_NODE_SET_MATERIAL_INDEX, 0, SetMaterialIndex, "Set Material Index", "Set the material index for each selected geometry element") -DefNode(GeometryNode, GEO_NODE_SET_MATERIAL, 0, SetMaterial, "Set Material", "Assign a material to geometry elements") -DefNode(GeometryNode, GEO_NODE_SET_POINT_RADIUS, 0, SetPointRadius, "Set Point Radius", "Set the display size of point cloud points") -DefNode(GeometryNode, GEO_NODE_SET_POSITION, 0, SetPosition, "Set Position", "Set the location of each point") -DefNode(GeometryNode, GEO_NODE_SET_SHADE_SMOOTH, 0, SetShadeSmooth, "Set Shade Smooth", "Control the smoothness of mesh normals around each face by changing the \"shade smooth\" attribute") -DefNode(GeometryNode, GEO_NODE_SET_SPLINE_CYCLIC, 0, SetSplineCyclic, "Set Spline Cyclic", "Control whether each spline loops back on itself by changing the \"cyclic\" attribute") -DefNode(GeometryNode, GEO_NODE_SET_SPLINE_RESOLUTION, 0, SetSplineResolution, "Set Spline Resolution", "Control how many evaluated points should be generated on every curve segment") -DefNode(GeometryNode, GEO_NODE_SIMULATION_INPUT, def_geo_simulation_input, SimulationInput, "Simulation Input", "Input data for the simulation zone") -DefNode(GeometryNode, GEO_NODE_SIMULATION_OUTPUT, def_geo_simulation_output, SimulationOutput, "Simulation Output", "Output data from the simulation zone") -DefNode(GeometryNode, GEO_NODE_SORT_ELEMENTS, 0, SortElements, "Sort Elements", "Rearrange geometry elements, changing their indices") -DefNode(GeometryNode, GEO_NODE_SPLIT_EDGES, 0, SplitEdges, "Split Edges", "Duplicate mesh edges and break connections with the surrounding faces") -DefNode(GeometryNode, GEO_NODE_SPLIT_TO_INSTANCES, 0, SplitToInstances, "Split to Instances", "Create separate geometries containing the elements from the same group") -DefNode(GeometryNode, GEO_NODE_STORE_NAMED_ATTRIBUTE, 0, StoreNamedAttribute, "Store Named Attribute", "Store the result of a field on a geometry as an attribute with the specified name") -DefNode(GeometryNode, GEO_NODE_STORE_NAMED_GRID, 0, StoreNamedGrid, "Store Named Grid", "Store grid data in a volume geometry with the specified name") -DefNode(GeometryNode, GEO_NODE_STRING_JOIN, 0, StringJoin, "Join Strings", "Combine any number of input strings") -DefNode(GeometryNode, GEO_NODE_STRING_TO_CURVES, def_geo_string_to_curves, StringToCurves, "String to Curves", "Generate a paragraph of text with a specific font, using a curve instance to store each character") -DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_CURVE, 0, SubdivideCurve, "Subdivide Curve", "Dividing each curve segment into a specified number of pieces") -DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_MESH, 0, SubdivideMesh, "Subdivide Mesh", "Divide mesh faces into smaller ones without changing the shape or volume, using linear interpolation to place the new vertices") -DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, 0,SubdivisionSurface, "Subdivision Surface", "Divide mesh faces to form a smooth surface, using the Catmull-Clark subdivision method") -DefNode(GeometryNode, GEO_NODE_SWITCH, 0, Switch, "Switch", "Switch between two inputs") -DefNode(GeometryNode, GEO_NODE_TOOL_3D_CURSOR, 0, Tool3DCursor, "3D Cursor", "The scene's 3D cursor location and rotation") -DefNode(GeometryNode, GEO_NODE_TOOL_ACTIVE_ELEMENT, 0, ToolActiveElement, "Active Element", "Active element indices of the edited geometry, for tool execution") -DefNode(GeometryNode, GEO_NODE_TOOL_FACE_SET, 0, ToolFaceSet, "Face Set", "Each face's sculpt face set value") -DefNode(GeometryNode, GEO_NODE_TOOL_MOUSE_POSITION, 0, ToolMousePosition, "Mouse Position", "Retrieve the position of the mouse cursor") -DefNode(GeometryNode, GEO_NODE_TOOL_SELECTION, 0, ToolSelection, "Selection", "User selection of the edited geometry, for tool execution") -DefNode(GeometryNode, GEO_NODE_TOOL_SET_FACE_SET, 0, ToolSetFaceSet, "Set Face Set", "Set sculpt face set values for faces") -DefNode(GeometryNode, GEO_NODE_TOOL_SET_SELECTION, 0, ToolSetSelection, "Set Selection", "Set selection of the edited geometry, for tool execution") -DefNode(GeometryNode, GEO_NODE_TOOL_VIEWPORT_TRANSFORM, 0, ViewportTransform, "Viewport Transform", "Retrieve the view direction and location of the 3D viewport") -DefNode(GeometryNode, GEO_NODE_TRANSFORM_GEOMETRY, 0, Transform, "Transform Geometry", "Translate, rotate or scale the geometry") -DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0,TranslateInstances, "Translate Instances", "Move top-level geometry instances in local or global space") -DefNode(GeometryNode, GEO_NODE_TRIANGULATE, 0, Triangulate, "Triangulate", "Convert all faces in a mesh to triangular faces") -DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, 0, TrimCurve, "Trim Curve", "Shorten curves by removing portions at the start or end") -DefNode(GeometryNode, GEO_NODE_UV_PACK_ISLANDS, 0, UVPackIslands, "Pack UV Islands", "Scale islands of a UV map and move them so they fill the UV space as much as possible") -DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, 0, UVUnwrap, "UV Unwrap", "Generate a UV map based on seam edges") -DefNode(GeometryNode, GEO_NODE_VIEWER, 0, Viewer, "Viewer", "Display the input data in the Spreadsheet Editor") -DefNode(GeometryNode, GEO_NODE_VOLUME_CUBE, 0, VolumeCube, "Volume Cube", "Generate a dense volume with a field that controls the density at each grid voxel based on its position") -DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, 0, VolumeToMesh, "Volume to Mesh", "Generate a mesh on the \"surface\" of a volume") -DefNode(GeometryNode, GEO_NODE_WARNING, 0, Warning, "Warning", "Create custom warnings in node groups") +DefNode(GeometryNode, GEO_NODE_ACCUMULATE_FIELD, 0, AccumulateField) +DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, 0, AttributeDomainSize) +DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 0, AttributeStatistic) +DefNode(GeometryNode, GEO_NODE_BAKE, rna_def_geo_bake, Bake) +DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, 0, BlurAttribute) +DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, BoundBox) +DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, rna_def_geo_capture_attribute, CaptureAttribute) +DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, 0, CollectionInfo) +DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, ConvexHull) +DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, CurveEndpointSelection) +DefNode(GeometryNode, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, def_geo_curve_handle_type_selection, CurveHandleTypeSelection) +DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, CurveLength) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_ARC, 0, CurveArc) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, 0, CurvePrimitiveBezierSegment) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_CIRCLE,0, CurvePrimitiveCircle) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_LINE, 0, CurvePrimitiveLine) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, 0, CurveQuadraticBezier) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, 0, CurvePrimitiveQuadrilateral) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL,0, CurveSpiral) +DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, CurveStar) +DefNode(GeometryNode, GEO_NODE_CURVE_SET_HANDLE_TYPE, def_geo_curve_set_handle_type, CurveSetHandles) +DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_PARAMETER,0, SplineParameter) +DefNode(GeometryNode, GEO_NODE_CURVE_SPLINE_TYPE, 0, CurveSplineType) +DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, CurveToMesh) +DefNode(GeometryNode, GEO_NODE_CURVE_TO_POINTS, 0, CurveToPoints) +DefNode(GeometryNode, GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT, 0, CurveOfPoint) +DefNode(GeometryNode, GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE, 0, PointsOfCurve) +DefNode(GeometryNode, GEO_NODE_CURVES_TO_GREASE_PENCIL, 0, CurvesToGreasePencil) +DefNode(GeometryNode, GEO_NODE_DEFORM_CURVES_ON_SURFACE, 0, DeformCurvesOnSurface) +DefNode(GeometryNode, GEO_NODE_DELETE_GEOMETRY, 0, DeleteGeometry) +DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_IN_GRID, 0, DistributePointsInGrid) +DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME, 0, DistributePointsInVolume) +DefNode(GeometryNode, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, def_geo_distribute_points_on_faces, DistributePointsOnFaces) +DefNode(GeometryNode, GEO_NODE_DUAL_MESH, 0, DualMesh) +DefNode(GeometryNode, GEO_NODE_DUPLICATE_ELEMENTS, 0, DuplicateElements) +DefNode(GeometryNode, GEO_NODE_EDGE_PATHS_TO_CURVES, 0, EdgePathsToCurves) +DefNode(GeometryNode, GEO_NODE_EDGE_PATHS_TO_SELECTION, 0, EdgePathsToSelection) +DefNode(GeometryNode, GEO_NODE_EDGES_TO_FACE_GROUPS, 0, EdgesToFaceGroups) +DefNode(GeometryNode, GEO_NODE_EVALUATE_AT_INDEX, 0, FieldAtIndex) +DefNode(GeometryNode, GEO_NODE_EVALUATE_ON_DOMAIN, 0, FieldOnDomain) +DefNode(GeometryNode, GEO_NODE_EXTRUDE_MESH, 0, ExtrudeMesh) +DefNode(GeometryNode, GEO_NODE_FILL_CURVE, 0, FillCurve) +DefNode(GeometryNode, GEO_NODE_FILLET_CURVE, 0, FilletCurve) +DefNode(GeometryNode, GEO_NODE_FLIP_FACES, 0, FlipFaces) +DefNode(GeometryNode, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT, def_geo_foreach_geometry_element_input, ForeachGeometryElementInput) +DefNode(GeometryNode, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, def_geo_foreach_geometry_element_output, ForeachGeometryElementOutput) +DefNode(GeometryNode, GEO_NODE_GEOMETRY_TO_INSTANCE, 0, GeometryToInstance) +DefNode(GeometryNode, GEO_NODE_GET_NAMED_GRID, 0, GetNamedGrid) +DefNode(GeometryNode, GEO_NODE_GIZMO_DIAL, 0, GizmoDial) +DefNode(GeometryNode, GEO_NODE_GIZMO_LINEAR, 0, GizmoLinear) +DefNode(GeometryNode, GEO_NODE_GIZMO_TRANSFORM, rna_def_geo_gizmo_transform, GizmoTransform) +DefNode(GeometryNode, GEO_NODE_GREASE_PENCIL_TO_CURVES, 0, GreasePencilToCurves) +DefNode(GeometryNode, GEO_NODE_GRID_TO_MESH, 0, GridToMesh) +DefNode(GeometryNode, GEO_NODE_IMAGE_INFO, 0, ImageInfo) +DefNode(GeometryNode, GEO_NODE_IMAGE_TEXTURE, def_geo_image_texture, ImageTexture) +DefNode(GeometryNode, GEO_NODE_IMAGE, def_geo_image, InputImage) +DefNode(GeometryNode, GEO_NODE_IMPORT_OBJ, 0, ImportOBJ) +DefNode(GeometryNode, GEO_NODE_IMPORT_PLY, 0, ImportPLY) +DefNode(GeometryNode, GEO_NODE_IMPORT_STL, 0, ImportSTL) +DefNode(GeometryNode, GEO_NODE_INDEX_OF_NEAREST, 0, IndexOfNearest) +DefNode(GeometryNode, GEO_NODE_INDEX_SWITCH, def_geo_index_switch, IndexSwitch) +DefNode(GeometryNode, GEO_NODE_INPUT_ACTIVE_CAMERA, 0, InputActiveCamera) +DefNode(GeometryNode, GEO_NODE_INPUT_COLLECTION, def_geo_input_collection, InputCollection) +DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_HANDLES, 0, InputCurveHandlePositions) +DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_TILT, 0, InputCurveTilt) +DefNode(GeometryNode, GEO_NODE_INPUT_EDGE_SMOOTH, 0, InputEdgeSmooth) +DefNode(GeometryNode, GEO_NODE_INPUT_FACE_SMOOTH, 0, InputShadeSmooth) +DefNode(GeometryNode, GEO_NODE_INPUT_ID, 0, InputID) +DefNode(GeometryNode, GEO_NODE_INPUT_INDEX, 0, InputIndex) +DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_ROTATION, 0, InputInstanceRotation) +DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_SCALE, 0, InputInstanceScale) +DefNode(GeometryNode, GEO_NODE_INPUT_INSTANCE_TRANSFORM, 0, InstanceTransform) +DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL_INDEX, 0, InputMaterialIndex) +DefNode(GeometryNode, GEO_NODE_INPUT_MATERIAL, def_geo_input_material, InputMaterial) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_ANGLE, 0, InputMeshEdgeAngle) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, 0,InputMeshEdgeNeighbors) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_EDGE_VERTICES, 0, InputMeshEdgeVertices) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_AREA, 0, InputMeshFaceArea) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_IS_PLANAR, 0, InputMeshFaceIsPlanar) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, 0,InputMeshFaceNeighbors) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_ISLAND, 0, InputMeshIsland) +DefNode(GeometryNode, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, 0, InputMeshVertexNeighbors) +DefNode(GeometryNode, GEO_NODE_INPUT_NAMED_ATTRIBUTE, 0, InputNamedAttribute) +DefNode(GeometryNode, GEO_NODE_INPUT_NAMED_LAYER_SELECTION, 0, InputNamedLayerSelection) +DefNode(GeometryNode, GEO_NODE_INPUT_NORMAL, 0, InputNormal) +DefNode(GeometryNode, GEO_NODE_INPUT_OBJECT, def_geo_input_object, InputObject) +DefNode(GeometryNode, GEO_NODE_INPUT_POSITION, 0, InputPosition) +DefNode(GeometryNode, GEO_NODE_INPUT_RADIUS, 0, InputRadius) +DefNode(GeometryNode, GEO_NODE_INPUT_SCENE_TIME, 0, InputSceneTime) +DefNode(GeometryNode, GEO_NODE_INPUT_SHORTEST_EDGE_PATHS, 0, InputShortestEdgePaths) +DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_CYCLIC, 0,InputSplineCyclic) +DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_LENGTH, 0, SplineLength) +DefNode(GeometryNode, GEO_NODE_INPUT_SPLINE_RESOLUTION, 0, InputSplineResolution) +DefNode(GeometryNode, GEO_NODE_INPUT_TANGENT, 0, InputTangent) +DefNode(GeometryNode, GEO_NODE_INSTANCE_ON_POINTS, 0, InstanceOnPoints) +DefNode(GeometryNode, GEO_NODE_INSTANCES_TO_POINTS, 0,InstancesToPoints) +DefNode(GeometryNode, GEO_NODE_INTERPOLATE_CURVES, 0, InterpolateCurves) +DefNode(GeometryNode, GEO_NODE_IS_VIEWPORT, 0, IsViewport) +DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, JoinGeometry) +DefNode(GeometryNode, GEO_NODE_MATERIAL_SELECTION, 0, MaterialSelection) +DefNode(GeometryNode, GEO_NODE_MENU_SWITCH, def_geo_menu_switch, MenuSwitch) +DefNode(GeometryNode, GEO_NODE_MERGE_BY_DISTANCE, 0, MergeByDistance) +DefNode(GeometryNode, GEO_NODE_MERGE_LAYERS, 0, MergeLayers) +DefNode(GeometryNode, GEO_NODE_MESH_BOOLEAN, 0, MeshBoolean) +DefNode(GeometryNode, GEO_NODE_MESH_FACE_GROUP_BOUNDARIES, 0, MeshFaceSetBoundaries) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CIRCLE, 0, MeshCircle) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CONE, 0, MeshCone) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CUBE, 0, MeshCube) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CYLINDER, 0, MeshCylinder) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_GRID, 0,MeshGrid) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, 0, MeshIcoSphere) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_LINE, 0, MeshLine) +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, 0, MeshUVSphere) +DefNode(GeometryNode, GEO_NODE_MESH_TO_CURVE, 0, MeshToCurve) +DefNode(GeometryNode, GEO_NODE_MESH_TO_DENSITY_GRID, 0, MeshToDensityGrid) +DefNode(GeometryNode, GEO_NODE_MESH_TO_POINTS, 0, MeshToPoints) +DefNode(GeometryNode, GEO_NODE_MESH_TO_SDF_GRID, 0, MeshToSDFGrid) +DefNode(GeometryNode, GEO_NODE_MESH_TO_VOLUME, 0, MeshToVolume) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE, 0, CornersOfEdge) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_FACE, 0, CornersOfFace) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX, 0, CornersOfVertex) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_CORNER, 0, EdgesOfCorner) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX, 0, EdgesOfVertex) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER, 0, FaceOfCorner) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE, 0, OffsetCornerInFace) +DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, 0, VertexOfCorner) +DefNode(GeometryNode, GEO_NODE_OBJECT_INFO, 0, ObjectInfo) +DefNode(GeometryNode, GEO_NODE_OFFSET_POINT_IN_CURVE, 0, OffsetPointInCurve) +DefNode(GeometryNode, GEO_NODE_POINTS_TO_CURVES, 0, PointsToCurves) +DefNode(GeometryNode, GEO_NODE_POINTS_TO_SDF_GRID, 0, PointsToSDFGrid) +DefNode(GeometryNode, GEO_NODE_POINTS_TO_VERTICES, 0, PointsToVertices) +DefNode(GeometryNode, GEO_NODE_POINTS_TO_VOLUME, 0, PointsToVolume) +DefNode(GeometryNode, GEO_NODE_POINTS, 0, Points) +DefNode(GeometryNode, GEO_NODE_PROXIMITY, 0, Proximity) +DefNode(GeometryNode, GEO_NODE_RAYCAST, 0, Raycast) +DefNode(GeometryNode, GEO_NODE_REALIZE_INSTANCES, 0, RealizeInstances) +DefNode(GeometryNode, GEO_NODE_REMOVE_ATTRIBUTE, 0, RemoveAttribute) +DefNode(GeometryNode, GEO_NODE_REPEAT_INPUT, def_geo_repeat_input, RepeatInput) +DefNode(GeometryNode, GEO_NODE_REPEAT_OUTPUT, def_geo_repeat_output, RepeatOutput) +DefNode(GeometryNode, GEO_NODE_REPLACE_MATERIAL, 0, ReplaceMaterial) +DefNode(GeometryNode, GEO_NODE_RESAMPLE_CURVE, 0, ResampleCurve) +DefNode(GeometryNode, GEO_NODE_REVERSE_CURVE, 0, ReverseCurve) +DefNode(GeometryNode, GEO_NODE_ROTATE_INSTANCES, 0, RotateInstances) +DefNode(GeometryNode, GEO_NODE_SAMPLE_CURVE, def_geo_curve_sample, SampleCurve) +DefNode(GeometryNode, GEO_NODE_SAMPLE_GRID_INDEX, 0, SampleGridIndex) +DefNode(GeometryNode, GEO_NODE_SAMPLE_GRID, 0, SampleGrid) +DefNode(GeometryNode, GEO_NODE_SAMPLE_INDEX, def_geo_sample_index, SampleIndex) +DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST_SURFACE, 0, SampleNearestSurface) +DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST, 0, SampleNearest) +DefNode(GeometryNode, GEO_NODE_SAMPLE_UV_SURFACE, 0, SampleUVSurface) +DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, 0, ScaleElements) +DefNode(GeometryNode, GEO_NODE_SCALE_INSTANCES, 0, ScaleInstances) +DefNode(GeometryNode, GEO_NODE_SDF_GRID_BOOLEAN, 0, SDFGridBoolean) +DefNode(GeometryNode, GEO_NODE_SELF_OBJECT, 0, SelfObject) +DefNode(GeometryNode, GEO_NODE_SEPARATE_COMPONENTS, 0, SeparateComponents) +DefNode(GeometryNode, GEO_NODE_SEPARATE_GEOMETRY, 0, SeparateGeometry) +DefNode(GeometryNode, GEO_NODE_SET_CURVE_HANDLES, 0, SetCurveHandlePositions) +DefNode(GeometryNode, GEO_NODE_SET_CURVE_NORMAL, 0, SetCurveNormal) +DefNode(GeometryNode, GEO_NODE_SET_CURVE_RADIUS, 0, SetCurveRadius) +DefNode(GeometryNode, GEO_NODE_SET_CURVE_TILT, 0, SetCurveTilt) +DefNode(GeometryNode, GEO_NODE_SET_GEOMETRY_NAME, 0, SetGeometryName) +DefNode(GeometryNode, GEO_NODE_SET_ID, 0, SetID) +DefNode(GeometryNode, GEO_NODE_SET_INSTANCE_TRANSFORM, 0, SetInstanceTransform) +DefNode(GeometryNode, GEO_NODE_SET_MATERIAL_INDEX, 0, SetMaterialIndex) +DefNode(GeometryNode, GEO_NODE_SET_MATERIAL, 0, SetMaterial) +DefNode(GeometryNode, GEO_NODE_SET_POINT_RADIUS, 0, SetPointRadius) +DefNode(GeometryNode, GEO_NODE_SET_POSITION, 0, SetPosition) +DefNode(GeometryNode, GEO_NODE_SET_SHADE_SMOOTH, 0, SetShadeSmooth) +DefNode(GeometryNode, GEO_NODE_SET_SPLINE_CYCLIC, 0, SetSplineCyclic) +DefNode(GeometryNode, GEO_NODE_SET_SPLINE_RESOLUTION, 0, SetSplineResolution) +DefNode(GeometryNode, GEO_NODE_SIMULATION_INPUT, def_geo_simulation_input, SimulationInput) +DefNode(GeometryNode, GEO_NODE_SIMULATION_OUTPUT, def_geo_simulation_output, SimulationOutput) +DefNode(GeometryNode, GEO_NODE_SORT_ELEMENTS, 0, SortElements) +DefNode(GeometryNode, GEO_NODE_SPLIT_EDGES, 0, SplitEdges) +DefNode(GeometryNode, GEO_NODE_SPLIT_TO_INSTANCES, 0, SplitToInstances) +DefNode(GeometryNode, GEO_NODE_STORE_NAMED_ATTRIBUTE, 0, StoreNamedAttribute) +DefNode(GeometryNode, GEO_NODE_STORE_NAMED_GRID, 0, StoreNamedGrid) +DefNode(GeometryNode, GEO_NODE_STRING_JOIN, 0, StringJoin) +DefNode(GeometryNode, GEO_NODE_STRING_TO_CURVES, def_geo_string_to_curves, StringToCurves) +DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_CURVE, 0, SubdivideCurve) +DefNode(GeometryNode, GEO_NODE_SUBDIVIDE_MESH, 0, SubdivideMesh) +DefNode(GeometryNode, GEO_NODE_SUBDIVISION_SURFACE, 0,SubdivisionSurface) +DefNode(GeometryNode, GEO_NODE_SWITCH, 0, Switch) +DefNode(GeometryNode, GEO_NODE_TOOL_3D_CURSOR, 0, Tool3DCursor) +DefNode(GeometryNode, GEO_NODE_TOOL_ACTIVE_ELEMENT, 0, ToolActiveElement) +DefNode(GeometryNode, GEO_NODE_TOOL_FACE_SET, 0, ToolFaceSet) +DefNode(GeometryNode, GEO_NODE_TOOL_MOUSE_POSITION, 0, ToolMousePosition) +DefNode(GeometryNode, GEO_NODE_TOOL_SELECTION, 0, ToolSelection) +DefNode(GeometryNode, GEO_NODE_TOOL_SET_FACE_SET, 0, ToolSetFaceSet) +DefNode(GeometryNode, GEO_NODE_TOOL_SET_SELECTION, 0, ToolSetSelection) +DefNode(GeometryNode, GEO_NODE_TOOL_VIEWPORT_TRANSFORM, 0, ViewportTransform) +DefNode(GeometryNode, GEO_NODE_TRANSFORM_GEOMETRY, 0, Transform) +DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0,TranslateInstances) +DefNode(GeometryNode, GEO_NODE_TRIANGULATE, 0, Triangulate) +DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, 0, TrimCurve) +DefNode(GeometryNode, GEO_NODE_UV_PACK_ISLANDS, 0, UVPackIslands) +DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, 0, UVUnwrap) +DefNode(GeometryNode, GEO_NODE_VIEWER, 0, Viewer) +DefNode(GeometryNode, GEO_NODE_VOLUME_CUBE, 0, VolumeCube) +DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, 0, VolumeToMesh) +DefNode(GeometryNode, GEO_NODE_WARNING, 0, Warning) /* undefine macros */ #undef DefNode diff --git a/source/blender/nodes/composite/node_composite_tree.cc b/source/blender/nodes/composite/node_composite_tree.cc index 835879b3f7dd..480092338cc6 100644 --- a/source/blender/nodes/composite/node_composite_tree.cc +++ b/source/blender/nodes/composite/node_composite_tree.cc @@ -150,15 +150,15 @@ blender::bke::bNodeTreeType *ntreeType_Composite; void register_node_tree_type_cmp() { - blender::bke::bNodeTreeType *tt = ntreeType_Composite = MEM_cnew( + blender::bke::bNodeTreeType *tt = ntreeType_Composite = MEM_new( __func__); tt->type = NTREE_COMPOSIT; - STRNCPY(tt->idname, "CompositorNodeTree"); - STRNCPY(tt->group_idname, "CompositorNodeGroup"); - STRNCPY(tt->ui_name, N_("Compositor")); + tt->idname = "CompositorNodeTree"; + tt->group_idname = "CompositorNodeGroup"; + tt->ui_name = N_("Compositor"); tt->ui_icon = ICON_NODE_COMPOSITING; - STRNCPY(tt->ui_description, N_("Compositing nodes")); + tt->ui_description = N_("Compositing nodes"); tt->foreach_nodeclass = foreach_nodeclass; tt->localize = localize; diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc index 11f19d529c80..90c67a96df84 100644 --- a/source/blender/nodes/composite/node_composite_util.cc +++ b/source/blender/nodes/composite/node_composite_util.cc @@ -28,9 +28,9 @@ void cmp_node_update_default(bNodeTree * /*ntree*/, bNode *node) node->runtime->need_exec = 1; } -void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - blender::bke::node_type_base(ntype, type, name, nclass); + blender::bke::node_type_base(ntype, type, nclass); ntype->poll = cmp_node_poll_default; ntype->updatefunc = cmp_node_update_default; diff --git a/source/blender/nodes/composite/node_composite_util.hh b/source/blender/nodes/composite/node_composite_util.hh index a07bb9d3ac50..198e267a9959 100644 --- a/source/blender/nodes/composite/node_composite_util.hh +++ b/source/blender/nodes/composite/node_composite_util.hh @@ -24,4 +24,4 @@ bool cmp_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint); void cmp_node_update_default(bNodeTree *ntree, bNode *node); -void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass); +void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); 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 683acaee4737..9e234c332702 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc @@ -197,7 +197,9 @@ void register_node_type_cmp_alphaover() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Alpha Over"; + ntype.ui_description = "Overlay a foreground image onto a background image"; ntype.enum_name_legacy = "ALPHAOVER"; ntype.declare = file_ns::cmp_node_alphaover_declare; ntype.draw_buttons = file_ns::node_composit_buts_alphaover; diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index 1cc64d8dfdd4..855d7a50a6af 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -101,7 +101,9 @@ void register_node_type_cmp_antialiasing() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_ANTIALIASING, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Anti-Aliasing"; + ntype.ui_description = "Smooth away jagged edges"; ntype.enum_name_legacy = "ANTIALIASING"; ntype.declare = file_ns::cmp_node_antialiasing_declare; ntype.draw_buttons = file_ns::node_composit_buts_antialiasing; diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index e67af1bae0e0..c9a227fe8b8d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -182,7 +182,9 @@ void register_node_type_cmp_bilateralblur() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Bilateral Blur"; + ntype.ui_description = "Adaptively blur image, while retaining sharp edges"; ntype.enum_name_legacy = "BILATERALBLUR"; ntype.declare = file_ns::cmp_node_bilateralblur_declare; ntype.draw_buttons = file_ns::node_composit_buts_bilateralblur; diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index 1de7b6e9758f..3ff6b3c14890 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -523,7 +523,9 @@ void register_node_type_cmp_blur() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_BLUR, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Blur"; + ntype.ui_description = "Blur an image, using several blur modes"; ntype.enum_name_legacy = "BLUR"; ntype.declare = file_ns::cmp_node_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_blur; diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc index 263251c79edf..6b25b846ea7d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -415,7 +415,11 @@ void register_node_type_cmp_bokehblur() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Bokeh Blur"; + ntype.ui_description = + "Generate a bokeh type blur similar to Defocus. Unlike defocus an in-focus region is " + "defined in the compositor"; ntype.enum_name_legacy = "BOKEHBLUR"; ntype.declare = file_ns::cmp_node_bokehblur_declare; ntype.draw_buttons = file_ns::node_composit_buts_bokehblur; diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc index 5001eeda65ab..b9c92f6237d2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -107,7 +107,9 @@ void register_node_type_cmp_bokehimage() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, NODE_CLASS_INPUT); + ntype.ui_name = "Bokeh Image"; + ntype.ui_description = "Generate image with bokeh shape for use with the Bokeh Blur filter node"; ntype.enum_name_legacy = "BOKEHIMAGE"; ntype.declare = file_ns::cmp_node_bokehimage_declare; ntype.draw_buttons = file_ns::node_composit_buts_bokehimage; diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index 32a087d5c256..5cc0bbbcf023 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -303,7 +303,9 @@ void register_node_type_cmp_boxmask() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, NODE_CLASS_MATTE); + ntype.ui_name = "Box Mask"; + ntype.ui_description = "Create rectangular mask suitable for use as a simple matte"; ntype.enum_name_legacy = "BOXMASK"; ntype.declare = file_ns::cmp_node_boxmask_declare; ntype.draw_buttons = file_ns::node_composit_buts_boxmask; diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index 1a9802b31842..b0bbafc03e53 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -148,7 +148,9 @@ void register_node_type_cmp_brightcontrast() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Brightness/Contrast", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Brightness/Contrast"; + ntype.ui_description = "Adjust brightness and contrast"; ntype.enum_name_legacy = "BRIGHTCONTRAST"; ntype.declare = file_ns::cmp_node_brightcontrast_declare; ntype.draw_buttons = file_ns::node_composit_buts_brightcontrast; 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 ccd802ea1a13..dc448de36304 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channel_matte.cc @@ -297,7 +297,9 @@ void register_node_type_cmp_channel_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Channel Key"; + ntype.ui_description = "Create matte based on differences in color channels"; ntype.enum_name_legacy = "CHANNEL_MATTE"; ntype.declare = file_ns::cmp_node_channel_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_channel_matte; 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 475f7d730828..2077de94a7c6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc @@ -188,7 +188,9 @@ void register_node_type_cmp_chroma_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Chroma Key"; + ntype.ui_description = "Create matte based on chroma values"; ntype.enum_name_legacy = "CHROMA_MATTE"; ntype.declare = file_ns::cmp_node_chroma_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_chroma_matte; 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 87cfe6487517..60eb67778e7d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_color_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_color_matte.cc @@ -180,7 +180,9 @@ void register_node_type_cmp_color_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Color Key"; + ntype.ui_description = "Create matte using a given color, for green or blue screen footage"; ntype.enum_name_legacy = "COLOR_MATTE"; ntype.declare = file_ns::cmp_node_color_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_color_matte; 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 32961834563f..47e058c1270f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_color_spill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_color_spill.cc @@ -225,7 +225,11 @@ void register_node_type_cmp_color_spill() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, NODE_CLASS_MATTE); + ntype.ui_name = "Color Spill"; + ntype.ui_description = + "Remove colors from a blue or green screen, by reducing one RGB channel compared to the " + "others"; ntype.enum_name_legacy = "COLOR_SPILL"; ntype.declare = file_ns::cmp_node_color_spill_declare; ntype.draw_buttons = file_ns::node_composit_buts_color_spill; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc index e1943555c223..0123794dd239 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -386,7 +386,9 @@ void register_node_type_cmp_colorbalance() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Color Balance"; + ntype.ui_description = "Adjust color and values"; ntype.enum_name_legacy = "COLORBALANCE"; ntype.declare = file_ns::cmp_node_colorbalance_declare; ntype.draw_buttons = file_ns::node_composit_buts_colorbalance; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc index 33b605b4006b..134aeb2ae2ba 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -510,7 +510,11 @@ void register_node_type_cmp_colorcorrection() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Color Correction"; + ntype.ui_description = + "Adjust the color of an image, separately in several tonal ranges (highlights, midtones and " + "shadows)"; ntype.enum_name_legacy = "COLORCORRECTION"; ntype.declare = file_ns::cmp_node_colorcorrection_declare; ntype.draw_buttons = file_ns::node_composit_buts_colorcorrection; diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.cc b/source/blender/nodes/composite/nodes/node_composite_composite.cc index 292c0e80b821..2380a833b0cd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.cc +++ b/source/blender/nodes/composite/nodes/node_composite_composite.cc @@ -288,7 +288,9 @@ void register_node_type_cmp_composite() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT); + cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, NODE_CLASS_OUTPUT); + ntype.ui_name = "Composite"; + ntype.ui_description = "Final render output"; ntype.enum_name_legacy = "COMPOSITE"; ntype.declare = file_ns::cmp_node_composite_declare; ntype.draw_buttons = file_ns::node_composit_buts_composite; 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 9e2870d3d959..3eb4759b30de 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 @@ -196,8 +196,9 @@ void register_node_type_cmp_convert_color_space() namespace file_ns = blender::nodes::node_composite_convert_color_space_cc; static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_CONVERT_COLOR_SPACE, "Convert Colorspace", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_CONVERT_COLOR_SPACE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Convert Colorspace"; + ntype.ui_description = "Convert between color spaces"; ntype.enum_name_legacy = "CONVERT_COLORSPACE"; ntype.declare = file_ns::CMP_NODE_CONVERT_COLOR_SPACE_declare; ntype.draw_buttons = file_ns::node_composit_buts_convert_colorspace; diff --git a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc index ace551b49399..a55a7dbf8d1e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cornerpin.cc @@ -264,7 +264,9 @@ void register_node_type_cmp_cornerpin() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, "Corner Pin", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_CORNERPIN, NODE_CLASS_DISTORT); + ntype.ui_name = "Corner Pin"; + ntype.ui_description = "Plane warp transformation using explicit corner values"; ntype.enum_name_legacy = "CORNERPIN"; ntype.declare = file_ns::cmp_node_cornerpin_declare; 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 a7da5090a8a7..e1a62f29f729 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -292,7 +292,11 @@ void register_node_type_cmp_crop() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_CROP, NODE_CLASS_DISTORT); + ntype.ui_name = "Crop"; + ntype.ui_description = + "Crops image to a smaller region, either making the cropped area transparent or resizing " + "the image"; ntype.enum_name_legacy = "CROP"; ntype.declare = file_ns::cmp_node_crop_declare; ntype.draw_buttons = file_ns::node_composit_buts_crop; diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 8d1970267941..3f0d7eac4055 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -911,7 +911,10 @@ void register_node_type_cmp_cryptomatte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Cryptomatte"; + ntype.ui_description = + "Generate matte for individual objects and materials using Cryptomatte render passes"; ntype.enum_name_legacy = "CRYPTOMATTE"; ntype.declare = file_ns::cmp_node_cryptomatte_declare; blender::bke::node_type_size(&ntype, 240, 100, 700); @@ -1015,8 +1018,9 @@ void register_node_type_cmp_cryptomatte_legacy() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte (Legacy)", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, NODE_CLASS_MATTE); + ntype.ui_name = "Cryptomatte (Legacy)"; + ntype.ui_description = "Deprecated. Use Cryptomatte Node instead"; ntype.enum_name_legacy = "CRYPTOMATTE"; blender::bke::node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out); ntype.initfunc = legacy_file_ns::node_init_cryptomatte_legacy; diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc index b38fc4e2eca3..c05bb0e7ed22 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.cc +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -106,7 +106,11 @@ void register_node_type_cmp_curve_time() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time Curve", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_TIME, NODE_CLASS_INPUT); + ntype.ui_name = "Time Curve"; + ntype.ui_description = + "Generate a factor value (from 0.0 to 1.0) between scene start and end time, using a curve " + "mapping"; ntype.enum_name_legacy = "TIME"; ntype.declare = file_ns::cmp_node_time_declare; blender::bke::node_type_size(&ntype, 200, 140, 320); @@ -218,7 +222,9 @@ void register_node_type_cmp_curve_vec() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR); + cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Curves"; + ntype.ui_description = "Map input vector components with curves"; ntype.enum_name_legacy = "CURVE_VEC"; ntype.declare = file_ns::cmp_node_curve_vec_declare; ntype.draw_buttons = file_ns::node_buts_curvevec; @@ -389,7 +395,9 @@ void register_node_type_cmp_curve_rgb() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_CURVE_RGB, NODE_CLASS_OP_COLOR); + ntype.ui_name = "RGB Curves"; + ntype.ui_description = "Perform level adjustments on each color channel of an image"; ntype.enum_name_legacy = "CURVE_RGB"; ntype.declare = file_ns::cmp_node_rgbcurves_declare; blender::bke::node_type_size(&ntype, 200, 140, 320); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index ca741e4f02a1..af914aa96dfd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -560,7 +560,9 @@ void register_node_type_cmp_defocus() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Defocus"; + ntype.ui_description = "Apply depth of field in 2D, using a Z depth map or mask"; ntype.enum_name_legacy = "DEFOCUS"; ntype.declare = file_ns::cmp_node_defocus_declare; ntype.draw_buttons = file_ns::node_composit_buts_defocus; diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index 421b0c36e538..fd1bc2b02987 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -327,7 +327,9 @@ void register_node_type_cmp_denoise() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_DENOISE, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Denoise"; + ntype.ui_description = "Denoise renders from Cycles and other ray tracing renderers"; ntype.enum_name_legacy = "DENOISE"; ntype.declare = file_ns::cmp_node_denoise_declare; ntype.draw_buttons = file_ns::node_composit_buts_denoise; diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc index c9e137d9ad90..79b561099ce6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -202,7 +202,11 @@ void register_node_type_cmp_despeckle() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Despeckle"; + ntype.ui_description = + "Smooth areas of an image in which noise is noticeable, while leaving complex areas " + "untouched"; ntype.enum_name_legacy = "DESPECKLE"; ntype.declare = file_ns::cmp_node_despeckle_declare; ntype.draw_buttons = file_ns::node_composit_buts_despeckle; 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 1ded3bd5330a..14bb4807c6e8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diff_matte.cc @@ -134,7 +134,11 @@ void register_node_type_cmp_diff_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_DIFF_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Difference Key"; + ntype.ui_description = + "Produce a matte that isolates foreground content by comparing it with a reference " + "background image"; ntype.enum_name_legacy = "DIFF_MATTE"; ntype.declare = file_ns::cmp_node_diff_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_diff_matte; diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index abc70b9f9f23..c8bb4f837c7e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -558,7 +558,9 @@ void register_node_type_cmp_dilateerode() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Dilate/Erode"; + ntype.ui_description = "Expand and shrink masks"; ntype.enum_name_legacy = "DILATE_ERODE"; ntype.draw_buttons = file_ns::node_composit_buts_dilateerode; ntype.declare = file_ns::cmp_node_dilate_declare; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index 855481454ff8..31dbe5a0bb76 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -257,7 +257,9 @@ void register_node_type_cmp_dblur() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_DBLUR, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Directional Blur"; + ntype.ui_description = "Blur an image along a direction"; ntype.enum_name_legacy = "DBLUR"; ntype.declare = file_ns::cmp_node_directional_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_dblur; diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.cc b/source/blender/nodes/composite/nodes/node_composite_displace.cc index 464da4eb28f5..0ef288f9f850 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.cc +++ b/source/blender/nodes/composite/nodes/node_composite_displace.cc @@ -219,7 +219,9 @@ void register_node_type_cmp_displace() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_DISPLACE, NODE_CLASS_DISTORT); + ntype.ui_name = "Displace"; + ntype.ui_description = "Displace pixel position using an offset vector"; ntype.enum_name_legacy = "DISPLACE"; ntype.declare = file_ns::cmp_node_displace_declare; 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 3c2186b51df0..12b305c4eea8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distance_matte.cc @@ -203,7 +203,9 @@ void register_node_type_cmp_distance_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Distance Key"; + ntype.ui_description = "Create matte based on 3D distance between colors"; ntype.enum_name_legacy = "DIST_MATTE"; ntype.declare = file_ns::cmp_node_distance_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_distance_matte; diff --git a/source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc b/source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc index f74472d8f9ab..669f6424d815 100644 --- a/source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc @@ -320,7 +320,9 @@ void register_node_type_cmp_doubleedgemask() static blender::bke::bNodeType ntype; /* Allocate a node type data structure. */ - cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, NODE_CLASS_MATTE); + ntype.ui_name = "Double Edge Mask"; + ntype.ui_description = "Create a gradient between two masks"; ntype.enum_name_legacy = "DOUBLE_EDGE_MASK"; ntype.declare = file_ns::cmp_node_double_edge_mask_declare; ntype.draw_buttons = file_ns::node_composit_buts_double_edge_mask; diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index dee2369fa528..dac3e7529619 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -301,7 +301,10 @@ void register_node_type_cmp_ellipsemask() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, NODE_CLASS_MATTE); + ntype.ui_name = "Ellipse Mask"; + ntype.ui_description = + "Create elliptical mask suitable for use as a simple matte or vignette mask"; ntype.enum_name_legacy = "ELLIPSEMASK"; ntype.declare = file_ns::cmp_node_ellipsemask_declare; ntype.draw_buttons = file_ns::node_composit_buts_ellipsemask; diff --git a/source/blender/nodes/composite/nodes/node_composite_exposure.cc b/source/blender/nodes/composite/nodes/node_composite_exposure.cc index 8c5c378795ae..b89283218e1a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_exposure.cc +++ b/source/blender/nodes/composite/nodes/node_composite_exposure.cc @@ -72,7 +72,9 @@ void register_node_type_cmp_exposure() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, "Exposure", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_EXPOSURE, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Exposure"; + ntype.ui_description = "Adjust brightness using a camera exposure parameter"; ntype.enum_name_legacy = "EXPOSURE"; ntype.declare = file_ns::cmp_node_exposure_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_file_output.cc b/source/blender/nodes/composite/nodes/node_composite_file_output.cc index 0a66c122d0d8..996e8fd7fb9b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_file_output.cc +++ b/source/blender/nodes/composite/nodes/node_composite_file_output.cc @@ -920,7 +920,9 @@ void register_node_type_cmp_output_file() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT); + cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, NODE_CLASS_OUTPUT); + ntype.ui_name = "File Output"; + ntype.ui_description = "Write image file to disk"; ntype.enum_name_legacy = "OUTPUT_FILE"; ntype.draw_buttons = file_ns::node_composit_buts_file_output; ntype.draw_buttons_ex = file_ns::node_composit_buts_file_output_ex; diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc index af5939a1486b..eeeb57d536c0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.cc +++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc @@ -247,7 +247,9 @@ void register_node_type_cmp_filter() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_FILTER, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Filter"; + ntype.ui_description = "Apply common image enhancement filters"; ntype.enum_name_legacy = "FILTER"; ntype.declare = file_ns::cmp_node_filter_declare; ntype.draw_buttons = file_ns::node_composit_buts_filter; diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.cc b/source/blender/nodes/composite/nodes/node_composite_flip.cc index 6f9f83a8e251..8edd7256cb4e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_flip.cc @@ -131,7 +131,9 @@ void register_node_type_cmp_flip() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_FLIP, NODE_CLASS_DISTORT); + ntype.ui_name = "Flip"; + ntype.ui_description = "Flip an image along a defined axis"; ntype.enum_name_legacy = "FLIP"; ntype.declare = file_ns::cmp_node_flip_declare; ntype.draw_buttons = file_ns::node_composit_buts_flip; diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.cc b/source/blender/nodes/composite/nodes/node_composite_gamma.cc index f106636c5572..2002d380c699 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.cc +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.cc @@ -76,7 +76,9 @@ void register_node_type_cmp_gamma() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_GAMMA, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Gamma"; + ntype.ui_description = "Apply gamma correction"; ntype.enum_name_legacy = "GAMMA"; ntype.declare = file_ns::cmp_node_gamma_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index f74361a127de..5789d7b42492 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -46,7 +47,6 @@ #include "node_composite_util.hh" #define MAX_GLARE_ITERATIONS 5 -#define MAX_GLARE_SIZE 9 namespace blender::nodes::node_composite_glare_cc { @@ -57,7 +57,78 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b) b.add_input("Image") .default_value({1.0f, 1.0f, 1.0f, 1.0f}) .compositor_domain_priority(0); - b.add_output("Image"); + b.add_input("Threshold") + .default_value(1.0f) + .min(0.0f) + .description( + "Defines the luminance at which pixels start to be considered part of the highlights " + "that will produce a glare") + .compositor_expects_single_value(); + b.add_input("Strength") + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR) + .description("The strength of the glare that will be added to the image") + .compositor_expects_single_value(); + b.add_input("Saturation") + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR) + .description("Defines how saturated the glare that will be added to the image") + .compositor_expects_single_value(); + b.add_input("Tint") + .default_value({1.0f, 1.0f, 1.0f, 1.0f}) + .description("Tints the glare that will be added to the image") + .compositor_expects_single_value(); + b.add_input("Size") + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR) + .description( + "The size of the glare relative to the image. 1 means the glare covers the entire " + "image, 0.5 means the glare covers half the image, and so on") + .compositor_expects_single_value(); + b.add_input("Streaks") + .default_value(4) + .min(1) + .max(16) + .description("The number of streaks") + .compositor_expects_single_value(); + b.add_input("Streaks Angle") + .default_value(0.0f) + .subtype(PROP_ANGLE) + .description("The angle that the first streak makes with the horizontal axis") + .compositor_expects_single_value(); + b.add_input("Iterations") + .default_value(3) + .min(2) + .max(5) + .description( + "The number of ghosts for Ghost glare or the spread of Glare for Streaks and Simple " + "Star") + .compositor_expects_single_value(); + b.add_input("Fade") + .default_value(0.9f) + .min(0.75f) + .max(1.0f) + .subtype(PROP_FACTOR) + .description("Streak fade-out factor") + .compositor_expects_single_value(); + b.add_input("Color Modulation") + .default_value(0.25) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR) + .description("Modulates colors of streaks and ghosts for a spectral dispersion effect") + .compositor_expects_single_value(); + + b.add_output("Image").description("The image with the generated glare added"); + b.add_output("Glare").description("The generated glare"); + b.add_output("Highlights") + .description("The extracted highlights from which the glare was generated"); } static void node_composit_init_glare(bNodeTree * /*ntree*/, bNode *node) @@ -65,15 +136,7 @@ static void node_composit_init_glare(bNodeTree * /*ntree*/, bNode *node) NodeGlare *ndg = MEM_cnew(__func__); ndg->quality = 1; ndg->type = CMP_NODE_GLARE_STREAKS; - ndg->iter = 3; - ndg->colmod = 0.25; - ndg->mix = 0; - ndg->threshold = 1; ndg->star_45 = true; - ndg->streaks = 4; - ndg->angle_ofs = 0.0f; - ndg->fade = 0.9; - ndg->size = 8; node->storage = ndg; } @@ -89,43 +152,42 @@ static void node_composit_buts_glare(uiLayout *layout, bContext * /*C*/, Pointer uiItemR(layout, ptr, "glare_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); uiItemR(layout, ptr, "quality", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); - if (ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS)) { - uiItemR(layout, ptr, "iterations", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - } - - if (ELEM(glare_type, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS)) { - uiItemR(layout, - ptr, - "color_modulation", - UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, - std::nullopt, - ICON_NONE); - } - - uiItemR(layout, ptr, "mix", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - uiItemR(layout, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - - if (glare_type == CMP_NODE_GLARE_STREAKS) { - uiItemR(layout, ptr, "streaks", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - uiItemR(layout, ptr, "angle_offset", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - } - - if (ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_STREAKS)) { - uiItemR(layout, - ptr, - "fade", - UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, - std::nullopt, - ICON_NONE); - } - if (glare_type == CMP_NODE_GLARE_SIMPLE_STAR) { uiItemR(layout, ptr, "use_rotate_45", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); } +} - if (ELEM(glare_type, CMP_NODE_GLARE_FOG_GLOW, CMP_NODE_GLARE_BLOOM)) { - uiItemR(layout, ptr, "size", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE); - } +static void node_update(bNodeTree *ntree, bNode *node) +{ + const CMPNodeGlareType glare_type = static_cast(node_storage(*node).type); + + bNodeSocket *size_input = bke::node_find_socket(node, SOCK_IN, "Size"); + blender::bke::node_set_socket_availability( + ntree, size_input, ELEM(glare_type, CMP_NODE_GLARE_FOG_GLOW, CMP_NODE_GLARE_BLOOM)); + + bNodeSocket *iterations_input = bke::node_find_socket(node, SOCK_IN, "Iterations"); + blender::bke::node_set_socket_availability( + ntree, + iterations_input, + ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS)); + + bNodeSocket *fade_input = bke::node_find_socket(node, SOCK_IN, "Fade"); + blender::bke::node_set_socket_availability( + ntree, fade_input, ELEM(glare_type, CMP_NODE_GLARE_SIMPLE_STAR, CMP_NODE_GLARE_STREAKS)); + + bNodeSocket *color_modulation_input = bke::node_find_socket(node, SOCK_IN, "Color Modulation"); + blender::bke::node_set_socket_availability( + ntree, + color_modulation_input, + ELEM(glare_type, CMP_NODE_GLARE_GHOST, CMP_NODE_GLARE_STREAKS)); + + bNodeSocket *streaks_input = bke::node_find_socket(node, SOCK_IN, "Streaks"); + blender::bke::node_set_socket_availability( + ntree, streaks_input, glare_type == CMP_NODE_GLARE_STREAKS); + + bNodeSocket *streaks_angle_input = bke::node_find_socket(node, SOCK_IN, "Streaks Angle"); + blender::bke::node_set_socket_availability( + ntree, streaks_angle_input, glare_type == CMP_NODE_GLARE_STREAKS); } using namespace blender::compositor; @@ -136,57 +198,54 @@ class GlareOperation : public NodeOperation { void execute() override { - if (is_identity()) { - get_input("Image").pass_through(get_result("Image")); + Result &image_input = this->get_input("Image"); + Result &image_output = this->get_result("Image"); + Result &glare_output = this->get_result("Glare"); + Result &highlights_output = this->get_result("Highlights"); + + if (image_input.is_single_value()) { + if (image_output.should_compute()) { + image_input.pass_through(image_output); + } + if (glare_output.should_compute()) { + glare_output.allocate_invalid(); + } + if (highlights_output.should_compute()) { + highlights_output.allocate_invalid(); + } return; } - Result highlights_result = execute_highlights(); - Result glare_result = execute_glare(highlights_result); - highlights_result.release(); - execute_mix(glare_result); - glare_result.release(); - } + Result highlights = this->compute_highlights(); + Result glare = this->compute_glare(highlights); - bool is_identity() - { - if (get_input("Image").is_single_value()) { - return true; + if (highlights_output.should_compute()) { + if (highlights.domain().size != image_input.domain().size) { + /* The highlights were computed on a fraction of the image size, see the get_quality_factor + * method. So we need to upsample them while writing as opposed to just stealing the + * existing data. */ + this->write_highlights_output(highlights); + } + else { + highlights_output.steal_data(highlights); + } } + highlights.release(); - /* A mix factor of -1 indicates that the original image is returned as is. See the execute_mix - * method for more information. */ - if (node_storage(bnode()).mix == -1.0f) { - return true; - } + /* Combine the original input and the generated glare. */ + execute_mix(glare); - return false; - } - - Result execute_glare(Result &highlights_result) - { - switch (node_storage(bnode()).type) { - case CMP_NODE_GLARE_SIMPLE_STAR: - return execute_simple_star(highlights_result); - case CMP_NODE_GLARE_FOG_GLOW: - return execute_fog_glow(highlights_result); - case CMP_NODE_GLARE_STREAKS: - return execute_streaks(highlights_result); - case CMP_NODE_GLARE_GHOST: - return execute_ghost(highlights_result); - case CMP_NODE_GLARE_BLOOM: - return execute_bloom(highlights_result); - default: - BLI_assert_unreachable(); - return context().create_result(ResultType::Color); + if (glare_output.should_compute()) { + this->write_glare_output(glare); } + glare.release(); } /* ----------------- * Glare Highlights. * ----------------- */ - Result execute_highlights() + Result compute_highlights() { if (this->context().use_gpu()) { return this->execute_highlights_gpu(); @@ -199,18 +258,18 @@ class GlareOperation : public NodeOperation { GPUShader *shader = context().get_shader("compositor_glare_highlights"); GPU_shader_bind(shader); - GPU_shader_uniform_1f(shader, "threshold", node_storage(bnode()).threshold); + GPU_shader_uniform_1f(shader, "threshold", this->get_threshold()); const Result &input_image = get_input("Image"); GPU_texture_filter_mode(input_image, true); input_image.bind_as_texture(shader, "input_tx"); - const int2 glare_size = get_glare_size(); + const int2 highlights_size = get_highlights_size(); Result highlights_result = context().create_result(ResultType::Color); - highlights_result.allocate_texture(glare_size); + highlights_result.allocate_texture(highlights_size); highlights_result.bind_as_image(shader, "output_img"); - compute_dispatch_threads_at_least(shader, glare_size); + compute_dispatch_threads_at_least(shader, highlights_size); GPU_shader_unbind(); input_image.unbind_as_texture(); @@ -221,21 +280,21 @@ class GlareOperation : public NodeOperation { Result execute_highlights_cpu() { - const float threshold = node_storage(bnode()).threshold; + const float threshold = this->get_threshold(); const Result &input = get_input("Image"); - const int2 glare_size = this->get_glare_size(); + const int2 highlights_size = this->get_highlights_size(); Result output = context().create_result(ResultType::Color); - output.allocate_texture(glare_size); + output.allocate_texture(highlights_size); /* The dispatch domain covers the output image size, which might be a fraction of the input * image size, so you will notice the glare size used throughout the code instead of the input * one. */ - parallel_for(glare_size, [&](const int2 texel) { + parallel_for(highlights_size, [&](const int2 texel) { /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image * size to get the coordinates into the sampler's expected [0, 1] range. */ - float2 normalized_coordinates = (float2(texel) + float2(0.5f)) / float2(glare_size); + float2 normalized_coordinates = (float2(texel) + float2(0.5f)) / float2(highlights_size); float4 hsva; rgb_to_hsv_v(input.sample_bilinear_extended(normalized_coordinates), hsva); @@ -254,6 +313,95 @@ class GlareOperation : public NodeOperation { return output; } + /* As a performance optimization, the operation can compute the glare on a fraction of the input + * image size, so we extract the highlights to a smaller result, whose size is returned by this + * method. */ + int2 get_highlights_size() + { + return this->compute_domain().size / this->get_quality_factor(); + } + + /* Writes the given input highlights by upsampling it using bilinear interpolation to match the + * size of the original input, allocating the highlights output and writing the result to it. */ + void write_highlights_output(const Result &highlights) + { + if (this->context().use_gpu()) { + this->write_highlights_output_gpu(highlights); + } + else { + this->write_highlights_output_cpu(highlights); + } + } + + void write_highlights_output_gpu(const Result &highlights) + { + GPUShader *shader = this->context().get_shader("compositor_glare_write_highlights_output"); + GPU_shader_bind(shader); + + GPU_texture_filter_mode(highlights, true); + GPU_texture_extend_mode(highlights, GPU_SAMPLER_EXTEND_MODE_EXTEND); + highlights.bind_as_texture(shader, "input_tx"); + + const Result &image_input = this->get_input("Image"); + Result &output = this->get_result("Highlights"); + output.allocate_texture(image_input.domain()); + output.bind_as_image(shader, "output_img"); + + compute_dispatch_threads_at_least(shader, output.domain().size); + + GPU_shader_unbind(); + output.unbind_as_image(); + highlights.unbind_as_texture(); + } + + void write_highlights_output_cpu(const Result &highlights) + { + const Result &image_input = this->get_input("Image"); + Result &output = this->get_result("Highlights"); + output.allocate_texture(image_input.domain()); + + const int2 size = output.domain().size; + parallel_for(size, [&](const int2 texel) { + float2 normalized_coordinates = (float2(texel) + float2(0.5f)) / float2(size); + output.store_pixel(texel, highlights.sample_bilinear_extended(normalized_coordinates)); + }); + } + + /* ------ + * Glare. + * ------ */ + + Result compute_glare(Result &highlights_result) + { + if (!this->should_compute_glare()) { + return this->context().create_result(ResultType::Color); + } + + switch (node_storage(bnode()).type) { + case CMP_NODE_GLARE_SIMPLE_STAR: + return this->execute_simple_star(highlights_result); + case CMP_NODE_GLARE_FOG_GLOW: + return this->execute_fog_glow(highlights_result); + case CMP_NODE_GLARE_STREAKS: + return this->execute_streaks(highlights_result); + case CMP_NODE_GLARE_GHOST: + return this->execute_ghost(highlights_result); + case CMP_NODE_GLARE_BLOOM: + return this->execute_bloom(highlights_result); + default: + BLI_assert_unreachable(); + return this->context().create_result(ResultType::Color); + } + } + + /* Glare should be computed either because the glare output is needed directly or the image + * output is needed. */ + bool should_compute_glare() + { + return this->get_result("Glare").should_compute() || + this->get_result("Image").should_compute(); + } + /* ------------------ * Simple Star Glare. * ------------------ */ @@ -289,7 +437,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result vertical_pass_result = context().create_result(ResultType::Color); vertical_pass_result.allocate_texture(size); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); @@ -299,7 +447,7 @@ class GlareOperation : public NodeOperation { GPU_shader_bind(shader); GPU_shader_uniform_1i(shader, "iterations", get_number_of_iterations()); - GPU_shader_uniform_1f(shader, "fade_factor", node_storage(bnode()).fade); + GPU_shader_uniform_1f(shader, "fade_factor", this->get_fade()); horizontal_pass_result.bind_as_texture(shader, "horizontal_tx"); @@ -321,7 +469,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result output = this->context().create_result(ResultType::Color); output.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -329,7 +477,7 @@ class GlareOperation : public NodeOperation { }); const int iterations = this->get_number_of_iterations(); - const float fade_factor = node_storage(this->bnode()).fade; + const float fade_factor = this->get_fade(); /* Dispatch a thread for each column in the image. */ const int width = size.x; @@ -378,7 +526,8 @@ class GlareOperation : public NodeOperation { int2 texel = int2(x, y); float4 horizontal = horizontal_pass_result.load_pixel(texel); float4 vertical = output.load_pixel(texel); - output.store_pixel(texel, horizontal + vertical); + float4 combined = horizontal + vertical; + output.store_pixel(texel, float4(combined.xyz(), 1.0f)); } } }); @@ -398,7 +547,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result horizontal_pass_result = context().create_result(ResultType::Color); horizontal_pass_result.allocate_texture(size); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); @@ -408,7 +557,7 @@ class GlareOperation : public NodeOperation { GPU_shader_bind(shader); GPU_shader_uniform_1i(shader, "iterations", get_number_of_iterations()); - GPU_shader_uniform_1f(shader, "fade_factor", node_storage(bnode()).fade); + GPU_shader_uniform_1f(shader, "fade_factor", this->get_fade()); horizontal_pass_result.bind_as_image(shader, "horizontal_img"); @@ -425,7 +574,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result horizontal_pass_result = context().create_result(ResultType::Color); horizontal_pass_result.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -433,7 +582,7 @@ class GlareOperation : public NodeOperation { }); const int iterations = this->get_number_of_iterations(); - const float fade_factor = node_storage(this->bnode()).fade; + const float fade_factor = this->get_fade(); /* Dispatch a thread for each row in the image. */ const int width = size.x; @@ -504,9 +653,9 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 glare_size = get_glare_size(); + const int2 size = highlights.domain().size; Result anti_diagonal_pass_result = context().create_result(ResultType::Color); - anti_diagonal_pass_result.allocate_texture(glare_size); + anti_diagonal_pass_result.allocate_texture(size); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); GPU_texture_copy(anti_diagonal_pass_result, highlights); @@ -514,14 +663,14 @@ class GlareOperation : public NodeOperation { GPU_shader_bind(shader); GPU_shader_uniform_1i(shader, "iterations", get_number_of_iterations()); - GPU_shader_uniform_1f(shader, "fade_factor", node_storage(bnode()).fade); + GPU_shader_uniform_1f(shader, "fade_factor", this->get_fade()); diagonal_pass_result.bind_as_texture(shader, "diagonal_tx"); anti_diagonal_pass_result.bind_as_image(shader, "anti_diagonal_img"); /* Dispatch a thread for each diagonal in the image. */ - compute_dispatch_threads_at_least(shader, int2(compute_number_of_diagonals(glare_size), 1)); + compute_dispatch_threads_at_least(shader, int2(compute_number_of_diagonals(size), 1)); diagonal_pass_result.unbind_as_texture(); anti_diagonal_pass_result.unbind_as_image(); @@ -535,7 +684,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result output = this->context().create_result(ResultType::Color); output.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -543,7 +692,7 @@ class GlareOperation : public NodeOperation { }); const int iterations = this->get_number_of_iterations(); - const float fade_factor = node_storage(this->bnode()).fade; + const float fade_factor = this->get_fade(); /* Dispatch a thread for each diagonal in the image. */ const int diagonals_count = compute_number_of_diagonals(size); @@ -595,7 +744,8 @@ class GlareOperation : public NodeOperation { int2 texel = start + j * direction; float4 horizontal = diagonal_pass_result.load_pixel(texel); float4 vertical = output.load_pixel(texel); - output.store_pixel(texel, horizontal + vertical); + float4 combined = horizontal + vertical; + output.store_pixel(texel, float4(combined.xyz(), 1.0f)); } } }); @@ -615,9 +765,9 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 glare_size = get_glare_size(); + const int2 size = highlights.domain().size; Result diagonal_pass_result = context().create_result(ResultType::Color); - diagonal_pass_result.allocate_texture(glare_size); + diagonal_pass_result.allocate_texture(size); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); GPU_texture_copy(diagonal_pass_result, highlights); @@ -625,12 +775,12 @@ class GlareOperation : public NodeOperation { GPU_shader_bind(shader); GPU_shader_uniform_1i(shader, "iterations", get_number_of_iterations()); - GPU_shader_uniform_1f(shader, "fade_factor", node_storage(bnode()).fade); + GPU_shader_uniform_1f(shader, "fade_factor", this->get_fade()); diagonal_pass_result.bind_as_image(shader, "diagonal_img"); /* Dispatch a thread for each diagonal in the image. */ - compute_dispatch_threads_at_least(shader, int2(compute_number_of_diagonals(glare_size), 1)); + compute_dispatch_threads_at_least(shader, int2(compute_number_of_diagonals(size), 1)); diagonal_pass_result.unbind_as_image(); GPU_shader_unbind(); @@ -642,7 +792,7 @@ class GlareOperation : public NodeOperation { { /* First, copy the highlights result to the output since we will be doing the computation * in-place. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result diagonal_pass_result = this->context().create_result(ResultType::Color); diagonal_pass_result.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -650,7 +800,7 @@ class GlareOperation : public NodeOperation { }); const int iterations = this->get_number_of_iterations(); - const float fade_factor = node_storage(this->bnode()).fade; + const float fade_factor = this->get_fade(); /* Dispatch a thread for each diagonal in the image. */ const int diagonals_count = compute_number_of_diagonals(size); @@ -712,7 +862,7 @@ class GlareOperation : public NodeOperation { Result execute_streaks(const Result &highlights) { /* Create an initially zero image where streaks will be accumulated. */ - const int2 size = get_glare_size(); + const int2 size = highlights.domain().size; Result accumulated_streaks_result = context().create_result(ResultType::Color); accumulated_streaks_result.allocate_texture(size); if (this->context().use_gpu()) { @@ -752,14 +902,14 @@ class GlareOperation : public NodeOperation { /* Copy the highlights result into a new result because the output will be copied to the input * after each iteration. */ - const int2 glare_size = get_glare_size(); + const int2 size = highlights.domain().size; Result input_streak_result = context().create_result(ResultType::Color); - input_streak_result.allocate_texture(glare_size); + input_streak_result.allocate_texture(size); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); GPU_texture_copy(input_streak_result, highlights); Result output_streak_result = context().create_result(ResultType::Color); - output_streak_result.allocate_texture(glare_size); + output_streak_result.allocate_texture(size); /* For the given number of iterations, apply the streak filter in the given direction. The * result of the previous iteration is used as the input of the current iteration. */ @@ -780,7 +930,7 @@ class GlareOperation : public NodeOperation { output_streak_result.bind_as_image(shader, "output_streak_img"); - compute_dispatch_threads_at_least(shader, glare_size); + compute_dispatch_threads_at_least(shader, size); input_streak_result.unbind_as_texture(); output_streak_result.unbind_as_image(); @@ -804,7 +954,7 @@ class GlareOperation : public NodeOperation { { /* Copy the highlights result into a new result because the output will be copied to the input * after each iteration. */ - const int2 size = this->get_glare_size(); + const int2 size = highlights.domain().size; Result input = this->context().create_result(ResultType::Color); input.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -894,8 +1044,7 @@ class GlareOperation : public NodeOperation { streak_result.bind_as_texture(shader, "streak_tx"); accumulated_streaks_result.bind_as_image(shader, "accumulated_streaks_img", true); - const int2 glare_size = get_glare_size(); - compute_dispatch_threads_at_least(shader, glare_size); + compute_dispatch_threads_at_least(shader, streak_result.domain().size); streak_result.unbind_as_texture(); accumulated_streaks_result.unbind_as_image(); @@ -906,11 +1055,12 @@ class GlareOperation : public NodeOperation { { const float attenuation_factor = this->compute_streak_attenuation_factor(); - const int2 size = get_glare_size(); + const int2 size = streak.domain().size; parallel_for(size, [&](const int2 texel) { float4 attenuated_streak = streak.load_pixel(texel) * attenuation_factor; float4 current_accumulated_streaks = accumulated_streaks.load_pixel(texel); - accumulated_streaks.store_pixel(texel, current_accumulated_streaks + attenuated_streak); + float4 combined_streaks = current_accumulated_streaks + attenuated_streak; + accumulated_streaks.store_pixel(texel, float4(combined_streaks.xyz(), 1.0f)); }); } @@ -932,7 +1082,7 @@ class GlareOperation : public NodeOperation { float2 compute_streak_direction(int streak_index) { const int number_of_streaks = get_number_of_streaks(); - const float start_angle = get_streaks_start_angle(); + const float start_angle = this->get_streaks_angle(); const float angle = start_angle + (float(streak_index) / number_of_streaks) * (M_PI * 2.0f); return float2(math::cos(angle), math::sin(angle)); } @@ -948,7 +1098,7 @@ class GlareOperation : public NodeOperation { * one makes sure the power starts at one. */ float compute_streak_color_modulator(int iteration) { - return 1.0f - std::pow(get_color_modulation_factor(), iteration + 1); + return 1.0f - std::pow(this->get_color_modulation(), iteration + 1); } /* Streaks are computed by iteratively applying a filter that samples 3 neighboring pixels in the @@ -964,7 +1114,7 @@ class GlareOperation : public NodeOperation { * fade factors for those farther neighbors. */ float3 compute_streak_fade_factors(float iteration_magnitude) { - const float fade_factor = std::pow(node_storage(bnode()).fade, iteration_magnitude); + const float fade_factor = std::pow(this->get_fade(), iteration_magnitude); return float3(fade_factor, std::pow(fade_factor, 2.0f), std::pow(fade_factor, 3.0f)); } @@ -979,14 +1129,14 @@ class GlareOperation : public NodeOperation { return std::pow(4.0f, iteration); } - float get_streaks_start_angle() + int get_number_of_streaks() { - return node_storage(bnode()).angle_ofs; + return math::clamp(this->get_input("Streaks").get_single_value_default(4), 1, 16); } - int get_number_of_streaks() + float get_streaks_angle() { - return node_storage(bnode()).streaks; + return this->get_input("Streaks Angle").get_single_value_default(0.0f); } /* ------------ @@ -1022,14 +1172,14 @@ class GlareOperation : public NodeOperation { /* Zero initialize output image where ghosts will be accumulated. */ const float4 zero_color = float4(0.0f); - const int2 glare_size = get_glare_size(); - accumulated_ghosts_result.allocate_texture(glare_size); + const int2 size = base_ghost_result.domain().size; + accumulated_ghosts_result.allocate_texture(size); GPU_texture_clear(accumulated_ghosts_result, GPU_DATA_FLOAT, zero_color); /* Copy the highlights result into a new result because the output will be copied to the input * after each iteration. */ Result input_ghost_result = context().create_result(ResultType::Color); - input_ghost_result.allocate_texture(glare_size); + input_ghost_result.allocate_texture(size); GPU_texture_copy(input_ghost_result, base_ghost_result); /* For the given number of iterations, accumulate four ghosts with different scales and color @@ -1044,7 +1194,7 @@ class GlareOperation : public NodeOperation { input_ghost_result.bind_as_texture(shader, "input_ghost_tx"); accumulated_ghosts_result.bind_as_image(shader, "accumulated_ghost_img", true); - compute_dispatch_threads_at_least(shader, glare_size); + compute_dispatch_threads_at_least(shader, size); input_ghost_result.unbind_as_texture(); accumulated_ghosts_result.unbind_as_image(); @@ -1068,7 +1218,7 @@ class GlareOperation : public NodeOperation { std::array color_modulators = this->compute_ghost_color_modulators(); /* Zero initialize output image where ghosts will be accumulated. */ - const int2 size = get_glare_size(); + const int2 size = base_ghost.domain().size; accumulated_ghosts_result.allocate_texture(size); parallel_for(size, [&](const int2 texel) { accumulated_ghosts_result.store_pixel(texel, float4(0.0f)); @@ -1119,8 +1269,8 @@ class GlareOperation : public NodeOperation { } float4 current_accumulated_ghost = accumulated_ghosts_result.load_pixel(texel); - accumulated_ghosts_result.store_pixel(texel, - current_accumulated_ghost + accumulated_ghost); + float4 combined_ghost = current_accumulated_ghost + accumulated_ghost; + accumulated_ghosts_result.store_pixel(texel, float4(combined_ghost.xyz(), 1.0f)); }); /* The accumulated result serves as the input for the next iteration, so copy the result to @@ -1186,11 +1336,10 @@ class GlareOperation : public NodeOperation { GPU_texture_extend_mode(big_ghost_result, GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER); big_ghost_result.bind_as_texture(shader, "big_ghost_tx"); - const int2 glare_size = get_glare_size(); - base_ghost_result.allocate_texture(glare_size); + base_ghost_result.allocate_texture(small_ghost_result.domain()); base_ghost_result.bind_as_image(shader, "combined_ghost_img"); - compute_dispatch_threads_at_least(shader, glare_size); + compute_dispatch_threads_at_least(shader, base_ghost_result.domain().size); GPU_shader_unbind(); small_ghost_result.unbind_as_texture(); @@ -1202,7 +1351,7 @@ class GlareOperation : public NodeOperation { const Result &big_ghost_result, Result &combined_ghost) { - const int2 size = get_glare_size(); + const int2 size = small_ghost_result.domain().size; combined_ghost.allocate_texture(size); parallel_for(size, [&](const int2 texel) { @@ -1320,7 +1469,7 @@ class GlareOperation : public NodeOperation { * subtract from one. */ float get_ghost_color_modulation_factor() { - return 1.0f - get_color_modulation_factor(); + return 1.0f - this->get_color_modulation(); } /* ------------ @@ -1357,11 +1506,10 @@ class GlareOperation : public NodeOperation { * smaller dimension of the size of the highlights. * * However, as users might want a smaller glare size, we reduce the chain length by the - * halving count supplied by the user. */ - const int2 glare_size = get_glare_size(); - const int smaller_glare_dimension = math::min(glare_size.x, glare_size.y); - const int chain_length = int(std::log2(smaller_glare_dimension)) - - compute_bloom_size_halving_count(); + * size supplied by the user. Also make sure that log2 does not get zero. */ + const int smaller_dimension = math::reduce_min(highlights.domain().size); + const float scaled_dimension = smaller_dimension * this->get_size(); + const int chain_length = int(std::log2(math::max(1.0f, scaled_dimension))); /* If the chain length is less than 2, that means no down-sampling will happen, so we just * return a copy of the highlights. This is a sanitization of a corner case, so no need to @@ -1460,7 +1608,8 @@ class GlareOperation : public NodeOperation { upsampled += (1.0f / 16.0f) * input.sample_bilinear_extended(coordinates + pixel_size * float2(1.0f, 1.0f)); - output.store_pixel(texel, output.load_pixel(texel) + upsampled); + float4 combined = output.load_pixel(texel) + upsampled; + output.store_pixel(texel, float4(combined.xyz(), 1.0f)); }); } @@ -1660,21 +1809,6 @@ class GlareOperation : public NodeOperation { math::safe_rcp(math::reduce_add(weights)); } - /* The bloom has a maximum possible size when the bloom size is equal to MAX_GLARE_SIZE and - * halves for every unit decrement of the bloom size. This method computes the number of halving - * that should take place, which is simply the difference to MAX_GLARE_SIZE. */ - int compute_bloom_size_halving_count() - { - return MAX_GLARE_SIZE - get_bloom_size(); - } - - /* The size of the bloom relative to its maximum possible size, see the - * compute_bloom_size_halving_count() method for more information. */ - int get_bloom_size() - { - return node_storage(bnode()).size; - } - /* --------------- * Fog Glow Glare. * --------------- */ @@ -1684,7 +1818,7 @@ class GlareOperation : public NodeOperation { #if defined(WITH_FFTW3) fftw::initialize_float(); - const int kernel_size = compute_fog_glow_kernel_size(); + const int kernel_size = compute_fog_glow_kernel_size(highlights); /* Since we will be doing a circular convolution, we need to zero pad our input image by half * the kernel size to avoid the kernel affecting the pixels at the other side of image. @@ -1850,11 +1984,21 @@ class GlareOperation : public NodeOperation { /* Computes the size of the fog glow kernel that will be convolved with the image, which is * essentially the extent of the glare in pixels. */ - int compute_fog_glow_kernel_size() + int compute_fog_glow_kernel_size(const Result &highlights) { - /* We use an odd sized kernel since an even one will typically introduce a tiny offset as it - * has no exact center value. */ - return (1 << node_storage(bnode()).size) + 1; + /* The input size is relative to the larger dimension of the image. */ + const int size = int(math::reduce_max(highlights.domain().size) * this->get_size()); + + /* Make sure size is at least 3 pixels for implicitly since code deals with half kernel sizes + * which will be zero if less than 3, causing zero division. */ + const int safe_size = math::max(3, size); + + /* Make sure the kernel size is odd since an even one will typically introduce a tiny offset as + * it has no exact center value. */ + const bool is_even = safe_size % 2 == 0; + const int odd_size = safe_size + (is_even ? 1 : 0); + + return odd_size; } /* ---------- @@ -1863,6 +2007,11 @@ class GlareOperation : public NodeOperation { void execute_mix(const Result &glare_result) { + Result &image_output = this->get_result("Image"); + if (!image_output.should_compute()) { + return; + } + if (this->context().use_gpu()) { this->execute_mix_gpu(glare_result); } @@ -1876,7 +2025,8 @@ class GlareOperation : public NodeOperation { GPUShader *shader = context().get_shader("compositor_glare_mix"); GPU_shader_bind(shader); - GPU_shader_uniform_1f(shader, "mix_factor", node_storage(bnode()).mix); + GPU_shader_uniform_1f(shader, "saturation", this->get_saturation()); + GPU_shader_uniform_3fv(shader, "tint", this->get_tint()); const Result &input_image = get_input("Image"); input_image.bind_as_texture(shader, "input_tx"); @@ -1899,7 +2049,8 @@ class GlareOperation : public NodeOperation { void execute_mix_cpu(const Result &glare_result) { - const float mix_factor = node_storage(bnode()).mix; + const float saturation = this->get_saturation(); + const float3 tint = this->get_tint(); const Result &input = get_input("Image"); @@ -1908,26 +2059,85 @@ class GlareOperation : public NodeOperation { output.allocate_texture(domain); parallel_for(domain.size, [&](const int2 texel) { - /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the input - * image size to get the relevant coordinates into the sampler's expected [0, 1] range. - * Make sure the input color is not negative to avoid a subtractive effect when mixing the - * glare. - */ + /* Make sure the input is not negative to avoid a subtractive effect when adding the glare.*/ + float4 input_color = math::max(float4(0.0f), input.load_pixel(texel)); + float2 normalized_coordinates = (float2(texel) + float2(0.5f)) / float2(input.domain().size); float4 glare_color = glare_result.sample_bilinear_extended(normalized_coordinates); - float4 input_color = math::max(float4(0.0f), input.load_pixel(texel)); - /* The mix factor is in the range [-1, 1] and linearly interpolate between the three values - * such that: 1 => Glare only. 0 => Input + Glare. -1 => Input only. We implement that as a - * weighted sum as follows. When the mix factor is 1, the glare weight should be 1 and the - * input weight should be 0. When the mix factor is -1, the glare weight should be 0 and - * the input weight should be 1. When the mix factor is 0, both weights should be 1. This - * can be expressed using the following compact min max expressions. */ - float input_weight = 1.0f - math::max(0.0f, mix_factor); - float glare_weight = 1.0f + math::min(0.0f, mix_factor); - float3 highlights = input_weight * input_color.xyz() + glare_weight * glare_color.xyz(); - - output.store_pixel(texel, float4(highlights, input_color.w)); + /* Adjust saturation of glare. */ + float4 glare_hsva; + rgb_to_hsv_v(glare_color, glare_hsva); + glare_hsva.y = math::clamp(glare_hsva.y * saturation, 0.0f, 1.0f); + float4 glare_rgba; + hsv_to_rgb_v(glare_hsva, glare_rgba); + + float3 combined_color = input_color.xyz() + glare_rgba.xyz() * tint; + + output.store_pixel(texel, float4(combined_color, input_color.w)); + }); + } + + /* Writes the given input glare by adjusting it as needed and upsampling it using bilinear + * interpolation to match the size of the original input, allocating the glare output and writing + * the result to it. */ + void write_glare_output(const Result &glare) + { + if (this->context().use_gpu()) { + this->write_glare_output_gpu(glare); + } + else { + this->write_glare_output_cpu(glare); + } + } + + void write_glare_output_gpu(const Result &glare) + { + GPUShader *shader = this->context().get_shader("compositor_glare_write_glare_output"); + GPU_shader_bind(shader); + + GPU_shader_uniform_1f(shader, "saturation", this->get_saturation()); + GPU_shader_uniform_3fv(shader, "tint", this->get_tint()); + + GPU_texture_filter_mode(glare, true); + GPU_texture_extend_mode(glare, GPU_SAMPLER_EXTEND_MODE_EXTEND); + glare.bind_as_texture(shader, "input_tx"); + + const Result &image_input = this->get_input("Image"); + Result &output = this->get_result("Glare"); + output.allocate_texture(image_input.domain()); + output.bind_as_image(shader, "output_img"); + + compute_dispatch_threads_at_least(shader, output.domain().size); + + GPU_shader_unbind(); + output.unbind_as_image(); + glare.unbind_as_texture(); + } + + void write_glare_output_cpu(const Result &glare) + { + const float saturation = this->get_saturation(); + const float3 tint = this->get_tint(); + + const Result &image_input = this->get_input("Image"); + Result &output = this->get_result("Glare"); + output.allocate_texture(image_input.domain()); + + const int2 size = output.domain().size; + parallel_for(size, [&](const int2 texel) { + float2 normalized_coordinates = (float2(texel) + float2(0.5f)) / float2(size); + float4 glare_color = glare.sample_bilinear_extended(normalized_coordinates); + + /* Adjust saturation of glare. */ + float4 glare_hsva; + rgb_to_hsv_v(glare_color, glare_hsva); + glare_hsva.y = math::clamp(glare_hsva.y * saturation, 0.0f, 1.0f); + float4 glare_rgba; + hsv_to_rgb_v(glare_hsva, glare_rgba); + + float3 adjusted_glare_value = glare_rgba.xyz() * tint; + output.store_pixel(texel, float4(adjusted_glare_value, 1.0f)); }); } @@ -1935,21 +2145,46 @@ class GlareOperation : public NodeOperation { * Common. * ------- */ - /* As a performance optimization, the operation can compute the glare on a fraction of the input - * image size, which is what this method returns. */ - int2 get_glare_size() + float get_threshold() + { + return math::max(0.0f, this->get_input("Threshold").get_single_value_default(1.0f)); + } + + float get_strength() + { + return math::max(0.0f, this->get_input("Strength").get_single_value_default(1.0f)); + } + + float get_saturation() { - return compute_domain().size / get_quality_factor(); + return math::max(0.0f, this->get_input("Saturation").get_single_value_default(1.0f)); + } + + float3 get_tint() + { + return this->get_input("Tint").get_single_value_default(float4(1.0f)).xyz() * + this->get_strength(); + } + + float get_size() + { + return math::clamp(this->get_input("Size").get_single_value_default(0.5f), 0.0f, 1.0f); } int get_number_of_iterations() { - return node_storage(bnode()).iter; + return math::clamp(this->get_input("Iterations").get_single_value_default(3), 2, 5); + } + + float get_fade() + { + return math::clamp(this->get_input("Fade").get_single_value_default(0.9f), 0.75f, 1.0f); } - float get_color_modulation_factor() + float get_color_modulation() { - return node_storage(bnode()).colmod; + return math::clamp( + this->get_input("Color Modulation").get_single_value_default(0.25f), 0.0f, 1.0f); } /* The glare node can compute the glare on a fraction of the input image size to improve @@ -1982,9 +2217,12 @@ void register_node_type_cmp_glare() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_GLARE, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Glare "; + ntype.ui_description = "Add lens flares, fog and glows around bright parts of the image"; ntype.enum_name_legacy = "GLARE"; ntype.declare = file_ns::cmp_node_glare_declare; + ntype.updatefunc = file_ns::node_update; ntype.draw_buttons = file_ns::node_composit_buts_glare; ntype.initfunc = file_ns::node_composit_init_glare; blender::bke::node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc b/source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc index fd38655679a1..17369b3bf388 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc +++ b/source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc @@ -112,7 +112,9 @@ void register_node_type_cmp_hue_sat() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue/Saturation/Value", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Hue/Saturation/Value"; + ntype.ui_description = "Apply a color transformation in the HSV color model"; ntype.enum_name_legacy = "HUE_SAT"; ntype.declare = file_ns::cmp_node_huesatval_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc index 266951eef142..a109bfeba859 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.cc @@ -155,7 +155,9 @@ void register_node_type_cmp_huecorrect() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_HUECORRECT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Hue Correct"; + ntype.ui_description = "Adjust hue, saturation, and value with a curve"; ntype.enum_name_legacy = "HUECORRECT"; ntype.declare = file_ns::cmp_node_huecorrect_declare; blender::bke::node_type_size(&ntype, 320, 140, 500); diff --git a/source/blender/nodes/composite/nodes/node_composite_id_mask.cc b/source/blender/nodes/composite/nodes/node_composite_id_mask.cc index 895bb04e0803..0c86ed29e957 100644 --- a/source/blender/nodes/composite/nodes/node_composite_id_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_id_mask.cc @@ -143,7 +143,9 @@ void register_node_type_cmp_idmask() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, NODE_CLASS_CONVERTER); + ntype.ui_name = "ID Mask"; + ntype.ui_description = "Create a matte from an object or material index pass"; ntype.enum_name_legacy = "ID_MASK"; ntype.declare = file_ns::cmp_node_idmask_declare; ntype.draw_buttons = file_ns::node_composit_buts_id_mask; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index f68068ba92fb..2bc41202915e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -509,7 +509,9 @@ void register_node_type_cmp_image() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_IMAGE, NODE_CLASS_INPUT); + ntype.ui_name = "Image"; + ntype.ui_description = "Input image or movie file"; ntype.enum_name_legacy = "IMAGE"; ntype.initfunc = file_ns::node_composit_init_image; blender::bke::node_type_storage( @@ -819,7 +821,9 @@ void register_node_type_cmp_rlayers() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, NODE_CLASS_INPUT); + ntype.ui_name = "Render Layers"; + ntype.ui_description = "Input render passes from a scene render"; ntype.enum_name_legacy = "R_LAYERS"; blender::bke::node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); ntype.draw_buttons = file_ns::node_composit_buts_viewlayers; diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc index f5e6fea1dd34..9bc89592c48a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc @@ -364,7 +364,9 @@ void register_node_type_cmp_inpaint() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_INPAINT, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Inpaint"; + ntype.ui_description = "Extend borders of an image into transparent or masked regions"; ntype.enum_name_legacy = "INPAINT"; ntype.declare = file_ns::cmp_node_inpaint_declare; ntype.draw_buttons = file_ns::node_composit_buts_inpaint; diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc index e5822133f52c..f56910a02d85 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.cc +++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc @@ -160,7 +160,9 @@ void register_node_type_cmp_invert() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert Color", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_INVERT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Invert Color"; + ntype.ui_description = "Invert colors, producing a negative"; ntype.enum_name_legacy = "INVERT"; ntype.declare = file_ns::cmp_node_invert_declare; ntype.draw_buttons = file_ns::node_composit_buts_invert; diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index 2803a22d5e90..5b8af8d21797 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -681,7 +681,11 @@ void register_node_type_cmp_keying() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_KEYING, NODE_CLASS_MATTE); + ntype.ui_name = "Keying"; + ntype.ui_description = + "Perform both chroma keying (to remove the backdrop) and despill (to correct color cast " + "from the backdrop)"; ntype.enum_name_legacy = "KEYING"; ntype.declare = file_ns::cmp_node_keying_declare; ntype.draw_buttons = file_ns::node_composit_buts_keying; diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc index 82fa92c205e5..b77e2c612018 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -169,7 +169,9 @@ void register_node_type_cmp_keyingscreen() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, NODE_CLASS_MATTE); + ntype.ui_name = "Keying Screen"; + ntype.ui_description = "Create plates for use as a color reference for keying nodes"; ntype.enum_name_legacy = "KEYINGSCREEN"; ntype.declare = file_ns::cmp_node_keyingscreen_declare; ntype.draw_buttons = file_ns::node_composit_buts_keyingscreen; diff --git a/source/blender/nodes/composite/nodes/node_composite_kuwahara.cc b/source/blender/nodes/composite/nodes/node_composite_kuwahara.cc index 8f1822b5e438..64813b4a673f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_kuwahara.cc +++ b/source/blender/nodes/composite/nodes/node_composite_kuwahara.cc @@ -785,7 +785,10 @@ void register_node_type_cmp_kuwahara() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_KUWAHARA, "Kuwahara", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_KUWAHARA, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Kuwahara"; + ntype.ui_description = + "Apply smoothing filter that preserves edges, for stylized and painterly effects"; ntype.enum_name_legacy = "KUWAHARA"; ntype.declare = file_ns::cmp_node_kuwahara_declare; ntype.draw_buttons = file_ns::node_composit_buts_kuwahara; diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index eb96cadd5f90..01ace833a4eb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -505,7 +505,9 @@ void register_node_type_cmp_lensdist() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, NODE_CLASS_DISTORT); + ntype.ui_name = "Lens Distortion"; + ntype.ui_description = "Simulate distortion and dispersion from camera lenses"; ntype.enum_name_legacy = "LENSDIST"; ntype.declare = file_ns::cmp_node_lensdist_declare; ntype.draw_buttons = file_ns::node_composit_buts_lensdist; diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc index 7505db8dcb18..d2273e39ac39 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.cc +++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc @@ -198,7 +198,9 @@ void register_node_type_cmp_view_levels() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT); + cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, NODE_CLASS_OUTPUT); + ntype.ui_name = "Levels"; + ntype.ui_description = "Compute average and standard deviation of pixel values"; ntype.enum_name_legacy = "LEVELS"; ntype.declare = file_ns::cmp_node_levels_declare; ntype.draw_buttons = file_ns::node_composit_buts_view_levels; 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 b619bc4a3e41..102205d5a197 100644 --- a/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc @@ -137,7 +137,9 @@ void register_node_type_cmp_luma_matte() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE); + cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, NODE_CLASS_MATTE); + ntype.ui_name = "Luminance Key"; + ntype.ui_description = "Create a matte based on luminance (brightness) difference"; ntype.enum_name_legacy = "LUMA_MATTE"; ntype.declare = file_ns::cmp_node_luma_matte_declare; ntype.draw_buttons = file_ns::node_composit_buts_luma_matte; diff --git a/source/blender/nodes/composite/nodes/node_composite_map_range.cc b/source/blender/nodes/composite/nodes/node_composite_map_range.cc index 4a75b0fb1034..f400d96749da 100644 --- a/source/blender/nodes/composite/nodes/node_composite_map_range.cc +++ b/source/blender/nodes/composite/nodes/node_composite_map_range.cc @@ -175,7 +175,9 @@ void register_node_type_cmp_map_range() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR); + cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Map Range"; + ntype.ui_description = "Map an input value range into a destination range"; ntype.enum_name_legacy = "MAP_RANGE"; ntype.declare = file_ns::cmp_node_map_range_declare; ntype.draw_buttons = file_ns::node_composit_buts_map_range; diff --git a/source/blender/nodes/composite/nodes/node_composite_map_uv.cc b/source/blender/nodes/composite/nodes/node_composite_map_uv.cc index 906fe0c8c1f1..505acefb624d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_map_uv.cc +++ b/source/blender/nodes/composite/nodes/node_composite_map_uv.cc @@ -301,7 +301,10 @@ void register_node_type_cmp_mapuv() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, NODE_CLASS_DISTORT); + ntype.ui_name = "Map UV"; + ntype.ui_description = + "Map a texture using UV coordinates, to apply a texture to objects in compositing"; ntype.enum_name_legacy = "MAP_UV"; ntype.declare = file_ns::cmp_node_map_uv_declare; ntype.draw_buttons = file_ns::node_composit_buts_map_uv; 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 f8ea86166e1f..c47cb6ef48c3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_map_value.cc +++ b/source/blender/nodes/composite/nodes/node_composite_map_value.cc @@ -195,7 +195,9 @@ void register_node_type_cmp_map_value() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR); + cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Map Value"; + ntype.ui_description = "Scale, offset and clamp values"; ntype.enum_name_legacy = "MAP_VALUE"; ntype.declare = file_ns::cmp_node_map_value_declare; ntype.draw_buttons = file_ns::node_composit_buts_map_value; diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc index c429e674198e..ec2b41e89678 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -177,7 +177,9 @@ void register_node_type_cmp_mask() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_MASK, NODE_CLASS_INPUT); + ntype.ui_name = "Mask"; + ntype.ui_description = "Input mask from a mask datablock, created in the image editor"; ntype.enum_name_legacy = "MASK"; ntype.declare = file_ns::cmp_node_mask_declare; ntype.draw_buttons = file_ns::node_composit_buts_mask; diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc index 0707184b06de..b5e957b58e0a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_math.cc +++ b/source/blender/nodes/composite/nodes/node_composite_math.cc @@ -125,7 +125,9 @@ void register_node_type_cmp_math() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_MATH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Math"; + ntype.ui_description = "Perform math operations"; ntype.enum_name_legacy = "MATH"; ntype.declare = file_ns::cmp_node_math_declare; ntype.labelfunc = node_math_label; diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc index 23e429e5914b..60ff9221020a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc @@ -244,7 +244,9 @@ void register_node_type_cmp_mix_rgb() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Mix"; + ntype.ui_description = "Blend two images together using various blending modes"; ntype.enum_name_legacy = "MIX_RGB"; ntype.flag |= NODE_PREVIEW; ntype.declare = file_ns::cmp_node_mixrgb_declare; diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index 2702b723df6b..33aab9f85d5c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -268,7 +268,10 @@ void register_node_type_cmp_movieclip() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, NODE_CLASS_INPUT); + ntype.ui_name = "Movie Clip"; + ntype.ui_description = + "Input image or movie from a movie clip datablock, typically used for motion tracking"; ntype.enum_name_legacy = "MOVIECLIP"; ntype.declare = file_ns::cmp_node_movieclip_declare; ntype.draw_buttons = file_ns::node_composit_buts_movieclip; diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc index acd497accf38..c76209e44bc8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc @@ -179,7 +179,10 @@ void register_node_type_cmp_moviedistortion() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, NODE_CLASS_DISTORT); + ntype.ui_name = "Movie Distortion"; + ntype.ui_description = + "Remove lens distortion from footage, using motion tracking camera lens settings"; ntype.enum_name_legacy = "MOVIEDISTORTION"; ntype.declare = file_ns::cmp_node_moviedistortion_declare; ntype.draw_buttons = file_ns::node_composit_buts_moviedistortion; diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.cc b/source/blender/nodes/composite/nodes/node_composite_normal.cc index d3343e8169ed..bb8fa0a41827 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normal.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normal.cc @@ -95,7 +95,9 @@ void register_node_type_cmp_normal() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); + cmp_node_type_base(&ntype, CMP_NODE_NORMAL, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Normal"; + ntype.ui_description = "Generate a normal vector and a dot product"; ntype.enum_name_legacy = "NORMAL"; ntype.declare = file_ns::cmp_node_normal_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.cc b/source/blender/nodes/composite/nodes/node_composite_normalize.cc index 0641aa10cce3..f08b19195a8a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.cc @@ -114,7 +114,10 @@ void register_node_type_cmp_normalize() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR); + cmp_node_type_base(&ntype, CMP_NODE_NORMALIZE, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Normalize"; + ntype.ui_description = + "Map values to 0 to 1 range, based on the minimum and maximum pixel values"; ntype.enum_name_legacy = "NORMALIZE"; ntype.declare = file_ns::cmp_node_normalize_declare; ntype.get_compositor_operation = file_ns::get_compositor_operation; diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc index a8498bfb7bd9..1a2d26ae6c7a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc @@ -132,7 +132,11 @@ void register_node_type_cmp_pixelate() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, "Pixelate", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_PIXELATE, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Pixelate"; + ntype.ui_description = + "Reduce detail in an image by making individual pixels more prominent, for a blocky or " + "mosaic-like appearance"; ntype.enum_name_legacy = "PIXELATE"; ntype.declare = file_ns::cmp_node_pixelate_declare; ntype.draw_buttons = file_ns::node_composit_buts_pixelate; diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc index b964d8f1c591..d8aa624be4e1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -435,7 +435,11 @@ void register_node_type_cmp_planetrackdeform() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_PLANETRACKDEFORM, NODE_CLASS_DISTORT); + ntype.ui_name = "Plane Track Deform"; + ntype.ui_description = + "Replace flat planes in footage by another image, detected by plane tracks from motion " + "tracking"; ntype.enum_name_legacy = "PLANETRACKDEFORM"; ntype.declare = file_ns::cmp_node_planetrackdeform_declare; ntype.draw_buttons = file_ns::node_composit_buts_planetrackdeform; diff --git a/source/blender/nodes/composite/nodes/node_composite_posterize.cc b/source/blender/nodes/composite/nodes/node_composite_posterize.cc index 20e45239a10c..df8517cceefb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_posterize.cc +++ b/source/blender/nodes/composite/nodes/node_composite_posterize.cc @@ -77,7 +77,10 @@ void register_node_type_cmp_posterize() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Posterize"; + ntype.ui_description = + "Reduce number of colors in an image, converting smooth gradients into sharp transitions"; ntype.enum_name_legacy = "POSTERIZE"; ntype.declare = file_ns::cmp_node_posterize_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc index bf040104b893..51fbcd602f08 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc @@ -103,7 +103,9 @@ void register_node_type_cmp_premulkey() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Alpha Convert"; + ntype.ui_description = "Convert to and from premultiplied (associated) alpha"; ntype.enum_name_legacy = "PREMULKEY"; ntype.declare = file_ns::cmp_node_premulkey_declare; ntype.draw_buttons = file_ns::node_composit_buts_premulkey; diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.cc b/source/blender/nodes/composite/nodes/node_composite_rgb.cc index 4686bd32116b..5c8180ea42af 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.cc @@ -54,7 +54,9 @@ void register_node_type_cmp_rgb() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_RGB, NODE_CLASS_INPUT); + ntype.ui_name = "RGB"; + ntype.ui_description = "A color picker"; ntype.enum_name_legacy = "RGB"; ntype.declare = file_ns::cmp_node_rgb_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Default); diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc index ed81f0cf4fae..968285284ea6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -95,7 +95,9 @@ void register_node_type_cmp_rotate() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_ROTATE, NODE_CLASS_DISTORT); + ntype.ui_name = "Rotate"; + ntype.ui_description = "Rotate image by specified angle"; ntype.enum_name_legacy = "ROTATE"; ntype.declare = file_ns::cmp_node_rotate_declare; ntype.draw_buttons = file_ns::node_composit_buts_rotate; diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc index c75717c0db5b..d3820172ae78 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -317,7 +317,9 @@ void register_node_type_cmp_scale() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_SCALE, NODE_CLASS_DISTORT); + ntype.ui_name = "Scale"; + ntype.ui_description = "Change the size of the image"; ntype.enum_name_legacy = "SCALE"; ntype.declare = file_ns::cmp_node_scale_declare; ntype.draw_buttons = file_ns::node_composit_buts_scale; diff --git a/source/blender/nodes/composite/nodes/node_composite_scene_time.cc b/source/blender/nodes/composite/nodes/node_composite_scene_time.cc index 44eef945e572..733fc8012bba 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scene_time.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scene_time.cc @@ -55,7 +55,9 @@ void register_node_type_cmp_scene_time() { static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SCENE_TIME, "Scene Time", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_SCENE_TIME, NODE_CLASS_INPUT); + ntype.ui_name = "Scene Time"; + ntype.ui_description = "Input the current scene time in seconds or frames"; ntype.enum_name_legacy = "SCENE_TIME"; ntype.declare = blender::nodes::cmp_node_scene_time_declare; ntype.get_compositor_operation = blender::nodes::get_compositor_operation; 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 9c45646890b4..a46e7aaac31b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc @@ -240,7 +240,9 @@ void register_node_type_cmp_separate_color() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate Color"; + ntype.ui_description = "Split an image into its composite color channels"; ntype.enum_name_legacy = "SEPARATE_COLOR"; ntype.declare = file_ns::cmp_node_separate_color_declare; ntype.initfunc = node_cmp_combsep_color_init; @@ -463,7 +465,9 @@ void register_node_type_cmp_combine_color() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBINE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine Color"; + ntype.ui_description = "Combine an image from its composite color channels"; ntype.enum_name_legacy = "COMBINE_COLOR"; ntype.declare = file_ns::cmp_node_combine_color_declare; ntype.initfunc = node_cmp_combsep_color_init; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc index 312e32b4f068..f90835bb29bf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc @@ -55,8 +55,9 @@ void register_node_type_cmp_sephsva() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_SEPHSVA_LEGACY, "Separate HSVA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPHSVA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate HSVA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPHSVA"; ntype.declare = file_ns::cmp_node_sephsva_declare; ntype.gather_link_search_ops = nullptr; @@ -123,8 +124,9 @@ void register_node_type_cmp_combhsva() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_COMBHSVA_LEGACY, "Combine HSVA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBHSVA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine HSVA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBHSVA"; ntype.declare = file_ns::cmp_node_combhsva_declare; ntype.gather_link_search_ops = nullptr; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc index 7adfef7013cf..03b68680c3a2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc @@ -55,8 +55,9 @@ void register_node_type_cmp_seprgba() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_SEPRGBA_LEGACY, "Separate RGBA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPRGBA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate RGBA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPRGBA"; ntype.declare = file_ns::cmp_node_seprgba_declare; ntype.gather_link_search_ops = nullptr; @@ -123,8 +124,9 @@ void register_node_type_cmp_combrgba() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_COMBRGBA_LEGACY, "Combine RGBA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBRGBA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine RGBA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBRGBA"; ntype.declare = file_ns::cmp_node_combrgba_declare; ntype.gather_link_search_ops = nullptr; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc index b9f7b1b2a0b7..7f6cbe687690 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc @@ -71,7 +71,9 @@ void register_node_type_cmp_separate_xyz() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_XYZ, "Separate XYZ", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPARATE_XYZ, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate XYZ"; + ntype.ui_description = "Split a vector into its individual components"; ntype.enum_name_legacy = "SEPARATE_XYZ"; ntype.declare = file_ns::cmp_node_separate_xyz_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; @@ -129,7 +131,9 @@ void register_node_type_cmp_combine_xyz() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_COMBINE_XYZ, "Combine XYZ", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBINE_XYZ, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine XYZ"; + ntype.ui_description = "Combine a vector from its individual components"; ntype.enum_name_legacy = "COMBINE_XYZ"; ntype.declare = file_ns::cmp_node_combine_xyz_declare; ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node; 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 4f44bf05cb1d..673e28ab79c1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc @@ -82,8 +82,9 @@ void register_node_type_cmp_sepycca() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_SEPYCCA_LEGACY, "Separate YCbCrA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPYCCA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate YCbCrA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPYCCA"; ntype.declare = file_ns::cmp_node_sepycca_declare; ntype.initfunc = file_ns::node_composit_init_mode_sepycca; @@ -176,8 +177,9 @@ void register_node_type_cmp_combycca() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_COMBYCCA_LEGACY, "Combine YCbCrA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBYCCA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine YCbCrA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBYCCA"; ntype.declare = file_ns::cmp_node_combycca_declare; ntype.initfunc = file_ns::node_composit_init_mode_combycca; diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc index 522fded06ab3..3aec66bc1ab8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc @@ -55,8 +55,9 @@ void register_node_type_cmp_sepyuva() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_SEPYUVA_LEGACY, "Separate YUVA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SEPYUVA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate YUVA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPYUVA"; ntype.declare = file_ns::cmp_node_sepyuva_declare; ntype.gather_link_search_ops = nullptr; @@ -123,8 +124,9 @@ void register_node_type_cmp_combyuva() static blender::bke::bNodeType ntype; - cmp_node_type_base( - &ntype, CMP_NODE_COMBYUVA_LEGACY, "Combine YUVA (Legacy)", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_COMBYUVA_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine YUVA (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBYUVA"; ntype.declare = file_ns::cmp_node_combyuva_declare; ntype.gather_link_search_ops = nullptr; diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc index 84b68c429b8d..06ce23c4e0c4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -112,7 +112,9 @@ void register_node_type_cmp_setalpha() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, NODE_CLASS_CONVERTER); + ntype.ui_name = "Set Alpha"; + ntype.ui_description = "Add an alpha channel to an image"; ntype.enum_name_legacy = "SETALPHA"; ntype.declare = file_ns::cmp_node_setalpha_declare; ntype.draw_buttons = file_ns::node_composit_buts_set_alpha; diff --git a/source/blender/nodes/composite/nodes/node_composite_split.cc b/source/blender/nodes/composite/nodes/node_composite_split.cc index 4dadf88fc67e..5a87154dd403 100644 --- a/source/blender/nodes/composite/nodes/node_composite_split.cc +++ b/source/blender/nodes/composite/nodes/node_composite_split.cc @@ -149,7 +149,11 @@ void register_node_type_cmp_split() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SPLIT, "Split", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SPLIT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Split"; + ntype.ui_description = + "Combine two images for side-by-side display. Typically used in combination with a Viewer " + "node"; ntype.enum_name_legacy = "SPLIT"; ntype.declare = file_ns::cmp_node_split_declare; ntype.draw_buttons = file_ns::node_composit_buts_split; diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc index f295c8b1a45e..4ca6244ac09d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc @@ -144,7 +144,9 @@ void register_node_type_cmp_stabilize2d() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, NODE_CLASS_DISTORT); + ntype.ui_name = "Stabilize 2D"; + ntype.ui_description = "Stabilize footage using 2D stabilization motion tracking settings"; ntype.enum_name_legacy = "STABILIZE2D"; ntype.declare = file_ns::cmp_node_stabilize2d_declare; ntype.draw_buttons = file_ns::node_composit_buts_stabilize2d; diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index ca76b80535e9..42d227838242 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -170,7 +170,9 @@ void register_node_type_cmp_sunbeams() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Sun Beams"; + ntype.ui_description = "Create sun beams based on image brightness"; ntype.enum_name_legacy = "SUNBEAMS"; ntype.declare = file_ns::cmp_node_sunbeams_declare; ntype.draw_buttons = file_ns::node_composit_buts_sunbeams; diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc b/source/blender/nodes/composite/nodes/node_composite_switch.cc index 14bea7573f95..21910888d687 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc @@ -61,7 +61,9 @@ void register_node_type_cmp_switch() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SWITCH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Switch"; + ntype.ui_description = "Switch between two images using a checkbox"; ntype.enum_name_legacy = "SWITCH"; ntype.declare = file_ns::cmp_node_switch_declare; ntype.draw_buttons = file_ns::node_composit_buts_switch; diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc index e149c9171da8..c553bb55ef2e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc @@ -87,7 +87,9 @@ void register_node_type_cmp_switch_view() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, NODE_CLASS_CONVERTER); + ntype.ui_name = "Switch View"; + ntype.ui_description = "Combine the views (left and right) into a single stereo 3D output"; ntype.enum_name_legacy = "VIEWSWITCH"; ntype.declare = file_ns::node_declare; ntype.initfunc_api = file_ns::init_switch_view; diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.cc b/source/blender/nodes/composite/nodes/node_composite_texture.cc index 55edf199f1c5..ed08be148b1c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_texture.cc +++ b/source/blender/nodes/composite/nodes/node_composite_texture.cc @@ -109,7 +109,9 @@ void register_node_type_cmp_texture() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, NODE_CLASS_INPUT); + ntype.ui_name = "Texture"; + ntype.ui_description = "Generate texture pattern from texture datablock"; ntype.enum_name_legacy = "TEXTURE"; ntype.declare = file_ns::cmp_node_texture_declare; ntype.compositor_unsupported_message = N_( diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc index ec3a9b22dadb..9ee43ccc8f50 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -428,7 +428,11 @@ void register_node_type_cmp_tonemap() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Tonemap"; + ntype.ui_description = + "Map one set of colors to another in order to approximate the appearance of high dynamic " + "range"; ntype.enum_name_legacy = "TONEMAP"; ntype.declare = file_ns::cmp_node_tonemap_declare; ntype.draw_buttons = file_ns::node_composit_buts_tonemap; diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc index a44ca0383bac..0d8fb9f8aa40 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc @@ -355,7 +355,10 @@ void register_node_type_cmp_trackpos() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, NODE_CLASS_INPUT); + ntype.ui_name = "Track Position"; + ntype.ui_description = + "Provide information about motion tracking points, such as x and y values"; ntype.enum_name_legacy = "TRACKPOS"; ntype.declare = file_ns::cmp_node_trackpos_declare; ntype.draw_buttons = file_ns::node_composit_buts_trackpos; diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.cc b/source/blender/nodes/composite/nodes/node_composite_transform.cc index cafc74428173..e59220d8db6e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_transform.cc @@ -110,7 +110,9 @@ void register_node_type_cmp_transform() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, NODE_CLASS_DISTORT); + ntype.ui_name = "Transform"; + ntype.ui_description = "Scale, translate and rotate an image"; ntype.enum_name_legacy = "TRANSFORM"; ntype.declare = file_ns::cmp_node_transform_declare; ntype.draw_buttons = file_ns::node_composit_buts_transform; diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index a854ae90e0f8..5735c7c0c2cd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -6,13 +6,14 @@ * \ingroup cmpnodes */ +#include "BLI_assert.h" #include "BLI_math_matrix.hh" #include "UI_interface.hh" #include "UI_resources.hh" -#include "COM_algorithm_transform.hh" #include "COM_node_operation.hh" +#include "COM_utilities.hh" #include "node_composite_util.hh" @@ -61,25 +62,117 @@ class TranslateOperation : public NodeOperation { void execute() override { - Result &input = get_input("Image"); - Result &result = get_result("Image"); + Result &input = this->get_input("Image"); - float x = get_input("X").get_single_value_default(0.0f); - float y = get_input("Y").get_single_value_default(0.0f); - if (get_use_relative()) { + float x = this->get_input("X").get_single_value_default(0.0f); + float y = this->get_input("Y").get_single_value_default(0.0f); + if (this->get_use_relative()) { x *= input.domain().size.x; y *= input.domain().size.y; } const float2 translation = float2(x, y); - const float3x3 transformation = math::from_location(translation); - RealizationOptions realization_options = input.get_realization_options(); - realization_options.wrap_x = get_wrap_x(); - realization_options.wrap_y = get_wrap_y(); - realization_options.interpolation = get_interpolation(); + if (this->get_wrap_x() || this->get_wrap_y()) { + this->execute_wrapped(translation); + } + else { + Result &output = this->get_result("Image"); + input.pass_through(output); + output.transform(math::from_location(translation)); + output.get_realization_options().interpolation = this->get_interpolation(); + } + } + + void execute_wrapped(const float2 &translation) + { + BLI_assert(this->get_wrap_x() || this->get_wrap_y()); + + /* Get the translation components that wrap. */ + const float2 wrapped_translation = float2(this->get_wrap_x() ? translation.x : 0.0f, + this->get_wrap_y() ? translation.y : 0.0f); + if (this->context().use_gpu()) { + this->execute_wrapped_gpu(wrapped_translation); + } + else { + this->execute_wrapped_cpu(wrapped_translation); + } + + /* If we are wrapping on both sides, then there is nothing left to do. Otherwise, we will have + * to transform the output by the translation components that do not wrap. While also setting + * up the appropriate interpolation. */ + if (this->get_wrap_x() && this->get_wrap_y()) { + return; + } + + /* Get the translation components that do not wrap. */ + const float2 non_wrapped_translation = float2(this->get_wrap_x() ? 0.0f : translation.x, + this->get_wrap_y() ? 0.0f : translation.y); + Result &output = this->get_result("Image"); + output.transform(math::from_location(non_wrapped_translation)); + output.get_realization_options().interpolation = this->get_interpolation(); + } - transform(context(), input, result, transformation, realization_options); + void execute_wrapped_gpu(const float2 &translation) + { + const Result &input = this->get_input("Image"); + Result &output = this->get_result("Image"); + + const Interpolation interpolation = this->get_interpolation(); + GPUShader *shader = this->context().get_shader(interpolation == Interpolation::Bicubic ? + "compositor_translate_wrapped_bicubic" : + "compositor_translate_wrapped"); + GPU_shader_bind(shader); + + GPU_shader_uniform_2fv(shader, "translation", translation); + + /* The texture sampler should use bilinear interpolation for both the bilinear and bicubic + * cases, as the logic used by the bicubic realization shader expects textures to use bilinear + * interpolation. */ + const bool use_bilinear = ELEM(interpolation, Interpolation::Bilinear, Interpolation::Bicubic); + GPU_texture_filter_mode(input, use_bilinear); + GPU_texture_extend_mode(input, GPU_SAMPLER_EXTEND_MODE_REPEAT); + + input.bind_as_texture(shader, "input_tx"); + + output.allocate_texture(input.domain()); + output.bind_as_image(shader, "output_img"); + + compute_dispatch_threads_at_least(shader, input.domain().size); + + input.unbind_as_texture(); + output.unbind_as_image(); + GPU_shader_unbind(); + } + + void execute_wrapped_cpu(const float2 &translation) + { + const Result &input = this->get_input("Image"); + Result &output = this->get_result("Image"); + output.allocate_texture(input.domain()); + + const bool wrap_x = this->get_wrap_x(); + const bool wrap_y = this->get_wrap_y(); + const Interpolation interpolation = this->get_interpolation(); + + const int2 size = input.domain().size; + parallel_for(size, [&](const int2 texel) { + float2 translated_coordinates = (float2(texel) + float2(0.5f) - translation) / float2(size); + + float4 sample; + switch (interpolation) { + case Interpolation::Nearest: + sample = input.sample_nearest_wrap(translated_coordinates, wrap_x, wrap_y); + break; + case Interpolation::Bilinear: + sample = input.sample_bilinear_wrap(translated_coordinates, wrap_x, wrap_y); + break; + case Interpolation::Bicubic: + sample = input.sample_cubic_wrap(translated_coordinates, wrap_x, wrap_y); + break; + } + output.store_pixel(texel, sample); + }); } Interpolation get_interpolation() @@ -126,7 +219,9 @@ void register_node_type_cmp_translate() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT); + cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, NODE_CLASS_DISTORT); + ntype.ui_name = "Translate"; + ntype.ui_description = "Offset an image"; ntype.enum_name_legacy = "TRANSLATE"; ntype.declare = file_ns::cmp_node_translate_declare; ntype.draw_buttons = file_ns::node_composit_buts_translate; 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 6bcd1a53c6fa..d6ba3ae08f5e 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 @@ -154,7 +154,9 @@ void register_node_type_cmp_valtorgb() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, "Color Ramp", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_VALTORGB, NODE_CLASS_CONVERTER); + ntype.ui_name = "Color Ramp"; + ntype.ui_description = "Map values to colors with the use of a gradient"; ntype.enum_name_legacy = "VALTORGB"; ntype.declare = file_ns::cmp_node_valtorgb_declare; blender::bke::node_type_size(&ntype, 240, 200, 320); @@ -230,7 +232,9 @@ void register_node_type_cmp_rgbtobw() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); + cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, NODE_CLASS_CONVERTER); + ntype.ui_name = "RGB to BW"; + ntype.ui_description = "Convert RGB input into grayscale using luminance"; ntype.enum_name_legacy = "RGBTOBW"; ntype.declare = file_ns::cmp_node_rgbtobw_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Default); diff --git a/source/blender/nodes/composite/nodes/node_composite_value.cc b/source/blender/nodes/composite/nodes/node_composite_value.cc index 89c6ddfa1d61..266aadea6f36 100644 --- a/source/blender/nodes/composite/nodes/node_composite_value.cc +++ b/source/blender/nodes/composite/nodes/node_composite_value.cc @@ -50,7 +50,9 @@ void register_node_type_cmp_value() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT); + cmp_node_type_base(&ntype, CMP_NODE_VALUE, NODE_CLASS_INPUT); + ntype.ui_name = "Value"; + ntype.ui_description = "Input numerical values to other nodes in the node graph"; ntype.enum_name_legacy = "VALUE"; ntype.declare = file_ns::cmp_node_value_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Default); 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 5437b1d8b7bc..8c1aeae26cf2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vec_blur.cc @@ -677,7 +677,9 @@ void register_node_type_cmp_vecblur() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER); + cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, NODE_CLASS_OP_FILTER); + ntype.ui_name = "Vector Blur"; + ntype.ui_description = "Uses the vector speed render pass to blur the image pixels in 2D"; ntype.enum_name_legacy = "VECBLUR"; ntype.declare = file_ns::cmp_node_vec_blur_declare; ntype.draw_buttons = file_ns::node_composit_buts_vecblur; diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc index 448c33ef2872..a044bd4f5173 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -324,7 +324,10 @@ void register_node_type_cmp_viewer() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); + cmp_node_type_base(&ntype, CMP_NODE_VIEWER, NODE_CLASS_OUTPUT); + ntype.ui_name = "Viewer"; + ntype.ui_description = + "Visualize data from inside a node graph, in the image editor or as a backdrop"; ntype.enum_name_legacy = "VIEWER"; ntype.declare = file_ns::cmp_node_viewer_declare; ntype.draw_buttons = file_ns::node_composit_buts_viewer; diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc index 9b69c59324e6..00c9382268e9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -380,7 +380,9 @@ void register_node_type_cmp_zcombine() static blender::bke::bNodeType ntype; - cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR); + cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Z Combine"; + ntype.ui_description = "Combine two images using depth maps"; ntype.enum_name_legacy = "ZCOMBINE"; ntype.declare = file_ns::cmp_node_zcombine_declare; ntype.draw_buttons = file_ns::node_composit_buts_zcombine; diff --git a/source/blender/nodes/function/node_function_util.cc b/source/blender/nodes/function/node_function_util.cc index 84ad1fe0448d..f2796382c19c 100644 --- a/source/blender/nodes/function/node_function_util.cc +++ b/source/blender/nodes/function/node_function_util.cc @@ -19,9 +19,9 @@ static bool fn_node_poll_default(const blender::bke::bNodeType * /*ntype*/, return true; } -void fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void fn_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - blender::bke::node_type_base(ntype, type, name, nclass); + blender::bke::node_type_base(ntype, type, nclass); ntype->poll = fn_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; diff --git a/source/blender/nodes/function/node_function_util.hh b/source/blender/nodes/function/node_function_util.hh index 5a00064ea825..3f402d965272 100644 --- a/source/blender/nodes/function/node_function_util.hh +++ b/source/blender/nodes/function/node_function_util.hh @@ -25,4 +25,4 @@ #include "RNA_access.hh" -void fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass); +void fn_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); diff --git a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc index 0491eeab7d2d..9d40137a86fc 100644 --- a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc @@ -259,8 +259,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_ALIGN_EULER_TO_VECTOR, "Align Euler to Vector", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ALIGN_EULER_TO_VECTOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Align Euler to Vector"; ntype.enum_name_legacy = "ALIGN_EULER_TO_VECTOR"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/function/nodes/node_fn_align_rotation_to_vector.cc b/source/blender/nodes/function/nodes/node_fn_align_rotation_to_vector.cc index 41df6ed35b74..f65e0743fbb6 100644 --- a/source/blender/nodes/function/nodes/node_fn_align_rotation_to_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_align_rotation_to_vector.cc @@ -229,8 +229,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_ALIGN_ROTATION_TO_VECTOR, "Align Rotation to Vector", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ALIGN_ROTATION_TO_VECTOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Align Rotation to Vector"; ntype.enum_name_legacy = "ALIGN_ROTATION_TO_VECTOR"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/function/nodes/node_fn_axes_to_rotation.cc b/source/blender/nodes/function/nodes/node_fn_axes_to_rotation.cc index 0d257e7a2268..1a7e1d5f6f2a 100644 --- a/source/blender/nodes/function/nodes/node_fn_axes_to_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_axes_to_rotation.cc @@ -176,7 +176,10 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_AXES_TO_ROTATION, "Axes to Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_AXES_TO_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Axes to Rotation"; + ntype.ui_description = + "Create a rotation from a primary and (ideally orthogonal) secondary axis"; ntype.enum_name_legacy = "AXES_TO_ROTATION"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/function/nodes/node_fn_axis_angle_to_rotation.cc b/source/blender/nodes/function/nodes/node_fn_axis_angle_to_rotation.cc index fdd0b39197ca..3711458a1f9b 100644 --- a/source/blender/nodes/function/nodes/node_fn_axis_angle_to_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_axis_angle_to_rotation.cc @@ -67,8 +67,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_AXIS_ANGLE_TO_ROTATION, "Axis Angle to Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_AXIS_ANGLE_TO_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Axis Angle to Rotation"; ntype.enum_name_legacy = "AXIS_ANGLE_TO_ROTATION"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; 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 955966da1c8d..a9f29e3d600b 100644 --- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc +++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc @@ -190,7 +190,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Boolean Math"; ntype.enum_name_legacy = "BOOLEAN_MATH"; ntype.declare = node_declare; ntype.labelfunc = node_label; 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 3d957be8671e..ce6cfae47338 100644 --- a/source/blender/nodes/function/nodes/node_fn_combine_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_combine_color.cc @@ -97,7 +97,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_COMBINE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine Color"; ntype.enum_name_legacy = "COMBINE_COLOR"; ntype.declare = node_declare; ntype.updatefunc = node_update; diff --git a/source/blender/nodes/function/nodes/node_fn_combine_matrix.cc b/source/blender/nodes/function/nodes/node_fn_combine_matrix.cc index ddb2717930a0..41d35194bf06 100644 --- a/source/blender/nodes/function/nodes/node_fn_combine_matrix.cc +++ b/source/blender/nodes/function/nodes/node_fn_combine_matrix.cc @@ -236,7 +236,9 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_COMBINE_MATRIX, "Combine Matrix", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_COMBINE_MATRIX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine Matrix"; + ntype.ui_description = "Construct a 4x4 matrix from its individual values"; ntype.enum_name_legacy = "COMBINE_MATRIX"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_combine_transform.cc b/source/blender/nodes/function/nodes/node_fn_combine_transform.cc index 8c2b6d838746..0c855cf6d00f 100644 --- a/source/blender/nodes/function/nodes/node_fn_combine_transform.cc +++ b/source/blender/nodes/function/nodes/node_fn_combine_transform.cc @@ -112,7 +112,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_COMBINE_TRANSFORM, "Combine Transform", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_COMBINE_TRANSFORM, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine Transform"; ntype.enum_name_legacy = "COMBINE_TRANSFORM"; ntype.declare = node_declare; ntype.build_multi_function = node_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 5afd40eeb2b9..9813920c50b0 100644 --- a/source/blender/nodes/function/nodes/node_fn_compare.cc +++ b/source/blender/nodes/function/nodes/node_fn_compare.cc @@ -737,7 +737,8 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_COMPARE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Compare"; ntype.enum_name_legacy = "COMPARE"; ntype.declare = node_declare; ntype.labelfunc = node_label; diff --git a/source/blender/nodes/function/nodes/node_fn_euler_to_rotation.cc b/source/blender/nodes/function/nodes/node_fn_euler_to_rotation.cc index cf6d6a2540a5..2824d215c714 100644 --- a/source/blender/nodes/function/nodes/node_fn_euler_to_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_euler_to_rotation.cc @@ -55,7 +55,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_EULER_TO_ROTATION, "Euler to Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_EULER_TO_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Euler to Rotation"; ntype.enum_name_legacy = "EULER_TO_ROTATION"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_find_in_string.cc b/source/blender/nodes/function/nodes/node_fn_find_in_string.cc index 8413cf8a5f78..2fe5350288ee 100644 --- a/source/blender/nodes/function/nodes/node_fn_find_in_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_find_in_string.cc @@ -58,7 +58,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_FIND_IN_STRING, "Find in String", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_FIND_IN_STRING, NODE_CLASS_CONVERTER); + ntype.ui_name = "Find in String"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; blender::bke::node_register_type(&ntype); diff --git a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc index 3101f6476fee..5834397fe44a 100644 --- a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc @@ -79,7 +79,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, "Float to Integer", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Float to Integer"; ntype.enum_name_legacy = "FLOAT_TO_INT"; ntype.declare = node_declare; ntype.labelfunc = node_label; diff --git a/source/blender/nodes/function/nodes/node_fn_hash_value.cc b/source/blender/nodes/function/nodes/node_fn_hash_value.cc index 81d60ed11da9..263192e92eef 100644 --- a/source/blender/nodes/function/nodes/node_fn_hash_value.cc +++ b/source/blender/nodes/function/nodes/node_fn_hash_value.cc @@ -177,7 +177,8 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_HASH_VALUE, "Hash Value", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_HASH_VALUE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Hash Value"; ntype.enum_name_legacy = "HASH_VALUE"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 0f935f541c1c..5231b2aa80e9 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_bool.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_bool.cc @@ -37,7 +37,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, "Boolean", 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, 0); + ntype.ui_name = "Boolean"; ntype.enum_name_legacy = "INPUT_BOOL"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 aa131a0bc485..994e8a822ff9 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_color.cc @@ -41,7 +41,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, "Color", NODE_CLASS_INPUT); + fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, NODE_CLASS_INPUT); + ntype.ui_name = "Color"; ntype.enum_name_legacy = "INPUT_COLOR"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 449ad69eddaf..64eb7f6c6d31 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_int.cc @@ -37,7 +37,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_INT, "Integer", 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_INT, 0); + ntype.ui_name = "Integer"; ntype.enum_name_legacy = "INPUT_INT"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/function/nodes/node_fn_input_rotation.cc b/source/blender/nodes/function/nodes/node_fn_input_rotation.cc index 64cdc9b7083d..3f74a47d96ea 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_rotation.cc @@ -46,7 +46,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_ROTATION, "Rotation", 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_ROTATION, 0); + ntype.ui_name = "Rotation"; ntype.enum_name_legacy = "INPUT_ROTATION"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc index e059547a43d0..ea88274e9d37 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc @@ -48,8 +48,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_INPUT_SPECIAL_CHARACTERS, "Special Characters", NODE_CLASS_INPUT); + fn_node_type_base(&ntype, FN_NODE_INPUT_SPECIAL_CHARACTERS, NODE_CLASS_INPUT); + ntype.ui_name = "Special Characters"; ntype.enum_name_legacy = "INPUT_SPECIAL_CHARACTERS"; ntype.declare = node_declare; ntype.build_multi_function = node_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 626ef2ee6206..0e8c7c35685b 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_string.cc @@ -61,7 +61,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, "String", NODE_CLASS_INPUT); + fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, NODE_CLASS_INPUT); + ntype.ui_name = "String"; ntype.enum_name_legacy = "INPUT_STRING"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 de752ddba331..e363cdb5cc64 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_vector.cc @@ -38,7 +38,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, "Vector", 0); + fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, 0); + ntype.ui_name = "Vector"; ntype.enum_name_legacy = "INPUT_VECTOR"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/function/nodes/node_fn_integer_math.cc b/source/blender/nodes/function/nodes/node_fn_integer_math.cc index 140250a1ff66..b33b03e99457 100644 --- a/source/blender/nodes/function/nodes/node_fn_integer_math.cc +++ b/source/blender/nodes/function/nodes/node_fn_integer_math.cc @@ -302,7 +302,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INTEGER_MATH, "Integer Math", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_INTEGER_MATH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Integer Math"; ntype.enum_name_legacy = "INTEGER_MATH"; ntype.declare = node_declare; ntype.labelfunc = node_label; diff --git a/source/blender/nodes/function/nodes/node_fn_invert_matrix.cc b/source/blender/nodes/function/nodes/node_fn_invert_matrix.cc index 2055b92e23e3..cc699d83e4c7 100644 --- a/source/blender/nodes/function/nodes/node_fn_invert_matrix.cc +++ b/source/blender/nodes/function/nodes/node_fn_invert_matrix.cc @@ -62,7 +62,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INVERT_MATRIX, "Invert Matrix", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_INVERT_MATRIX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Invert Matrix"; ntype.enum_name_legacy = "INVERT_MATRIX"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_invert_rotation.cc b/source/blender/nodes/function/nodes/node_fn_invert_rotation.cc index 0033cb79f105..7da95b178bdd 100644 --- a/source/blender/nodes/function/nodes/node_fn_invert_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_invert_rotation.cc @@ -25,7 +25,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_INVERT_ROTATION, "Invert Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_INVERT_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Invert Rotation"; ntype.enum_name_legacy = "INVERT_ROTATION"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_matrix_determinant.cc b/source/blender/nodes/function/nodes/node_fn_matrix_determinant.cc index ada09025251f..0dc1e58ea328 100644 --- a/source/blender/nodes/function/nodes/node_fn_matrix_determinant.cc +++ b/source/blender/nodes/function/nodes/node_fn_matrix_determinant.cc @@ -25,8 +25,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_MATRIX_DETERMINANT, "Matrix Determinant", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_MATRIX_DETERMINANT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Matrix Determinant"; ntype.enum_name_legacy = "MATRIX_DETERMINANT"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_matrix_multiply.cc b/source/blender/nodes/function/nodes/node_fn_matrix_multiply.cc index 502cb2082d56..0b679c2aab13 100644 --- a/source/blender/nodes/function/nodes/node_fn_matrix_multiply.cc +++ b/source/blender/nodes/function/nodes/node_fn_matrix_multiply.cc @@ -50,7 +50,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_MATRIX_MULTIPLY, "Multiply Matrices", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_MATRIX_MULTIPLY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Multiply Matrices"; ntype.enum_name_legacy = "MATRIX_MULTIPLY"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_project_point.cc b/source/blender/nodes/function/nodes/node_fn_project_point.cc index 621ccbaa5b4c..2111c13fa56b 100644 --- a/source/blender/nodes/function/nodes/node_fn_project_point.cc +++ b/source/blender/nodes/function/nodes/node_fn_project_point.cc @@ -27,7 +27,10 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_PROJECT_POINT, "Project Point", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_PROJECT_POINT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Project Point"; + ntype.ui_description = + "Project a point using a matrix, using location, rotation, scale, and perspective divide"; ntype.enum_name_legacy = "PROJECT_POINT"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_quaternion_to_rotation.cc b/source/blender/nodes/function/nodes/node_fn_quaternion_to_rotation.cc index 15f463464f6c..49b99db9b534 100644 --- a/source/blender/nodes/function/nodes/node_fn_quaternion_to_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_quaternion_to_rotation.cc @@ -31,8 +31,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_QUATERNION_TO_ROTATION, "Quaternion to Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_QUATERNION_TO_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Quaternion to Rotation"; ntype.enum_name_legacy = "QUATERNION_TO_ROTATION"; ntype.declare = node_declare; ntype.build_multi_function = node_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 502989ec68ca..00f608ade7fa 100644 --- a/source/blender/nodes/function/nodes/node_fn_random_value.cc +++ b/source/blender/nodes/function/nodes/node_fn_random_value.cc @@ -201,7 +201,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, "Random Value", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Random Value"; ntype.enum_name_legacy = "RANDOM_VALUE"; ntype.initfunc = fn_node_random_value_init; ntype.updatefunc = fn_node_random_value_update; diff --git a/source/blender/nodes/function/nodes/node_fn_replace_string.cc b/source/blender/nodes/function/nodes/node_fn_replace_string.cc index 94828798f6c3..1a9282f883e4 100644 --- a/source/blender/nodes/function/nodes/node_fn_replace_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_replace_string.cc @@ -42,7 +42,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_REPLACE_STRING, "Replace String", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_REPLACE_STRING, NODE_CLASS_CONVERTER); + ntype.ui_name = "Replace String"; ntype.enum_name_legacy = "REPLACE_STRING"; ntype.declare = node_declare; ntype.build_multi_function = node_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 3ebe81212702..7561092bb3a5 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc @@ -133,7 +133,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, "Rotate Euler", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotate Euler"; ntype.enum_name_legacy = "ROTATE_EULER"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/function/nodes/node_fn_rotate_rotation.cc b/source/blender/nodes/function/nodes/node_fn_rotate_rotation.cc index b0a65bec0912..583115fbede0 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotate_rotation.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotate_rotation.cc @@ -76,7 +76,8 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_ROTATE_ROTATION, "Rotate Rotation", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATE_ROTATION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotate Rotation"; ntype.enum_name_legacy = "ROTATE_ROTATION"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/function/nodes/node_fn_rotate_vector.cc b/source/blender/nodes/function/nodes/node_fn_rotate_vector.cc index b6002834fc07..2fe1c924dddb 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotate_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotate_vector.cc @@ -27,7 +27,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_ROTATE_VECTOR, "Rotate Vector", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATE_VECTOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotate Vector"; ntype.enum_name_legacy = "ROTATE_VECTOR"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_rotation_to_axis_angle.cc b/source/blender/nodes/function/nodes/node_fn_rotation_to_axis_angle.cc index 960a38d35998..44bc8eb638a8 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotation_to_axis_angle.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotation_to_axis_angle.cc @@ -89,8 +89,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_ROTATION_TO_AXIS_ANGLE, "Rotation to Axis Angle", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATION_TO_AXIS_ANGLE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotation to Axis Angle"; ntype.enum_name_legacy = "ROTATION_TO_AXIS_ANGLE"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_rotation_to_euler.cc b/source/blender/nodes/function/nodes/node_fn_rotation_to_euler.cc index 2ee459913c6d..d5fb9f5686d8 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotation_to_euler.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotation_to_euler.cc @@ -54,7 +54,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_ROTATION_TO_EULER, "Rotation to Euler", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATION_TO_EULER, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotation to Euler"; ntype.enum_name_legacy = "ROTATION_TO_EULER"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_rotation_to_quaternion.cc b/source/blender/nodes/function/nodes/node_fn_rotation_to_quaternion.cc index 1c3d4eff8096..e143e1c84068 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotation_to_quaternion.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotation_to_quaternion.cc @@ -59,8 +59,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_ROTATION_TO_QUATERNION, "Rotation to Quaternion", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_ROTATION_TO_QUATERNION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Rotation to Quaternion"; ntype.enum_name_legacy = "ROTATION_TO_QUATERNION"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; 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 8f664c663d9b..746d1e11fc47 100644 --- a/source/blender/nodes/function/nodes/node_fn_separate_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_separate_color.cc @@ -215,7 +215,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_SEPARATE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate Color"; ntype.enum_name_legacy = "SEPARATE_COLOR"; ntype.declare = node_declare; ntype.updatefunc = node_update; diff --git a/source/blender/nodes/function/nodes/node_fn_separate_matrix.cc b/source/blender/nodes/function/nodes/node_fn_separate_matrix.cc index 2c23a2eaac64..7ec965c6323c 100644 --- a/source/blender/nodes/function/nodes/node_fn_separate_matrix.cc +++ b/source/blender/nodes/function/nodes/node_fn_separate_matrix.cc @@ -275,7 +275,9 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_SEPARATE_MATRIX, "Separate Matrix", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_SEPARATE_MATRIX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate Matrix"; + ntype.ui_description = "Split a 4x4 matrix into its individual values"; ntype.enum_name_legacy = "SEPARATE_MATRIX"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_separate_transform.cc b/source/blender/nodes/function/nodes/node_fn_separate_transform.cc index c77e62392849..ea4cd0eaa9d8 100644 --- a/source/blender/nodes/function/nodes/node_fn_separate_transform.cc +++ b/source/blender/nodes/function/nodes/node_fn_separate_transform.cc @@ -106,8 +106,8 @@ static void node_eval_inverse(inverse_eval::InverseEvalParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_SEPARATE_TRANSFORM, "Separate Transform", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_SEPARATE_TRANSFORM, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate Transform"; ntype.enum_name_legacy = "SEPARATE_TRANSFORM"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_slice_string.cc b/source/blender/nodes/function/nodes/node_fn_slice_string.cc index 04e39ed3e7e3..7ad2a9e43f21 100644 --- a/source/blender/nodes/function/nodes/node_fn_slice_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_slice_string.cc @@ -32,7 +32,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_SLICE_STRING, "Slice String", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_SLICE_STRING, NODE_CLASS_CONVERTER); + ntype.ui_name = "Slice String"; ntype.enum_name_legacy = "SLICE_STRING"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_string_length.cc b/source/blender/nodes/function/nodes/node_fn_string_length.cc index 3275b5b493f0..9c5d2783483c 100644 --- a/source/blender/nodes/function/nodes/node_fn_string_length.cc +++ b/source/blender/nodes/function/nodes/node_fn_string_length.cc @@ -27,7 +27,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, "String Length", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, NODE_CLASS_CONVERTER); + ntype.ui_name = "String Length"; ntype.enum_name_legacy = "STRING_LENGTH"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_transform_direction.cc b/source/blender/nodes/function/nodes/node_fn_transform_direction.cc index 3c9105a01fc0..2f3335e5a999 100644 --- a/source/blender/nodes/function/nodes/node_fn_transform_direction.cc +++ b/source/blender/nodes/function/nodes/node_fn_transform_direction.cc @@ -28,8 +28,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base( - &ntype, FN_NODE_TRANSFORM_DIRECTION, "Transform Direction", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_TRANSFORM_DIRECTION, NODE_CLASS_CONVERTER); + ntype.ui_name = "Transform Direction"; ntype.enum_name_legacy = "TRANSFORM_DIRECTION"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_transform_point.cc b/source/blender/nodes/function/nodes/node_fn_transform_point.cc index 6d570e717fa3..14e4d54a7233 100644 --- a/source/blender/nodes/function/nodes/node_fn_transform_point.cc +++ b/source/blender/nodes/function/nodes/node_fn_transform_point.cc @@ -27,7 +27,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_TRANSFORM_POINT, "Transform Point", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_TRANSFORM_POINT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Transform Point"; ntype.enum_name_legacy = "TRANSFORM_POINT"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_transpose_matrix.cc b/source/blender/nodes/function/nodes/node_fn_transpose_matrix.cc index 2e5d9bf3f94c..b800f390715c 100644 --- a/source/blender/nodes/function/nodes/node_fn_transpose_matrix.cc +++ b/source/blender/nodes/function/nodes/node_fn_transpose_matrix.cc @@ -25,7 +25,8 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder) static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_TRANSPOSE_MATRIX, "Transpose Matrix", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_TRANSPOSE_MATRIX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Transpose Matrix"; ntype.enum_name_legacy = "TRANSPOSE_MATRIX"; ntype.declare = node_declare; ntype.build_multi_function = node_build_multi_function; diff --git a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc index 9d906f820b0b..ba41954b1a82 100644 --- a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc @@ -126,7 +126,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - fn_node_type_base(&ntype, FN_NODE_VALUE_TO_STRING, "Value to String", NODE_CLASS_CONVERTER); + fn_node_type_base(&ntype, FN_NODE_VALUE_TO_STRING, NODE_CLASS_CONVERTER); + ntype.ui_name = "Value to String"; ntype.enum_name_legacy = "VALUE_TO_STRING"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/node_geometry_tree.cc b/source/blender/nodes/geometry/node_geometry_tree.cc index d3ccf8b4dda4..0da9242bf9ed 100644 --- a/source/blender/nodes/geometry/node_geometry_tree.cc +++ b/source/blender/nodes/geometry/node_geometry_tree.cc @@ -138,15 +138,14 @@ static bool geometry_node_tree_socket_type_valid(blender::bke::bNodeTreeType * / void register_node_tree_type_geo() { - blender::bke::bNodeTreeType *tt = ntreeType_Geometry = - static_cast( - MEM_callocN(sizeof(blender::bke::bNodeTreeType), "geometry node tree type")); + blender::bke::bNodeTreeType *tt = ntreeType_Geometry = MEM_new( + __func__); tt->type = NTREE_GEOMETRY; - STRNCPY(tt->idname, "GeometryNodeTree"); - STRNCPY(tt->group_idname, "GeometryNodeGroup"); - STRNCPY(tt->ui_name, N_("Geometry Node Editor")); + tt->idname = "GeometryNodeTree"; + tt->group_idname = "GeometryNodeGroup"; + tt->ui_name = N_("Geometry Node Editor"); tt->ui_icon = ICON_GEOMETRY_NODES; - STRNCPY(tt->ui_description, N_("Geometry nodes")); + tt->ui_description = N_("Geometry nodes"); tt->rna_ext.srna = &RNA_GeometryNodeTree; tt->update = geometry_node_tree_update; tt->get_from_context = geometry_node_tree_get_from_context; diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc index 34ff909e9546..bab2953cb037 100644 --- a/source/blender/nodes/geometry/node_geometry_util.cc +++ b/source/blender/nodes/geometry/node_geometry_util.cc @@ -135,9 +135,9 @@ bool geo_node_poll_default(const blender::bke::bNodeType * /*ntype*/, return true; } -void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void geo_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - blender::bke::node_type_base(ntype, type, name, nclass); + blender::bke::node_type_base(ntype, type, nclass); ntype->poll = geo_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index 45bf34c56e78..051e5032d1ee 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -26,7 +26,7 @@ class GatherLinkSearchOpParams; } // namespace nodes } // namespace blender -void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass); +void geo_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); bool geo_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint); 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 9ba45b3da381..b6c955f532c3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc @@ -426,8 +426,11 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_ACCUMULATE_FIELD, "Accumulate Field", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_ACCUMULATE_FIELD, NODE_CLASS_CONVERTER); + ntype.ui_name = "Accumulate Field"; + ntype.ui_description = + "Add the values of an evaluated field together and output the running total for each " + "element"; ntype.enum_name_legacy = "ACCUMULATE_FIELD"; ntype.geometry_node_execute = node_geo_exec; ntype.initfunc = node_init; 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 bc78be58d6e8..35fdacc69445 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc @@ -249,9 +249,12 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base( - &ntype, GEO_NODE_CAPTURE_ATTRIBUTE, "Capture Attribute", NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Capture Attribute"; + ntype.ui_description = + "Store the result of a field on a geometry and output the data as a node socket. Allows " + "remembering or interpolating data as the geometry changes, such as positions before " + "deformation"; + geo_node_type_base(&ntype, GEO_NODE_CAPTURE_ATTRIBUTE, NODE_CLASS_ATTRIBUTE); ntype.enum_name_legacy = "CAPTURE_ATTRIBUTE"; blender::bke::node_type_storage( &ntype, "NodeGeometryAttributeCapture", node_free_storage, node_copy_storage); 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 9929da37e9d5..28a9008a5827 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 @@ -172,7 +172,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, "Domain Size", NODE_CLASS_ATTRIBUTE); + geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Domain Size"; + ntype.ui_description = "Retrieve the number of elements in a geometry for each attribute domain"; ntype.enum_name_legacy = "ATTRIBUTE_DOMAIN_SIZE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 3a039d6f9526..755baa83407e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc @@ -363,9 +363,10 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base( - &ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE); + geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_STATISTIC, NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Attribute Statistic"; + ntype.ui_description = + "Calculate statistics about a data set from a field evaluated on a geometry"; ntype.enum_name_legacy = "ATTRIBUTE_STATISTIC"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_bake.cc b/source/blender/nodes/geometry/nodes/node_geo_bake.cc index a5f1319df1eb..4de09adbe8f1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_bake.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_bake.cc @@ -568,8 +568,9 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_BAKE, "Bake", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_BAKE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Bake"; + ntype.ui_description = "Cache the incoming data so that it can be used without recomputation"; ntype.enum_name_legacy = "BAKE"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc index eb55178976f4..11308db8fc4e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc @@ -496,7 +496,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_BLUR_ATTRIBUTE, "Blur Attribute", NODE_CLASS_ATTRIBUTE); + geo_node_type_base(&ntype, GEO_NODE_BLUR_ATTRIBUTE, NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Blur Attribute"; + ntype.ui_description = "Mix attribute values of neighboring elements"; ntype.enum_name_legacy = "BLUR_ATTRIBUTE"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc index f9e46560b584..282d92287921 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc @@ -289,8 +289,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_MESH_BOOLEAN, "Mesh Boolean", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_BOOLEAN, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh Boolean"; + ntype.ui_description = "Cut, subtract, or join multiple mesh inputs"; ntype.enum_name_legacy = "MESH_BOOLEAN"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc index 665884b70243..05aa744fbc27 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc @@ -68,8 +68,11 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_BOUNDING_BOX, "Bounding Box", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_BOUNDING_BOX, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Bounding Box"; + ntype.ui_description = + "Calculate the limits of a geometry's positions and generate a box mesh with those " + "dimensions"; ntype.enum_name_legacy = "BOUNDING_BOX"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 c7476acfe82d..a812c52a2f3a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -187,7 +187,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, "Collection Info", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Collection Info"; + ntype.ui_description = "Retrieve geometry instances from a collection"; ntype.enum_name_legacy = "COLLECTION_INFO"; ntype.declare = node_declare; ntype.initfunc = node_node_init; 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 87f5fb38bd1e..2b0493d6e044 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -285,8 +285,11 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_CONVEX_HULL, "Convex Hull", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CONVEX_HULL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Convex Hull"; + ntype.ui_description = + "Create a mesh that encloses all points in the input geometry with the smallest number of " + "points"; ntype.enum_name_legacy = "CONVEX_HULL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc index 17118e5c1680..9155ad0760aa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc @@ -122,9 +122,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base( - &ntype, GEO_NODE_CURVE_ENDPOINT_SELECTION, "Endpoint Selection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_CURVE_ENDPOINT_SELECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Endpoint Selection"; + ntype.ui_description = "Provide a selection for an arbitrary number of endpoints in each spline"; ntype.enum_name_legacy = "CURVE_ENDPOINT_SELECTION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 44e3ae694397..e0d613227fba 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc @@ -339,8 +339,10 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, "Fill Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Fill Curve"; + ntype.ui_description = + "Generate a mesh on the XY plane with faces on the inside of input curves"; ntype.enum_name_legacy = "FILL_CURVE"; ntype.initfunc = node_init; blender::bke::node_type_storage( 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 e4dda90370b8..6f4e0acaa75d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc @@ -197,7 +197,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_FILLET_CURVE, "Fillet Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_FILLET_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Fillet Curve"; + ntype.ui_description = "Round corners by generating circular arcs on each control point"; ntype.enum_name_legacy = "FILLET_CURVE"; ntype.draw_buttons = node_layout; blender::bke::node_type_storage( 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 2e46b8d3dab1..2b1e64f3262d 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 @@ -134,8 +134,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, "Handle Type Selection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Handle Type Selection"; + ntype.ui_description = "Provide a selection based on the handle types of Bézier control points"; ntype.enum_name_legacy = "CURVE_HANDLE_TYPE_SELECTION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc index 86b087ae2eb2..242dd7856883 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_length.cc @@ -61,7 +61,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_LENGTH, "Curve Length", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_LENGTH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curve Length"; + ntype.ui_description = "Retrieve the length of all splines added together"; ntype.enum_name_legacy = "CURVE_LENGTH"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 5580618216df..921b9c7d7738 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 @@ -372,7 +372,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_ARC, "Arc", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_ARC, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Arc"; + ntype.ui_description = "Generate a poly spline arc"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_ARC"; ntype.initfunc = node_init; blender::bke::node_type_storage(&ntype, 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 dcf6584e6d10..fc42eff304b5 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 @@ -143,8 +143,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bézier Segment", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Bézier Segment"; + ntype.ui_description = "Generate a 2D Bézier spline from the given control points and handles"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_BEZIER_SEGMENT"; ntype.initfunc = node_init; blender::bke::node_type_storage(&ntype, 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 b702cdfa3d85..a9d8bc84eff3 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 @@ -231,7 +231,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, "Curve Circle", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curve Circle"; + ntype.ui_description = "Generate a poly spline circle"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_CIRCLE"; ntype.initfunc = node_init; blender::bke::node_type_storage(&ntype, 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 2f7fbad4a4ff..025bbe827e10 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 @@ -139,7 +139,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, "Curve Line", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curve Line"; + ntype.ui_description = "Generate a poly spline line with two points"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_LINE"; ntype.initfunc = node_init; blender::bke::node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc index 9b7950d7fd59..a6901d77c04e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc @@ -64,8 +64,10 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, "Quadratic Bézier", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Quadratic Bézier"; + ntype.ui_description = + "Generate a poly spline in a parabola shape with control points positions"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_QUADRATIC_BEZIER"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 a1118f32ef07..5f0fed1f9a5b 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 @@ -310,8 +310,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, "Quadrilateral", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Quadrilateral"; + ntype.ui_description = "Generate a polygon with four points"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_QUADRILATERAL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc index ef3d22e1086b..efa95733f170 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc @@ -89,8 +89,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, "Spiral", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Spiral"; + ntype.ui_description = "Generate a poly spline in a spiral shape"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_SPIRAL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc index 193fc6a9186d..3b2f528eb683 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc @@ -90,7 +90,10 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_STAR, "Star", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_STAR, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Star"; + ntype.ui_description = + "Generate a poly spline in a star pattern by connecting alternating points of two circles"; ntype.enum_name_legacy = "CURVE_PRIMITIVE_STAR"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 2c2653dc8271..c5a2125e01e2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc @@ -199,7 +199,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_RESAMPLE_CURVE, "Resample Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_RESAMPLE_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Resample Curve"; + ntype.ui_description = "Generate a poly spline for each input spline"; ntype.enum_name_legacy = "RESAMPLE_CURVE"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc index bf4781b5b998..bcfc1b57131a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc @@ -73,7 +73,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REVERSE_CURVE, "Reverse Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_REVERSE_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Reverse Curve"; + ntype.ui_description = "Change the direction of curves by swapping their start and end data"; ntype.enum_name_legacy = "REVERSE_CURVE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 fcb4e1b29855..80835baebff1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -494,7 +494,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_CURVE, "Sample Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sample Curve"; + ntype.ui_description = + "Retrieve data from a point on a curve at a certain distance from its start"; ntype.enum_name_legacy = "SAMPLE_CURVE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 39f1fcea58ac..cb168d1b0444 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,8 +120,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_SET_HANDLE_TYPE, "Set Handle Type", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_SET_HANDLE_TYPE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Handle Type"; + ntype.ui_description = "Set the handle type for the control points of a Bézier curve"; ntype.enum_name_legacy = "CURVE_SET_HANDLES"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc index ada74ef5ec7a..b7723e9f62f7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc @@ -293,8 +293,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_SPLINE_PARAMETER, "Spline Parameter", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_CURVE_SPLINE_PARAMETER, NODE_CLASS_INPUT); + ntype.ui_name = "Spline Parameter"; + ntype.ui_description = "Retrieve how far along each spline a control point is"; ntype.enum_name_legacy = "SPLINE_PARAMETER"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 0c88a192cb49..73bd134e26e8 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 @@ -92,7 +92,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_SPLINE_TYPE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Spline Type"; + ntype.ui_description = "Change the type of curves"; ntype.enum_name_legacy = "CURVE_SPLINE_TYPE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index 77fb34166ea3..13da866d0e35 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -106,8 +106,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - - geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_CURVE, "Subdivide Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Subdivide Curve"; + ntype.ui_description = "Dividing each curve segment into a specified number of pieces"; ntype.enum_name_legacy = "SUBDIVIDE_CURVE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc index 27498b7c220a..aba6d78b9921 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc @@ -134,7 +134,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_MESH, "Curve to Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curve to Mesh"; + ntype.ui_description = + "Convert curves into a mesh, optionally with a custom profile shape defined by curves"; ntype.enum_name_legacy = "CURVE_TO_MESH"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 2bc6b9d919e7..dd4089af1e64 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 @@ -373,7 +373,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TO_POINTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curve to Points"; + ntype.ui_description = "Generate a point cloud by sampling positions along curves"; ntype.enum_name_legacy = "CURVE_TO_POINTS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc index 55ff49c6c0b9..d312c10e3bae 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc @@ -115,8 +115,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT, "Curve of Point", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT, NODE_CLASS_INPUT); + ntype.ui_name = "Curve of Point"; + ntype.ui_description = "Retrieve the curve a control point is part of"; ntype.enum_name_legacy = "CURVE_OF_POINT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc index eee361ee2f86..5412508d09c3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc @@ -249,8 +249,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE, "Points of Curve", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE, NODE_CLASS_INPUT); + ntype.ui_name = "Points of Curve"; + ntype.ui_description = "Retrieve a point index within a curve"; ntype.enum_name_legacy = "POINTS_OF_CURVE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 cc794728fdcc..526da614810f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc @@ -260,7 +260,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TRIM_CURVE, "Trim Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TRIM_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Trim Curve"; + ntype.ui_description = "Shorten curves by removing portions at the start or end"; ntype.enum_name_legacy = "TRIM_CURVE"; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curves_to_grease_pencil.cc b/source/blender/nodes/geometry/nodes/node_geo_curves_to_grease_pencil.cc index b0ffb9a0da94..62aed9691a71 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curves_to_grease_pencil.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curves_to_grease_pencil.cc @@ -220,8 +220,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_CURVES_TO_GREASE_PENCIL, "Curves to Grease Pencil", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_CURVES_TO_GREASE_PENCIL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Curves to Grease Pencil"; + ntype.ui_description = "Convert the curves in each top-level instance into Grease Pencil layer"; ntype.enum_name_legacy = "CURVES_TO_GREASE_PENCIL"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 4ae6cf198d13..850f9da126cf 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 @@ -394,8 +394,11 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_DEFORM_CURVES_ON_SURFACE, "Deform Curves on Surface", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DEFORM_CURVES_ON_SURFACE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Deform Curves on Surface"; + ntype.ui_description = + "Translate and rotate curves based on changes between the object's original and evaluated " + "surface mesh"; ntype.enum_name_legacy = "DEFORM_CURVES_ON_SURFACE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 e5c1e41c190b..acc3ccd84e9b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -112,7 +112,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DELETE_GEOMETRY, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Delete Geometry"; + ntype.ui_description = "Remove selected elements of a geometry"; ntype.enum_name_legacy = "DELETE_GEOMETRY"; blender::bke::node_type_storage(&ntype, "NodeGeometryDeleteGeometry", diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_grid.cc index a673baad3843..799d2dcf46e7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_grid.cc @@ -253,10 +253,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_DISTRIBUTE_POINTS_IN_GRID, - "Distribute Points in Grid", - NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DISTRIBUTE_POINTS_IN_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Distribute Points in Grid"; + ntype.ui_description = "Generate points inside a volume grid"; ntype.enum_name_legacy = "DISTRIBUTE_POINTS_IN_GRID"; ntype.initfunc = node_init; blender::bke::node_type_size(&ntype, 170, 100, 320); 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 5f89a2d468e3..4e0c35a47c94 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 @@ -281,10 +281,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME, - "Distribute Points in Volume", - NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Distribute Points in Volume", + ntype.ui_description = "Generate points inside a volume"; ntype.enum_name_legacy = "DISTRIBUTE_POINTS_IN_VOLUME"; blender::bke::node_type_storage(&ntype, "NodeGeometryDistributePointsInVolume", 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 ad110c6eb960..bab78c492417 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 @@ -606,10 +606,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, - "Distribute Points on Faces", - NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Distribute Points on Faces"; + ntype.ui_description = "Generate points spread out on the surface of a mesh"; ntype.enum_name_legacy = "DISTRIBUTE_POINTS_ON_FACES"; blender::bke::node_type_size(&ntype, 170, 100, 320); ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc index be1e93f2c7a2..c29847fd165f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc @@ -932,7 +932,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_DUAL_MESH, "Dual Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DUAL_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Dual Mesh"; + ntype.ui_description = "Convert Faces into vertices and vertices into faces"; ntype.enum_name_legacy = "DUAL_MESH"; ntype.declare = node_declare; ntype.geometry_node_execute = 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 a79bb4409ac2..161919ac9981 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -1243,8 +1243,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_DUPLICATE_ELEMENTS, "Duplicate Elements", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_DUPLICATE_ELEMENTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Duplicate Elements"; + ntype.ui_description = "Generate an arbitrary number copies of each selected input element"; ntype.enum_name_legacy = "DUPLICATE_ELEMENTS"; blender::bke::node_type_storage(&ntype, "NodeGeometryDuplicateElements", diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_curves.cc index 4edd5a58c629..a984e5d3b957 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_curves.cc @@ -102,8 +102,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_EDGE_PATHS_TO_CURVES, "Edge Paths to Curves", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_EDGE_PATHS_TO_CURVES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Edge Paths to Curves"; + ntype.ui_description = "Output curves following paths across mesh edges"; ntype.enum_name_legacy = "EDGE_PATHS_TO_CURVES"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc index 3d8b3cbd28a6..01ecdef9da91 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc @@ -132,8 +132,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_EDGE_PATHS_TO_SELECTION, "Edge Paths to Selection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_EDGE_PATHS_TO_SELECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Edge Paths to Selection"; + ntype.ui_description = "Output a selection of edges by following paths across mesh edges"; ntype.enum_name_legacy = "EDGE_PATHS_TO_SELECTION"; ntype.declare = node_declare; blender::bke::node_type_size(&ntype, 150, 100, 300); diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc index 1e5ea6484324..211791a74c2c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc @@ -46,7 +46,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SPLIT_EDGES, "Split Edges", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SPLIT_EDGES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Split Edges"; + ntype.ui_description = "Duplicate mesh edges and break connections with the surrounding faces"; ntype.enum_name_legacy = "SPLIT_EDGES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_edges_to_face_groups.cc b/source/blender/nodes/geometry/nodes/node_geo_edges_to_face_groups.cc index e396d84b0ef5..8f569397952c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_edges_to_face_groups.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_edges_to_face_groups.cc @@ -102,8 +102,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_EDGES_TO_FACE_GROUPS, "Edges to Face Groups", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_EDGES_TO_FACE_GROUPS, NODE_CLASS_INPUT); + ntype.ui_name = "Edges to Face Groups"; + ntype.ui_description = "Group faces into regions surrounded by the selected boundary edges"; ntype.enum_name_legacy = "EDGES_TO_FACE_GROUPS"; ntype.geometry_node_execute = geo_node_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc b/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc index 541f0b8296c6..3a1f8893f695 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc @@ -98,8 +98,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_EVALUATE_AT_INDEX, "Evaluate at Index", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_EVALUATE_AT_INDEX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Evaluate at Index"; + ntype.ui_description = "Retrieve data of other elements in the context's geometry"; ntype.enum_name_legacy = "FIELD_AT_INDEX"; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_evaluate_on_domain.cc b/source/blender/nodes/geometry/nodes/node_geo_evaluate_on_domain.cc index 6aa6d0ad8c92..5df442fc3be3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_evaluate_on_domain.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_evaluate_on_domain.cc @@ -91,8 +91,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_EVALUATE_ON_DOMAIN, "Evaluate on Domain", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_EVALUATE_ON_DOMAIN, NODE_CLASS_CONVERTER); + ntype.ui_name = "Evaluate on Domain"; + ntype.ui_description = + "Retrieve values from a field on a different domain besides the domain from the context"; ntype.enum_name_legacy = "FIELD_ON_DOMAIN"; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; 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 e5ddabe5c3c5..f3e874ee3425 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc @@ -1541,7 +1541,11 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_EXTRUDE_MESH, "Extrude Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_EXTRUDE_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Extrude Mesh"; + ntype.ui_description = + "Generate new vertices, edges, or faces from selected elements and move them based on an " + "offset while keeping them connected by their boundary"; ntype.enum_name_legacy = "EXTRUDE_MESH"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc index f5c33413f0b8..fe6536e9b345 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc @@ -43,7 +43,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_FLIP_FACES, "Flip Faces", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_FLIP_FACES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Flip Faces"; + ntype.ui_description = + "Reverse the order of the vertices and edges of selected faces, flipping their normal " + "direction"; ntype.enum_name_legacy = "FLIP_FACES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc index edbecfc2afc0..9dcbc2c9752a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc @@ -199,10 +199,8 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT, - "For Each Geometry Element Input", - NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_INPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "For Each Geometry Element Input"; ntype.enum_name_legacy = "FOREACH_GEOMETRY_ELEMENT_INPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; @@ -372,10 +370,8 @@ static void node_extra_info(NodeExtraInfoParams ¶ms) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, - "For Each Geometry Element Output", - NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "For Each Geometry Element Output"; ntype.enum_name_legacy = "FOREACH_GEOMETRY_ELEMENT_OUTPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc b/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc index 597280cfc741..76891a093ba0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_geometry_to_instance.cc @@ -33,8 +33,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_GEOMETRY_TO_INSTANCE, "Geometry to Instance", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_GEOMETRY_TO_INSTANCE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Geometry to Instance"; + ntype.ui_description = + "Convert each input geometry into an instance, which can be much faster than the Join " + "Geometry node when the inputs are large"; ntype.enum_name_legacy = "GEOMETRY_TO_INSTANCE"; blender::bke::node_type_size(&ntype, 160, 100, 300); ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc index 50cb77de384f..50cc874293f8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_get_named_grid.cc @@ -95,7 +95,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_GET_NAMED_GRID, "Get Named Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_GET_NAMED_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Get Named Grid"; + ntype.ui_description = "Get volume grid from a volume geometry with the specified name"; ntype.enum_name_legacy = "GET_NAMED_GRID"; ntype.declare = node_declare; ntype.gather_link_search_ops = search_link_ops_for_volume_grid_node; diff --git a/source/blender/nodes/geometry/nodes/node_geo_gizmo_dial.cc b/source/blender/nodes/geometry/nodes/node_geo_gizmo_dial.cc index 32460d29da64..65e6758fde87 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_gizmo_dial.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_gizmo_dial.cc @@ -52,7 +52,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_GIZMO_DIAL, "Dial Gizmo", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_GIZMO_DIAL, NODE_CLASS_INTERFACE); + ntype.ui_name = "Dial Gizmo"; + ntype.ui_description = "Show a dial gizmo in the viewport for a value"; ntype.enum_name_legacy = "GIZMO_DIAL"; bke::node_type_storage( &ntype, "NodeGeometryDialGizmo", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_gizmo_linear.cc b/source/blender/nodes/geometry/nodes/node_geo_gizmo_linear.cc index 5c3a0defcf4f..addc79616c41 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_gizmo_linear.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_gizmo_linear.cc @@ -54,7 +54,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_GIZMO_LINEAR, "Linear Gizmo", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_GIZMO_LINEAR, NODE_CLASS_INTERFACE); + ntype.ui_name = "Linear Gizmo"; + ntype.ui_description = "Show a linear gizmo in the viewport for a value"; ntype.enum_name_legacy = "GIZMO_LINEAR"; bke::node_type_storage( &ntype, "NodeGeometryLinearGizmo", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_gizmo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_gizmo_transform.cc index 18ddb1bf6996..9a6efd9e8eba 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_gizmo_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_gizmo_transform.cc @@ -67,7 +67,9 @@ static void node_layout_ex(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) static void node_register() { static bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_GIZMO_TRANSFORM, "Transform Gizmo", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_GIZMO_TRANSFORM, NODE_CLASS_INTERFACE); + ntype.ui_name = "Transform Gizmo"; + ntype.ui_description = "Show a transform gizmo in the viewport"; ntype.enum_name_legacy = "GIZMO_TRANSFORM"; bke::node_type_storage(&ntype, "NodeGeometryTransformGizmo", diff --git a/source/blender/nodes/geometry/nodes/node_geo_grease_pencil_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_grease_pencil_to_curves.cc index b829ef010cc1..78e67ff4b51e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_grease_pencil_to_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_grease_pencil_to_curves.cc @@ -141,8 +141,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_GREASE_PENCIL_TO_CURVES, "Grease Pencil to Curves", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_GREASE_PENCIL_TO_CURVES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Grease Pencil to Curves"; + ntype.ui_description = "Convert Grease Pencil layers into curve instances"; ntype.enum_name_legacy = "GREASE_PENCIL_TO_CURVES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_grid_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_grid_to_mesh.cc index 2f62318740eb..8849845540bc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_grid_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_grid_to_mesh.cc @@ -47,7 +47,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_GRID_TO_MESH, "Grid to Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_GRID_TO_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Grid to Mesh"; + ntype.ui_description = "Generate a mesh on the \"surface\" of a volume grid"; ntype.enum_name_legacy = "GRID_TO_MESH"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_image.cc b/source/blender/nodes/geometry/nodes/node_geo_image.cc index cb12af237480..4e179d65c0f2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image.cc @@ -30,7 +30,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMAGE, "Image", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IMAGE, NODE_CLASS_INPUT); + ntype.ui_name = "Image"; + ntype.ui_description = "Input an image data-block"; ntype.enum_name_legacy = "IMAGE"; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_info.cc b/source/blender/nodes/geometry/nodes/node_geo_image_info.cc index ca91ef506b33..6f771974d070 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_info.cc @@ -77,7 +77,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMAGE_INFO, "Image Info", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IMAGE_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Image Info"; + ntype.ui_description = "Retrieve information about an image"; ntype.enum_name_legacy = "IMAGE_INFO"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 ee2d7ce3bfed..d0b70089cc6c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc @@ -419,7 +419,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMAGE_TEXTURE, "Image Texture", NODE_CLASS_TEXTURE); + geo_node_type_base(&ntype, GEO_NODE_IMAGE_TEXTURE, NODE_CLASS_TEXTURE); + ntype.ui_name = "Image Texture"; + ntype.ui_description = "Sample values from an image texture"; ntype.enum_name_legacy = "IMAGE_TEXTURE"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_import_obj.cc b/source/blender/nodes/geometry/nodes/node_geo_import_obj.cc index bdbe034b060e..ee5162373caa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_import_obj.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_import_obj.cc @@ -82,7 +82,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMPORT_OBJ, "Import OBJ", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IMPORT_OBJ, NODE_CLASS_INPUT); + ntype.ui_name = "Import OBJ"; + ntype.ui_description = "Import geometry from an OBJ file"; ntype.enum_name_legacy = "IMPORT_OBJ"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_import_ply.cc b/source/blender/nodes/geometry/nodes/node_geo_import_ply.cc index e474d92a61d3..a6a71d39f32a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_import_ply.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_import_ply.cc @@ -70,7 +70,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMPORT_PLY, "Import PLY", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IMPORT_PLY, NODE_CLASS_INPUT); + ntype.ui_name = "Import PLY"; + ntype.ui_description = "Import a point cloud from a PLY file"; ntype.enum_name_legacy = "IMPORT_PLY"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_import_stl.cc b/source/blender/nodes/geometry/nodes/node_geo_import_stl.cc index 60096388b9fc..b7ae07bac670 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_import_stl.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_import_stl.cc @@ -73,7 +73,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IMPORT_STL, "Import STL", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IMPORT_STL, NODE_CLASS_INPUT); + ntype.ui_name = "Import STL"; + ntype.ui_description = "Import a mesh from an STL file"; ntype.enum_name_legacy = "IMPORT_STL"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_index_of_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_index_of_nearest.cc index 814ec269ba6b..e849696c0bdc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_index_of_nearest.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_index_of_nearest.cc @@ -245,7 +245,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INDEX_OF_NEAREST, "Index of Nearest", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_INDEX_OF_NEAREST, NODE_CLASS_CONVERTER); + ntype.ui_name = "Index of Nearest"; + ntype.ui_description = + "Find the nearest element in a group. Similar to the \"Sample Nearest\" node"; ntype.enum_name_legacy = "INDEX_OF_NEAREST"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc index 6da58f3ce7fe..ace89aa88b03 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc @@ -370,7 +370,9 @@ static void register_node() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INDEX_SWITCH, "Index Switch", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_INDEX_SWITCH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Index Switch"; + ntype.ui_description = "Choose between an arbitrary number of values with an index"; ntype.enum_name_legacy = "INDEX_SWITCH"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_active_camera.cc b/source/blender/nodes/geometry/nodes/node_geo_input_active_camera.cc index 74ffc736c7ad..efde1f262ebf 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_active_camera.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_active_camera.cc @@ -24,7 +24,9 @@ static void node_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_ACTIVE_CAMERA, "Active Camera", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_ACTIVE_CAMERA, NODE_CLASS_INPUT); + ntype.ui_name = "Active Camera"; + ntype.ui_description = "Retrieve the scene's active camera"; ntype.enum_name_legacy = "INPUT_ACTIVE_CAMERA"; ntype.geometry_node_execute = node_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_collection.cc b/source/blender/nodes/geometry/nodes/node_geo_input_collection.cc index d2318353c4ba..060cc8921eb5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_collection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_collection.cc @@ -29,7 +29,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_COLLECTION, "Collection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_COLLECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Collection"; + ntype.ui_description = "Output a single collection"; ntype.enum_name_legacy = "INPUT_COLLECTION"; ntype.draw_buttons = node_layout; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc index a3db1aa4b89e..91b2d34fac3b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc @@ -118,8 +118,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_CURVE_HANDLES, "Curve Handle Positions", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_CURVE_HANDLES, NODE_CLASS_INPUT); + ntype.ui_name = "Curve Handle Positions"; + ntype.ui_description = "Retrieve the position of each Bézier control point's handles"; ntype.enum_name_legacy = "INPUT_CURVE_HANDLES"; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc b/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc index e408ab2ba3a3..ed462beaa7b1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_curve_tilt.cc @@ -21,7 +21,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_CURVE_TILT, "Curve Tilt", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_CURVE_TILT, NODE_CLASS_INPUT); + ntype.ui_name = "Curve Tilt"; + ntype.ui_description = + "Retrieve the angle at each control point used to twist the curve's normal around its " + "tangent"; ntype.enum_name_legacy = "INPUT_CURVE_TILT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_edge_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_input_edge_smooth.cc index 3b03aed7d8a7..64b6772a2e15 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_edge_smooth.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_edge_smooth.cc @@ -21,7 +21,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_EDGE_SMOOTH, "Is Edge Smooth", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_EDGE_SMOOTH, NODE_CLASS_INPUT); + ntype.ui_name = "Is Edge Smooth"; + ntype.ui_description = "Retrieve whether each edge is marked for smooth or split normals"; ntype.enum_name_legacy = "INPUT_EDGE_SMOOTH"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_face_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_input_face_smooth.cc index 88f174d9fa97..9d7b6a622369 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_face_smooth.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_face_smooth.cc @@ -21,7 +21,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_FACE_SMOOTH, "Is Face Smooth", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_FACE_SMOOTH, NODE_CLASS_INPUT); + ntype.ui_name = "Is Face Smooth"; + ntype.ui_description = "Retrieve whether each face is marked for smooth or sharp normals"; ntype.enum_name_legacy = "INPUT_SHADE_SMOOTH"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_id.cc b/source/blender/nodes/geometry/nodes/node_geo_input_id.cc index c0f66f28ef83..9710f3e8e2b8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_id.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_id.cc @@ -23,7 +23,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_ID, "ID", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_ID, NODE_CLASS_INPUT); + ntype.ui_name = "ID"; + ntype.ui_description = + "Retrieve a stable random identifier value from the \"id\" attribute on the point domain, " + "or the index if the attribute does not exist"; ntype.enum_name_legacy = "INPUT_ID"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc index b3151e631651..8e4892bc546c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc @@ -21,7 +21,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_INDEX, "Index", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_INDEX, NODE_CLASS_INPUT); + ntype.ui_name = "Index"; + ntype.ui_description = + "Retrieve an integer value indicating the position of each element in the list, starting at " + "zero"; ntype.enum_name_legacy = "INDEX"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_instance_rotation.cc b/source/blender/nodes/geometry/nodes/node_geo_input_instance_rotation.cc index 25f8f4ebfeab..14e5c043ada1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_instance_rotation.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_instance_rotation.cc @@ -51,8 +51,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_INSTANCE_ROTATION, "Instance Rotation", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_INSTANCE_ROTATION, NODE_CLASS_INPUT); + ntype.ui_name = "Instance Rotation"; + ntype.ui_description = "Retrieve the rotation of each instance in the geometry"; ntype.enum_name_legacy = "INPUT_INSTANCE_ROTATION"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_instance_scale.cc b/source/blender/nodes/geometry/nodes/node_geo_input_instance_scale.cc index 9af01f433cb6..edc404094d2b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_instance_scale.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_instance_scale.cc @@ -48,7 +48,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_INSTANCE_SCALE, "Instance Scale", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_INSTANCE_SCALE, NODE_CLASS_INPUT); + ntype.ui_name = "Instance Scale"; + ntype.ui_description = "Retrieve the scale of each instance in the geometry"; ntype.enum_name_legacy = "INPUT_INSTANCE_SCALE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_instance_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_input_instance_transform.cc index bdd16bb67522..2e4282f4cd56 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_instance_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_instance_transform.cc @@ -23,8 +23,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_INSTANCE_TRANSFORM, "Instance Transform", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_INSTANCE_TRANSFORM, NODE_CLASS_INPUT); + ntype.ui_name = "Instance Transform"; + ntype.ui_description = "Retrieve the full transformation of each instance in the geometry"; ntype.enum_name_legacy = "INPUT_INSTANCE_TRANSFORM"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_material.cc b/source/blender/nodes/geometry/nodes/node_geo_input_material.cc index 996cfdfefad2..90568a4e6733 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_material.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_material.cc @@ -29,7 +29,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL, "Material", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL, NODE_CLASS_INPUT); + ntype.ui_name = "Material"; + ntype.ui_description = "Output a single material"; ntype.enum_name_legacy = "INPUT_MATERIAL"; ntype.draw_buttons = node_layout; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc b/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc index 580a2a93b417..fd9be74e480f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_material_index.cc @@ -21,7 +21,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL_INDEX, "Material Index", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MATERIAL_INDEX, NODE_CLASS_INPUT); + ntype.ui_name = "Material Index"; + ntype.ui_description = + "Retrieve the index of the material used for each element in the geometry's list of " + "materials"; ntype.enum_name_legacy = "INPUT_MATERIAL_INDEX"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc index 265fc1094fe6..2c0ebd5f7c64 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc @@ -190,7 +190,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_ANGLE, "Edge Angle", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_ANGLE, NODE_CLASS_INPUT); + ntype.ui_name = "Edge Angle"; + ntype.ui_description = "The angle between the normals of connected manifold faces"; ntype.enum_name_legacy = "MESH_EDGE_ANGLE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc index 8789a02c09b5..8c5b25623554 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc @@ -4,7 +4,7 @@ #include "BLI_array_utils.hh" -#include "BKE_mesh.hh" +#include "DNA_mesh_types.h" #include "node_geometry_util.hh" @@ -61,8 +61,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, "Edge Neighbors", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS, NODE_CLASS_INPUT); + ntype.ui_name = "Edge Neighbors"; + ntype.ui_description = "Retrieve the number of faces that use each edge as one of their sides"; ntype.enum_name_legacy = "MESH_EDGE_NEIGHBORS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc index 49128226d93a..8eee1e468714 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc @@ -2,7 +2,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include "BKE_mesh.hh" +#include "DNA_mesh_types.h" #include "node_geometry_util.hh" @@ -153,7 +153,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_VERTICES, "Edge Vertices", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_EDGE_VERTICES, NODE_CLASS_INPUT); + ntype.ui_name = "Edge Vertices"; + ntype.ui_description = "Retrieve topology information relating to each edge of a mesh"; ntype.enum_name_legacy = "MESH_EDGE_VERTICES"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc index 80c04cb00787..c47b27d51d66 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc @@ -69,7 +69,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_AREA, "Face Area", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_AREA, NODE_CLASS_INPUT); + ntype.ui_name = "Face Area"; + ntype.ui_description = "Calculate the surface area of a mesh's faces"; ntype.enum_name_legacy = "MESH_FACE_AREA"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc index 4f69e321a6c5..105c788d1cfd 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc @@ -4,7 +4,7 @@ #include "BLI_math_vector.hh" -#include "BKE_mesh.hh" +#include "DNA_mesh_types.h" #include "node_geometry_util.hh" @@ -111,8 +111,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_FACE_IS_PLANAR, "Is Face Planar", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_IS_PLANAR, NODE_CLASS_INPUT); + ntype.ui_name = "Is Face Planar"; + ntype.ui_description = + "Retrieve whether all triangles in a face are on the same plane, i.e. whether they have the " + "same normal"; ntype.enum_name_legacy = "MESH_FACE_IS_PLANAR"; ntype.geometry_node_execute = geo_node_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc index 794f5c13ec39..b7542ad6f1fb 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc @@ -154,8 +154,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, "Face Neighbors", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_FACE_NEIGHBORS, NODE_CLASS_INPUT); + ntype.ui_name = "Face Neighbors"; + ntype.ui_description = "Retrieve topology information relating to each face of a mesh"; ntype.enum_name_legacy = "MESH_FACE_NEIGHBORS"; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc index b84a5f0ec90a..cd009d1032a4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc @@ -123,7 +123,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_ISLAND, "Mesh Island", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_ISLAND, NODE_CLASS_INPUT); + ntype.ui_name = "Mesh Island"; + ntype.ui_description = "Retrieve information about separate connected regions in a mesh"; ntype.enum_name_legacy = "MESH_ISLAND"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc index f36c334b2ca9..b7f094aa5415 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_vertex_neighbors.cc @@ -106,8 +106,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, "Vertex Neighbors", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS, NODE_CLASS_INPUT); + ntype.ui_name = "Vertex Neighbors"; + ntype.ui_description = "Retrieve topology information relating to each vertex of a mesh"; ntype.enum_name_legacy = "MESH_VERTEX_NEIGHBORS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 c8b5e36821a7..7f59f73e458c 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 @@ -121,7 +121,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_NAMED_ATTRIBUTE, "Named Attribute", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_NAMED_ATTRIBUTE, NODE_CLASS_INPUT); + ntype.ui_name = "Named Attribute"; + ntype.ui_description = "Retrieve the data of a specified attribute"; ntype.enum_name_legacy = "INPUT_ATTRIBUTE"; ntype.geometry_node_execute = node_geo_exec; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_named_layer_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_input_named_layer_selection.cc index 495dbcf64c87..6c3d028393fe 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_named_layer_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_named_layer_selection.cc @@ -33,8 +33,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_NAMED_LAYER_SELECTION, "Named Layer Selection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_NAMED_LAYER_SELECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Named Layer Selection"; + ntype.ui_description = "Output a selection of a Grease Pencil layer"; ntype.enum_name_legacy = "INPUT_NAMED_LAYER_SELECTION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc index 73a6d8511d6a..1f67b03e6be2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc @@ -21,7 +21,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_NORMAL, "Normal", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_NORMAL, NODE_CLASS_INPUT); + ntype.ui_name = "Normal"; + ntype.ui_description = + "Retrieve a unit length vector indicating the direction pointing away from the geometry at " + "each element"; ntype.enum_name_legacy = "INPUT_NORMAL"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_object.cc b/source/blender/nodes/geometry/nodes/node_geo_input_object.cc index 7e1207949582..c4bb3e11da3d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_object.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_object.cc @@ -29,7 +29,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_OBJECT, "Object", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_OBJECT, NODE_CLASS_INPUT); + ntype.ui_name = "Object"; + ntype.ui_description = "Output a single object"; ntype.enum_name_legacy = "INPUT_OBJECT"; ntype.draw_buttons = node_layout; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc index 6fc52524b19b..ec9caaca752b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc @@ -21,7 +21,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_POSITION, "Position", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_POSITION, NODE_CLASS_INPUT); + ntype.ui_name = "Position"; + ntype.ui_description = "Retrieve a vector indicating the location of each element"; ntype.enum_name_legacy = "POSITION"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc index e880fc3ace91..6faec5230595 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_radius.cc @@ -21,7 +21,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_RADIUS, "Radius", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_RADIUS, NODE_CLASS_INPUT); + ntype.ui_name = "Radius"; + ntype.ui_description = "Retrieve the radius at each point on curve or point cloud geometry"; ntype.enum_name_legacy = "INPUT_RADIUS"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc b/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc index 0efc09d41ad2..4a1b7ac5d038 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_scene_time.cc @@ -28,7 +28,10 @@ static void node_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SCENE_TIME, "Scene Time", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SCENE_TIME, NODE_CLASS_INPUT); + ntype.ui_name = "Scene Time"; + ntype.ui_description = + "Retrieve the current time in the scene's animation in units of seconds or frames"; ntype.enum_name_legacy = "INPUT_SCENE_TIME"; ntype.geometry_node_execute = node_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc index 2fda65f17910..116444496675 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc @@ -5,9 +5,7 @@ #include #include "BLI_array_utils.hh" -#include "BLI_map.hh" #include "BLI_math_vector_types.hh" -#include "BLI_set.hh" #include "BLI_task.hh" #include "BKE_mesh.hh" @@ -264,8 +262,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_SHORTEST_EDGE_PATHS, "Shortest Edge Paths", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SHORTEST_EDGE_PATHS, NODE_CLASS_INPUT); + ntype.ui_name = "Shortest Edge Paths"; + ntype.ui_description = + "Find the shortest paths along mesh edges to selected end vertices, with customizable cost " + "per edge"; ntype.enum_name_legacy = "SHORTEST_EDGE_PATHS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc index f2903e76aeef..39d29d29fe04 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_cyclic.cc @@ -21,7 +21,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_CYCLIC, "Is Spline Cyclic", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_CYCLIC, NODE_CLASS_INPUT); + ntype.ui_name = "Is Spline Cyclic"; + ntype.ui_description = "Retrieve whether each spline endpoint connects to the beginning"; ntype.enum_name_legacy = "INPUT_SPLINE_CYCLIC"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc index f5733d063dd2..5a5ac0cd3822 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc @@ -78,7 +78,10 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_LENGTH, "Spline Length", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_LENGTH, NODE_CLASS_INPUT); + ntype.ui_name = "Spline Length"; + ntype.ui_description = + "Retrieve the total length of each spline, as a distance or as a number of points"; ntype.enum_name_legacy = "SPLINE_LENGTH"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc index e8fc50aa6f74..118aafe65364 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_resolution.cc @@ -52,8 +52,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INPUT_SPLINE_RESOLUTION, "Spline Resolution", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_SPLINE_RESOLUTION, NODE_CLASS_INPUT); + ntype.ui_name = "Spline Resolution"; + ntype.ui_description = + "Retrieve the number of evaluated points that will be generated for every control point on " + "curves"; ntype.enum_name_legacy = "INPUT_SPLINE_RESOLUTION"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc index 2765281972a3..d74ba6744bb3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc @@ -131,7 +131,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_INPUT_TANGENT, "Curve Tangent", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_INPUT_TANGENT, NODE_CLASS_INPUT); + ntype.ui_name = "Curve Tangent"; + ntype.ui_description = "Retrieve the direction of curves at each control point"; ntype.enum_name_legacy = "INPUT_TANGENT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index 6bacac0ef0a7..ee51d3715f40 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -7,7 +7,6 @@ #include "BLI_math_matrix.hh" #include "BLI_task.hh" -#include "BKE_attribute_math.hh" #include "BKE_curves.hh" #include "BKE_grease_pencil.hh" #include "BKE_instances.hh" @@ -289,8 +288,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INSTANCE_ON_POINTS, "Instance on Points", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_INSTANCE_ON_POINTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Instance on Points"; + ntype.ui_description = + "Generate a reference to geometry at each of the input points, without duplicating its " + "underlying data"; ntype.enum_name_legacy = "INSTANCE_ON_POINTS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc index db504e1af22b..15abd5e5d49e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc @@ -6,7 +6,6 @@ #include "DNA_pointcloud_types.h" -#include "BKE_attribute_math.hh" #include "BKE_instances.hh" #include "BKE_pointcloud.hh" @@ -111,8 +110,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INSTANCES_TO_POINTS, "Instances to Points", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_INSTANCES_TO_POINTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Instances to Points"; + ntype.ui_description = + "Generate points at the origins of instances.\nNote: Nested instances are not affected by " + "this node"; ntype.enum_name_legacy = "INSTANCES_TO_POINTS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc index d173bc1c3ef0..3eb5a4133065 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc @@ -871,8 +871,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_INTERPOLATE_CURVES, "Interpolate Curves", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_INTERPOLATE_CURVES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Interpolate Curves"; + ntype.ui_description = "Generate new curves on points by interpolating between existing curves"; ntype.enum_name_legacy = "INTERPOLATE_CURVES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc b/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc index a6265ba44eeb..b91dbde3e923 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_is_viewport.cc @@ -26,7 +26,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_IS_VIEWPORT, "Is Viewport", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_IS_VIEWPORT, NODE_CLASS_INPUT); + ntype.ui_name = "Is Viewport"; + ntype.ui_description = + "Retrieve whether the nodes are being evaluated for the viewport rather than the final " + "render"; ntype.enum_name_legacy = "IS_VIEWPORT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 66fc82d9d5ec..18cc7fc0b55d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -33,7 +33,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, "Join Geometry", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_JOIN_GEOMETRY, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Join Geometry"; + ntype.ui_description = "Merge separately generated geometries into a single one"; ntype.enum_name_legacy = "JOIN_GEOMETRY"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc index a63706f2e531..f8ad2583dd43 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_material_replace.cc @@ -55,7 +55,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REPLACE_MATERIAL, "Replace Material", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_REPLACE_MATERIAL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Replace Material"; + ntype.ui_description = "Swap one material with another"; ntype.enum_name_legacy = "REPLACE_MATERIAL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc index 54689cee500b..8fb5278ca644 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc @@ -161,8 +161,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MATERIAL_SELECTION, "Material Selection", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MATERIAL_SELECTION, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Material Selection"; + ntype.ui_description = "Provide a selection of faces that use the specified material"; ntype.enum_name_legacy = "MATERIAL_SELECTION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc index 058b569cec44..c248aa5bb8ec 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc @@ -2,14 +2,10 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include - #include "node_geometry_util.hh" #include "DNA_node_types.h" -#include "BLI_string.h" - #include "FN_multi_function.hh" #include "UI_interface.hh" @@ -411,7 +407,9 @@ static void register_node() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MENU_SWITCH, "Menu Switch", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_MENU_SWITCH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Menu Switch"; + ntype.ui_description = "Select from multiple inputs by name"; ntype.enum_name_legacy = "MENU_SWITCH"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 c512f1883f42..6017b10451a8 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 @@ -159,7 +159,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MERGE_BY_DISTANCE, "Merge by Distance", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MERGE_BY_DISTANCE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Merge by Distance"; + ntype.ui_description = "Merge vertices or points within a given distance"; ntype.enum_name_legacy = "MERGE_BY_DISTANCE"; ntype.initfunc = node_init; blender::bke::node_type_storage(&ntype, diff --git a/source/blender/nodes/geometry/nodes/node_geo_merge_layers.cc b/source/blender/nodes/geometry/nodes/node_geo_merge_layers.cc index 270a1943bb5a..6d430c3d7b0a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_merge_layers.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_merge_layers.cc @@ -198,7 +198,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MERGE_LAYERS, "Merge Layers", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MERGE_LAYERS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Merge Layers"; + ntype.ui_description = "Join groups of Grease Pencil layers into one"; ntype.enum_name_legacy = "MERGE_LAYERS"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_face_group_boundaries.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_face_group_boundaries.cc index ac1d9d23499f..d30e21c19eca 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_face_group_boundaries.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_face_group_boundaries.cc @@ -4,7 +4,7 @@ #include -#include "BKE_mesh.hh" +#include "DNA_mesh_types.h" #include "node_geometry_util.hh" @@ -125,8 +125,10 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_FACE_GROUP_BOUNDARIES, "Face Group Boundaries", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_FACE_GROUP_BOUNDARIES, NODE_CLASS_INPUT); + ntype.ui_name = "Face Group Boundaries"; + ntype.ui_description = + "Find edges on the boundaries between groups of faces with the same ID value"; ntype.enum_name_legacy = "MESH_FACE_SET_BOUNDARIES"; bke::node_type_size_preset(&ntype, bke::eNodeSizePreset::Middle); ntype.declare = node_declare; 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 9b90b83cdd4d..fc6a8ce48a3a 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 @@ -221,7 +221,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CIRCLE, "Mesh Circle", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CIRCLE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh Circle"; + ntype.ui_description = "Generate a circular ring of edges"; ntype.enum_name_legacy = "MESH_PRIMITIVE_CIRCLE"; ntype.initfunc = node_init; blender::bke::node_type_storage( 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 9bd0204d030a..6f514ef49acd 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 @@ -153,7 +153,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CONE, "Cone", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CONE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Cone"; + ntype.ui_description = "Generate a cone mesh"; ntype.enum_name_legacy = "MESH_PRIMITIVE_CONE"; ntype.initfunc = node_init; blender::bke::node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index e0087f230343..c53b3c701749 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -115,7 +115,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CUBE, "Cube", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CUBE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Cube"; + ntype.ui_description = "Generate a cuboid mesh with variable side lengths and subdivisions"; ntype.enum_name_legacy = "MESH_PRIMITIVE_CUBE"; ntype.declare = node_declare; ntype.geometry_node_execute = 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 929eef7142d0..6ffe2de9be5a 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 @@ -143,7 +143,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Cylinder", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Cylinder"; + ntype.ui_description = "Generate a cylinder mesh"; ntype.enum_name_legacy = "MESH_PRIMITIVE_CYLINDER"; ntype.initfunc = node_init; blender::bke::node_type_storage( 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 7767b9f4461c..4a5459d9f34c 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 @@ -60,7 +60,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_GRID, "Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Grid"; + ntype.ui_description = "Generate a planar mesh on the XY plane"; ntype.enum_name_legacy = "MESH_PRIMITIVE_GRID"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc index 45e758e312e0..56814d4123b8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc @@ -134,8 +134,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, "Ico Sphere", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Ico Sphere"; + ntype.ui_description = "Generate a spherical mesh that consists of equally sized triangles"; ntype.enum_name_legacy = "MESH_PRIMITIVE_ICO_SPHERE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 4decf3d36a11..c748ebe1c730 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 @@ -222,7 +222,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_LINE, "Mesh Line", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_LINE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh Line"; + ntype.ui_description = "Generate vertices in a line and connect them with edges"; ntype.enum_name_legacy = "MESH_PRIMITIVE_LINE"; ntype.declare = node_declare; ntype.initfunc = node_init; 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 01b604c55691..7b3b798cfa40 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 @@ -57,7 +57,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, "UV Sphere", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "UV Sphere"; + ntype.ui_description = + "Generate a spherical mesh with quads, except for triangles at the top and bottom"; ntype.enum_name_legacy = "MESH_PRIMITIVE_UV_SPHERE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc index 41b2c14463aa..cd9514232793 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_subdivide.cc @@ -80,7 +80,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_MESH, "Subdivide Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SUBDIVIDE_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Subdivide Mesh"; + ntype.ui_description = + "Divide mesh faces into smaller ones without changing the shape or volume, using linear " + "interpolation to place the new vertices"; ntype.enum_name_legacy = "SUBDIVIDE_MESH"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc index b1f707c832c4..acdafe976c30 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc @@ -51,7 +51,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_CURVE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh to Curve"; + ntype.ui_description = "Generate a curve from a mesh"; ntype.enum_name_legacy = "MESH_TO_CURVE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_density_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_density_grid.cc index bfcaf339de43..c2db27c76bde 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_density_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_density_grid.cc @@ -57,8 +57,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TO_DENSITY_GRID, "Mesh to Density Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_DENSITY_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh to Density Grid"; + ntype.ui_description = "Create a filled volume grid from a mesh"; ntype.enum_name_legacy = "MESH_TO_DENSITY_GRID"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 40a367e1e3fa..5c0f951f62dc 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 @@ -241,7 +241,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_POINTS, "Mesh to Points", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_POINTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh to Points"; + ntype.ui_description = "Generate a point cloud from a mesh's vertices"; ntype.enum_name_legacy = "MESH_TO_POINTS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_grid.cc index 2f44669f8412..fb748c7751aa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_sdf_grid.cc @@ -52,7 +52,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_SDF_GRID, "Mesh to SDF Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_SDF_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh to SDF Grid"; + ntype.ui_description = "Create a signed distance volume grid from a mesh"; ntype.enum_name_legacy = "MESH_TO_SDF_GRID"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 e755a43cc0e3..423c49a5fff3 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 @@ -162,7 +162,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_TO_VOLUME, "Mesh to Volume", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_MESH_TO_VOLUME, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Mesh to Volume"; + ntype.ui_description = "Create a fog volume with the shape of the input mesh's surface"; ntype.enum_name_legacy = "MESH_TO_VOLUME"; ntype.declare = node_declare; bke::node_type_size(&ntype, 200, 120, 700); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_edge.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_edge.cc index 605cf1a1ddf6..5b96be03230c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_edge.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_edge.cc @@ -190,8 +190,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE, "Corners of Edge", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE, NODE_CLASS_INPUT); + ntype.ui_name = "Corners of Edge"; + ntype.ui_description = "Retrieve face corners connected to edges"; ntype.enum_name_legacy = "CORNERS_OF_EDGE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc index 675e959fb79a..5b2c7f871a2f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc @@ -192,8 +192,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_FACE, "Corners of Face", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_FACE, NODE_CLASS_INPUT); + ntype.ui_name = "Corners of Face"; + ntype.ui_description = "Retrieve corners that make up a face"; ntype.enum_name_legacy = "CORNERS_OF_FACE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc index e078c9ef0b61..56411b12e759 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc @@ -197,8 +197,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX, "Corners of Vertex", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX, NODE_CLASS_INPUT); + ntype.ui_name = "Corners of Vertex"; + ntype.ui_description = "Retrieve face corners connected to vertices"; ntype.enum_name_legacy = "CORNERS_OF_VERTEX"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc index 0d07c4e4b274..d2e3e242d77f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc @@ -119,8 +119,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_CORNER, "Edges of Corner", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_CORNER, NODE_CLASS_INPUT); + ntype.ui_name = "Edges of Corner"; + ntype.ui_description = "Retrieve the edges on both sides of a face corner"; ntype.enum_name_legacy = "EDGES_OF_CORNER"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc index c99cdee838f8..c66e36263921 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc @@ -203,8 +203,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX, "Edges of Vertex", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX, NODE_CLASS_INPUT); + ntype.ui_name = "Edges of Vertex"; + ntype.ui_description = "Retrieve the edges connected to each vertex"; ntype.enum_name_legacy = "EDGES_OF_VERTEX"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_face_of_corner.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_face_of_corner.cc index 5f46bcfc5642..29e7da07d073 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_face_of_corner.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_face_of_corner.cc @@ -109,8 +109,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER, "Face of Corner", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER, NODE_CLASS_INPUT); + ntype.ui_name = "Face of Corner"; + ntype.ui_description = "Retrieve the face each face corner is part of"; ntype.enum_name_legacy = "FACE_OF_CORNER"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc index 404b044a6700..fc4e3eae7093 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc @@ -107,10 +107,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, - GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE, - "Offset Corner in Face", - NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE, NODE_CLASS_INPUT); + ntype.ui_name = "Offset Corner in Face"; + ntype.ui_description = "Retrieve corners in the same face as another"; ntype.enum_name_legacy = "OFFSET_CORNER_IN_FACE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_vertex_of_corner.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_vertex_of_corner.cc index 196d325607ae..87fe8fe8cdb7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_vertex_of_corner.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_vertex_of_corner.cc @@ -65,8 +65,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, "Vertex of Corner", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, NODE_CLASS_INPUT); + ntype.ui_name = "Vertex of Corner"; + ntype.ui_description = "Retrieve the vertex each face corner is attached to"; ntype.enum_name_legacy = "VERTEX_OF_CORNER"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_mouse_position.cc b/source/blender/nodes/geometry/nodes/node_geo_mouse_position.cc index 6f88b37eddcd..38ad5f31fd22 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mouse_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mouse_position.cc @@ -32,7 +32,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_MOUSE_POSITION, "Mouse Position", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_MOUSE_POSITION, NODE_CLASS_INPUT); + ntype.ui_name = "Mouse Position"; + ntype.ui_description = "Retrieve the position of the mouse cursor"; ntype.enum_name_legacy = "TOOL_MOUSE_POSITION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 07238d257b43..ab65a5298695 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc @@ -199,7 +199,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_OBJECT_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Object Info"; + ntype.ui_description = "Retrieve information from an object"; ntype.enum_name_legacy = "OBJECT_INFO"; ntype.initfunc = node_node_init; blender::bke::node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_offset_point_in_curve.cc b/source/blender/nodes/geometry/nodes/node_geo_offset_point_in_curve.cc index eb501b1e4935..d811d06ddfea 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_offset_point_in_curve.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_offset_point_in_curve.cc @@ -182,8 +182,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_OFFSET_POINT_IN_CURVE, "Offset Point in Curve", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_OFFSET_POINT_IN_CURVE, NODE_CLASS_INPUT); + ntype.ui_name = "Offset Point in Curve"; + ntype.ui_description = "Offset a control point index within its curve"; ntype.enum_name_legacy = "OFFSET_POINT_IN_CURVE"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points.cc b/source/blender/nodes/geometry/nodes/node_geo_points.cc index 9ba18ae6c6a7..2270c91d8e58 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points.cc @@ -2,6 +2,8 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include + #include "BKE_pointcloud.hh" #include "DNA_pointcloud_types.h" @@ -87,7 +89,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_POINTS, "Points", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_POINTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Points"; + ntype.ui_description = "Generate a point cloud with positions and radii defined by fields"; ntype.enum_name_legacy = "POINTS"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_curves.cc index 8056a4a306ad..e7cff28695f8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_curves.cc @@ -192,7 +192,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_CURVES, "Points to Curves", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_CURVES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Points to Curves"; + ntype.ui_description = "Split all points to curve by its group ID and reorder by weight"; ntype.enum_name_legacy = "POINTS_TO_CURVES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_grid.cc index 73311bd1b05e..80e69416dc61 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_sdf_grid.cc @@ -107,8 +107,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_POINTS_TO_SDF_GRID, "Points to SDF Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_SDF_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Points to SDF Grid"; + ntype.ui_description = "Create a signed distance volume grid from points"; ntype.enum_name_legacy = "POINTS_TO_SDF_GRID"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc index b2d005dd8e98..9d66230b7912 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc @@ -103,8 +103,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_POINTS_TO_VERTICES, "Points to Vertices", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_VERTICES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Points to Vertices"; + ntype.ui_description = "Generate a mesh vertex for each point cloud point"; ntype.enum_name_legacy = "POINTS_TO_VERTICES"; ntype.declare = node_declare; ntype.geometry_node_execute = 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 1038bffd0083..800d963c50a8 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 @@ -219,7 +219,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_VOLUME, "Points to Volume", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_POINTS_TO_VOLUME, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Points to Volume"; + ntype.ui_description = "Generate a fog volume sphere around every point"; ntype.enum_name_legacy = "POINTS_TO_VOLUME"; blender::bke::node_type_storage(&ntype, "NodeGeometryPointsToVolume", diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc index 752904f628cf..7a411bed4742 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc @@ -308,7 +308,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_PROXIMITY, "Geometry Proximity", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_PROXIMITY, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Geometry Proximity"; + ntype.ui_description = "Compute the closest location on the target geometry"; ntype.enum_name_legacy = "PROXIMITY"; ntype.initfunc = geo_proximity_init; blender::bke::node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index e460674b830a..d308e843d0f3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -302,7 +302,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_RAYCAST, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Raycast"; + ntype.ui_description = + "Cast rays from the context geometry onto a target geometry, and retrieve information from " + "each hit point"; ntype.enum_name_legacy = "RAYCAST"; bke::node_type_size_preset(&ntype, bke::eNodeSizePreset::Middle); ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc index 3c4b3a247fb0..ed665000b17e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc @@ -88,7 +88,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REALIZE_INSTANCES, "Realize Instances", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_REALIZE_INSTANCES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Realize Instances"; + ntype.ui_description = "Convert instances into real geometry data"; ntype.enum_name_legacy = "REALIZE_INSTANCES"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc index 8fd7560429c3..e45708390c5a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_remove_attribute.cc @@ -171,8 +171,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_REMOVE_ATTRIBUTE, "Remove Named Attribute", NODE_CLASS_ATTRIBUTE); + geo_node_type_base(&ntype, GEO_NODE_REMOVE_ATTRIBUTE, NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Remove Named Attribute"; + ntype.ui_description = + "Delete an attribute with a specified name from a geometry. Typically used to optimize " + "performance"; ntype.enum_name_legacy = "REMOVE_ATTRIBUTE"; ntype.declare = node_declare; ntype.draw_buttons = node_layout; diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc index f100dd7fea1c..35b5673bfdd0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc @@ -131,7 +131,8 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REPEAT_INPUT, "Repeat Input", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_REPEAT_INPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "Repeat Input"; ntype.enum_name_legacy = "REPEAT_INPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; @@ -223,7 +224,8 @@ static void node_operators() static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_REPEAT_OUTPUT, "Repeat Output", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_REPEAT_OUTPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "Repeat Output"; ntype.enum_name_legacy = "REPEAT_OUTPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc index 4e859fce72a6..47cd68f19df1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc @@ -93,7 +93,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_ROTATE_INSTANCES, "Rotate Instances", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_ROTATE_INSTANCES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Rotate Instances"; + ntype.ui_description = "Rotate geometry instances in local or global space"; ntype.enum_name_legacy = "ROTATE_INSTANCES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_grid.cc index 38e3490c45b2..26539e466819 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_grid.cc @@ -283,7 +283,8 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_GRID, "Sample Grid", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_GRID, NODE_CLASS_CONVERTER); + ntype.ui_name = "Sample Grid"; ntype.enum_name_legacy = "SAMPLE_GRID"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_grid_index.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_grid_index.cc index 9fb6d37415b0..d1459fc37d8d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_grid_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_grid_index.cc @@ -240,8 +240,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SAMPLE_GRID_INDEX, "Sample Grid Index", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_GRID_INDEX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Sample Grid Index"; + ntype.ui_description = "Retrieve volume grid values at specific voxels"; ntype.enum_name_legacy = "SAMPLE_GRID_INDEX"; ntype.initfunc = node_init; ntype.declare = 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 fc54dac67286..51192d166dcc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc @@ -248,7 +248,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_INDEX, "Sample Index", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_INDEX, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sample Index"; + ntype.ui_description = "Retrieve values from specific geometry elements"; ntype.enum_name_legacy = "SAMPLE_INDEX"; ntype.initfunc = node_init; ntype.declare = node_declare; 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 38bc633327b3..cbb7234af1b6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc @@ -329,7 +329,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_NEAREST, "Sample Nearest", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_NEAREST, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sample Nearest"; + ntype.ui_description = + "Find the element of a geometry closest to a position. Similar to the \"Index of Nearest\" " + "node"; ntype.enum_name_legacy = "SAMPLE_NEAREST"; ntype.initfunc = node_init; ntype.declare = node_declare; 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 ad9350a8d7fc..eaa595f19894 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 @@ -234,8 +234,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SAMPLE_NEAREST_SURFACE, "Sample Nearest Surface", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_NEAREST_SURFACE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sample Nearest Surface"; + ntype.ui_description = + "Calculate the interpolated value of a mesh attribute on the closest point of its surface"; ntype.enum_name_legacy = "SAMPLE_NEAREST_SURFACE"; ntype.initfunc = node_init; ntype.declare = node_declare; 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 74e6c9a1f375..307e74b75cb4 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 @@ -196,7 +196,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SAMPLE_UV_SURFACE, "Sample UV Surface", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SAMPLE_UV_SURFACE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sample UV Surface"; + ntype.ui_description = + "Calculate the interpolated values of a mesh attribute at a UV coordinate"; ntype.enum_name_legacy = "SAMPLE_UV_SURFACE"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc index 7f81996cca64..f46719b56827 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc @@ -565,7 +565,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SCALE_ELEMENTS, "Scale Elements", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SCALE_ELEMENTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Scale Elements"; + ntype.ui_description = "Scale groups of connected edges and faces"; ntype.enum_name_legacy = "SCALE_ELEMENTS"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc index 53230935f540..57cca06ca3de 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc @@ -72,7 +72,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SCALE_INSTANCES, "Scale Instances", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SCALE_INSTANCES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Scale Instances"; + ntype.ui_description = "Scale geometry instances in local or global space"; ntype.enum_name_legacy = "SCALE_INSTANCES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_sdf_grid_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_sdf_grid_boolean.cc index c5a1e88a590f..7bcdcffd312e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sdf_grid_boolean.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sdf_grid_boolean.cc @@ -178,7 +178,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SDF_GRID_BOOLEAN, "SDF Grid Boolean", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SDF_GRID_BOOLEAN, NODE_CLASS_GEOMETRY); + ntype.ui_name = "SDF Grid Boolean"; + ntype.ui_description = "Cut, subtract, or join multiple SDF volume grid inputs"; ntype.enum_name_legacy = "SDF_GRID_BOOLEAN"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_self_object.cc b/source/blender/nodes/geometry/nodes/node_geo_self_object.cc index e2ce604135d8..f555c7ef0a36 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_self_object.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_self_object.cc @@ -20,7 +20,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SELF_OBJECT, "Self Object", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_SELF_OBJECT, NODE_CLASS_INPUT); + ntype.ui_name = "Self Object"; + ntype.ui_description = + "Retrieve the object that contains the geometry nodes modifier currently being executed"; ntype.enum_name_legacy = "SELF_OBJECT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc index 32f96c5252f4..b9870a94252f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_components.cc @@ -69,8 +69,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SEPARATE_COMPONENTS, "Separate Components", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SEPARATE_COMPONENTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Separate Components"; + ntype.ui_description = + "Split a geometry into a separate output for each type of data in the geometry"; ntype.enum_name_legacy = "SEPARATE_COMPONENTS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 3c9b733b0397..429f72c197b8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc @@ -108,7 +108,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SEPARATE_GEOMETRY, "Separate Geometry", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SEPARATE_GEOMETRY, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Separate Geometry"; + ntype.ui_description = "Split a geometry into two geometry outputs based on a selection"; ntype.enum_name_legacy = "SEPARATE_GEOMETRY"; blender::bke::node_type_storage(&ntype, "NodeGeometrySeparateGeometry", 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 f8f5ec7d5781..d0e6626efcf9 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 @@ -201,8 +201,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_CURVE_HANDLES, "Set Handle Positions", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_HANDLES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Handle Positions"; + ntype.ui_description = "Set the positions for the handles of Bézier curves"; ntype.enum_name_legacy = "SET_CURVE_HANDLES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 bd30b05ef873..cf5a76b2ae7d 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 @@ -136,7 +136,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_NORMAL, "Set Curve Normal", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_NORMAL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Curve Normal"; + ntype.ui_description = "Set the evaluation mode for curve normals"; ntype.enum_name_legacy = "SET_CURVE_NORMAL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc index 897ab09a2b0e..f02fa45a891f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc @@ -70,7 +70,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_RADIUS, "Set Curve Radius", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_RADIUS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Curve Radius"; + ntype.ui_description = "Set the radius of the curve at each control point"; ntype.enum_name_legacy = "SET_CURVE_RADIUS"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc index 20d403ccd052..0ee9b2b8a352 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc @@ -73,7 +73,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_TILT, "Set Curve Tilt", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_CURVE_TILT, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Curve Tilt"; + ntype.ui_description = "Set the tilt angle at each curve control point"; ntype.enum_name_legacy = "SET_CURVE_TILT"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_geometry_name.cc b/source/blender/nodes/geometry/nodes/node_geo_set_geometry_name.cc index 715a662fac7d..59ac239bcfb2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_geometry_name.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_geometry_name.cc @@ -25,7 +25,9 @@ static void node_register() { static bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_GEOMETRY_NAME, "Set Geometry Name", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_GEOMETRY_NAME, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Geometry Name"; + ntype.ui_description = "Set the name of a geometry for easier debugging"; ntype.enum_name_legacy = "SET_GEOMETRY_NAME"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc index 8afa04ed1eca..a6f3a6a68021 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc @@ -75,7 +75,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_ID, "Set ID", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_ID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set ID"; + ntype.ui_description = + "Set the id attribute on the input geometry, mainly used internally for randomizing"; ntype.enum_name_legacy = "SET_ID"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_instance_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_set_instance_transform.cc index b5f1bd35010e..efa9f777f788 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_instance_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_instance_transform.cc @@ -35,8 +35,9 @@ static void node_register() { static bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_INSTANCE_TRANSFORM, "Set Instance Transform", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_INSTANCE_TRANSFORM, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Instance Transform"; + ntype.ui_description = "Set the transformation matrix of every instance"; ntype.enum_name_legacy = "SET_INSTANCE_TRANSFORM"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc index 57c28aed9906..e0cf1cb92d6a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc @@ -164,7 +164,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, "Set Material", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Material"; + ntype.ui_description = "Assign a material to geometry elements"; ntype.enum_name_legacy = "SET_MATERIAL"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc index 8679db40b3bc..a7efe7a7bf2b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc @@ -67,8 +67,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_MATERIAL_INDEX, "Set Material Index", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_MATERIAL_INDEX, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Material Index"; + ntype.ui_description = "Set the material index for each selected geometry element"; ntype.enum_name_legacy = "SET_MATERIAL_INDEX"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc index cf47b0315b26..4e98a9ccd911 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc @@ -44,7 +44,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_POINT_RADIUS, "Set Point Radius", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_POINT_RADIUS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Point Radius"; + ntype.ui_description = "Set the display size of point cloud points"; ntype.enum_name_legacy = "SET_POINT_RADIUS"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc index 3c6dd4684861..c87a0f27b587 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc @@ -162,7 +162,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_POSITION, "Set Position", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_POSITION, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Position"; + ntype.ui_description = "Set the location of each point"; ntype.enum_name_legacy = "SET_POSITION"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc index ba72ec1fb451..2d14fb3c56d3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc @@ -110,7 +110,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_SHADE_SMOOTH, "Set Shade Smooth", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_SHADE_SMOOTH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Shade Smooth"; + ntype.ui_description = + "Control the smoothness of mesh normals around each face by changing the \"shade smooth\" " + "attribute"; ntype.enum_name_legacy = "SET_SHADE_SMOOTH"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc b/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc index 0893d5975b53..337151a97f10 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc @@ -73,7 +73,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SET_SPLINE_CYCLIC, "Set Spline Cyclic", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_SPLINE_CYCLIC, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Spline Cyclic"; + ntype.ui_description = + "Control whether each spline loops back on itself by changing the \"cyclic\" attribute"; ntype.enum_name_legacy = "SET_SPLINE_CYCLIC"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc index b4b7536adddd..e5224af1ddfc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc @@ -73,8 +73,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SET_SPLINE_RESOLUTION, "Set Spline Resolution", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SET_SPLINE_RESOLUTION, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Spline Resolution"; + ntype.ui_description = + "Control how many evaluated points should be generated on every curve segment"; ntype.enum_name_legacy = "SET_SPLINE_RESOLUTION"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc index 13decca6112d..89cdd7eea099 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc @@ -489,7 +489,9 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SIMULATION_INPUT, "Simulation Input", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_SIMULATION_INPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "Simulation Input"; + ntype.ui_description = "Input data for the simulation zone"; ntype.enum_name_legacy = "SIMULATION_INPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; @@ -864,8 +866,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SIMULATION_OUTPUT, "Simulation Output", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_SIMULATION_OUTPUT, NODE_CLASS_INTERFACE); + ntype.ui_name = "Simulation Output"; + ntype.ui_description = "Output data from the simulation zone"; ntype.enum_name_legacy = "SIMULATION_OUTPUT"; ntype.initfunc = node_init; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_sort_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_sort_elements.cc index 29635bea940b..fc9482c8b05d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sort_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sort_elements.cc @@ -295,7 +295,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SORT_ELEMENTS, "Sort Elements", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SORT_ELEMENTS, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Sort Elements"; + ntype.ui_description = "Rearrange geometry elements, changing their indices"; ntype.enum_name_legacy = "SORT_ELEMENTS"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_split_to_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_split_to_instances.cc index 875f3abcda27..9861533e0fb6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_split_to_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_split_to_instances.cc @@ -354,8 +354,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SPLIT_TO_INSTANCES, "Split to Instances", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SPLIT_TO_INSTANCES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Split to Instances"; + ntype.ui_description = "Create separate geometries containing the elements from the same group"; ntype.enum_name_legacy = "Split to Instances"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 4fcf23dc2be1..47d6551961d7 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 @@ -210,8 +210,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_STORE_NAMED_ATTRIBUTE, "Store Named Attribute", NODE_CLASS_ATTRIBUTE); + geo_node_type_base(&ntype, GEO_NODE_STORE_NAMED_ATTRIBUTE, NODE_CLASS_ATTRIBUTE); + ntype.ui_name = "Store Named Attribute"; + ntype.ui_description = + "Store the result of a field on a geometry as an attribute with the specified name"; ntype.enum_name_legacy = "STORE_NAMED_ATTRIBUTE"; blender::bke::node_type_storage(&ntype, "NodeGeometryStoreNamedAttribute", diff --git a/source/blender/nodes/geometry/nodes/node_geo_store_named_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_store_named_grid.cc index c48edf1c7990..8c70bf389dae 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_store_named_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_grid.cc @@ -134,7 +134,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_STORE_NAMED_GRID, "Store Named Grid", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_STORE_NAMED_GRID, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Store Named Grid"; + ntype.ui_description = "Store grid data in a volume geometry with the specified name"; ntype.enum_name_legacy = "STORE_NAMED_GRID"; ntype.declare = node_declare; ntype.gather_link_search_ops = search_link_ops; diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc index 099190b3b70c..713210bd3a07 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc @@ -32,7 +32,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_STRING_JOIN, "Join Strings", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_STRING_JOIN, NODE_CLASS_CONVERTER); + ntype.ui_name = "Join Strings"; + ntype.ui_description = "Combine any number of input strings"; ntype.enum_name_legacy = "STRING_JOIN"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; 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 e036abf41191..76b087de373c 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 @@ -378,7 +378,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_STRING_TO_CURVES, "String to Curves", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_STRING_TO_CURVES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "String to Curves"; + ntype.ui_description = + "Generate a paragraph of text with a specific font, using a curve instance to store each " + "character"; ntype.enum_name_legacy = "STRING_TO_CURVES"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 c0a1af0deb32..3123131744e2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc @@ -231,8 +231,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_SUBDIVISION_SURFACE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Subdivision Surface"; + ntype.ui_description = + "Divide mesh faces to form a smooth surface, using the Catmull-Clark subdivision method"; ntype.enum_name_legacy = "SUBDIVISION_SURFACE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_switch.cc index 0399bc5f35b4..b35793915dda 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_switch.cc @@ -246,7 +246,9 @@ static void register_node() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_SWITCH, "Switch", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_SWITCH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Switch"; + ntype.ui_description = "Switch between two inputs"; ntype.enum_name_legacy = "SWITCH"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc index f40b6064913c..6f327c86a140 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_3d_cursor.cc @@ -39,7 +39,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_3D_CURSOR, "3D Cursor", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_3D_CURSOR, NODE_CLASS_INPUT); + ntype.ui_name = "3D Cursor"; + ntype.ui_description = "The scene's 3D cursor location and rotation"; ntype.enum_name_legacy = "TOOL_3D_CURSOR"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_active_element.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_active_element.cc index 1759cdf71f06..e09a4e834b08 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_active_element.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_active_element.cc @@ -84,7 +84,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_ACTIVE_ELEMENT, "Active Element", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_ACTIVE_ELEMENT, NODE_CLASS_INPUT); + ntype.ui_name = "Active Element"; + ntype.ui_description = "Active element indices of the edited geometry, for tool execution"; ntype.enum_name_legacy = "TOOL_ACTIVE_ELEMENT"; ntype.initfunc = node_init; ntype.geometry_node_execute = node_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc index b5348b1e7271..8b8e5ea1668a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_face_set.cc @@ -26,7 +26,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_FACE_SET, "Face Set", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_FACE_SET, NODE_CLASS_INPUT); + ntype.ui_name = "Face Set"; + ntype.ui_description = "Each face's sculpt face set value"; ntype.enum_name_legacy = "TOOL_FACE_SET"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc index 15d906958274..1568f2581a5e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_selection.cc @@ -174,7 +174,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_SELECTION, "Selection", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_SELECTION, NODE_CLASS_INPUT); + ntype.ui_name = "Selection"; + ntype.ui_description = "User selection of the edited geometry, for tool execution"; ntype.enum_name_legacy = "TOOL_SELECTION"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc index 324d09d86e1a..ad80c6e437f9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_set_face_set.cc @@ -56,7 +56,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_SET_FACE_SET, "Set Face Set", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TOOL_SET_FACE_SET, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Face Set"; + ntype.ui_description = "Set sculpt face set values for faces"; ntype.enum_name_legacy = "TOOL_SET_FACE_SET"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc index 6340c4795129..d59d3bc2afb3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_tool_set_selection.cc @@ -201,7 +201,9 @@ static void node_rna(StructRNA *srna) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TOOL_SET_SELECTION, "Set Selection", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TOOL_SET_SELECTION, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Set Selection"; + ntype.ui_description = "Set selection of the edited geometry, for tool execution"; ntype.enum_name_legacy = "TOOL_SELECTION_SET"; ntype.declare = node_declare; ntype.initfunc = node_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_transform_geometry.cc index 879e40b8a932..9db58d6481b6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transform_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transform_geometry.cc @@ -128,9 +128,9 @@ static void node_rna(StructRNA *srna) static void register_node() { static blender::bke::bNodeType ntype; - - geo_node_type_base( - &ntype, GEO_NODE_TRANSFORM_GEOMETRY, "Transform Geometry", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TRANSFORM_GEOMETRY, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Transform Geometry"; + ntype.ui_description = "Translate, rotate or scale the geometry"; ntype.enum_name_legacy = "TRANSFORM_GEOMETRY"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc index 7766452b4e9d..dfc39f472039 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc @@ -59,8 +59,9 @@ static void register_node() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_TRANSLATE_INSTANCES, "Translate Instances", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TRANSLATE_INSTANCES, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Translate Instances"; + ntype.ui_description = "Move top-level geometry instances in local or global space"; ntype.enum_name_legacy = "TRANSLATE_INSTANCES"; ntype.geometry_node_execute = node_geo_exec; ntype.declare = node_declare; diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc index 46c71b81a820..1349c79ccda6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc @@ -154,7 +154,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, "Triangulate", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_TRIANGULATE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Triangulate"; + ntype.ui_description = "Convert all faces in a mesh to triangular faces"; ntype.enum_name_legacy = "TRIANGULATE"; ntype.declare = node_declare; ntype.initfunc = geo_triangulate_init; diff --git a/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc b/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc index 375241b3abd9..6d0528947c99 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc @@ -142,7 +142,10 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_UV_PACK_ISLANDS, "Pack UV Islands", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_UV_PACK_ISLANDS, NODE_CLASS_CONVERTER); + ntype.ui_name = "Pack UV Islands"; + ntype.ui_description = + "Scale islands of a UV map and move them so they fill the UV space as much as possible"; ntype.enum_name_legacy = "UV_PACK_ISLANDS"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 4f3a91291e6c..9962ac284880 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc @@ -212,7 +212,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_UV_UNWRAP, "UV Unwrap", NODE_CLASS_CONVERTER); + geo_node_type_base(&ntype, GEO_NODE_UV_UNWRAP, NODE_CLASS_CONVERTER); + ntype.ui_name = "UV Unwrap"; + ntype.ui_description = "Generate a UV map based on seam edges"; ntype.enum_name_legacy = "UV_UNWRAP"; ntype.initfunc = node_init; blender::bke::node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc index af01e1b5f8a4..0f57d8ac077c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_viewer.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_viewer.cc @@ -142,7 +142,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); + geo_node_type_base(&ntype, GEO_NODE_VIEWER, NODE_CLASS_OUTPUT); + ntype.ui_name = "Viewer"; + ntype.ui_description = "Display the input data in the Spreadsheet Editor"; ntype.enum_name_legacy = "VIEWER"; blender::bke::node_type_storage( &ntype, "NodeGeometryViewer", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/geometry/nodes/node_geo_viewport_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_viewport_transform.cc index 5f5e5eb87d37..df7b7ec4dfe0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_viewport_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_viewport_transform.cc @@ -37,8 +37,9 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base( - &ntype, GEO_NODE_TOOL_VIEWPORT_TRANSFORM, "Viewport Transform", NODE_CLASS_INPUT); + geo_node_type_base(&ntype, GEO_NODE_TOOL_VIEWPORT_TRANSFORM, NODE_CLASS_INPUT); + ntype.ui_name = "Viewport Transform"; + ntype.ui_description = "Retrieve the view direction and location of the 3D viewport"; ntype.enum_name_legacy = "VIEWPORT_TRANFORM"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc index f9680f7b1684..73fb55dbce8b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc @@ -182,7 +182,11 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_VOLUME_CUBE, "Volume Cube", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_VOLUME_CUBE, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Volume Cube"; + ntype.ui_description = + "Generate a dense volume with a field that controls the density at each grid voxel based on " + "its position"; ntype.enum_name_legacy = "VOLUME_CUBE"; ntype.declare = node_declare; ntype.geometry_node_execute = node_geo_exec; 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 24dc2f23cd1c..40d76b9a2236 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 @@ -244,7 +244,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY); + geo_node_type_base(&ntype, GEO_NODE_VOLUME_TO_MESH, NODE_CLASS_GEOMETRY); + ntype.ui_name = "Volume to Mesh"; + ntype.ui_description = "Generate a mesh on the \"surface\" of a volume"; ntype.enum_name_legacy = "VOLUME_TO_MESH"; ntype.declare = node_declare; blender::bke::node_type_storage( diff --git a/source/blender/nodes/geometry/nodes/node_geo_warning.cc b/source/blender/nodes/geometry/nodes/node_geo_warning.cc index c574fffdb42d..c5062f36f8f6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_warning.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_warning.cc @@ -102,7 +102,9 @@ static void node_register() { static blender::bke::bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_WARNING, "Warning", NODE_CLASS_INTERFACE); + geo_node_type_base(&ntype, GEO_NODE_WARNING, NODE_CLASS_INTERFACE); + ntype.ui_name = "Warning"; + ntype.ui_description = "Create custom warnings in node groups"; ntype.enum_name_legacy = "WARNING"; ntype.declare = node_declare; ntype.labelfunc = node_label; diff --git a/source/blender/nodes/intern/geometry_nodes_execute.cc b/source/blender/nodes/intern/geometry_nodes_execute.cc index 91b1c21fdb61..be2d21d04c5d 100644 --- a/source/blender/nodes/intern/geometry_nodes_execute.cc +++ b/source/blender/nodes/intern/geometry_nodes_execute.cc @@ -219,6 +219,7 @@ std::unique_ptr id_property_create_f auto property = bke::idprop::create(identifier, value->value); IDPropertyUIDataInt *ui_data = (IDPropertyUIDataInt *)IDP_ui_data_ensure(property.get()); id_property_int_update_enum_items(value, ui_data); + ui_data->default_value = value->value; return property; } case SOCK_OBJECT: { diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index 47cc677324c3..085848dad82c 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -12,6 +12,8 @@ #include "DNA_asset_types.h" #include "DNA_node_types.h" +#include "BLI_array.hh" +#include "BLI_disjoint_set.hh" #include "BLI_listbase.h" #include "BLI_map.hh" #include "BLI_multi_value_map.hh" @@ -20,6 +22,7 @@ #include "BLI_string.h" #include "BLI_string_ref.hh" #include "BLI_utildefines.h" +#include "BLI_vector_set.hh" #include "BLT_translation.hh" @@ -506,10 +509,14 @@ static void node_frame_init(bNodeTree * /*ntree*/, bNode *node) void register_node_type_frame() { /* frame type is used for all tree types, needs dynamic allocation */ - blender::bke::bNodeType *ntype = MEM_cnew("frame node type"); - ntype->free_self = (void (*)(blender::bke::bNodeType *))MEM_freeN; - - blender::bke::node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT); + blender::bke::bNodeType *ntype = MEM_new("frame node type"); + ntype->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); }; + + blender::bke::node_type_base(ntype, NODE_FRAME, NODE_CLASS_LAYOUT); + ntype->ui_name = "Frame"; + ntype->ui_description = + "Collect related nodes together in a common area. Useful for organization when the " + "re-usability of a node group is not required"; ntype->enum_name_legacy = "FRAME"; ntype->initfunc = node_frame_init; blender::bke::node_type_storage( @@ -549,10 +556,13 @@ static void node_reroute_init(bNodeTree * /*ntree*/, bNode *node) void register_node_type_reroute() { /* frame type is used for all tree types, needs dynamic allocation */ - blender::bke::bNodeType *ntype = MEM_cnew("frame node type"); - ntype->free_self = (void (*)(blender::bke::bNodeType *))MEM_freeN; + blender::bke::bNodeType *ntype = MEM_new("frame node type"); + ntype->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); }; - blender::bke::node_type_base(ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT); + blender::bke::node_type_base(ntype, NODE_REROUTE, NODE_CLASS_LAYOUT); + ntype->ui_name = "Reroute"; + ntype->ui_description = + "A single-socket organization tool that supports one input and multiple outputs"; ntype->enum_name_legacy = "REROUTE"; ntype->declare = node_reroute_declare; ntype->initfunc = node_reroute_init; @@ -561,88 +571,134 @@ void register_node_type_reroute() blender::bke::node_register_type(ntype); } -static void propagate_reroute_type_from_start_socket( - bNodeSocket *start_socket, - const MultiValueMap &links_map, - Map &r_reroute_types) -{ - Stack nodes_to_check; - for (bNodeLink *link : links_map.lookup(start_socket)) { - if (link->tonode->type == NODE_REROUTE) { - nodes_to_check.push(link->tonode); - } - if (link->fromnode->type == NODE_REROUTE) { - nodes_to_check.push(link->fromnode); - } +struct RerouteTargetPriority { + int node_i = std::numeric_limits::max(); + int socket_in_node_i = std::numeric_limits::max(); + + RerouteTargetPriority() = default; + RerouteTargetPriority(const bNodeSocket &socket) + : node_i(socket.owner_node().index()), socket_in_node_i(socket.index()) + { } - const blender::bke::bNodeSocketType *current_type = start_socket->typeinfo; - while (!nodes_to_check.is_empty()) { - bNode *reroute_node = nodes_to_check.pop(); - BLI_assert(reroute_node->type == NODE_REROUTE); - if (r_reroute_types.add(reroute_node, current_type)) { - for (bNodeLink *link : links_map.lookup((bNodeSocket *)reroute_node->inputs.first)) { - if (link->fromnode->type == NODE_REROUTE) { - nodes_to_check.push(link->fromnode); - } - } - for (bNodeLink *link : links_map.lookup((bNodeSocket *)reroute_node->outputs.first)) { - if (link->tonode->type == NODE_REROUTE) { - nodes_to_check.push(link->tonode); - } - } + + bool operator>(const RerouteTargetPriority other) + { + if (this->node_i == other.node_i) { + return this->socket_in_node_i < other.socket_in_node_i; } + return this->node_i < other.node_i; } -} +}; void ntree_update_reroute_nodes(bNodeTree *ntree) { - /* Contains nodes that are linked to at least one reroute node. */ - Set nodes_linked_with_reroutes; - /* Contains all links that are linked to at least one reroute node. */ - MultiValueMap links_map; - /* Build acceleration data structures for the algorithm below. */ - LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { - if (link->fromsock == nullptr || link->tosock == nullptr) { - continue; + using namespace blender; + ntree->ensure_topology_cache(); + + const Span all_reroute_nodes = ntree->nodes_by_type("NodeReroute"); + + VectorSet reroute_nodes; + for (const bNode *reroute : all_reroute_nodes) { + reroute_nodes.add(reroute->index()); + } + + /* Any reroute can be connected only to one source, or can be not connected at all. + * So reroute forms a trees. It is possible that there will be cycle, but such cycle + * can be only one in strongly connected set of reroutes. To propagate a types from + * some certain target to all the reroutes in such a tree we need to know all such + * a trees and all possible targets for each tree. */ + DisjointSet reroutes_groups(reroute_nodes.size()); + + for (const bNode *src_reroute : all_reroute_nodes) { + const int src_reroute_i = reroute_nodes.index_of(src_reroute->index()); + for (const bNodeSocket *dst_socket : + src_reroute->output_sockets().first()->directly_linked_sockets()) + { + const bNode &dst_node = dst_socket->owner_node(); + if (!dst_node.is_reroute()) { + continue; + } + const int dst_reroute_i = reroute_nodes.index_of(dst_node.index()); + reroutes_groups.join(src_reroute_i, dst_reroute_i); } - if (link->fromnode->type != NODE_REROUTE && link->tonode->type != NODE_REROUTE) { + } + + VectorSet reroute_groups; + for (const int reroute_i : reroute_nodes.index_range()) { + const int root_reroute_i = reroutes_groups.find_root(reroute_i); + reroute_groups.add(root_reroute_i); + } + + /* Any reroute can have only one source and many destination targets. Type propagation considers + * source as target with highest priority. */ + Array dst_type_by_reroute_group(reroute_groups.size(), nullptr); + Array src_type_by_reroute_group(reroute_groups.size(), nullptr); + + /* Reroute type priority based on the indices of target sockets in the node and the nodes in the + * tree. */ + Array reroute_group_dst_type_priority(reroute_groups.size(), + RerouteTargetPriority{}); + + for (const bNodeLink *link : ntree->all_links()) { + const bNode *src_node = link->fromnode; + const bNode *dst_node = link->tonode; + + if (src_node->is_reroute() == dst_node->is_reroute()) { continue; } - if (link->fromnode->type != NODE_REROUTE) { - nodes_linked_with_reroutes.add(link->fromnode); - } - if (link->tonode->type != NODE_REROUTE) { - nodes_linked_with_reroutes.add(link->tonode); + + if (!dst_node->is_reroute()) { + const int src_reroute_i = reroute_nodes.index_of(src_node->index()); + const int src_reroute_root_i = reroutes_groups.find_root(src_reroute_i); + const int src_reroute_group_i = reroute_groups.index_of(src_reroute_root_i); + + const RerouteTargetPriority type_priority(*link->tosock); + if (reroute_group_dst_type_priority[src_reroute_group_i] > type_priority) { + continue; + } + + reroute_group_dst_type_priority[src_reroute_group_i] = type_priority; + + const bNodeSocket *dst_socket = link->tosock; + /* There could be a function which will choose best from + * #dst_type_by_reroute_group and #dst_socket, but right now this match behavior as-is. */ + dst_type_by_reroute_group[src_reroute_group_i] = dst_socket->typeinfo; + continue; } - links_map.add(link->fromsock, link); - links_map.add(link->tosock, link); + + BLI_assert(!src_node->is_reroute()); + const int dst_reroute_i = reroute_nodes.index_of(dst_node->index()); + const int dst_reroute_root_i = reroutes_groups.find_root(dst_reroute_i); + const int dst_reroute_group_i = reroute_groups.index_of(dst_reroute_root_i); + + const bNodeSocket *src_socket = link->fromsock; + /* There could be a function which will choose best from + * #src_type_by_reroute_group and #src_socket, but right now this match behavior as-is. */ + src_type_by_reroute_group[dst_reroute_group_i] = src_socket->typeinfo; } - /* Will contain the socket type for every linked reroute node. */ - Map reroute_types; + const Span all_nodes = ntree->all_nodes(); + for (const int reroute_i : reroute_nodes.index_range()) { + const int reroute_root_i = reroutes_groups.find_root(reroute_i); + const int reroute_group_i = reroute_groups.index_of(reroute_root_i); - /* Propagate socket types from left to right. */ - for (bNode *start_node : nodes_linked_with_reroutes) { - LISTBASE_FOREACH (bNodeSocket *, output_socket, &start_node->outputs) { - propagate_reroute_type_from_start_socket(output_socket, links_map, reroute_types); + const bke::bNodeSocketType *reroute_type = nullptr; + if (dst_type_by_reroute_group[reroute_group_i] != nullptr) { + reroute_type = dst_type_by_reroute_group[reroute_group_i]; + } + if (src_type_by_reroute_group[reroute_group_i] != nullptr) { + reroute_type = src_type_by_reroute_group[reroute_group_i]; } - } - /* Propagate socket types from right to left. This affects reroute nodes that haven't been - * changed in the loop above. */ - for (bNode *start_node : nodes_linked_with_reroutes) { - LISTBASE_FOREACH (bNodeSocket *, input_socket, &start_node->inputs) { - propagate_reroute_type_from_start_socket(input_socket, links_map, reroute_types); + if (reroute_type == nullptr) { + continue; } - } - /* Actually update reroute nodes with changed types. */ - for (const auto item : reroute_types.items()) { - bNode *reroute_node = item.key; - const blender::bke::bNodeSocketType *socket_type = item.value; - NodeReroute *storage = static_cast(reroute_node->storage); - STRNCPY(storage->type_idname, socket_type->idname); - blender::nodes::update_node_declaration_and_sockets(*ntree, *reroute_node); + const int reroute_index = reroute_nodes[reroute_i]; + bNode &reroute_node = *all_nodes[reroute_index]; + NodeReroute *storage = static_cast(reroute_node.storage); + StringRef(reroute_type->idname).copy(storage->type_idname); + nodes::update_node_declaration_and_sockets(*ntree, reroute_node); } } @@ -781,10 +837,13 @@ static bool group_output_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *l void register_node_type_group_input() { /* used for all tree types, needs dynamic allocation */ - blender::bke::bNodeType *ntype = MEM_cnew("node type"); - ntype->free_self = (void (*)(blender::bke::bNodeType *))MEM_freeN; + blender::bke::bNodeType *ntype = MEM_new("node type"); + ntype->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); }; - blender::bke::node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE); + blender::bke::node_type_base(ntype, NODE_GROUP_INPUT, NODE_CLASS_INTERFACE); + ntype->ui_name = "Group Input"; + ntype->ui_description = + "Expose connected data from inside a node group as inputs to its interface"; ntype->enum_name_legacy = "GROUP_INPUT"; blender::bke::node_type_size(ntype, 140, 80, 400); ntype->declare = blender::nodes::group_input_declare; @@ -806,10 +865,12 @@ bNodeSocket *node_group_output_find_socket(bNode *node, const char *identifier) void register_node_type_group_output() { /* used for all tree types, needs dynamic allocation */ - blender::bke::bNodeType *ntype = MEM_cnew("node type"); - ntype->free_self = (void (*)(blender::bke::bNodeType *))MEM_freeN; + blender::bke::bNodeType *ntype = MEM_new("node type"); + ntype->free_self = [](blender::bke::bNodeType *type) { MEM_delete(type); }; - blender::bke::node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE); + blender::bke::node_type_base(ntype, NODE_GROUP_OUTPUT, NODE_CLASS_INTERFACE); + ntype->ui_name = "Group Output"; + ntype->ui_description = "Output data from inside of a node group"; ntype->enum_name_legacy = "GROUP_OUTPUT"; blender::bke::node_type_size(ntype, 140, 80, 400); ntype->declare = blender::nodes::group_output_declare; diff --git a/source/blender/nodes/intern/node_register.cc b/source/blender/nodes/intern/node_register.cc index 308bbf617dd5..45bc59d52d59 100644 --- a/source/blender/nodes/intern/node_register.cc +++ b/source/blender/nodes/intern/node_register.cc @@ -30,15 +30,15 @@ static void register_undefined_types() */ blender::bke::NodeTreeTypeUndefined.type = NTREE_UNDEFINED; - STRNCPY(blender::bke::NodeTreeTypeUndefined.idname, "NodeTreeUndefined"); - STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_name, N_("Undefined")); - STRNCPY(blender::bke::NodeTreeTypeUndefined.ui_description, N_("Undefined Node Tree Type")); + blender::bke::NodeTreeTypeUndefined.idname = "NodeTreeUndefined"; + blender::bke::NodeTreeTypeUndefined.ui_name = N_("Undefined"); + blender::bke::NodeTreeTypeUndefined.ui_description = N_("Undefined Node Tree Type"); blender::bke::node_type_base_custom( &blender::bke::NodeTypeUndefined, "NodeUndefined", "Undefined", "UNDEFINED", 0); blender::bke::NodeTypeUndefined.poll = node_undefined_poll; - STRNCPY(blender::bke::NodeSocketTypeUndefined.idname, "NodeSocketUndefined"); + blender::bke::NodeSocketTypeUndefined.idname = "NodeSocketUndefined"; /* extra type info for standard socket types */ blender::bke::NodeSocketTypeUndefined.type = SOCK_CUSTOM; blender::bke::NodeSocketTypeUndefined.subtype = PROP_NONE; diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index 3de6925c56c7..ba920edbea66 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -857,11 +857,11 @@ static bke::bNodeSocketType *make_standard_socket_type(int type, int subtype) bke::bNodeSocketType *stype; StructRNA *srna; - stype = MEM_cnew("node socket C type"); - stype->free_self = (void (*)(bke::bNodeSocketType *stype))MEM_freeN; - STRNCPY(stype->idname, socket_idname.c_str()); - STRNCPY(stype->label, socket_label.c_str()); - STRNCPY(stype->subtype_label, socket_subtype_label.c_str()); + stype = MEM_new(__func__); + stype->free_self = [](bke::bNodeSocketType *type) { MEM_delete(type); }; + stype->idname = socket_idname; + stype->label = socket_label; + stype->subtype_label = socket_subtype_label; /* set the RNA type * uses the exact same identifier as the socket type idname */ @@ -901,9 +901,9 @@ static bke::bNodeSocketType *make_socket_type_virtual() bke::bNodeSocketType *stype; StructRNA *srna; - stype = MEM_cnew("node socket C type"); - stype->free_self = (void (*)(bke::bNodeSocketType *stype))MEM_freeN; - STRNCPY(stype->idname, socket_idname); + stype = MEM_new(__func__); + stype->free_self = [](bke::bNodeSocketType *type) { MEM_delete(type); }; + stype->idname = socket_idname; /* set the RNA type * uses the exact same identifier as the socket type idname */ diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc index 842558367ebc..f53ffe868c21 100644 --- a/source/blender/nodes/intern/node_socket_declarations.cc +++ b/source/blender/nodes/intern/node_socket_declarations.cc @@ -810,7 +810,7 @@ bool Custom::matches(const bNodeSocket &socket) const if (socket.type != SOCK_CUSTOM) { return false; } - if (!STREQ(socket.typeinfo->idname, idname_)) { + if (socket.typeinfo->idname != idname_) { return false; } return true; @@ -823,7 +823,7 @@ bool Custom::can_connect(const bNodeSocket &socket) const bNodeSocket &Custom::update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const { - if (!STREQ(socket.typeinfo->idname, idname_)) { + if (socket.typeinfo->idname != idname_) { return this->build(ntree, node); } this->set_common_flags(socket); diff --git a/source/blender/nodes/intern/node_util.hh b/source/blender/nodes/intern/node_util.hh index f4885162d289..9cb7d0a9eca5 100644 --- a/source/blender/nodes/intern/node_util.hh +++ b/source/blender/nodes/intern/node_util.hh @@ -8,6 +8,8 @@ #pragma once +#include "DNA_node_types.h" + struct bNode; namespace blender::bke { struct bNodeInstanceHash; diff --git a/source/blender/nodes/intern/socket_search_link.cc b/source/blender/nodes/intern/socket_search_link.cc index e67325ebbf2b..6f1aeb914f02 100644 --- a/source/blender/nodes/intern/socket_search_link.cc +++ b/source/blender/nodes/intern/socket_search_link.cc @@ -25,7 +25,7 @@ void GatherLinkSearchOpParams::add_item(std::string socket_name, { std::string name = fmt::format("{}{} " UI_MENU_ARROW_SEP " {}", - IFACE_(node_type_.ui_name), + IFACE_(node_type_.ui_name.c_str()), node_type_.deprecation_notice ? IFACE_(" (Deprecated)") : "", socket_name); diff --git a/source/blender/nodes/shader/materialx/node_item.h b/source/blender/nodes/shader/materialx/node_item.h index f6a98366d73b..2f45e2d0df11 100644 --- a/source/blender/nodes/shader/materialx/node_item.h +++ b/source/blender/nodes/shader/materialx/node_item.h @@ -4,8 +4,6 @@ #pragma once -#include - #include namespace blender::nodes::materialx { diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc index 0861e8efb985..ae94bcc7e52a 100644 --- a/source/blender/nodes/shader/node_shader_tree.cc +++ b/source/blender/nodes/shader/node_shader_tree.cc @@ -176,15 +176,15 @@ blender::bke::bNodeTreeType *ntreeType_Shader; void register_node_tree_type_sh() { - blender::bke::bNodeTreeType *tt = ntreeType_Shader = MEM_cnew( - "shader node tree type"); + blender::bke::bNodeTreeType *tt = ntreeType_Shader = MEM_new( + __func__); tt->type = NTREE_SHADER; - STRNCPY(tt->idname, "ShaderNodeTree"); - STRNCPY(tt->group_idname, "ShaderNodeGroup"); - STRNCPY(tt->ui_name, N_("Shader Editor")); + tt->idname = "ShaderNodeTree"; + tt->group_idname = "ShaderNodeGroup"; + tt->ui_name = N_("Shader Editor"); tt->ui_icon = ICON_NODE_MATERIAL; - STRNCPY(tt->ui_description, N_("Shader nodes")); + tt->ui_description = N_("Shader nodes"); tt->foreach_nodeclass = foreach_nodeclass; tt->localize = localize; diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc index 2553954b7d41..98d499aa1f89 100644 --- a/source/blender/nodes/shader/node_shader_util.cc +++ b/source/blender/nodes/shader/node_shader_util.cc @@ -47,18 +47,18 @@ static bool sh_fn_poll_default(const blender::bke::bNodeType * /*ntype*/, return true; } -void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void sh_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - blender::bke::node_type_base(ntype, type, name, nclass); + blender::bke::node_type_base(ntype, type, nclass); ntype->poll = sh_node_poll_default; ntype->insert_link = node_insert_link_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; } -void sh_fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void sh_fn_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - sh_node_type_base(ntype, type, name, nclass); + sh_node_type_base(ntype, type, nclass); ntype->poll = sh_fn_poll_default; ntype->gather_link_search_ops = blender::nodes::search_link_ops_for_basic_node; } diff --git a/source/blender/nodes/shader/node_shader_util.hh b/source/blender/nodes/shader/node_shader_util.hh index ac878666b73f..1d3f829bd627 100644 --- a/source/blender/nodes/shader/node_shader_util.hh +++ b/source/blender/nodes/shader/node_shader_util.hh @@ -39,11 +39,8 @@ struct GPUMaterial; bool sh_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint); -void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass); -void sh_fn_node_type_base(blender::bke::bNodeType *ntype, - int type, - const char *name, - short nclass); +void sh_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); +void sh_fn_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); bool line_style_shader_nodes_poll(const bContext *C); bool world_shader_nodes_poll(const bContext *C); bool object_shader_nodes_poll(const bContext *C); 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 b01df23d7479..6892c6b890f7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc @@ -58,7 +58,9 @@ void register_node_type_sh_add_shader() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, NODE_CLASS_SHADER); + ntype.ui_name = "Add Shader"; + ntype.ui_description = "Add two Shaders together"; ntype.enum_name_legacy = "ADD_SHADER"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_add_shader; 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 b58435918b94..34f35513d471 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc @@ -81,7 +81,11 @@ void register_node_type_sh_ambient_occlusion() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, NODE_CLASS_INPUT); + ntype.ui_name = "Ambient Occlusion"; + ntype.ui_description = + "Compute how much the hemisphere above the shading point is occluded, for example to add " + "weathering effects to corners.\nNote: For Cycles, this may slow down renders significantly"; ntype.enum_name_legacy = "AMBIENT_OCCLUSION"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion; diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index bcf9d604f6b9..96bcbebbdf83 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -106,7 +106,9 @@ void register_node_type_sh_attribute() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, NODE_CLASS_INPUT); + ntype.ui_name = "Attribute"; + ntype.ui_description = "Retrieve attributes attached to objects or geometry"; ntype.enum_name_legacy = "ATTRIBUTE"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_attribute; diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index dae50487a18f..c193dd7c7be8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -38,7 +38,11 @@ void register_node_type_sh_background() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BACKGROUND, NODE_CLASS_SHADER); + ntype.ui_name = "Background"; + ntype.ui_description = + "Add background light emission.\nNote: This node should only be used for the world surface " + "output"; ntype.enum_name_legacy = "BACKGROUND"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = world_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index 944d64c2cb1b..22bacf554410 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -57,7 +57,11 @@ void register_node_type_sh_bevel() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_BEVEL, NODE_CLASS_INPUT); + ntype.ui_name = "Bevel"; + ntype.ui_description = + "Generates normals with round corners.\nNote: only supported in Cycles, and may slow down " + "renders"; ntype.enum_name_legacy = "BEVEL"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_bevel; diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc index b77a1a801683..4cbe92e82755 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc @@ -70,7 +70,9 @@ void register_node_type_sh_blackbody() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_BLACKBODY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Blackbody"; + ntype.ui_description = "Convert a blackbody temperature to an RGB value"; ntype.enum_name_legacy = "BLACKBODY"; ntype.declare = file_ns::node_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc index dbc51888936e..6f7f8ad4a51a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc @@ -57,7 +57,9 @@ void register_node_type_sh_brightcontrast() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Brightness/Contrast", NODE_CLASS_OP_COLOR); + sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Brightness/Contrast"; + ntype.ui_description = "Control the brightness and contrast of the input color"; ntype.enum_name_legacy = "BRIGHTCONTRAST"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_brightcontrast; 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 5ac530ab7380..de8cbb375360 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc @@ -61,7 +61,9 @@ void register_node_type_sh_bsdf_diffuse() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, NODE_CLASS_SHADER); + ntype.ui_name = "Diffuse BSDF"; + ntype.ui_description = "Lambertian and Oren-Nayar diffuse reflection"; ntype.enum_name_legacy = "DIFFUSE_BSDF"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 792913a28db9..b9dc51248fd7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc @@ -74,7 +74,9 @@ void register_node_type_sh_bsdf_glass() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, NODE_CLASS_SHADER); + ntype.ui_name = "Glass BSDF"; + ntype.ui_description = "Glass-like shader mixing refraction and reflection at grazing angles"; ntype.enum_name_legacy = "BSDF_GLASS"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 528f7e8a0b18..171640ad4247 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc @@ -95,7 +95,10 @@ void register_node_type_sh_bsdf_glossy() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, NODE_CLASS_SHADER); + ntype.ui_name = "Glossy BSDF"; + ntype.ui_description = + "Reflection with microfacet distribution, used for materials such as metal or mirrors"; ntype.enum_name_legacy = "BSDF_GLOSSY"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 02e3f739f76a..f3ca4d5f466d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc @@ -54,7 +54,9 @@ void register_node_type_sh_bsdf_hair() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, NODE_CLASS_SHADER); + ntype.ui_name = "Hair BSDF"; + ntype.ui_description = "Reflection and transmission shaders optimized for hair rendering"; ntype.enum_name_legacy = "BSDF_HAIR"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_cycles_shader_nodes_poll; 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 715fbb4f0c38..bffe429e235f 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 @@ -212,8 +212,9 @@ void register_node_type_sh_bsdf_hair_principled() static blender::bke::bNodeType ntype; - sh_node_type_base( - &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, NODE_CLASS_SHADER); + ntype.ui_name = "Principled Hair BSDF"; + ntype.ui_description = "Physically-based, easy-to-use shader for rendering hair and fur"; ntype.enum_name_legacy = "BSDF_HAIR_PRINCIPLED"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_cycles_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_metallic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_metallic.cc index d21979ad2047..e0a15f2b7f8e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_metallic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_metallic.cc @@ -154,7 +154,9 @@ void register_node_type_sh_bsdf_metallic() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_METALLIC, "Metallic BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_METALLIC, NODE_CLASS_SHADER); + ntype.ui_name = "Metallic BSDF"; + ntype.ui_description = "Metallic reflection with microfacet distribution, and metallic fresnel"; ntype.enum_name_legacy = "BSDF_METALLIC"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 98606dfa2fac..880a96d94527 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -663,7 +663,11 @@ void register_node_type_sh_bsdf_principled() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, NODE_CLASS_SHADER); + ntype.ui_name = "Principled BSDF"; + ntype.ui_description = + "Physically-based, easy-to-use shader for rendering surface materials, based on the OpenPBR " + "model"; ntype.enum_name_legacy = "BSDF_PRINCIPLED"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_ray_portal.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_ray_portal.cc index f5101c3689ee..98f1ad263244 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_ray_portal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_ray_portal.cc @@ -60,7 +60,9 @@ void register_node_type_sh_bsdf_ray_portal() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_RAY_PORTAL, "Ray Portal BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_RAY_PORTAL, NODE_CLASS_SHADER); + ntype.ui_name = "Ray Portal BSDF"; + ntype.ui_description = "Continue tracing from an arbitrary new position and in a new direction"; ntype.enum_name_legacy = "BSDF_RAY_PORTAL"; ntype.add_ui_poll = object_shader_nodes_poll; ntype.declare = file_ns::node_declare; 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 9b6437d4e0e9..8c856d47ad64 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc @@ -72,7 +72,11 @@ void register_node_type_sh_bsdf_refraction() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, NODE_CLASS_SHADER); + ntype.ui_name = "Refraction BSDF"; + ntype.ui_description = + "Glossy refraction with sharp or microfacet distribution, typically used for materials that " + "transmit light"; ntype.enum_name_legacy = "BSDF_REFRACTION"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_sheen.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_sheen.cc index 8c4196b7b049..912b66577e0d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_sheen.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_sheen.cc @@ -74,7 +74,11 @@ void register_node_type_sh_bsdf_sheen() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_SHEEN, "Sheen BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_SHEEN, NODE_CLASS_SHADER); + ntype.ui_name = "Sheen BSDF"; + ntype.ui_description = + "Reflection for materials such as cloth.\nTypically mixed with other shaders (such as a " + "Diffuse Shader) and is not particularly useful on its own"; ntype.enum_name_legacy = "BSDF_SHEEN"; ntype.add_ui_poll = object_cycles_shader_nodes_poll; ntype.declare = file_ns::node_declare; 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 cae2de507244..757baeb5a5e5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc @@ -48,7 +48,9 @@ void register_node_type_sh_bsdf_toon() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, NODE_CLASS_SHADER); + ntype.ui_name = "Toon BSDF"; + ntype.ui_description = "Diffuse and Glossy shaders with cartoon light effects"; ntype.enum_name_legacy = "BSDF_TOON"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_cycles_shader_nodes_poll; 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 681112f27d24..6b9426091332 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc @@ -54,7 +54,9 @@ void register_node_type_sh_bsdf_translucent() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, NODE_CLASS_SHADER); + ntype.ui_name = "Translucent BSDF"; + ntype.ui_description = "Lambertian diffuse transmission"; ntype.enum_name_legacy = "BSDF_TRANSLUCENT"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 437d1cc4e740..30ea640b9287 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc @@ -58,7 +58,11 @@ void register_node_type_sh_bsdf_transparent() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, NODE_CLASS_SHADER); + ntype.ui_name = "Transparent BSDF"; + ntype.ui_description = + "Transparency without refraction, passing straight through the surface as if there were no " + "geometry"; ntype.enum_name_legacy = "BSDF_TRANSPARENT"; ntype.add_ui_poll = object_shader_nodes_poll; ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc index 87d9b8436949..d4094eb9e5c0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc @@ -116,7 +116,11 @@ void register_node_type_sh_bump() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_BUMP, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Bump"; + ntype.ui_description = + "Generate a perturbed normal from a height texture for bump mapping. Typically used for " + "faking highly detailed surfaces"; ntype.enum_name_legacy = "BUMP"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_bump; diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.cc b/source/blender/nodes/shader/nodes/node_shader_camera.cc index a92f59ea4c99..b9cef907b9ad 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.cc +++ b/source/blender/nodes/shader/nodes/node_shader_camera.cc @@ -43,7 +43,11 @@ void register_node_type_sh_camera() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_CAMERA, NODE_CLASS_INPUT); + ntype.ui_name = "Camera Data"; + ntype.ui_description = + "Retrieve information about the camera and how it relates to the current shading point's " + "position"; ntype.enum_name_legacy = "CAMERA"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_camera; diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index 18f84ac60b82..8a2516242fd7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc @@ -99,7 +99,9 @@ void register_node_type_sh_clamp() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, NODE_CLASS_CONVERTER); + ntype.ui_name = "Clamp"; + ntype.ui_description = "Clamp a value between a minimum and a maximum"; ntype.enum_name_legacy = "CLAMP"; ntype.declare = file_ns::sh_node_clamp_declare; ntype.draw_buttons = file_ns::node_shader_buts_clamp; 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 8df5c6df0024..dc0fc9dae405 100644 --- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc @@ -159,7 +159,9 @@ void register_node_type_sh_valtorgb() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "Color Ramp", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, NODE_CLASS_CONVERTER); + ntype.ui_name = "Color Ramp"; + ntype.ui_description = "Map values to colors with the use of a gradient"; ntype.enum_name_legacy = "VALTORGB"; ntype.declare = file_ns::sh_node_valtorgb_declare; ntype.initfunc = file_ns::node_shader_init_valtorgb; diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc index 1c21075589dd..4c7124defd47 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.cc +++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc @@ -132,7 +132,9 @@ void register_node_type_sh_curve_vec() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Curves"; + ntype.ui_description = "Map input vector components with curves"; ntype.enum_name_legacy = "CURVE_VEC"; ntype.declare = file_ns::sh_node_curve_vec_declare; ntype.initfunc = file_ns::node_shader_init_curve_vec; @@ -293,7 +295,9 @@ void register_node_type_sh_curve_rgb() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, NODE_CLASS_OP_COLOR); + ntype.ui_name = "RGB Curves"; + ntype.ui_description = "Apply color corrections for each color channel"; ntype.enum_name_legacy = "CURVE_RGB"; ntype.declare = file_ns::sh_node_curve_rgb_declare; ntype.initfunc = file_ns::node_shader_init_curve_rgb; @@ -422,7 +426,9 @@ void register_node_type_sh_curve_float() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, NODE_CLASS_CONVERTER); + ntype.ui_name = "Float Curve"; + ntype.ui_description = "Map an input float to a curve and outputs a float value"; ntype.enum_name_legacy = "CURVE_FLOAT"; ntype.declare = file_ns::sh_node_curve_float_declare; ntype.initfunc = file_ns::node_shader_init_curve_float; diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_displacement.cc index 6cca95d94b64..15997a489a44 100644 --- a/source/blender/nodes/shader/nodes/node_shader_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_displacement.cc @@ -74,7 +74,9 @@ void register_node_type_sh_displacement() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Displacement"; + ntype.ui_description = "Displace the surface along the surface normal"; ntype.enum_name_legacy = "DISPLACEMENT"; ntype.declare = file_ns::node_declare; ntype.initfunc = file_ns::node_shader_init_displacement; 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 8b93f3944d5c..09ad04667604 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc @@ -81,7 +81,12 @@ void register_node_type_sh_eevee_specular() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, NODE_CLASS_SHADER); + ntype.ui_name = "Specular BSDF"; + ntype.ui_description = + "Similar to the Principled BSDF node but uses the specular workflow instead of metallic, " + "which functions by specifying the facing (along normal) reflection color. Energy is not " + "conserved, so the result may not be physically accurate"; ntype.enum_name_legacy = "EEVEE_SPECULAR"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_eevee_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc index 2663f01ffb02..79704386c9b9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.cc +++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc @@ -48,7 +48,9 @@ void register_node_type_sh_emission() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_EMISSION, NODE_CLASS_SHADER); + ntype.ui_name = "Emission"; + ntype.ui_description = "Lambertian emission shader"; ntype.enum_name_legacy = "EMISSION"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_emission; diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc index d0e3a7f7f05c..a3538e4fdcce 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc @@ -45,7 +45,12 @@ void register_node_type_sh_fresnel() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_FRESNEL, NODE_CLASS_INPUT); + ntype.ui_name = "Fresnel"; + ntype.ui_description = + "Produce a blending factor depending on the angle between the surface normal and the view " + "direction using Fresnel equations.\nTypically used for mixing reflections at grazing " + "angles"; ntype.enum_name_legacy = "FRESNEL"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_fresnel; diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.cc b/source/blender/nodes/shader/nodes/node_shader_gamma.cc index 1b462a269a9e..8b1ef2e178b7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_gamma.cc +++ b/source/blender/nodes/shader/nodes/node_shader_gamma.cc @@ -50,7 +50,9 @@ void register_node_type_sh_gamma() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR); + sh_node_type_base(&ntype, SH_NODE_GAMMA, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Gamma"; + ntype.ui_description = "Apply a gamma correction"; ntype.enum_name_legacy = "GAMMA"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_gamma; diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.cc b/source/blender/nodes/shader/nodes/node_shader_geometry.cc index cb87478a6116..ec32d16b4b49 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.cc +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.cc @@ -91,7 +91,9 @@ void register_node_type_sh_geometry() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, NODE_CLASS_INPUT); + ntype.ui_name = "Geometry"; + ntype.ui_description = "Retrieve geometric information about the current shading point"; ntype.enum_name_legacy = "NEW_GEOMETRY"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_geometry; 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 448de081d092..ac8ce2ee07a8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc @@ -47,7 +47,9 @@ void register_node_type_sh_hair_info() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Curves Info", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Curves Info"; + ntype.ui_description = "Retrieve hair curve information"; ntype.enum_name_legacy = "HAIR_INFO"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_hair_info; diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.cc b/source/blender/nodes/shader/nodes/node_shader_holdout.cc index 49d0561305d1..ebc2b2febf98 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.cc +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.cc @@ -30,7 +30,12 @@ void register_node_type_sh_holdout() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_HOLDOUT, NODE_CLASS_SHADER); + ntype.ui_name = "Holdout"; + ntype.ui_description = + "Create a \"hole\" in the image with zero alpha transparency, which is useful for " + "compositing.\nNote: the holdout shader can only create alpha when transparency is enabled " + "in the film settings"; ntype.enum_name_legacy = "HOLDOUT"; ntype.add_ui_poll = object_shader_nodes_poll; ntype.declare = file_ns::node_declare; diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc index 095157f1a385..117c5132f6f4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc @@ -81,7 +81,9 @@ void register_node_type_sh_hue_sat() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue/Saturation/Value", NODE_CLASS_OP_COLOR); + sh_node_type_base(&ntype, SH_NODE_HUE_SAT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Hue/Saturation/Value"; + ntype.ui_description = "Apply a color transformation in the HSV color model"; ntype.enum_name_legacy = "HUE_SAT"; ntype.declare = file_ns::node_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); 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 ca944a68ca30..211d489e1356 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc @@ -56,7 +56,11 @@ void register_node_type_sh_tex_ies() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE); + sh_node_type_base(&ntype, SH_NODE_TEX_IES, NODE_CLASS_TEXTURE); + ntype.ui_name = "IES Texture"; + ntype.ui_description = + "Match real world lights with IES files, which store the directional intensity distribution " + "of light sources"; ntype.enum_name_legacy = "TEX_IES"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_ies; diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc index d6cf13cba01e..6a5edcf60e16 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.cc +++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc @@ -51,7 +51,9 @@ void register_node_type_sh_invert() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert Color", NODE_CLASS_OP_COLOR); + sh_node_type_base(&ntype, SH_NODE_INVERT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Invert Color"; + ntype.ui_description = "Invert a color, producing a negative"; ntype.enum_name_legacy = "INVERT"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_invert; 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 bee04c8bb9e6..d93c2896566d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc @@ -46,7 +46,11 @@ void register_node_type_sh_layer_weight() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, NODE_CLASS_INPUT); + ntype.ui_name = "Layer Weight"; + ntype.ui_description = + "Produce a blending factor depending on the angle between the surface normal and the view " + "direction.\nTypically used for layering shaders with the Mix Shader node"; ntype.enum_name_legacy = "LAYER_WEIGHT"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_layer_weight; 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 7c6f2fe02ec4..33d3ff345a2b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc @@ -54,7 +54,11 @@ void register_node_type_sh_light_falloff() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR); + sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Light Falloff"; + ntype.ui_description = + "Manipulate how light intensity decreases over distance. Typically used for " + "non-physically-based effects; in reality light always falls off quadratically"; ntype.enum_name_legacy = "LIGHT_FALLOFF"; ntype.declare = file_ns::node_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); 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 196b4855e079..0df0b319a390 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc @@ -57,7 +57,11 @@ void register_node_type_sh_light_path() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, NODE_CLASS_INPUT); + ntype.ui_name = "Light Path"; + ntype.ui_description = + "Retrieve the type of incoming ray for which the shader is being executed.\nTypically used " + "for non-physically-based tricks"; ntype.enum_name_legacy = "LIGHT_PATH"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_light_path; 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 13b89d79e058..68bd673b3ee7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -524,7 +524,9 @@ void register_node_type_sh_map_range() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Map Range"; + ntype.ui_description = "Remap a value from a range to a target range"; ntype.enum_name_legacy = "MAP_RANGE"; ntype.declare = file_ns::sh_node_map_range_declare; ntype.draw_buttons = file_ns::node_shader_buts_map_range; diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc index b20aa741de68..17697530d7af 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc @@ -121,7 +121,9 @@ void register_node_type_sh_mapping() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_MAPPING, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Mapping"; + ntype.ui_description = "Transform the input vector by applying translation, rotation, and scale"; ntype.enum_name_legacy = "MAPPING"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_mapping; diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc index 73ca1d332f4f..6df586a302a2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -362,7 +362,9 @@ void register_node_type_sh_math() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_MATH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Math"; + ntype.ui_description = "Perform math operations"; ntype.enum_name_legacy = "MATH"; ntype.declare = file_ns::sh_node_math_declare; ntype.labelfunc = node_math_label; diff --git a/source/blender/nodes/shader/nodes/node_shader_mix.cc b/source/blender/nodes/shader/nodes/node_shader_mix.cc index 873677927c86..41b55d91fd15 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix.cc @@ -610,7 +610,9 @@ void register_node_type_sh_mix() namespace file_ns = blender::nodes::node_sh_mix_cc; static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MIX, "Mix", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_MIX, NODE_CLASS_CONVERTER); + ntype.ui_name = "Mix"; + ntype.ui_description = "Mix values by a factor"; ntype.enum_name_legacy = "MIX"; ntype.declare = file_ns::sh_node_mix_declare; ntype.ui_class = file_ns::sh_node_mix_ui_class; 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 57bc2d9bf04b..997d3217099f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -158,7 +158,9 @@ void register_node_type_sh_mix_rgb() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB_LEGACY, "Mix (Legacy)", NODE_CLASS_OP_COLOR); + sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB_LEGACY, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Mix (Legacy)"; + ntype.ui_description = "Mix two input colors"; ntype.enum_name_legacy = "MIX_RGB"; ntype.declare = file_ns::sh_node_mix_rgb_declare; ntype.labelfunc = node_blend_label; 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 73486bbe88dd..0e5111af38ba 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc @@ -65,7 +65,9 @@ void register_node_type_sh_mix_shader() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, NODE_CLASS_SHADER); + ntype.ui_name = "Mix Shader"; + ntype.ui_description = "Mix two shaders together. Typically used for material layering"; ntype.enum_name_legacy = "MIX_SHADER"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_mix_shader; diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc index efb6a7ac68db..417c73890d30 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc @@ -61,7 +61,9 @@ void register_node_type_sh_normal() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_NORMAL, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Normal"; + ntype.ui_description = "Generate a normal vector and a dot product"; ntype.enum_name_legacy = "NORMAL"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_normal; 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 d824e2931c89..5770047bdad2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc @@ -171,7 +171,11 @@ void register_node_type_sh_normal_map() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Normal Map"; + ntype.ui_description = + "Generate a perturbed normal from an RGB normal map image. Typically used for faking highly " + "detailed surfaces"; ntype.enum_name_legacy = "NORMAL_MAP"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_normal_map; 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 c55bdcdeeae6..7f5d468e3e07 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.cc @@ -59,7 +59,9 @@ void register_node_type_sh_object_info() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Object Info"; + ntype.ui_description = "Retrieve information about the object instance"; ntype.enum_name_legacy = "OBJECT_INFO"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_object_info; 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 49148b1dd9cb..0bee0d039200 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc @@ -59,7 +59,11 @@ void register_node_type_sh_output_aov() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, NODE_CLASS_OUTPUT); + ntype.ui_name = "AOV Output"; + ntype.ui_description = + "Arbitrary Output Variables.\nProvide custom render passes for arbitrary shader node " + "outputs"; ntype.enum_name_legacy = "OUTPUT_AOV"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_output_aov; 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 5b1f1ec9bfe8..37a17da68d1f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc @@ -36,7 +36,9 @@ void register_node_type_sh_output_light() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, NODE_CLASS_OUTPUT); + ntype.ui_name = "Light Output"; + ntype.ui_description = "Output light information to a light object"; ntype.enum_name_legacy = "OUTPUT_LIGHT"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_cycles_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc index fcd1082fcc78..83eefeb0d6f9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc @@ -44,7 +44,8 @@ void register_node_type_sh_output_linestyle() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, NODE_CLASS_OUTPUT); + ntype.ui_name = "Line Style Output"; ntype.enum_name_legacy = "OUTPUT_LINESTYLE"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = line_style_shader_nodes_poll; 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 832007cabb9b..840bf51029fd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc @@ -78,7 +78,9 @@ void register_node_type_sh_output_material() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, NODE_CLASS_OUTPUT); + ntype.ui_name = "Material Output"; + ntype.ui_description = "Output surface material information for use in rendering"; ntype.enum_name_legacy = "OUTPUT_MATERIAL"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; 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 bd668281478d..a4f877d343a5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc @@ -39,7 +39,9 @@ void register_node_type_sh_output_world() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT); + sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, NODE_CLASS_OUTPUT); + ntype.ui_name = "World Output"; + ntype.ui_description = "Output light color information to the scene's World"; ntype.enum_name_legacy = "OUTPUT_WORLD"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = world_shader_nodes_poll; 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 fdf86f713f70..442077e3bc27 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc @@ -50,7 +50,11 @@ void register_node_type_sh_particle_info() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Particle Info"; + ntype.ui_description = + "Retrieve the data of the particle that spawned the object instance, for example to give " + "variation to multiple instances of an object"; ntype.enum_name_legacy = "PARTICLE_INFO"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_particle_info; 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 6496a747474d..aae98c5e3bae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_point_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_point_info.cc @@ -40,7 +40,9 @@ void register_node_type_sh_point_info() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_POINT_INFO, "Point Info", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_POINT_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Point Info"; + ntype.ui_description = "Retrieve information about points in a point cloud"; ntype.enum_name_legacy = "POINT_INFO"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_point_info; diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_rgb.cc index b4c8dfc56545..34576a458f00 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.cc @@ -43,7 +43,9 @@ void register_node_type_sh_rgb() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_RGB, NODE_CLASS_INPUT); + ntype.ui_name = "RGB"; + ntype.ui_description = "A color picker"; ntype.enum_name_legacy = "RGB"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::gpu_shader_rgb; 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 0519e32cb1e7..c1ac920ac317 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 @@ -42,7 +42,9 @@ void register_node_type_sh_rgbtobw() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_RGBTOBW, NODE_CLASS_CONVERTER); + ntype.ui_name = "RGB to BW"; + ntype.ui_description = "Convert a color's luminance to a grayscale value"; ntype.enum_name_legacy = "RGBTOBW"; ntype.declare = file_ns::sh_node_rgbtobw_declare; ntype.gpu_fn = file_ns::gpu_shader_rgbtobw; diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc index 4033b2498ded..abd8e2e10729 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.cc +++ b/source/blender/nodes/shader/nodes/node_shader_script.cc @@ -87,7 +87,11 @@ void register_node_type_sh_script() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT); + sh_node_type_base(&ntype, SH_NODE_SCRIPT, NODE_CLASS_SCRIPT); + ntype.ui_name = "Script"; + ntype.ui_description = + "Generate an OSL shader from a file or text data-block.\nNote: OSL shaders are not " + "supported on all GPU backends"; ntype.enum_name_legacy = "SCRIPT"; ntype.draw_buttons = file_ns::node_shader_buts_script; ntype.draw_buttons_ex = file_ns::node_shader_buts_script_ex; 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 690771ab8339..49ff89ac0f6c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_color.cc @@ -102,7 +102,9 @@ void register_node_type_sh_sepcolor() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_SEPARATE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate Color"; + ntype.ui_description = "Split a color into its individual components using multiple models"; ntype.enum_name_legacy = "SEPARATE_COLOR"; ntype.declare = file_ns::sh_node_sepcolor_declare; ntype.updatefunc = file_ns::node_sepcolor_update; @@ -204,7 +206,9 @@ void register_node_type_sh_combcolor() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_COMBINE_COLOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine Color"; + ntype.ui_description = "Create a color from individual components using multiple models"; ntype.enum_name_legacy = "COMBINE_COLOR"; ntype.declare = file_ns::sh_node_combcolor_declare; ntype.updatefunc = file_ns::node_combcolor_update; 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 dda6bf5c3b46..398bda4b735b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc @@ -37,7 +37,9 @@ void register_node_type_sh_sephsv() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SEPHSV_LEGACY, "Separate HSV (Legacy)", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_SEPHSV_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate HSV (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPHSV"; ntype.declare = file_ns::node_declare_sephsv; ntype.gpu_fn = file_ns::gpu_shader_sephsv; @@ -75,7 +77,9 @@ void register_node_type_sh_combhsv() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_COMBHSV_LEGACY, "Combine HSV (Legacy)", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_COMBHSV_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine HSV (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBHSV"; ntype.declare = file_ns::node_declare_combhsv; ntype.gpu_fn = file_ns::gpu_shader_combhsv; 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 954ff4c9d259..906ae1b6090b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -79,8 +79,9 @@ void register_node_type_sh_seprgb() static blender::bke::bNodeType ntype; - sh_fn_node_type_base( - &ntype, SH_NODE_SEPRGB_LEGACY, "Separate RGB (Legacy)", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate RGB (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SEPRGB"; ntype.declare = file_ns::sh_node_seprgb_declare; ntype.gpu_fn = file_ns::gpu_shader_seprgb; @@ -125,8 +126,9 @@ void register_node_type_sh_combrgb() static blender::bke::bNodeType ntype; - sh_fn_node_type_base( - &ntype, SH_NODE_COMBRGB_LEGACY, "Combine RGB (Legacy)", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB_LEGACY, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine RGB (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "COMBRGB"; ntype.declare = file_ns::sh_node_combrgb_declare; ntype.gpu_fn = file_ns::gpu_shader_combrgb; 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 e4d853c54f87..4e964981afdb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc @@ -137,7 +137,9 @@ void register_node_type_sh_sepxyz() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, NODE_CLASS_CONVERTER); + ntype.ui_name = "Separate XYZ"; + ntype.ui_description = "Split a vector into its X, Y, and Z components"; ntype.enum_name_legacy = "SEPXYZ"; ntype.declare = file_ns::sh_node_sepxyz_declare; ntype.gpu_fn = file_ns::gpu_shader_sepxyz; @@ -226,7 +228,9 @@ void register_node_type_sh_combxyz() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER); + sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, NODE_CLASS_CONVERTER); + ntype.ui_name = "Combine XYZ"; + ntype.ui_description = "Create a vector from X, Y, and Z components"; ntype.enum_name_legacy = "COMBXYZ"; ntype.declare = file_ns::sh_node_combxyz_declare; ntype.gpu_fn = file_ns::gpu_shader_combxyz; 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 8b52dde14a8e..b6b54abd8ce6 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 @@ -33,7 +33,12 @@ void register_node_type_sh_shadertorgb() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, NODE_CLASS_CONVERTER); + ntype.ui_name = "Shader to RGB"; + ntype.ui_description = + "Convert rendering effect (such as light and shadow) to color. Typically used for " + "non-photorealistic rendering, to apply additional effects on the output of BSDFs.\nNote: " + "only supported in EEVEE"; ntype.enum_name_legacy = "SHADERTORGB"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_eevee_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index 7469d35c0ae0..c43542284891 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -35,7 +35,9 @@ void register_node_type_sh_squeeze() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value (Legacy)", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_SQUEEZE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Squeeze Value (Legacy)"; + ntype.ui_description = "Deprecated"; ntype.enum_name_legacy = "SQUEEZE"; ntype.gather_link_search_ops = nullptr; ntype.declare = file_ns::node_declare; 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 c233f59937a6..936b2b1cfbbe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc @@ -115,8 +115,11 @@ void register_node_type_sh_subsurface_scattering() static blender::bke::bNodeType ntype; - sh_node_type_base( - &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_SUBSURFACE_SCATTERING, NODE_CLASS_SHADER); + ntype.ui_name = "Subsurface Scattering"; + ntype.ui_description = + "Subsurface multiple scattering shader to simulate light entering the surface and bouncing " + "internally.\nTypically used for materials such as skin, wax, marble or milk"; ntype.enum_name_legacy = "SUBSURFACE_SCATTERING"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc index e1d606bcfb14..0d7f26f861ca 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc @@ -105,7 +105,9 @@ void register_node_type_sh_tangent() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_TANGENT, NODE_CLASS_INPUT); + ntype.ui_name = "Tangent"; + ntype.ui_description = "Generate a tangent direction for the Anisotropic BSDF"; ntype.enum_name_legacy = "TANGENT"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_tangent; 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 982a70b04e8f..f330c16242b6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -299,7 +299,9 @@ void register_node_type_sh_tex_brick() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, NODE_CLASS_TEXTURE); + ntype.ui_name = "Brick Texture"; + ntype.ui_description = "Generate a procedural texture producing bricks"; ntype.enum_name_legacy = "TEX_BRICK"; ntype.declare = file_ns::sh_node_tex_brick_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_brick; 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 c14ccb61f772..323095649d4f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -139,7 +139,9 @@ void register_node_type_sh_tex_checker() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, NODE_CLASS_TEXTURE); + ntype.ui_name = "Checker Texture"; + ntype.ui_description = "Generate a checkerboard texture"; ntype.enum_name_legacy = "TEX_CHECKER"; ntype.declare = file_ns::sh_node_tex_checker_declare; ntype.initfunc = file_ns::node_shader_init_tex_checker; 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 6db5c5acb253..d94a5051f037 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -106,7 +106,11 @@ void register_node_type_sh_tex_coord() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_TEX_COORD, NODE_CLASS_INPUT); + ntype.ui_name = "Texture Coordinate"; + ntype.ui_description = + "Retrieve multiple types of texture coordinates.\nTypically used as inputs for texture " + "nodes"; ntype.enum_name_legacy = "TEX_COORD"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_coord; 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 85a87a2d238b..d0e76ca6589e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc @@ -189,7 +189,11 @@ void register_node_type_sh_tex_environment() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE); + sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, NODE_CLASS_TEXTURE); + ntype.ui_name = "Environment Texture"; + ntype.ui_description = + "Sample an image file as an environment texture. Typically used to light the scene with the " + "background node"; ntype.enum_name_legacy = "TEX_ENVIRONMENT"; ntype.declare = file_ns::node_declare; ntype.initfunc = file_ns::node_shader_init_tex_environment; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gabor.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gabor.cc index 19d0730606d1..2c5ec1a8d512 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gabor.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gabor.cc @@ -207,7 +207,9 @@ void register_node_type_sh_tex_gabor() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_GABOR, "Gabor Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_GABOR, NODE_CLASS_TEXTURE); + ntype.ui_name = "Gabor Texture"; + ntype.ui_description = "Generate Gabor noise"; ntype.enum_name_legacy = "TEX_GABOR"; ntype.declare = file_ns::sh_node_tex_gabor_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_gabor; 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 3acd802c7b63..91abbffc662a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -199,7 +199,10 @@ void register_node_type_sh_tex_gradient() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, NODE_CLASS_TEXTURE); + ntype.ui_name = "Gradient Texture"; + ntype.ui_description = + "Generate interpolated color and intensity values based on the input vector"; ntype.enum_name_legacy = "TEX_GRADIENT"; ntype.declare = file_ns::sh_node_tex_gradient_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_gradient; 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 fa165e6a562a..44cca5292022 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -279,7 +279,9 @@ void register_node_type_sh_tex_image() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE); + sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, NODE_CLASS_TEXTURE); + ntype.ui_name = "Image Texture"; + ntype.ui_description = "Sample an image file as a texture"; ntype.enum_name_legacy = "TEX_IMAGE"; ntype.declare = file_ns::sh_node_tex_image_declare; ntype.initfunc = file_ns::node_shader_init_tex_image; 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 d72d6069b439..c0d983e45835 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -183,7 +183,9 @@ void register_node_type_sh_tex_magic() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, NODE_CLASS_TEXTURE); + ntype.ui_name = "Magic Texture"; + ntype.ui_description = "Generate a psychedelic color texture"; ntype.enum_name_legacy = "TEX_MAGIC"; ntype.declare = file_ns::sh_node_tex_magic_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_magic; 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 cade01b8c972..397425ad916a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -461,7 +461,9 @@ void register_node_type_sh_tex_noise() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, NODE_CLASS_TEXTURE); + ntype.ui_name = "Noise Texture"; + ntype.ui_description = "Generate fractal Perlin noise"; ntype.enum_name_legacy = "TEX_NOISE"; ntype.declare = file_ns::sh_node_tex_noise_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_noise; 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 bd899d10ff10..9a15260a8477 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc @@ -111,7 +111,10 @@ void register_node_type_sh_tex_pointdensity() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE); + sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, NODE_CLASS_TEXTURE); + ntype.ui_name = "Point Density"; + ntype.ui_description = + "Generate a volumetric point for each particle or vertex of another object"; ntype.enum_name_legacy = "TEX_POINTDENSITY"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_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 027776f33db9..fd363eb1c31b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc @@ -313,7 +313,9 @@ void register_node_type_sh_tex_sky() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE); + sh_node_type_base(&ntype, SH_NODE_TEX_SKY, NODE_CLASS_TEXTURE); + ntype.ui_name = "Sky Texture"; + ntype.ui_description = "Generate a procedural sky texture"; ntype.enum_name_legacy = "TEX_SKY"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_sky; 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 dd98bbbf3fa6..fed51f72d5c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -818,7 +818,11 @@ void register_node_type_sh_tex_voronoi() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, NODE_CLASS_TEXTURE); + ntype.ui_name = "Voronoi Texture"; + ntype.ui_description = + "Generate Worley noise based on the distance to random points. Typically used to generate " + "textures such as stones, water, or biological cells"; ntype.enum_name_legacy = "TEX_VORONOI"; ntype.declare = file_ns::sh_node_tex_voronoi_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_voronoi; 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 0fac1dd8384a..7f7271547074 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -335,7 +335,9 @@ void register_node_type_sh_tex_wave() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, NODE_CLASS_TEXTURE); + ntype.ui_name = "Wave Texture"; + ntype.ui_description = "Generate procedural bands or rings with noise"; ntype.enum_name_legacy = "TEX_WAVE"; ntype.declare = file_ns::sh_node_tex_wave_declare; ntype.draw_buttons = file_ns::node_shader_buts_tex_wave; 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 33e383d635a2..8f88d28a0bda 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 @@ -260,7 +260,9 @@ void register_node_type_sh_tex_white_noise() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE); + sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, NODE_CLASS_TEXTURE); + ntype.ui_name = "White Noise Texture"; + ntype.ui_description = "Return a random value or color based on an input seed"; ntype.enum_name_legacy = "TEX_WHITE_NOISE"; ntype.declare = file_ns::sh_node_tex_white_noise_declare; ntype.draw_buttons = file_ns::node_shader_buts_white_noise; diff --git a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc index 1408898a8b64..4ca173c12a0f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc @@ -28,7 +28,8 @@ void register_node_type_sh_uvalongstroke() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, NODE_CLASS_INPUT); + ntype.ui_name = "UV Along Stroke"; ntype.enum_name_legacy = "UVALONGSTROKE"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = line_style_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc index fcf9360339c7..eac3b13be815 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc @@ -93,7 +93,10 @@ void register_node_type_sh_uvmap() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_UVMAP, NODE_CLASS_INPUT); + ntype.ui_name = "UV Map"; + ntype.ui_description = + "Retrieve a UV map from the geometry, or the default fallback if none is specified"; ntype.enum_name_legacy = "UVMAP"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_uvmap; diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index 521461b603c7..feca7392581f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -55,7 +55,9 @@ void register_node_type_sh_value() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT); + sh_fn_node_type_base(&ntype, SH_NODE_VALUE, NODE_CLASS_INPUT); + ntype.ui_name = "Value"; + ntype.ui_description = "Input numerical values to other nodes in the tree"; ntype.enum_name_legacy = "VALUE"; ntype.declare = file_ns::sh_node_value_declare; ntype.gpu_fn = file_ns::gpu_shader_value; 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 908556649871..b67d2dc851fa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc @@ -78,8 +78,9 @@ void register_node_type_sh_vector_displacement() static blender::bke::bNodeType ntype; - sh_node_type_base( - &ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_VECTOR_DISPLACEMENT, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Displacement"; + ntype.ui_description = "Displace the surface along an arbitrary direction"; ntype.enum_name_legacy = "VECTOR_DISPLACEMENT"; ntype.declare = file_ns::node_declare; ntype.initfunc = file_ns::node_shader_init_vector_displacement; 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 3f386c0b1bf4..be424a057480 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -556,7 +556,9 @@ void register_node_type_sh_vect_math() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR); + sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Math"; + ntype.ui_description = "Perform vector math operation"; ntype.enum_name_legacy = "VECT_MATH"; ntype.declare = file_ns::sh_node_vector_math_declare; ntype.draw_buttons = file_ns::node_shader_buts_vect_math; 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 4555ecb48180..6a38c4b821c4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc @@ -268,7 +268,9 @@ void register_node_type_sh_vector_rotate() static blender::bke::bNodeType ntype; - sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR); + sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Rotate"; + ntype.ui_description = "Rotate a vector around a pivot point (center)"; ntype.enum_name_legacy = "VECTOR_ROTATE"; ntype.declare = file_ns::sh_node_vector_rotate_declare; ntype.draw_buttons = file_ns::node_shader_buts_vector_rotate; 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 03d596825f20..554c26e811dc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc @@ -208,7 +208,10 @@ void register_node_type_sh_vect_transform() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR); + sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, NODE_CLASS_OP_VECTOR); + ntype.ui_name = "Vector Transform"; + ntype.ui_description = + "Convert a vector, point, or normal between world, camera, and object coordinate space"; ntype.enum_name_legacy = "VECT_TRANSFORM"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_vect_transform; 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 32b083a90a44..960140278de3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc @@ -88,7 +88,10 @@ void register_node_type_sh_vertex_color() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Color Attribute", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, NODE_CLASS_INPUT); + ntype.ui_name = "Color Attribute"; + ntype.ui_description = + "Retrieve a color attribute, or the default fallback if none is specified"; ntype.enum_name_legacy = "VERTEX_COLOR"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_vertex_color; 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 cf06d8abbdb0..02d6d225181b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc @@ -40,7 +40,9 @@ void register_node_type_sh_volume_absorption() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, NODE_CLASS_SHADER); + ntype.ui_name = "Volume Absorption"; + ntype.ui_description = "Absorb light as it passes through the volume"; ntype.enum_name_legacy = "VOLUME_ABSORPTION"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_volume_absorption; 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 65e546407739..c6ad830e1f84 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc @@ -48,7 +48,9 @@ void register_node_type_sh_volume_info() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, NODE_CLASS_INPUT); + ntype.ui_name = "Volume Info"; + ntype.ui_description = "Read volume data attributes from volume grids"; ntype.enum_name_legacy = "VOLUME_INFO"; ntype.declare = file_ns::node_declare; ntype.gpu_fn = file_ns::node_shader_gpu_volume_info; 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 a30706137e54..ac9a4b36f5ae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -164,7 +164,9 @@ void register_node_type_sh_volume_principled() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, NODE_CLASS_SHADER); + ntype.ui_name = "Principled Volume"; + ntype.ui_description = "Combine all volume shading components into a single easy to use node"; ntype.enum_name_legacy = "PRINCIPLED_VOLUME"; ntype.declare = file_ns::node_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Large); 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 6a6919f78738..4c275e401da3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc @@ -106,7 +106,10 @@ void register_node_type_sh_volume_scatter() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER); + sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, NODE_CLASS_SHADER); + ntype.ui_name = "Volume Scatter"; + ntype.ui_description = + "Scatter light as it passes through the volume, often used to add fog to a scene"; ntype.enum_name_legacy = "VOLUME_SCATTER"; ntype.declare = file_ns::node_declare; ntype.add_ui_poll = object_shader_nodes_poll; diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc index a0d32e431fc1..9ec5070832f2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc @@ -43,7 +43,9 @@ void register_node_type_sh_wavelength() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Wavelength"; + ntype.ui_description = "Convert a wavelength value to an RGB value"; ntype.enum_name_legacy = "WAVELENGTH"; ntype.declare = file_ns::node_declare; blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc index b0e838ad8a26..216a9c2411a7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc @@ -58,7 +58,11 @@ void register_node_type_sh_wireframe() static blender::bke::bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT); + sh_node_type_base(&ntype, SH_NODE_WIREFRAME, NODE_CLASS_INPUT); + ntype.ui_name = "Wireframe"; + ntype.ui_description = + "Retrieve the edges of an object as it appears to Cycles.\nNote: as meshes are triangulated " + "before being processed by Cycles, topology will always appear triangulated"; ntype.enum_name_legacy = "WIREFRAME"; ntype.declare = file_ns::node_declare; ntype.draw_buttons = file_ns::node_shader_buts_wireframe; diff --git a/source/blender/nodes/texture/node_texture_tree.cc b/source/blender/nodes/texture/node_texture_tree.cc index 62ca1be60bdd..c45918e8f1d4 100644 --- a/source/blender/nodes/texture/node_texture_tree.cc +++ b/source/blender/nodes/texture/node_texture_tree.cc @@ -132,15 +132,15 @@ blender::bke::bNodeTreeType *ntreeType_Texture; void register_node_tree_type_tex() { - blender::bke::bNodeTreeType *tt = ntreeType_Texture = MEM_cnew( - "texture node tree type"); + blender::bke::bNodeTreeType *tt = ntreeType_Texture = MEM_new( + __func__); tt->type = NTREE_TEXTURE; - STRNCPY(tt->idname, "TextureNodeTree"); - STRNCPY(tt->group_idname, "TextureNodeGroup"); - STRNCPY(tt->ui_name, N_("Texture Node Editor")); + tt->idname = "TextureNodeTree"; + tt->group_idname = "TextureNodeGroup"; + tt->ui_name = N_("Texture Node Editor"); tt->ui_icon = ICON_NODE_TEXTURE; /* Defined in `drawnode.cc`. */ - STRNCPY(tt->ui_description, N_("Texture nodes")); + tt->ui_description = N_("Texture nodes"); tt->foreach_nodeclass = foreach_nodeclass; tt->update = update; diff --git a/source/blender/nodes/texture/node_texture_util.cc b/source/blender/nodes/texture/node_texture_util.cc index da742bb71195..030b07970178 100644 --- a/source/blender/nodes/texture/node_texture_util.cc +++ b/source/blender/nodes/texture/node_texture_util.cc @@ -40,9 +40,9 @@ bool tex_node_poll_default(const blender::bke::bNodeType * /*ntype*/, return true; } -void tex_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass) +void tex_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass) { - blender::bke::node_type_base(ntype, type, name, nclass); + blender::bke::node_type_base(ntype, type, nclass); ntype->poll = tex_node_poll_default; ntype->insert_link = node_insert_link_default; diff --git a/source/blender/nodes/texture/node_texture_util.hh b/source/blender/nodes/texture/node_texture_util.hh index 564c8075b430..b2e0afc16ed1 100644 --- a/source/blender/nodes/texture/node_texture_util.hh +++ b/source/blender/nodes/texture/node_texture_util.hh @@ -60,7 +60,7 @@ struct TexDelegate { bool tex_node_poll_default(const blender::bke::bNodeType *ntype, const bNodeTree *ntree, const char **r_disabled_hint); -void tex_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass); +void tex_node_type_base(blender::bke::bNodeType *ntype, int type, short nclass); void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread); void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread); diff --git a/source/blender/nodes/texture/nodes/node_texture_at.cc b/source/blender/nodes/texture/nodes/node_texture_at.cc index 1ca231dcd745..8497a61adafc 100644 --- a/source/blender/nodes/texture/nodes/node_texture_at.cc +++ b/source/blender/nodes/texture/nodes/node_texture_at.cc @@ -42,7 +42,8 @@ void register_node_type_tex_at() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT); + tex_node_type_base(&ntype, TEX_NODE_AT, NODE_CLASS_DISTORT); + ntype.ui_name = "At"; ntype.enum_name_legacy = "AT"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); blender::bke::node_type_size(&ntype, 140, 100, 320); diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.cc b/source/blender/nodes/texture/nodes/node_texture_bricks.cc index 102974ec9443..c66e9244c0dc 100644 --- a/source/blender/nodes/texture/nodes/node_texture_bricks.cc +++ b/source/blender/nodes/texture/nodes/node_texture_bricks.cc @@ -107,7 +107,8 @@ void register_node_type_tex_bricks() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN); + tex_node_type_base(&ntype, TEX_NODE_BRICKS, NODE_CLASS_PATTERN); + ntype.ui_name = "Bricks"; ntype.enum_name_legacy = "BRICKS"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.cc b/source/blender/nodes/texture/nodes/node_texture_checker.cc index eabe0901a373..ef092253e770 100644 --- a/source/blender/nodes/texture/nodes/node_texture_checker.cc +++ b/source/blender/nodes/texture/nodes/node_texture_checker.cc @@ -54,7 +54,8 @@ void register_node_type_tex_checker() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN); + tex_node_type_base(&ntype, TEX_NODE_CHECKER, NODE_CLASS_PATTERN); + ntype.ui_name = "Checker"; ntype.enum_name_legacy = "CHECKER"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_combine_color.cc b/source/blender/nodes/texture/nodes/node_texture_combine_color.cc index 3997f1d4ba8b..c265cb0b0273 100644 --- a/source/blender/nodes/texture/nodes/node_texture_combine_color.cc +++ b/source/blender/nodes/texture/nodes/node_texture_combine_color.cc @@ -70,7 +70,8 @@ void register_node_type_tex_combine_color() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_COMBINE_COLOR, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Combine Color"; ntype.enum_name_legacy = "COMBINE_COLOR"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.cc b/source/blender/nodes/texture/nodes/node_texture_compose.cc index cb59b290b555..1412385e2240 100644 --- a/source/blender/nodes/texture/nodes/node_texture_compose.cc +++ b/source/blender/nodes/texture/nodes/node_texture_compose.cc @@ -42,8 +42,8 @@ void register_node_type_tex_compose() { static blender::bke::bNodeType ntype; - tex_node_type_base( - &ntype, TEX_NODE_COMPOSE_LEGACY, "Combine RGBA (Legacy)", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_COMPOSE_LEGACY, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Combine RGBA (Legacy)"; ntype.enum_name_legacy = "COMPOSE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_coord.cc b/source/blender/nodes/texture/nodes/node_texture_coord.cc index 3272ea3b9572..626a6ff6d28b 100644 --- a/source/blender/nodes/texture/nodes/node_texture_coord.cc +++ b/source/blender/nodes/texture/nodes/node_texture_coord.cc @@ -34,7 +34,8 @@ void register_node_type_tex_coord() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT); + tex_node_type_base(&ntype, TEX_NODE_COORD, NODE_CLASS_INPUT); + ntype.ui_name = "Coordinates"; ntype.enum_name_legacy = "COORD"; blender::bke::node_type_socket_templates(&ntype, nullptr, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.cc b/source/blender/nodes/texture/nodes/node_texture_curves.cc index 8e282d0fa1eb..28580cb74774 100644 --- a/source/blender/nodes/texture/nodes/node_texture_curves.cc +++ b/source/blender/nodes/texture/nodes/node_texture_curves.cc @@ -54,7 +54,8 @@ void register_node_type_tex_curve_time() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT); + tex_node_type_base(&ntype, TEX_NODE_CURVE_TIME, NODE_CLASS_INPUT); + ntype.ui_name = "Time"; ntype.enum_name_legacy = "CURVE_TIME"; blender::bke::node_type_socket_templates(&ntype, nullptr, time_outputs); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Large); @@ -105,7 +106,8 @@ void register_node_type_tex_curve_rgb() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_CURVE_RGB, NODE_CLASS_OP_COLOR); + ntype.ui_name = "RGB Curves"; ntype.enum_name_legacy = "CURVE_RGB"; blender::bke::node_type_socket_templates(&ntype, rgb_inputs, rgb_outputs); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Large); diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.cc b/source/blender/nodes/texture/nodes/node_texture_decompose.cc index c5439bdb1aa2..d414cb2420ef 100644 --- a/source/blender/nodes/texture/nodes/node_texture_decompose.cc +++ b/source/blender/nodes/texture/nodes/node_texture_decompose.cc @@ -63,7 +63,8 @@ void register_node_type_tex_decompose() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE_LEGACY, "Separate RGBA", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_DECOMPOSE_LEGACY, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Separate RGBA"; ntype.enum_name_legacy = "DECOMPOSE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_distance.cc b/source/blender/nodes/texture/nodes/node_texture_distance.cc index 1067494a46d6..1a3ee0e9dd34 100644 --- a/source/blender/nodes/texture/nodes/node_texture_distance.cc +++ b/source/blender/nodes/texture/nodes/node_texture_distance.cc @@ -45,7 +45,8 @@ void register_node_type_tex_distance() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTER); + tex_node_type_base(&ntype, TEX_NODE_DISTANCE, NODE_CLASS_CONVERTER); + ntype.ui_name = "Distance"; ntype.enum_name_legacy = "DISTANCE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc index 9c2cae0f9890..13c21db8bd9b 100644 --- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc +++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.cc @@ -93,7 +93,8 @@ void register_node_type_tex_hue_sat() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue/Saturation/Value", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_HUE_SAT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Hue/Saturation/Value"; ntype.enum_name_legacy = "HUE_SAT"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); diff --git a/source/blender/nodes/texture/nodes/node_texture_image.cc b/source/blender/nodes/texture/nodes/node_texture_image.cc index a7942179eec8..8ca0ad9f230d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_image.cc +++ b/source/blender/nodes/texture/nodes/node_texture_image.cc @@ -96,7 +96,8 @@ void register_node_type_tex_image() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT); + tex_node_type_base(&ntype, TEX_NODE_IMAGE, NODE_CLASS_INPUT); + ntype.ui_name = "Image"; ntype.enum_name_legacy = "IMAGE"; blender::bke::node_type_socket_templates(&ntype, nullptr, outputs); ntype.initfunc = init; diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.cc b/source/blender/nodes/texture/nodes/node_texture_invert.cc index 0110d6601b30..2f5fbcedeba2 100644 --- a/source/blender/nodes/texture/nodes/node_texture_invert.cc +++ b/source/blender/nodes/texture/nodes/node_texture_invert.cc @@ -48,7 +48,8 @@ void register_node_type_tex_invert() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_INVERT, "Invert Color", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_INVERT, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Invert Color"; ntype.enum_name_legacy = "INVERT"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_math.cc b/source/blender/nodes/texture/nodes/node_texture_math.cc index 98543c495f66..2e0423fb0e2d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.cc +++ b/source/blender/nodes/texture/nodes/node_texture_math.cc @@ -331,7 +331,8 @@ void register_node_type_tex_math() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTER); + tex_node_type_base(&ntype, TEX_NODE_MATH, NODE_CLASS_CONVERTER); + ntype.ui_name = "Math"; ntype.enum_name_legacy = "MATH"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.labelfunc = node_math_label; diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.cc b/source/blender/nodes/texture/nodes/node_texture_mixRgb.cc index 6830d6cd506a..1155b9eb866d 100644 --- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.cc +++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.cc @@ -58,7 +58,8 @@ void register_node_type_tex_mix_rgb() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Mix"; ntype.enum_name_legacy = "MIX_RGB"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.labelfunc = node_blend_label; diff --git a/source/blender/nodes/texture/nodes/node_texture_output.cc b/source/blender/nodes/texture/nodes/node_texture_output.cc index 437a48f4ab05..01ddb4a2dc1e 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.cc +++ b/source/blender/nodes/texture/nodes/node_texture_output.cc @@ -138,7 +138,8 @@ void register_node_type_tex_output() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT); + tex_node_type_base(&ntype, TEX_NODE_OUTPUT, NODE_CLASS_OUTPUT); + ntype.ui_name = "Output"; ntype.enum_name_legacy = "OUTPUT"; blender::bke::node_type_socket_templates(&ntype, inputs, nullptr); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.cc b/source/blender/nodes/texture/nodes/node_texture_proc.cc index c5c8e864c064..d36580f52842 100644 --- a/source/blender/nodes/texture/nodes/node_texture_proc.cc +++ b/source/blender/nodes/texture/nodes/node_texture_proc.cc @@ -256,7 +256,8 @@ static void init(bNodeTree * /*ntree*/, bNode *node) { \ static blender::bke::bNodeType ntype; \ \ - tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, Name, NODE_CLASS_TEXTURE); \ + tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, NODE_CLASS_TEXTURE); \ + ntype.ui_name = Name; \ ntype.enum_name_legacy = EnumNameLegacy; \ blender::bke::node_type_socket_templates(&ntype, name##_inputs, outputs); \ blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); \ diff --git a/source/blender/nodes/texture/nodes/node_texture_rotate.cc b/source/blender/nodes/texture/nodes/node_texture_rotate.cc index 6d168abcf295..4a3f4acfc078 100644 --- a/source/blender/nodes/texture/nodes/node_texture_rotate.cc +++ b/source/blender/nodes/texture/nodes/node_texture_rotate.cc @@ -81,7 +81,8 @@ void register_node_type_tex_rotate() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT); + tex_node_type_base(&ntype, TEX_NODE_ROTATE, NODE_CLASS_DISTORT); + ntype.ui_name = "Rotate"; ntype.enum_name_legacy = "ROTATE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_scale.cc b/source/blender/nodes/texture/nodes/node_texture_scale.cc index cc40a15b6881..05b891538347 100644 --- a/source/blender/nodes/texture/nodes/node_texture_scale.cc +++ b/source/blender/nodes/texture/nodes/node_texture_scale.cc @@ -54,7 +54,8 @@ void register_node_type_tex_scale() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT); + tex_node_type_base(&ntype, TEX_NODE_SCALE, NODE_CLASS_DISTORT); + ntype.ui_name = "Scale"; ntype.enum_name_legacy = "SCALE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_separate_color.cc b/source/blender/nodes/texture/nodes/node_texture_separate_color.cc index efe6487d3cb5..868a9deece10 100644 --- a/source/blender/nodes/texture/nodes/node_texture_separate_color.cc +++ b/source/blender/nodes/texture/nodes/node_texture_separate_color.cc @@ -97,7 +97,8 @@ void register_node_type_tex_separate_color() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_OP_COLOR); + tex_node_type_base(&ntype, TEX_NODE_SEPARATE_COLOR, NODE_CLASS_OP_COLOR); + ntype.ui_name = "Separate Color"; ntype.enum_name_legacy = "SEPARATE_COLOR"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.cc b/source/blender/nodes/texture/nodes/node_texture_texture.cc index 0b670423be1d..bbb88570ab5a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.cc +++ b/source/blender/nodes/texture/nodes/node_texture_texture.cc @@ -84,7 +84,8 @@ void register_node_type_tex_texture() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT); + tex_node_type_base(&ntype, TEX_NODE_TEXTURE, NODE_CLASS_INPUT); + ntype.ui_name = "Texture"; ntype.enum_name_legacy = "TEXTURE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_translate.cc b/source/blender/nodes/texture/nodes/node_texture_translate.cc index 8b1f91a3764d..2c58a6f79e5c 100644 --- a/source/blender/nodes/texture/nodes/node_texture_translate.cc +++ b/source/blender/nodes/texture/nodes/node_texture_translate.cc @@ -48,7 +48,8 @@ void register_node_type_tex_translate() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT); + tex_node_type_base(&ntype, TEX_NODE_TRANSLATE, NODE_CLASS_DISTORT); + ntype.ui_name = "Translate"; ntype.enum_name_legacy = "TRANSLATE"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_valToNor.cc b/source/blender/nodes/texture/nodes/node_texture_valToNor.cc index 36c41daa9cac..568ee334c211 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToNor.cc +++ b/source/blender/nodes/texture/nodes/node_texture_valToNor.cc @@ -64,7 +64,8 @@ void register_node_type_tex_valtonor() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTER); + tex_node_type_base(&ntype, TEX_NODE_VALTONOR, NODE_CLASS_CONVERTER); + ntype.ui_name = "Value to Normal"; ntype.enum_name_legacy = "VALTONOR"; blender::bke::node_type_socket_templates(&ntype, inputs, outputs); ntype.exec_fn = exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.cc b/source/blender/nodes/texture/nodes/node_texture_valToRgb.cc index 8601a0cb258e..bbfe12adde90 100644 --- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.cc +++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.cc @@ -49,7 +49,8 @@ void register_node_type_tex_valtorgb() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VALTORGB, "Color Ramp", NODE_CLASS_CONVERTER); + tex_node_type_base(&ntype, TEX_NODE_VALTORGB, NODE_CLASS_CONVERTER); + ntype.ui_name = "Color Ramp"; ntype.enum_name_legacy = "VALTORGB"; blender::bke::node_type_socket_templates(&ntype, valtorgb_in, valtorgb_out); blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Large); @@ -93,7 +94,8 @@ void register_node_type_tex_rgbtobw() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER); + tex_node_type_base(&ntype, TEX_NODE_RGBTOBW, NODE_CLASS_CONVERTER); + ntype.ui_name = "RGB to BW"; ntype.enum_name_legacy = "RGBTOBW"; blender::bke::node_type_socket_templates(&ntype, rgbtobw_in, rgbtobw_out); ntype.exec_fn = rgbtobw_exec; diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.cc b/source/blender/nodes/texture/nodes/node_texture_viewer.cc index 9294eac1f52f..707e643dc953 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.cc +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.cc @@ -36,7 +36,8 @@ void register_node_type_tex_viewer() { static blender::bke::bNodeType ntype; - tex_node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT); + tex_node_type_base(&ntype, TEX_NODE_VIEWER, NODE_CLASS_OUTPUT); + ntype.ui_name = "Viewer"; ntype.enum_name_legacy = "VIEWER"; blender::bke::node_type_socket_templates(&ntype, inputs, nullptr); ntype.exec_fn = exec; diff --git a/source/blender/python/BPY_extern.hh b/source/blender/python/BPY_extern.hh index 98150150f818..a02a22fa1a88 100644 --- a/source/blender/python/BPY_extern.hh +++ b/source/blender/python/BPY_extern.hh @@ -8,6 +8,8 @@ #pragma once +#include "BLI_sys_types.h" + struct ARegionType; struct AnimationEvalContext; struct ChannelDriver; /* DNA_anim_types.h */ @@ -25,8 +27,6 @@ struct bPythonConstraint; /* DNA_constraint_types.h */ struct StructRNA; struct wmWindowManager; -#include "BLI_utildefines.h" - void BPY_pyconstraint_exec(bPythonConstraint *con, bConstraintOb *cob, ListBase *targets); // void BPY_pyconstraint_settings(void *arg1, void *arg2); void BPY_pyconstraint_target(bPythonConstraint *con, bConstraintTarget *ct); diff --git a/source/blender/python/bmesh/bmesh_py_api.cc b/source/blender/python/bmesh/bmesh_py_api.cc index 049e32ed6c71..1ed5f36359c2 100644 --- a/source/blender/python/bmesh/bmesh_py_api.cc +++ b/source/blender/python/bmesh/bmesh_py_api.cc @@ -10,8 +10,6 @@ #include -#include "BLI_utildefines.h" - #include "bmesh.hh" #include "bmesh_py_types.hh" diff --git a/source/blender/python/bmesh/bmesh_py_api.hh b/source/blender/python/bmesh/bmesh_py_api.hh index 990cfd93d549..6cd345678fe9 100644 --- a/source/blender/python/bmesh/bmesh_py_api.hh +++ b/source/blender/python/bmesh/bmesh_py_api.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPyInit_bmesh(); diff --git a/source/blender/python/bmesh/bmesh_py_geometry.cc b/source/blender/python/bmesh/bmesh_py_geometry.cc index 640858673d71..ce03568ed640 100644 --- a/source/blender/python/bmesh/bmesh_py_geometry.cc +++ b/source/blender/python/bmesh/bmesh_py_geometry.cc @@ -11,8 +11,6 @@ #include -#include "BLI_utildefines.h" - #include "../mathutils/mathutils.hh" #include "bmesh.hh" diff --git a/source/blender/python/bmesh/bmesh_py_geometry.hh b/source/blender/python/bmesh/bmesh_py_geometry.hh index 2e3b58969b3e..9a8c1a1ebe05 100644 --- a/source/blender/python/bmesh/bmesh_py_geometry.hh +++ b/source/blender/python/bmesh/bmesh_py_geometry.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPyInit_bmesh_geometry(); diff --git a/source/blender/python/bmesh/bmesh_py_ops.cc b/source/blender/python/bmesh/bmesh_py_ops.cc index 5a27d03d2f23..eaa2c733f87f 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.cc +++ b/source/blender/python/bmesh/bmesh_py_ops.cc @@ -12,7 +12,6 @@ #include #include "BLI_dynstr.h" -#include "BLI_utildefines.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/python/bmesh/bmesh_py_ops.hh b/source/blender/python/bmesh/bmesh_py_ops.hh index 699db2c4b70b..dcff64228edc 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.hh +++ b/source/blender/python/bmesh/bmesh_py_ops.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPyInit_bmesh_ops(); diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.cc b/source/blender/python/bmesh/bmesh_py_ops_call.cc index c598ae54db10..d2328ec15529 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.cc +++ b/source/blender/python/bmesh/bmesh_py_ops_call.cc @@ -23,7 +23,6 @@ #include "bmesh_py_types.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_utildefines.hh" BLI_STATIC_ASSERT(sizeof(PyC_FlagSet) == sizeof(BMO_FlagSet), "size mismatch"); diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.hh b/source/blender/python/bmesh/bmesh_py_ops_call.hh index 64a72f7099e0..523a1c679101 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.hh +++ b/source/blender/python/bmesh/bmesh_py_ops_call.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct BPy_BMeshOpFunc { PyObject_HEAD /* Required Python macro. */ const char *opname; diff --git a/source/blender/python/bmesh/bmesh_py_types.cc b/source/blender/python/bmesh/bmesh_py_types.cc index 6ee88d3113c5..f981d5035417 100644 --- a/source/blender/python/bmesh/bmesh_py_types.cc +++ b/source/blender/python/bmesh/bmesh_py_types.cc @@ -10,7 +10,6 @@ #include "BLI_math_matrix.h" #include "BLI_math_vector.h" #include "BLI_sort.h" -#include "BLI_string.h" #include "BLI_string_utils.hh" #include "DNA_material_types.h" @@ -20,8 +19,9 @@ #include "BKE_customdata.hh" #include "BKE_global.hh" #include "BKE_lib_id.hh" -#include "BKE_mesh.hh" +#include "BKE_mesh.h" #include "BKE_mesh_runtime.hh" +#include "BKE_mesh_types.hh" #include "BKE_object.hh" #include "DEG_depsgraph.hh" diff --git a/source/blender/python/bmesh/bmesh_py_types.hh b/source/blender/python/bmesh/bmesh_py_types.hh index 850c024c4cbd..e1002c64a49a 100644 --- a/source/blender/python/bmesh/bmesh_py_types.hh +++ b/source/blender/python/bmesh/bmesh_py_types.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "bmesh.hh" + struct BMesh; struct BMEdge; struct BMElem; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.hh b/source/blender/python/bmesh/bmesh_py_types_customdata.hh index 5e204b482744..0dc5db5f9e36 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.hh +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "bmesh_py_types.hh" + struct BMesh; /* All use #BPy_BMLayerAccess struct. */ diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.hh b/source/blender/python/bmesh/bmesh_py_types_meshdata.hh index ffc7039a1f49..7bf7d85681f3 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.hh +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "bmesh.hh" + extern PyTypeObject BPy_BMLoopUV_Type; extern PyTypeObject BPy_BMDeformVert_Type; diff --git a/source/blender/python/bmesh/bmesh_py_types_select.hh b/source/blender/python/bmesh/bmesh_py_types_select.hh index 52076d761057..e7e1f83b3848 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.hh +++ b/source/blender/python/bmesh/bmesh_py_types_select.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "bmesh.hh" + struct BBMesh; struct BMEditSelection; struct BPy_BMesh; diff --git a/source/blender/python/bmesh/bmesh_py_utils.hh b/source/blender/python/bmesh/bmesh_py_utils.hh index 8aa8b206164b..e5b47f472064 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.hh +++ b/source/blender/python/bmesh/bmesh_py_utils.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPyInit_bmesh_utils(); diff --git a/source/blender/python/generic/bgl.cc b/source/blender/python/generic/bgl.cc index ecf72910df6d..4501e3feafda 100644 --- a/source/blender/python/generic/bgl.cc +++ b/source/blender/python/generic/bgl.cc @@ -14,18 +14,14 @@ #include -#include "BLI_string.h" #include "BLI_utildefines.h" #include "MEM_guardedalloc.h" #include "GPU_context.hh" -#include "GPU_state.hh" #include "py_capi_utils.hh" -#include "BKE_global.hh" - #include #include "CLG_log.h" diff --git a/source/blender/python/generic/bgl.hh b/source/blender/python/generic/bgl.hh index 189d8f93a9df..0a65c3cd1980 100644 --- a/source/blender/python/generic/bgl.hh +++ b/source/blender/python/generic/bgl.hh @@ -8,6 +8,8 @@ #pragma once +#include + PyObject *BPyInit_bgl(); /* This API is deprecated, currently these are only used in `bgl.cc` diff --git a/source/blender/python/generic/bl_math_py_api.hh b/source/blender/python/generic/bl_math_py_api.hh index b2b914f1b9d2..dde4e8295ce1 100644 --- a/source/blender/python/generic/bl_math_py_api.hh +++ b/source/blender/python/generic/bl_math_py_api.hh @@ -9,4 +9,6 @@ #pragma once +#include + PyMODINIT_FUNC BPyInit_bl_math(); diff --git a/source/blender/python/generic/idprop_py_api.hh b/source/blender/python/generic/idprop_py_api.hh index acf1ebceb8d3..38cf242c50ea 100644 --- a/source/blender/python/generic/idprop_py_api.hh +++ b/source/blender/python/generic/idprop_py_api.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct BPy_IDGroup_Iter; struct ID; struct IDProperty; diff --git a/source/blender/python/generic/idprop_py_ui_api.cc b/source/blender/python/generic/idprop_py_ui_api.cc index d93396923b28..0c823e662158 100644 --- a/source/blender/python/generic/idprop_py_ui_api.cc +++ b/source/blender/python/generic/idprop_py_ui_api.cc @@ -29,8 +29,6 @@ #endif #include "py_capi_rna.hh" -#include "python_utildefines.hh" - /* -------------------------------------------------------------------- */ /** \name UI Data Update * \{ */ diff --git a/source/blender/python/generic/idprop_py_ui_api.hh b/source/blender/python/generic/idprop_py_ui_api.hh index 8b24605d2671..58a283eb69c6 100644 --- a/source/blender/python/generic/idprop_py_ui_api.hh +++ b/source/blender/python/generic/idprop_py_ui_api.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct IDProperty; extern PyTypeObject BPy_IDPropertyUIManager_Type; diff --git a/source/blender/python/generic/imbuf_py_api.cc b/source/blender/python/generic/imbuf_py_api.cc index 45190cc76d3a..6b445dc44667 100644 --- a/source/blender/python/generic/imbuf_py_api.cc +++ b/source/blender/python/generic/imbuf_py_api.cc @@ -10,14 +10,12 @@ #include -#include "BLI_rect.h" #include "BLI_string.h" #include "BLI_utildefines.h" #include "py_capi_utils.hh" #include "python_compat.hh" -#include "python_utildefines.hh" #include "imbuf_py_api.hh" /* own include */ diff --git a/source/blender/python/generic/imbuf_py_api.hh b/source/blender/python/generic/imbuf_py_api.hh index c5f2024906bc..9129e6eb2109 100644 --- a/source/blender/python/generic/imbuf_py_api.hh +++ b/source/blender/python/generic/imbuf_py_api.hh @@ -8,6 +8,8 @@ * \ingroup pygen */ +#include + PyObject *BPyInit_imbuf(); extern PyTypeObject Py_ImBuf_Type; diff --git a/source/blender/python/generic/py_capi_rna.hh b/source/blender/python/generic/py_capi_rna.hh index e8eb807a69b2..990a594b494d 100644 --- a/source/blender/python/generic/py_capi_rna.hh +++ b/source/blender/python/generic/py_capi_rna.hh @@ -9,7 +9,7 @@ #pragma once -#include "BLI_sys_types.h" +#include struct EnumPropertyItem; diff --git a/source/blender/python/generic/py_capi_utils.cc b/source/blender/python/generic/py_capi_utils.cc index d6c58a5c6ebd..9619663b2e84 100644 --- a/source/blender/python/generic/py_capi_utils.cc +++ b/source/blender/python/generic/py_capi_utils.cc @@ -7,10 +7,6 @@ * * Extend upon CPython's API, filling in some gaps, these functions use PyC_ * prefix to distinguish them apart from CPython. - * - * \note - * This module should only depend on CPython, however it currently uses - * BLI_string_utf8() for unicode conversion. */ /* Future-proof, See https://docs.python.org/3/c-api/arg.html#strings-and-buffers */ @@ -29,10 +25,6 @@ # include "MEM_guardedalloc.h" # include "BLI_string.h" - -/* Only for #BLI_strncpy_wchar_from_utf8, - * should replace with Python functions but too late in release now. */ -# include "BLI_string_utf8.h" #endif #ifdef _WIN32 diff --git a/source/blender/python/generic/py_capi_utils.hh b/source/blender/python/generic/py_capi_utils.hh index 29222d35c2c6..1c593bc0bec3 100644 --- a/source/blender/python/generic/py_capi_utils.hh +++ b/source/blender/python/generic/py_capi_utils.hh @@ -8,12 +8,13 @@ #pragma once +#include + #include #include "BLI_compiler_attrs.h" #include "BLI_span.hh" #include "BLI_sys_types.h" -#include "BLI_utildefines_variadic.h" /** Useful to print Python objects while debugging. */ void PyC_ObSpit(const char *name, PyObject *var); diff --git a/source/blender/python/generic/python_compat.hh b/source/blender/python/generic/python_compat.hh index e2799aeeb468..2a60c90d9b34 100644 --- a/source/blender/python/generic/python_compat.hh +++ b/source/blender/python/generic/python_compat.hh @@ -9,6 +9,8 @@ #pragma once +#include + /* Removes `intialized` member from Python 3.13+. */ #if PY_VERSION_HEX >= 0x030d0000 # define PY_ARG_PARSER_HEAD_COMPAT() diff --git a/source/blender/python/generic/python_utildefines.hh b/source/blender/python/generic/python_utildefines.hh index 71139861aaf5..920c40bc4915 100644 --- a/source/blender/python/generic/python_utildefines.hh +++ b/source/blender/python/generic/python_utildefines.hh @@ -10,6 +10,8 @@ #pragma once +#include + #define PyTuple_SET_ITEMS(op_arg, ...) \ { \ PyTupleObject *op = (PyTupleObject *)op_arg; \ diff --git a/source/blender/python/gpu/gpu_py.hh b/source/blender/python/gpu/gpu_py.hh index 8d3eebfe3e20..91eae94b1f94 100644 --- a/source/blender/python/gpu/gpu_py.hh +++ b/source/blender/python/gpu/gpu_py.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "../generic/py_capi_utils.hh" extern struct PyC_StringEnumItems bpygpu_primtype_items[]; diff --git a/source/blender/python/gpu/gpu_py_api.cc b/source/blender/python/gpu/gpu_py_api.cc index 5d14fcea1797..3ab7e059a68b 100644 --- a/source/blender/python/gpu/gpu_py_api.cc +++ b/source/blender/python/gpu/gpu_py_api.cc @@ -14,8 +14,6 @@ #include -#include "BLI_utildefines.h" - #include "gpu_py_capabilities.hh" #include "gpu_py_compute.hh" #include "gpu_py_matrix.hh" diff --git a/source/blender/python/gpu/gpu_py_api.hh b/source/blender/python/gpu/gpu_py_api.hh index aee56ef595b7..bc60819e123e 100644 --- a/source/blender/python/gpu/gpu_py_api.hh +++ b/source/blender/python/gpu/gpu_py_api.hh @@ -8,6 +8,8 @@ #pragma once +#include + /* Each type object could have a method for free GPU resources. * However, it is currently of little use. */ // #define BPYGPU_USE_GPUOBJ_FREE_METHOD diff --git a/source/blender/python/gpu/gpu_py_batch.hh b/source/blender/python/gpu/gpu_py_batch.hh index 13bb18513fab..ad4ba06b1dd9 100644 --- a/source/blender/python/gpu/gpu_py_batch.hh +++ b/source/blender/python/gpu/gpu_py_batch.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" namespace blender::gpu { diff --git a/source/blender/python/gpu/gpu_py_buffer.hh b/source/blender/python/gpu/gpu_py_buffer.hh index 0b0741c97038..e717f77b8866 100644 --- a/source/blender/python/gpu/gpu_py_buffer.hh +++ b/source/blender/python/gpu/gpu_py_buffer.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_sys_types.h" extern PyTypeObject BPyGPU_BufferType; diff --git a/source/blender/python/gpu/gpu_py_capabilities.cc b/source/blender/python/gpu/gpu_py_capabilities.cc index 86289d06e9a9..f1ddb9f56088 100644 --- a/source/blender/python/gpu/gpu_py_capabilities.cc +++ b/source/blender/python/gpu/gpu_py_capabilities.cc @@ -11,8 +11,6 @@ #include -#include "BLI_utildefines.h" - #include "GPU_capabilities.hh" #include "gpu_py.hh" diff --git a/source/blender/python/gpu/gpu_py_capabilities.hh b/source/blender/python/gpu/gpu_py_capabilities.hh index 5f7965b6fc14..1a1464119773 100644 --- a/source/blender/python/gpu/gpu_py_capabilities.hh +++ b/source/blender/python/gpu/gpu_py_capabilities.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_capabilities_init(); diff --git a/source/blender/python/gpu/gpu_py_compute.cc b/source/blender/python/gpu/gpu_py_compute.cc index 8f844614cc1e..ce77bc46cc77 100644 --- a/source/blender/python/gpu/gpu_py_compute.cc +++ b/source/blender/python/gpu/gpu_py_compute.cc @@ -11,8 +11,6 @@ #include -#include "BLI_utildefines.h" - #include "GPU_capabilities.hh" #include "GPU_compute.hh" #include "GPU_state.hh" diff --git a/source/blender/python/gpu/gpu_py_compute.hh b/source/blender/python/gpu/gpu_py_compute.hh index 7bdbda1a71c0..77d5601de0f8 100644 --- a/source/blender/python/gpu/gpu_py_compute.hh +++ b/source/blender/python/gpu/gpu_py_compute.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_compute_init(); diff --git a/source/blender/python/gpu/gpu_py_element.hh b/source/blender/python/gpu/gpu_py_element.hh index 859e449f5d0c..4eb6bda1127e 100644 --- a/source/blender/python/gpu/gpu_py_element.hh +++ b/source/blender/python/gpu/gpu_py_element.hh @@ -8,6 +8,8 @@ #pragma once +#include + namespace blender::gpu { class IndexBuf; } diff --git a/source/blender/python/gpu/gpu_py_framebuffer.hh b/source/blender/python/gpu/gpu_py_framebuffer.hh index 3a3a91797572..7fd52a69251e 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.hh +++ b/source/blender/python/gpu/gpu_py_framebuffer.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" struct GPUFrameBuffer; diff --git a/source/blender/python/gpu/gpu_py_matrix.cc b/source/blender/python/gpu/gpu_py_matrix.cc index 3e34ee4114bc..cf1b9e52032f 100644 --- a/source/blender/python/gpu/gpu_py_matrix.cc +++ b/source/blender/python/gpu/gpu_py_matrix.cc @@ -20,8 +20,6 @@ #include "../mathutils/mathutils.hh" -#include "../generic/py_capi_utils.hh" - #define USE_GPU_PY_MATRIX_API #include "GPU_matrix.hh" #undef USE_GPU_PY_MATRIX_API diff --git a/source/blender/python/gpu/gpu_py_matrix.hh b/source/blender/python/gpu/gpu_py_matrix.hh index 617e83b85d3a..ce1a4fb3584d 100644 --- a/source/blender/python/gpu/gpu_py_matrix.hh +++ b/source/blender/python/gpu/gpu_py_matrix.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_matrix_init(); diff --git a/source/blender/python/gpu/gpu_py_offscreen.cc b/source/blender/python/gpu/gpu_py_offscreen.cc index db6cdf329c40..b9bfe551a69a 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.cc +++ b/source/blender/python/gpu/gpu_py_offscreen.cc @@ -15,7 +15,6 @@ #include #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BKE_global.hh" #include "BKE_lib_id.hh" /* For #BKE_id_is_in_global_main. */ diff --git a/source/blender/python/gpu/gpu_py_offscreen.hh b/source/blender/python/gpu/gpu_py_offscreen.hh index 12791c213ad8..63b6b7cc480b 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.hh +++ b/source/blender/python/gpu/gpu_py_offscreen.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" struct GPUOffScreen; diff --git a/source/blender/python/gpu/gpu_py_platform.cc b/source/blender/python/gpu/gpu_py_platform.cc index 71089544289d..03644101b87a 100644 --- a/source/blender/python/gpu/gpu_py_platform.cc +++ b/source/blender/python/gpu/gpu_py_platform.cc @@ -11,8 +11,6 @@ #include -#include "BLI_utildefines.h" - #include "GPU_context.hh" #include "GPU_platform.hh" diff --git a/source/blender/python/gpu/gpu_py_platform.hh b/source/blender/python/gpu/gpu_py_platform.hh index 25e1bf807ea7..9c78e49d99a7 100644 --- a/source/blender/python/gpu/gpu_py_platform.hh +++ b/source/blender/python/gpu/gpu_py_platform.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_platform_init(); diff --git a/source/blender/python/gpu/gpu_py_select.cc b/source/blender/python/gpu/gpu_py_select.cc index 18a0dc0f9ef9..162f04d1da8b 100644 --- a/source/blender/python/gpu/gpu_py_select.cc +++ b/source/blender/python/gpu/gpu_py_select.cc @@ -16,8 +16,6 @@ #include -#include "BLI_utildefines.h" - #include "../generic/py_capi_utils.hh" #include "GPU_select.hh" diff --git a/source/blender/python/gpu/gpu_py_select.hh b/source/blender/python/gpu/gpu_py_select.hh index 2572559b5ec3..93f0aa3d1fa9 100644 --- a/source/blender/python/gpu/gpu_py_select.hh +++ b/source/blender/python/gpu/gpu_py_select.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_select_init(); diff --git a/source/blender/python/gpu/gpu_py_shader.hh b/source/blender/python/gpu/gpu_py_shader.hh index d1abed9e0851..b7e992fdb374 100644 --- a/source/blender/python/gpu/gpu_py_shader.hh +++ b/source/blender/python/gpu/gpu_py_shader.hh @@ -8,6 +8,8 @@ #pragma once +#include + #ifndef __cplusplus # include "../generic/py_capi_utils.hh" #endif diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc b/source/blender/python/gpu/gpu_py_shader_create_info.cc index 16fa3780db65..cb787dab2a56 100644 --- a/source/blender/python/gpu/gpu_py_shader_create_info.cc +++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc @@ -19,7 +19,6 @@ #include "../generic/py_capi_utils.hh" #include "../generic/python_compat.hh" -#include "gpu_py.hh" #include "gpu_py_shader.hh" /* own include */ #include "gpu_py_texture.hh" diff --git a/source/blender/python/gpu/gpu_py_state.hh b/source/blender/python/gpu/gpu_py_state.hh index 336996d27593..97f8437c461f 100644 --- a/source/blender/python/gpu/gpu_py_state.hh +++ b/source/blender/python/gpu/gpu_py_state.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *bpygpu_state_init(); diff --git a/source/blender/python/gpu/gpu_py_texture.hh b/source/blender/python/gpu/gpu_py_texture.hh index f7f48388bf18..0584fb378c64 100644 --- a/source/blender/python/gpu/gpu_py_texture.hh +++ b/source/blender/python/gpu/gpu_py_texture.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" struct GPUTexture; diff --git a/source/blender/python/gpu/gpu_py_types.hh b/source/blender/python/gpu/gpu_py_types.hh index 29ea81e2b45a..9537de679169 100644 --- a/source/blender/python/gpu/gpu_py_types.hh +++ b/source/blender/python/gpu/gpu_py_types.hh @@ -8,17 +8,17 @@ #pragma once -#include "gpu_py_buffer.hh" +#include "gpu_py_buffer.hh" // IWYU pragma: export -#include "gpu_py_batch.hh" -#include "gpu_py_compute.hh" -#include "gpu_py_element.hh" -#include "gpu_py_framebuffer.hh" -#include "gpu_py_offscreen.hh" -#include "gpu_py_shader.hh" -#include "gpu_py_texture.hh" -#include "gpu_py_uniformbuffer.hh" -#include "gpu_py_vertex_buffer.hh" -#include "gpu_py_vertex_format.hh" +#include "gpu_py_batch.hh" // IWYU pragma: export +#include "gpu_py_compute.hh" // IWYU pragma: export +#include "gpu_py_element.hh" // IWYU pragma: export +#include "gpu_py_framebuffer.hh" // IWYU pragma: export +#include "gpu_py_offscreen.hh" // IWYU pragma: export +#include "gpu_py_shader.hh" // IWYU pragma: export +#include "gpu_py_texture.hh" // IWYU pragma: export +#include "gpu_py_uniformbuffer.hh" // IWYU pragma: export +#include "gpu_py_vertex_buffer.hh" // IWYU pragma: export +#include "gpu_py_vertex_format.hh" // IWYU pragma: export PyObject *bpygpu_types_init(); diff --git a/source/blender/python/gpu/gpu_py_uniformbuffer.hh b/source/blender/python/gpu/gpu_py_uniformbuffer.hh index 19eda128649d..9d3ce68d6458 100644 --- a/source/blender/python/gpu/gpu_py_uniformbuffer.hh +++ b/source/blender/python/gpu/gpu_py_uniformbuffer.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" struct GPUUniformBuf; diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.cc b/source/blender/python/gpu/gpu_py_vertex_buffer.cc index f4032a52a0b0..9683266ed586 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.cc +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.cc @@ -13,11 +13,8 @@ #include "GPU_vertex_buffer.hh" -#include "MEM_guardedalloc.h" - #include "../generic/py_capi_utils.hh" #include "../generic/python_compat.hh" -#include "../generic/python_utildefines.hh" #include "gpu_py.hh" #include "gpu_py_vertex_buffer.hh" /* own include */ diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.hh b/source/blender/python/gpu/gpu_py_vertex_buffer.hh index 2c716166b586..052411984868 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.hh +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "BLI_compiler_attrs.h" namespace blender::gpu { diff --git a/source/blender/python/gpu/gpu_py_vertex_format.hh b/source/blender/python/gpu/gpu_py_vertex_format.hh index 04a9bda6ae10..40b755d5f63b 100644 --- a/source/blender/python/gpu/gpu_py_vertex_format.hh +++ b/source/blender/python/gpu/gpu_py_vertex_format.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "GPU_vertex_format.hh" extern PyTypeObject BPyGPUVertFormat_Type; diff --git a/source/blender/python/intern/bpy.hh b/source/blender/python/intern/bpy.hh index 4cacd80ba66c..efeb920a3bc8 100644 --- a/source/blender/python/intern/bpy.hh +++ b/source/blender/python/intern/bpy.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct bContext; /** Creates the `bpy` module and adds it to `sys.modules` for importing. */ diff --git a/source/blender/python/intern/bpy_app.cc b/source/blender/python/intern/bpy_app.cc index 810753deae5e..42152f24ed92 100644 --- a/source/blender/python/intern/bpy_app.cc +++ b/source/blender/python/intern/bpy_app.cc @@ -42,8 +42,6 @@ #include "BKE_global.hh" #include "BKE_main.hh" -#include "DNA_ID.h" - #include "UI_interface_icons.hh" #include "MEM_guardedalloc.h" @@ -57,7 +55,6 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" #include "../generic/python_compat.hh" -#include "../generic/python_utildefines.hh" #ifdef BUILD_DATE extern "C" char build_date[]; diff --git a/source/blender/python/intern/bpy_app.hh b/source/blender/python/intern/bpy_app.hh index dbb33d6e83ec..9806ea0682be 100644 --- a/source/blender/python/intern/bpy_app.hh +++ b/source/blender/python/intern/bpy_app.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_struct(); diff --git a/source/blender/python/intern/bpy_app_alembic.hh b/source/blender/python/intern/bpy_app_alembic.hh index 20e9f5772e3f..28607a24fbad 100644 --- a/source/blender/python/intern/bpy_app_alembic.hh +++ b/source/blender/python/intern/bpy_app_alembic.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_alembic_struct(); diff --git a/source/blender/python/intern/bpy_app_build_options.hh b/source/blender/python/intern/bpy_app_build_options.hh index 2558ad0d2b72..5a2546810691 100644 --- a/source/blender/python/intern/bpy_app_build_options.hh +++ b/source/blender/python/intern/bpy_app_build_options.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_build_options_struct(); diff --git a/source/blender/python/intern/bpy_app_ffmpeg.hh b/source/blender/python/intern/bpy_app_ffmpeg.hh index 953e89ec6b0c..7ea59d47ab07 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.hh +++ b/source/blender/python/intern/bpy_app_ffmpeg.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_ffmpeg_struct(); diff --git a/source/blender/python/intern/bpy_app_handlers.cc b/source/blender/python/intern/bpy_app_handlers.cc index 7fa86aea81e3..3e41c10b93fe 100644 --- a/source/blender/python/intern/bpy_app_handlers.cc +++ b/source/blender/python/intern/bpy_app_handlers.cc @@ -20,8 +20,6 @@ #include "bpy_app_handlers.hh" #include "bpy_rna.hh" -#include "../generic/python_utildefines.hh" - #include "BPY_extern.hh" void bpy_app_generic_callback(Main *main, diff --git a/source/blender/python/intern/bpy_app_handlers.hh b/source/blender/python/intern/bpy_app_handlers.hh index 92c757d8f0eb..e5202ef10ed9 100644 --- a/source/blender/python/intern/bpy_app_handlers.hh +++ b/source/blender/python/intern/bpy_app_handlers.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_handlers_struct(); diff --git a/source/blender/python/intern/bpy_app_icons.cc b/source/blender/python/intern/bpy_app_icons.cc index f1da38e2100b..003535686c4c 100644 --- a/source/blender/python/intern/bpy_app_icons.cc +++ b/source/blender/python/intern/bpy_app_icons.cc @@ -12,8 +12,6 @@ #include "MEM_guardedalloc.h" -#include "BLI_utildefines.h" - #include "BKE_icons.h" #include "../generic/py_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_app_icons.hh b/source/blender/python/intern/bpy_app_icons.hh index 89e7628c6f35..d285036fbc67 100644 --- a/source/blender/python/intern/bpy_app_icons.hh +++ b/source/blender/python/intern/bpy_app_icons.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_icons_module(); diff --git a/source/blender/python/intern/bpy_app_ocio.hh b/source/blender/python/intern/bpy_app_ocio.hh index c533554986c0..7908c35676ac 100644 --- a/source/blender/python/intern/bpy_app_ocio.hh +++ b/source/blender/python/intern/bpy_app_ocio.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_ocio_struct(); diff --git a/source/blender/python/intern/bpy_app_oiio.hh b/source/blender/python/intern/bpy_app_oiio.hh index e7ce1c9cbed6..5ef943deb83b 100644 --- a/source/blender/python/intern/bpy_app_oiio.hh +++ b/source/blender/python/intern/bpy_app_oiio.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_oiio_struct(); diff --git a/source/blender/python/intern/bpy_app_opensubdiv.hh b/source/blender/python/intern/bpy_app_opensubdiv.hh index 8636faf3b8f3..5ec2de573c04 100644 --- a/source/blender/python/intern/bpy_app_opensubdiv.hh +++ b/source/blender/python/intern/bpy_app_opensubdiv.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_opensubdiv_struct(); diff --git a/source/blender/python/intern/bpy_app_openvdb.hh b/source/blender/python/intern/bpy_app_openvdb.hh index 5e8f191990e1..841b0efddac1 100644 --- a/source/blender/python/intern/bpy_app_openvdb.hh +++ b/source/blender/python/intern/bpy_app_openvdb.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_openvdb_struct(); diff --git a/source/blender/python/intern/bpy_app_sdl.hh b/source/blender/python/intern/bpy_app_sdl.hh index b0c091f0e077..8e3ff9552cf6 100644 --- a/source/blender/python/intern/bpy_app_sdl.hh +++ b/source/blender/python/intern/bpy_app_sdl.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_sdl_struct(); diff --git a/source/blender/python/intern/bpy_app_timers.hh b/source/blender/python/intern/bpy_app_timers.hh index c44d4e438d40..7a1efc4fc011 100644 --- a/source/blender/python/intern/bpy_app_timers.hh +++ b/source/blender/python/intern/bpy_app_timers.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_timers_module(); diff --git a/source/blender/python/intern/bpy_app_translations.cc b/source/blender/python/intern/bpy_app_translations.cc index ee028169d2b6..e0aaa2ace757 100644 --- a/source/blender/python/intern/bpy_app_translations.cc +++ b/source/blender/python/intern/bpy_app_translations.cc @@ -26,8 +26,6 @@ #include "RNA_types.hh" -#include "../generic/python_utildefines.hh" - #ifdef WITH_INTERNATIONAL # include "BLI_ghash.h" # include "BLI_string.h" diff --git a/source/blender/python/intern/bpy_app_translations.hh b/source/blender/python/intern/bpy_app_translations.hh index c53695982336..420d017ac9e0 100644 --- a/source/blender/python/intern/bpy_app_translations.hh +++ b/source/blender/python/intern/bpy_app_translations.hh @@ -8,5 +8,7 @@ #pragma once +#include + PyObject *BPY_app_translations_struct(); void BPY_app_translations_end(); diff --git a/source/blender/python/intern/bpy_app_usd.hh b/source/blender/python/intern/bpy_app_usd.hh index 22b3ba95410f..2dd0017b0060 100644 --- a/source/blender/python/intern/bpy_app_usd.hh +++ b/source/blender/python/intern/bpy_app_usd.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_app_usd_struct(); diff --git a/source/blender/python/intern/bpy_capi_utils.cc b/source/blender/python/intern/bpy_capi_utils.cc index 651c49e7b3ee..519b36e35389 100644 --- a/source/blender/python/intern/bpy_capi_utils.cc +++ b/source/blender/python/intern/bpy_capi_utils.cc @@ -11,9 +11,6 @@ #include -#include "BLI_listbase.h" -#include "BLI_utildefines.h" - #include "bpy_capi_utils.hh" #include "MEM_guardedalloc.h" diff --git a/source/blender/python/intern/bpy_cli_command.cc b/source/blender/python/intern/bpy_cli_command.cc index 413a9466e2a2..feac498bd92b 100644 --- a/source/blender/python/intern/bpy_cli_command.cc +++ b/source/blender/python/intern/bpy_cli_command.cc @@ -13,13 +13,10 @@ #include "bpy_capi_utils.hh" -#include "MEM_guardedalloc.h" - #include "BKE_blender_cli_command.hh" #include "../generic/py_capi_utils.hh" #include "../generic/python_compat.hh" -#include "../generic/python_utildefines.hh" #include "bpy_cli_command.hh" /* Own include. */ diff --git a/source/blender/python/intern/bpy_cli_command.hh b/source/blender/python/intern/bpy_cli_command.hh index 7f5db8859cdd..1de0f0e2f8de 100644 --- a/source/blender/python/intern/bpy_cli_command.hh +++ b/source/blender/python/intern/bpy_cli_command.hh @@ -8,5 +8,7 @@ #pragma once +#include + extern PyMethodDef BPY_cli_command_register_def; extern PyMethodDef BPY_cli_command_unregister_def; diff --git a/source/blender/python/intern/bpy_driver.cc b/source/blender/python/intern/bpy_driver.cc index 7908ca99a44f..f0d3f2b8ed9b 100644 --- a/source/blender/python/intern/bpy_driver.cc +++ b/source/blender/python/intern/bpy_driver.cc @@ -15,7 +15,6 @@ #include "DNA_anim_types.h" #include "BLI_listbase.h" -#include "BLI_math_base.h" #include "BLI_string.h" #include "BKE_animsys.h" diff --git a/source/blender/python/intern/bpy_driver.hh b/source/blender/python/intern/bpy_driver.hh index b4c9f5bf4d2b..9c10eceacdd4 100644 --- a/source/blender/python/intern/bpy_driver.hh +++ b/source/blender/python/intern/bpy_driver.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include /** diff --git a/source/blender/python/intern/bpy_gizmo_wrap.cc b/source/blender/python/intern/bpy_gizmo_wrap.cc index b3d679abdd44..054886ddd1e7 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.cc +++ b/source/blender/python/intern/bpy_gizmo_wrap.cc @@ -16,8 +16,6 @@ #include -#include "BLI_utildefines.h" - #include "WM_types.hh" #include "RNA_access.hh" diff --git a/source/blender/python/intern/bpy_interface.cc b/source/blender/python/intern/bpy_interface.cc index 04dfccb9dfd7..6af0ed8252ef 100644 --- a/source/blender/python/intern/bpy_interface.cc +++ b/source/blender/python/intern/bpy_interface.cc @@ -17,15 +17,10 @@ # include "pylifecycle.h" /* For `Py_Version`. */ #endif -#include "MEM_guardedalloc.h" - #include "CLG_log.h" -#include "BLI_fileops.h" -#include "BLI_listbase.h" #include "BLI_path_utils.hh" #include "BLI_string.h" -#include "BLI_string_utf8.h" #include "BLI_threads.h" #include "BLI_utildefines.h" @@ -39,7 +34,6 @@ #include "bpy_path.hh" #include "bpy_props.hh" #include "bpy_rna.hh" -#include "bpy_traceback.hh" #include "bpy_app_translations.hh" diff --git a/source/blender/python/intern/bpy_interface_atexit.cc b/source/blender/python/intern/bpy_interface_atexit.cc index 9d815e2f2825..8aaaf0a641d1 100644 --- a/source/blender/python/intern/bpy_interface_atexit.cc +++ b/source/blender/python/intern/bpy_interface_atexit.cc @@ -12,8 +12,6 @@ #include -#include "BLI_utildefines.h" - #include "bpy.hh" /* own include */ #include "bpy_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_interface_run.cc b/source/blender/python/intern/bpy_interface_run.cc index dcf53413a02b..d6326efc72e4 100644 --- a/source/blender/python/intern/bpy_interface_run.cc +++ b/source/blender/python/intern/bpy_interface_run.cc @@ -27,7 +27,6 @@ #include "BPY_extern_run.hh" #include "bpy_capi_utils.hh" -#include "bpy_intern_string.hh" #include "bpy_traceback.hh" #include "../generic/py_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_intern_string.hh b/source/blender/python/intern/bpy_intern_string.hh index 533a52db381d..60cd9f05ef7b 100644 --- a/source/blender/python/intern/bpy_intern_string.hh +++ b/source/blender/python/intern/bpy_intern_string.hh @@ -8,6 +8,8 @@ * \ingroup pythonintern */ +#include + void bpy_intern_string_init(); void bpy_intern_string_exit(); diff --git a/source/blender/python/intern/bpy_library.hh b/source/blender/python/intern/bpy_library.hh index a24ca7897120..5ecabf1c2689 100644 --- a/source/blender/python/intern/bpy_library.hh +++ b/source/blender/python/intern/bpy_library.hh @@ -8,6 +8,8 @@ #pragma once +#include + int BPY_library_load_type_ready(); extern PyMethodDef BPY_library_load_method_def; diff --git a/source/blender/python/intern/bpy_library_load.cc b/source/blender/python/intern/bpy_library_load.cc index 5da08830f8b5..a664d6dd8f76 100644 --- a/source/blender/python/intern/bpy_library_load.cc +++ b/source/blender/python/intern/bpy_library_load.cc @@ -32,8 +32,6 @@ #include "BLO_readfile.hh" -#include "MEM_guardedalloc.h" - #include "bpy_capi_utils.hh" #include "bpy_library.hh" diff --git a/source/blender/python/intern/bpy_library_write.cc b/source/blender/python/intern/bpy_library_write.cc index 09e9466f1f03..7b0b334f0753 100644 --- a/source/blender/python/intern/bpy_library_write.cc +++ b/source/blender/python/intern/bpy_library_write.cc @@ -12,11 +12,8 @@ #include #include -#include "MEM_guardedalloc.h" - #include "BLI_path_utils.hh" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BKE_blendfile.hh" #include "BKE_global.hh" diff --git a/source/blender/python/intern/bpy_msgbus.cc b/source/blender/python/intern/bpy_msgbus.cc index e48354d178bf..83629c023da8 100644 --- a/source/blender/python/intern/bpy_msgbus.cc +++ b/source/blender/python/intern/bpy_msgbus.cc @@ -16,8 +16,6 @@ #include "../mathutils/mathutils.hh" -#include "BLI_utildefines.h" - #include "BKE_context.hh" #include "WM_message.hh" diff --git a/source/blender/python/intern/bpy_msgbus.hh b/source/blender/python/intern/bpy_msgbus.hh index a6de5780d94b..c4722679be97 100644 --- a/source/blender/python/intern/bpy_msgbus.hh +++ b/source/blender/python/intern/bpy_msgbus.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_msgbus_module(); diff --git a/source/blender/python/intern/bpy_operator.cc b/source/blender/python/intern/bpy_operator.cc index d06fbeb09ca5..fd52f6b69782 100644 --- a/source/blender/python/intern/bpy_operator.cc +++ b/source/blender/python/intern/bpy_operator.cc @@ -18,12 +18,10 @@ #include "RNA_types.hh" #include "BLI_listbase.h" -#include "BLI_utildefines.h" #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" #include "../generic/python_compat.hh" -#include "../generic/python_utildefines.hh" #include "BPY_extern.hh" #include "bpy_capi_utils.hh" @@ -40,8 +38,6 @@ #include "MEM_guardedalloc.h" -#include "BLI_ghash.h" - #include "BKE_context.hh" #include "BKE_global.hh" #include "BKE_report.hh" diff --git a/source/blender/python/intern/bpy_operator.hh b/source/blender/python/intern/bpy_operator.hh index bfcd86b77898..ba7264cf662a 100644 --- a/source/blender/python/intern/bpy_operator.hh +++ b/source/blender/python/intern/bpy_operator.hh @@ -8,6 +8,8 @@ #pragma once +#include + extern PyTypeObject pyop_base_Type; #define BPy_OperatorBase_Check(v) (PyObject_TypeCheck(v, &pyop_base_Type)) diff --git a/source/blender/python/intern/bpy_operator_wrap.cc b/source/blender/python/intern/bpy_operator_wrap.cc index b77c9c4d08f8..0faee8d4ae1b 100644 --- a/source/blender/python/intern/bpy_operator_wrap.cc +++ b/source/blender/python/intern/bpy_operator_wrap.cc @@ -13,8 +13,6 @@ #include -#include "BLI_utildefines.h" - #include "WM_api.hh" #include "WM_types.hh" diff --git a/source/blender/python/intern/bpy_operator_wrap.hh b/source/blender/python/intern/bpy_operator_wrap.hh index 30dd961baef2..8bd16ce6f427 100644 --- a/source/blender/python/intern/bpy_operator_wrap.hh +++ b/source/blender/python/intern/bpy_operator_wrap.hh @@ -8,6 +8,8 @@ #pragma once +#include + struct wmOperatorType; /** diff --git a/source/blender/python/intern/bpy_path.cc b/source/blender/python/intern/bpy_path.cc index 981838c318dc..ce9d0be9b0c4 100644 --- a/source/blender/python/intern/bpy_path.cc +++ b/source/blender/python/intern/bpy_path.cc @@ -10,8 +10,6 @@ #include -#include "BLI_utildefines.h" - #include "bpy_path.hh" #include "../generic/py_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_path.hh b/source/blender/python/intern/bpy_path.hh index 620d81f32a77..790379956803 100644 --- a/source/blender/python/intern/bpy_path.hh +++ b/source/blender/python/intern/bpy_path.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPyInit__bpy_path(); diff --git a/source/blender/python/intern/bpy_props.hh b/source/blender/python/intern/bpy_props.hh index d0628a53c957..31262fd2f5a6 100644 --- a/source/blender/python/intern/bpy_props.hh +++ b/source/blender/python/intern/bpy_props.hh @@ -8,6 +8,10 @@ #pragma once +#include + +struct StructRNA; + PyObject *BPY_rna_props(); /** * Run this on exit, clearing all Python callback users and disable the RNA callback, diff --git a/source/blender/python/intern/bpy_rna.cc b/source/blender/python/intern/bpy_rna.cc index d2b311b9b73e..f1b653475ebc 100644 --- a/source/blender/python/intern/bpy_rna.cc +++ b/source/blender/python/intern/bpy_rna.cc @@ -16,13 +16,11 @@ #include /* FLT_MIN/MAX */ #include -#include #include #include "RNA_path.hh" #include "RNA_types.hh" -#include "BLI_bitmap.h" #include "BLI_dynstr.h" #include "BLI_listbase.h" #include "BLI_math_rotation.h" @@ -9718,13 +9716,13 @@ PyDoc_STRVAR( "\n" " Register a subclass of a Blender type class.\n" "\n" - " :arg cls: Blender type class in:\n" - " :class:`bpy.types.Panel`, :class:`bpy.types.UIList`,\n" - " :class:`bpy.types.Menu`, :class:`bpy.types.Header`,\n" - " :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n" - " :class:`bpy.types.RenderEngine`, :class:`bpy.types.AssetShelf`,\n" - " :class:`bpy.types.FileHandler`\n" - " :type cls: type\n" + " :arg cls: Registerable Blender class type.\n" + " :type cls: type[\n" + " :class:`bpy.types.Panel` | :class:`bpy.types.UIList` | \n" + " :class:`bpy.types.Menu` | :class:`bpy.types.Header` | \n" + " :class:`bpy.types.Operator` | :class:`bpy.types.KeyingSetInfo` | \n" + " :class:`bpy.types.RenderEngine` | :class:`bpy.types.AssetShelf` | \n" + " :class:`bpy.types.FileHandler`]\n" " :raises ValueError:\n" " if the class is not a subclass of a registerable blender class.\n" "\n" @@ -9906,7 +9904,12 @@ PyDoc_STRVAR( " :arg cls: Blender type class, \n" " see :mod:`bpy.utils.register_class` for classes which can \n" " be registered.\n" - " :type cls: type\n" + " :type cls: type[\n" + " :class:`bpy.types.Panel` | :class:`bpy.types.UIList` | \n" + " :class:`bpy.types.Menu` | :class:`bpy.types.Header` | \n" + " :class:`bpy.types.Operator` | :class:`bpy.types.KeyingSetInfo` | \n" + " :class:`bpy.types.RenderEngine` | :class:`bpy.types.AssetShelf` | \n" + " :class:`bpy.types.FileHandler`]\n" "\n" " .. note::\n" "\n" diff --git a/source/blender/python/intern/bpy_rna.hh b/source/blender/python/intern/bpy_rna.hh index b366271673e8..13c17168d7e8 100644 --- a/source/blender/python/intern/bpy_rna.hh +++ b/source/blender/python/intern/bpy_rna.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include /* --- bpy build options --- */ diff --git a/source/blender/python/intern/bpy_rna_anim.cc b/source/blender/python/intern/bpy_rna_anim.cc index 6ef403b999d0..3bc6e117a4ec 100644 --- a/source/blender/python/intern/bpy_rna_anim.cc +++ b/source/blender/python/intern/bpy_rna_anim.cc @@ -15,7 +15,6 @@ #include "BLI_string.h" #include "BLI_string_utils.hh" -#include "BLI_utildefines.h" #include "DNA_anim_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/python/intern/bpy_rna_anim.hh b/source/blender/python/intern/bpy_rna_anim.hh index 190a8ff0c48a..3ac9a1878e0c 100644 --- a/source/blender/python/intern/bpy_rna_anim.hh +++ b/source/blender/python/intern/bpy_rna_anim.hh @@ -4,6 +4,10 @@ #pragma once +#include + +#include "intern/bpy_rna.hh" + /** \file * \ingroup pythonintern */ diff --git a/source/blender/python/intern/bpy_rna_callback.hh b/source/blender/python/intern/bpy_rna_callback.hh index e30602daf33a..9b0aff4f6284 100644 --- a/source/blender/python/intern/bpy_rna_callback.hh +++ b/source/blender/python/intern/bpy_rna_callback.hh @@ -8,6 +8,8 @@ * \ingroup pythonintern */ +#include + struct BPy_StructRNA; #if 0 diff --git a/source/blender/python/intern/bpy_rna_context.hh b/source/blender/python/intern/bpy_rna_context.hh index 24cc66456c00..d14649b09fd4 100644 --- a/source/blender/python/intern/bpy_rna_context.hh +++ b/source/blender/python/intern/bpy_rna_context.hh @@ -8,6 +8,8 @@ #pragma once +#include + extern PyMethodDef BPY_rna_context_temp_override_method_def; void bpy_rna_context_types_init(); diff --git a/source/blender/python/intern/bpy_rna_data.cc b/source/blender/python/intern/bpy_rna_data.cc index a4a94b105d86..b8dc0056fe7e 100644 --- a/source/blender/python/intern/bpy_rna_data.cc +++ b/source/blender/python/intern/bpy_rna_data.cc @@ -20,7 +20,6 @@ #include "../generic/python_compat.hh" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BKE_global.hh" #include "BKE_main.hh" diff --git a/source/blender/python/intern/bpy_rna_data.hh b/source/blender/python/intern/bpy_rna_data.hh index b74aa2dcbfaa..bcc36682486d 100644 --- a/source/blender/python/intern/bpy_rna_data.hh +++ b/source/blender/python/intern/bpy_rna_data.hh @@ -8,6 +8,8 @@ #pragma once +#include + int BPY_rna_data_context_type_ready(); extern PyMethodDef BPY_rna_data_context_method_def; diff --git a/source/blender/python/intern/bpy_rna_driver.cc b/source/blender/python/intern/bpy_rna_driver.cc index 4e140f4c8e22..93bce0903ceb 100644 --- a/source/blender/python/intern/bpy_rna_driver.cc +++ b/source/blender/python/intern/bpy_rna_driver.cc @@ -10,12 +10,8 @@ #include -#include "MEM_guardedalloc.h" - #include "DNA_anim_types.h" -#include "BLI_utildefines.h" - #include "BKE_fcurve_driver.h" #include "RNA_access.hh" diff --git a/source/blender/python/intern/bpy_rna_driver.hh b/source/blender/python/intern/bpy_rna_driver.hh index fcfd2bfc6159..1039bd0b19c0 100644 --- a/source/blender/python/intern/bpy_rna_driver.hh +++ b/source/blender/python/intern/bpy_rna_driver.hh @@ -8,6 +8,8 @@ * \ingroup pythonintern */ +#include + struct AnimationEvalContext; struct ChannelDriver; struct DriverTarget; diff --git a/source/blender/python/intern/bpy_rna_gizmo.hh b/source/blender/python/intern/bpy_rna_gizmo.hh index 86f59781a246..80396c65ac46 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.hh +++ b/source/blender/python/intern/bpy_rna_gizmo.hh @@ -8,4 +8,6 @@ #pragma once +#include + bool BPY_rna_gizmo_module(PyObject *); diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index e04fabc35b24..741818a4aae1 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -14,7 +14,6 @@ #include "MEM_guardedalloc.h" #include "BLI_bitmap.h" -#include "BLI_utildefines.h" #include "BKE_global.hh" #include "BKE_lib_id.hh" diff --git a/source/blender/python/intern/bpy_rna_id_collection.hh b/source/blender/python/intern/bpy_rna_id_collection.hh index 586c50e57ca5..2afcac8b87d4 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.hh +++ b/source/blender/python/intern/bpy_rna_id_collection.hh @@ -8,6 +8,8 @@ #pragma once +#include + extern PyMethodDef BPY_rna_id_collection_user_map_method_def; extern PyMethodDef BPY_rna_id_collection_batch_remove_method_def; extern PyMethodDef BPY_rna_id_collection_orphans_purge_method_def; diff --git a/source/blender/python/intern/bpy_rna_operator.cc b/source/blender/python/intern/bpy_rna_operator.cc index 513de0467706..522e02e99233 100644 --- a/source/blender/python/intern/bpy_rna_operator.cc +++ b/source/blender/python/intern/bpy_rna_operator.cc @@ -14,8 +14,6 @@ #include "BKE_context.hh" -#include "../generic/python_utildefines.hh" - #include "BPY_extern.hh" #include "bpy_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_rna_operator.hh b/source/blender/python/intern/bpy_rna_operator.hh index eeced684898f..a374c5e9ac3f 100644 --- a/source/blender/python/intern/bpy_rna_operator.hh +++ b/source/blender/python/intern/bpy_rna_operator.hh @@ -8,4 +8,6 @@ #pragma once +#include + extern PyMethodDef BPY_rna_operator_poll_message_set_method_def; diff --git a/source/blender/python/intern/bpy_rna_text.hh b/source/blender/python/intern/bpy_rna_text.hh index 7fd854db5c1a..41f4a813cf35 100644 --- a/source/blender/python/intern/bpy_rna_text.hh +++ b/source/blender/python/intern/bpy_rna_text.hh @@ -8,5 +8,7 @@ #pragma once +#include + extern PyMethodDef BPY_rna_region_as_string_method_def; extern PyMethodDef BPY_rna_region_from_string_method_def; diff --git a/source/blender/python/intern/bpy_rna_types_capi.cc b/source/blender/python/intern/bpy_rna_types_capi.cc index 063c0d0f4ca9..517f463336b0 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.cc +++ b/source/blender/python/intern/bpy_rna_types_capi.cc @@ -17,8 +17,6 @@ #include #include -#include "RNA_types.hh" - #include "BLI_utildefines.h" #include "bpy_library.hh" @@ -281,19 +279,20 @@ void BPY_rna_types_extend_capi() BPY_rna_id_collection_batch_remove_method_def, BPY_rna_id_collection_orphans_purge_method_def, BPY_rna_data_context_method_def); - BLI_assert(ARRAY_SIZE(pyrna_blenddata_methods) == 5); + BLI_STATIC_ASSERT(ARRAY_SIZE(pyrna_blenddata_methods) == 5, "Unexpected number of methods") pyrna_struct_type_extend_capi(&RNA_BlendData, pyrna_blenddata_methods, nullptr); /* BlendDataLibraries */ ARRAY_SET_ITEMS( pyrna_blenddatalibraries_methods, BPY_library_load_method_def, BPY_library_write_method_def); - BLI_assert(ARRAY_SIZE(pyrna_blenddatalibraries_methods) == 3); + BLI_STATIC_ASSERT(ARRAY_SIZE(pyrna_blenddatalibraries_methods) == 3, + "Unexpected number of methods") pyrna_struct_type_extend_capi( &RNA_BlendDataLibraries, pyrna_blenddatalibraries_methods, nullptr); /* uiLayout */ ARRAY_SET_ITEMS(pyrna_uilayout_methods, BPY_rna_uilayout_introspect_method_def); - BLI_assert(ARRAY_SIZE(pyrna_uilayout_methods) == 2); + BLI_STATIC_ASSERT(ARRAY_SIZE(pyrna_uilayout_methods) == 2, "Unexpected number of methods") pyrna_struct_type_extend_capi(&RNA_UILayout, pyrna_uilayout_methods, nullptr); /* Space */ @@ -303,12 +302,12 @@ void BPY_rna_types_extend_capi() ARRAY_SET_ITEMS(pyrna_text_methods, BPY_rna_region_as_string_method_def, BPY_rna_region_from_string_method_def); - BLI_assert(ARRAY_SIZE(pyrna_text_methods) == 3); + BLI_STATIC_ASSERT(ARRAY_SIZE(pyrna_text_methods) == 3, "Unexpected number of methods") pyrna_struct_type_extend_capi(&RNA_Text, pyrna_text_methods, nullptr); /* wmOperator */ ARRAY_SET_ITEMS(pyrna_operator_methods, BPY_rna_operator_poll_message_set_method_def); - BLI_assert(ARRAY_SIZE(pyrna_operator_methods) == 2); + BLI_STATIC_ASSERT(ARRAY_SIZE(pyrna_operator_methods) == 2, "Unexpected number of methods") pyrna_struct_type_extend_capi(&RNA_Operator, pyrna_operator_methods, nullptr); /* WindowManager */ diff --git a/source/blender/python/intern/bpy_rna_ui.hh b/source/blender/python/intern/bpy_rna_ui.hh index 5d228dc36c6e..dd8a357972c0 100644 --- a/source/blender/python/intern/bpy_rna_ui.hh +++ b/source/blender/python/intern/bpy_rna_ui.hh @@ -8,4 +8,6 @@ #pragma once +#include + extern PyMethodDef BPY_rna_uilayout_introspect_method_def; diff --git a/source/blender/python/intern/bpy_utils_previews.cc b/source/blender/python/intern/bpy_utils_previews.cc index 5fad943a03e9..18ce7dafcb73 100644 --- a/source/blender/python/intern/bpy_utils_previews.cc +++ b/source/blender/python/intern/bpy_utils_previews.cc @@ -14,8 +14,6 @@ #include #include -#include "BLI_utildefines.h" - #include "RNA_access.hh" #include "RNA_prototypes.hh" @@ -24,8 +22,6 @@ #include "../generic/py_capi_utils.hh" -#include "MEM_guardedalloc.h" - #include "IMB_thumbs.hh" #include "BKE_preview_image.hh" diff --git a/source/blender/python/intern/bpy_utils_previews.hh b/source/blender/python/intern/bpy_utils_previews.hh index a23a159be13e..aaeb92e1a41c 100644 --- a/source/blender/python/intern/bpy_utils_previews.hh +++ b/source/blender/python/intern/bpy_utils_previews.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_utils_previews_module(); diff --git a/source/blender/python/intern/bpy_utils_units.hh b/source/blender/python/intern/bpy_utils_units.hh index 75cfa39254be..49262e05e0f5 100644 --- a/source/blender/python/intern/bpy_utils_units.hh +++ b/source/blender/python/intern/bpy_utils_units.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyObject *BPY_utils_units(); diff --git a/source/blender/python/intern/stubs.cc b/source/blender/python/intern/stubs.cc index 7c75064c44a3..45eb2f515705 100644 --- a/source/blender/python/intern/stubs.cc +++ b/source/blender/python/intern/stubs.cc @@ -6,8 +6,6 @@ * \ingroup pythonintern */ -#include "BLI_utildefines.h" - #include "BPY_extern.hh" /* python, will come back */ diff --git a/source/blender/python/mathutils/mathutils.cc b/source/blender/python/mathutils/mathutils.cc index fca69d6a7eb8..5b3fe15e45e7 100644 --- a/source/blender/python/mathutils/mathutils.cc +++ b/source/blender/python/mathutils/mathutils.cc @@ -15,7 +15,6 @@ #include "BLI_utildefines.h" #include "../generic/py_capi_utils.hh" -#include "../generic/python_utildefines.hh" #ifndef MATH_STANDALONE # include "BLI_dynstr.h" diff --git a/source/blender/python/mathutils/mathutils.hh b/source/blender/python/mathutils/mathutils.hh index 166c86d8b0e7..a57ff196d4bd 100644 --- a/source/blender/python/mathutils/mathutils.hh +++ b/source/blender/python/mathutils/mathutils.hh @@ -8,10 +8,11 @@ * \ingroup pymathutils */ +#include + /* Can cast different mathutils types to this, use for generic functions. */ #include "BLI_array.hh" -#include "BLI_compiler_attrs.h" #include "BLI_vector.hh" struct DynStr; @@ -61,11 +62,11 @@ struct BaseMathObject { }; /* types */ -#include "mathutils_Color.hh" -#include "mathutils_Euler.hh" -#include "mathutils_Matrix.hh" -#include "mathutils_Quaternion.hh" -#include "mathutils_Vector.hh" +#include "mathutils_Color.hh" // IWYU pragma: export +#include "mathutils_Euler.hh" // IWYU pragma: export +#include "mathutils_Matrix.hh" // IWYU pragma: export +#include "mathutils_Quaternion.hh" // IWYU pragma: export +#include "mathutils_Vector.hh" // IWYU pragma: export /* avoid checking all types */ #define BaseMathObject_CheckExact(v) (Py_TYPE(v)->tp_dealloc == (destructor)BaseMathObject_dealloc) diff --git a/source/blender/python/mathutils/mathutils_Color.hh b/source/blender/python/mathutils/mathutils_Color.hh index 2575cee7e72b..ae6fd136339a 100644 --- a/source/blender/python/mathutils/mathutils_Color.hh +++ b/source/blender/python/mathutils/mathutils_Color.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "mathutils.hh" + extern PyTypeObject color_Type; #define ColorObject_Check(v) PyObject_TypeCheck((v), &color_Type) #define ColorObject_CheckExact(v) (Py_TYPE(v) == &color_Type) diff --git a/source/blender/python/mathutils/mathutils_Euler.cc b/source/blender/python/mathutils/mathutils_Euler.cc index 131f7172135d..97df28b35683 100644 --- a/source/blender/python/mathutils/mathutils_Euler.cc +++ b/source/blender/python/mathutils/mathutils_Euler.cc @@ -13,7 +13,6 @@ #include "mathutils.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_utildefines.hh" #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" diff --git a/source/blender/python/mathutils/mathutils_Euler.hh b/source/blender/python/mathutils/mathutils_Euler.hh index 38e2aa287711..54bce9759633 100644 --- a/source/blender/python/mathutils/mathutils_Euler.hh +++ b/source/blender/python/mathutils/mathutils_Euler.hh @@ -8,9 +8,9 @@ * \ingroup pymathutils */ -#ifdef __cplusplus -extern "C" { -#endif +#include + +#include "mathutils.hh" extern PyTypeObject euler_Type; #define EulerObject_Check(v) PyObject_TypeCheck((v), &euler_Type) @@ -41,7 +41,3 @@ PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; short euler_order_from_string(const char *str, const char *error_prefix); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/mathutils/mathutils_Matrix.hh b/source/blender/python/mathutils/mathutils_Matrix.hh index 924334d214bd..96f70946bba1 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.hh +++ b/source/blender/python/mathutils/mathutils_Matrix.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "mathutils.hh" + extern PyTypeObject matrix_Type; extern PyTypeObject matrix_access_Type; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.hh b/source/blender/python/mathutils/mathutils_Quaternion.hh index 39976525d9e7..b320e2d59098 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.hh +++ b/source/blender/python/mathutils/mathutils_Quaternion.hh @@ -8,9 +8,9 @@ * \ingroup pymathutils */ -#ifdef __cplusplus -extern "C" { -#endif +#include + +#include "mathutils.hh" extern PyTypeObject quaternion_Type; @@ -36,7 +36,3 @@ PyObject *Quaternion_CreatePyObject_wrap(float quat[4], PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/mathutils/mathutils_Vector.hh b/source/blender/python/mathutils/mathutils_Vector.hh index 03091055c434..4baa2217f224 100644 --- a/source/blender/python/mathutils/mathutils_Vector.hh +++ b/source/blender/python/mathutils/mathutils_Vector.hh @@ -8,6 +8,10 @@ #pragma once +#include + +#include "mathutils.hh" + extern PyTypeObject vector_Type; #define VectorObject_Check(v) PyObject_TypeCheck((v), &vector_Type) diff --git a/source/blender/python/mathutils/mathutils_bvhtree.hh b/source/blender/python/mathutils/mathutils_bvhtree.hh index 52fa7d5e8332..024ddc72de13 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.hh +++ b/source/blender/python/mathutils/mathutils_bvhtree.hh @@ -8,6 +8,8 @@ #pragma once +#include + PyMODINIT_FUNC PyInit_mathutils_bvhtree(); extern PyTypeObject PyBVHTree_Type; diff --git a/source/blender/python/mathutils/mathutils_geometry.cc b/source/blender/python/mathutils/mathutils_geometry.cc index 31b40a17ca49..514f891a0369 100644 --- a/source/blender/python/mathutils/mathutils_geometry.cc +++ b/source/blender/python/mathutils/mathutils_geometry.cc @@ -15,10 +15,10 @@ #ifndef MATH_STANDALONE /* define when building outside blender */ # include "BKE_curve.hh" # include "BKE_displist.h" -# include "BLI_blenlib.h" # include "BLI_boxpack_2d.h" # include "BLI_convexhull_2d.h" # include "BLI_delaunay_2d.hh" +# include "BLI_listbase.h" # include "MEM_guardedalloc.h" #endif /* !MATH_STANDALONE */ diff --git a/source/blender/python/mathutils/mathutils_geometry.hh b/source/blender/python/mathutils/mathutils_geometry.hh index 760cd2a11fa7..5967449bb9bb 100644 --- a/source/blender/python/mathutils/mathutils_geometry.hh +++ b/source/blender/python/mathutils/mathutils_geometry.hh @@ -8,4 +8,6 @@ * \ingroup pymathutils */ +#include + PyMODINIT_FUNC PyInit_mathutils_geometry(); diff --git a/source/blender/python/mathutils/mathutils_interpolate.cc b/source/blender/python/mathutils/mathutils_interpolate.cc index f613a70e6199..5f4a1cd1786d 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.cc +++ b/source/blender/python/mathutils/mathutils_interpolate.cc @@ -12,7 +12,6 @@ #include "mathutils_interpolate.hh" #include "BLI_math_geom.h" -#include "BLI_utildefines.h" #ifndef MATH_STANDALONE /* define when building outside blender */ # include "MEM_guardedalloc.h" diff --git a/source/blender/python/mathutils/mathutils_interpolate.hh b/source/blender/python/mathutils/mathutils_interpolate.hh index 8c993b6a623e..86124fabecac 100644 --- a/source/blender/python/mathutils/mathutils_interpolate.hh +++ b/source/blender/python/mathutils/mathutils_interpolate.hh @@ -8,4 +8,6 @@ * \ingroup pymathutils */ +#include + PyMODINIT_FUNC PyInit_mathutils_interpolate(); diff --git a/source/blender/python/mathutils/mathutils_kdtree.hh b/source/blender/python/mathutils/mathutils_kdtree.hh index fffe8e7ccf69..3dad6a4c5894 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.hh +++ b/source/blender/python/mathutils/mathutils_kdtree.hh @@ -8,6 +8,8 @@ #pragma once +#include + PyMODINIT_FUNC PyInit_mathutils_kdtree(); extern PyTypeObject PyKDTree_Type; diff --git a/source/blender/python/mathutils/mathutils_noise.hh b/source/blender/python/mathutils/mathutils_noise.hh index 674ba4c8c763..c134b1ef5f1e 100644 --- a/source/blender/python/mathutils/mathutils_noise.hh +++ b/source/blender/python/mathutils/mathutils_noise.hh @@ -8,4 +8,6 @@ #pragma once +#include + PyMODINIT_FUNC PyInit_mathutils_noise(); diff --git a/source/blender/render/RE_bake.h b/source/blender/render/RE_bake.h index 9670ff0d017b..2a60a77fe894 100644 --- a/source/blender/render/RE_bake.h +++ b/source/blender/render/RE_bake.h @@ -8,6 +8,8 @@ #pragma once +#include "DNA_scene_types.h" + #include "RE_pipeline.h" struct Depsgraph; diff --git a/source/blender/render/RE_compositor.hh b/source/blender/render/RE_compositor.hh index e7f30f13bf9f..7adf5e5bd5b8 100644 --- a/source/blender/render/RE_compositor.hh +++ b/source/blender/render/RE_compositor.hh @@ -4,8 +4,6 @@ #pragma once -#include - namespace blender::compositor { class RenderContext; class Profiler; diff --git a/source/blender/render/RE_multires_bake.h b/source/blender/render/RE_multires_bake.h index 94e121515dfc..f66c3c2bc3d7 100644 --- a/source/blender/render/RE_multires_bake.h +++ b/source/blender/render/RE_multires_bake.h @@ -8,6 +8,10 @@ #pragma once +#include "DNA_listBase.h" + +struct Image; +struct DerivedMesh; struct MultiresBakeRender; struct Scene; diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index 0d486ae8eba5..9baaee9a94fb 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -12,8 +12,6 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" -#include "BLI_implicit_sharing.h" - struct GPUTexture; struct ImBuf; struct Image; diff --git a/source/blender/render/intern/pipeline.cc b/source/blender/render/intern/pipeline.cc index eff0e878c0dc..a85f5b116be3 100644 --- a/source/blender/render/intern/pipeline.cc +++ b/source/blender/render/intern/pipeline.cc @@ -1447,7 +1447,7 @@ bool RE_seq_render_active(Scene *scene, RenderData *rd) } LISTBASE_FOREACH (Strip *, seq, &ed->seqbase) { - if (seq->type != SEQ_TYPE_SOUND_RAM && !SEQ_render_is_muted(&ed->channels, seq)) { + if (seq->type != STRIP_TYPE_SOUND_RAM && !SEQ_render_is_muted(&ed->channels, seq)) { return true; } } @@ -1706,7 +1706,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override, ReportList if (RE_seq_render_active(scene, &scene->r)) { if (scene->ed) { LISTBASE_FOREACH (Strip *, seq, &scene->ed->seqbase) { - if ((seq->type == SEQ_TYPE_SCENE) && ((seq->flag & SEQ_SCENE_STRIPS) == 0) && + if ((seq->type == STRIP_TYPE_SCENE) && ((seq->flag & SEQ_SCENE_STRIPS) == 0) && (seq->scene != nullptr)) { if (!seq->scene_camera) { diff --git a/source/blender/render/intern/texture_image.cc b/source/blender/render/intern/texture_image.cc index 1061d7ca4e37..89bbc7c1f10a 100644 --- a/source/blender/render/intern/texture_image.cc +++ b/source/blender/render/intern/texture_image.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #ifndef WIN32 @@ -27,6 +26,7 @@ #include "BLI_math_color.h" #include "BLI_math_interp.hh" #include "BLI_math_vector.h" +#include "BLI_rect.h" #include "BLI_threads.h" #include "BLI_utildefines.h" diff --git a/source/blender/render/intern/tile_highlight.cc b/source/blender/render/intern/tile_highlight.cc index 6f34079bce93..b2186de4cdb7 100644 --- a/source/blender/render/intern/tile_highlight.cc +++ b/source/blender/render/intern/tile_highlight.cc @@ -8,9 +8,8 @@ #include "tile_highlight.h" -#include "MEM_guardedalloc.h" - #include "BLI_hash.hh" +#include "BLI_rect.h" #include "RE_pipeline.h" diff --git a/source/blender/render/intern/tile_highlight.h b/source/blender/render/intern/tile_highlight.h index 249fe34b36a4..f7daaf46820f 100644 --- a/source/blender/render/intern/tile_highlight.h +++ b/source/blender/render/intern/tile_highlight.h @@ -8,7 +8,8 @@ #pragma once -#include "BLI_rect.h" +#include "DNA_vec_types.h" + #include "BLI_set.hh" #include "BLI_vector.hh" diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt index 6373f0dc9aab..4ee61946b8dc 100644 --- a/source/blender/sequencer/CMakeLists.txt +++ b/source/blender/sequencer/CMakeLists.txt @@ -70,7 +70,7 @@ set(SRC intern/proxy_job.cc intern/render.cc intern/render.hh - intern/sequence_lookup.cc + intern/strip_lookup.cc intern/sequencer.cc intern/sequencer.hh intern/sound.cc diff --git a/source/blender/sequencer/SEQ_add.hh b/source/blender/sequencer/SEQ_add.hh index ed451d648196..76db282ab69c 100644 --- a/source/blender/sequencer/SEQ_add.hh +++ b/source/blender/sequencer/SEQ_add.hh @@ -103,7 +103,7 @@ Strip *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad * \param seq: The sound strip that will be synced * \param load_data: SeqLoadData with information necessary to sync the sound strip */ -void SEQ_add_sound_av_sync(Main *bmain, Scene *scene, Strip *seq, SeqLoadData *load_data); +void SEQ_add_sound_av_sync(Main *bmain, Scene *scene, Strip *strip, SeqLoadData *load_data); /** * Add meta strip. * @@ -165,7 +165,7 @@ Strip *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_d * \param seq: image strip to be changed * \param path: directory path */ -void SEQ_add_image_set_directory(Strip *seq, const char *dirpath); +void SEQ_add_image_set_directory(Strip *strip, const char *dirpath); /** * Set directory used by image strip. * @@ -173,13 +173,13 @@ void SEQ_add_image_set_directory(Strip *seq, const char *dirpath); * \param strip_frame: frame index of strip to be changed * \param filename: image filename (only filename, not complete path) */ -void SEQ_add_image_load_file(Scene *scene, Strip *seq, size_t strip_frame, const char *filename); +void SEQ_add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename); /** * Set image strip alpha mode * * \param seq: image strip to be changed */ -void SEQ_add_image_init_alpha_mode(Strip *seq); -void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *seq, bool lock_range); +void SEQ_add_image_init_alpha_mode(Strip *strip); +void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *strip, bool lock_range); void SEQ_add_movie_reload_if_needed( - Main *bmain, Scene *scene, Strip *seq, bool *r_was_reloaded, bool *r_can_produce_frames); + Main *bmain, Scene *scene, Strip *strip, bool *r_was_reloaded, bool *r_can_produce_frames); diff --git a/source/blender/sequencer/SEQ_animation.hh b/source/blender/sequencer/SEQ_animation.hh index de6712799b2c..b2e828f5a2ea 100644 --- a/source/blender/sequencer/SEQ_animation.hh +++ b/source/blender/sequencer/SEQ_animation.hh @@ -11,7 +11,6 @@ #include "DNA_listBase.h" #include "ANIM_action.hh" -#include "ANIM_action_legacy.hh" struct ListBase; struct Scene; @@ -20,12 +19,12 @@ struct SeqAnimationBackup; bool SEQ_animation_keyframes_exist(Scene *scene); bool SEQ_animation_drivers_exist(Scene *scene); -void SEQ_free_animdata(Scene *scene, Strip *seq); -void SEQ_offset_animdata(Scene *scene, Strip *seq, int ofs); +void SEQ_free_animdata(Scene *scene, Strip *strip); +void SEQ_offset_animdata(Scene *scene, Strip *strip, int ofs); /** * Return whether the fcurve targets the given sequence. */ -bool SEQ_fcurve_matches(const Strip &seq, const FCurve &fcurve); +bool SEQ_fcurve_matches(const Strip &strip, const FCurve &fcurve); struct SeqAnimationBackup { /* `curves` and `channelbag` here represent effectively the same data (the * fcurves that animate the Scene that the sequence belongs to), just for @@ -47,4 +46,6 @@ void SEQ_animation_restore_original(Scene *scene, SeqAnimationBackup *backup); /** * Duplicate F-Curves and drivers used by `seq` from `backup` to `scene`. */ -void SEQ_animation_duplicate_backup_to_scene(Scene *scene, Strip *seq, SeqAnimationBackup *backup); +void SEQ_animation_duplicate_backup_to_scene(Scene *scene, + Strip *strip, + SeqAnimationBackup *backup); diff --git a/source/blender/sequencer/SEQ_channels.hh b/source/blender/sequencer/SEQ_channels.hh index 6465056023a8..9f189640bf81 100644 --- a/source/blender/sequencer/SEQ_channels.hh +++ b/source/blender/sequencer/SEQ_channels.hh @@ -24,4 +24,4 @@ char *SEQ_channel_name_get(ListBase *channels, int channel_index); bool SEQ_channel_is_locked(const SeqTimelineChannel *channel); bool SEQ_channel_is_muted(const SeqTimelineChannel *channel); int SEQ_channel_index_get(const SeqTimelineChannel *channel); -ListBase *SEQ_get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *seq); +ListBase *SEQ_get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *strip); diff --git a/source/blender/sequencer/SEQ_connect.hh b/source/blender/sequencer/SEQ_connect.hh index c69ad89151a9..fab7268c5c5c 100644 --- a/source/blender/sequencer/SEQ_connect.hh +++ b/source/blender/sequencer/SEQ_connect.hh @@ -20,35 +20,35 @@ void SEQ_connections_duplicate(ListBase *connections_dst, ListBase *connections_ * frees the allocated memory as necessary. Returns false if any of the strips were not already * connected. */ -bool SEQ_disconnect(Strip *seq); -bool SEQ_disconnect(blender::VectorSet &seq_list); +bool SEQ_disconnect(Strip *strip); +bool SEQ_disconnect(blender::VectorSet &strip_list); /** * Ensure that the strip has only bidirectional connections (expected behavior). */ -void SEQ_cut_one_way_connections(Strip *seq); +void SEQ_cut_one_way_connections(Strip *strip); /** * Connect strips so that they may be selected together. Any connections the * strips already have will be severed before reconnection. */ void SEQ_connect(Strip *seq1, Strip *seq2); -void SEQ_connect(blender::VectorSet &seq_list); +void SEQ_connect(blender::VectorSet &strip_list); /** * Returns a list of strips that the `seq` is connected to. * NOTE: This does not include `seq` itself. * This list is empty if `seq` is not connected. */ -blender::VectorSet SEQ_get_connected_strips(const Strip *seq); +blender::VectorSet SEQ_get_connected_strips(const Strip *strip); /** * Check whether a strip has any connections. */ -bool SEQ_is_strip_connected(const Strip *seq); +bool SEQ_is_strip_connected(const Strip *strip); /** * Check whether the list of strips are a single connection "group", that is, they are all * connected to each other and there are no outside connections. */ -bool SEQ_are_strips_connected_together(blender::VectorSet &seq_list); +bool SEQ_are_strips_connected_together(blender::VectorSet &strip_list); diff --git a/source/blender/sequencer/SEQ_edit.hh b/source/blender/sequencer/SEQ_edit.hh index 67005e9e85f3..6a1707076ec8 100644 --- a/source/blender/sequencer/SEQ_edit.hh +++ b/source/blender/sequencer/SEQ_edit.hh @@ -8,12 +8,16 @@ * \ingroup sequencer */ +struct Editing; struct ListBase; struct Main; struct Scene; struct Strip; -bool SEQ_edit_sequence_swap(Scene *scene, Strip *seq_a, Strip *seq_b, const char **r_error_str); +bool SEQ_edit_sequence_swap(Scene *scene, + Strip *strip_a, + Strip *strip_b, + const char **r_error_str); /** * Move sequence to seqbase. * @@ -24,7 +28,7 @@ bool SEQ_edit_sequence_swap(Scene *scene, Strip *seq_a, Strip *seq_b, const char */ bool SEQ_edit_move_strip_to_seqbase(Scene *scene, ListBase *seqbase, - Strip *seq, + Strip *strip, ListBase *dst_seqbase); /** * Move sequence to meta sequence. @@ -41,7 +45,7 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, /** * Flag seq and its users (effects) for removal. */ -void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Strip *seq); +void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Strip *strip); /** * Remove all flagged sequences, return true if sequence is removed. */ @@ -67,7 +71,7 @@ enum eSeqSplitMethod { Strip *SEQ_edit_strip_split(Main *bmain, Scene *scene, ListBase *seqbase, - Strip *seq, + Strip *strip, int timeline_frame, eSeqSplitMethod method, const char **r_error); @@ -84,4 +88,4 @@ bool SEQ_edit_remove_gaps(Scene *scene, ListBase *seqbase, int initial_frame, bool remove_all_gaps); -void SEQ_edit_sequence_name_set(Scene *scene, Strip *seq, const char *new_name); +void SEQ_edit_sequence_name_set(Scene *scene, Strip *strip, const char *new_name); diff --git a/source/blender/sequencer/SEQ_effects.hh b/source/blender/sequencer/SEQ_effects.hh index b015671f8cea..68a175ab16bd 100644 --- a/source/blender/sequencer/SEQ_effects.hh +++ b/source/blender/sequencer/SEQ_effects.hh @@ -4,6 +4,8 @@ #pragma once +#include "DNA_vec_types.h" + #include "BLI_math_vector_types.hh" #include "BLI_vector.hh" @@ -12,6 +14,7 @@ */ struct ImBuf; +struct Scene; struct SeqRenderData; struct Strip; struct TextVars; @@ -36,7 +39,7 @@ enum { struct SeqEffectHandle { /* constructors & destructor */ /* init is _only_ called on first creation */ - void (*init)(Strip *seq); + void (*init)(Strip *strip); /* number of input strips needed * (called directly after construction) */ @@ -50,27 +53,30 @@ struct SeqEffectHandle { void (*copy)(Strip *dst, const Strip *src, int flag); /* destruct */ - void (*free)(Strip *seq, bool do_id_user); + void (*free)(Strip *strip, bool do_id_user); - StripEarlyOut (*early_out)(const Strip *seq, float fac); + StripEarlyOut (*early_out)(const Strip *strip, float fac); /* sets the default `fac` value */ - void (*get_default_fac)(const Scene *scene, const Strip *seq, float timeline_frame, float *fac); + void (*get_default_fac)(const Scene *scene, + const Strip *strip, + float timeline_frame, + float *fac); /* execute the effect */ ImBuf *(*execute)(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2); }; -SeqEffectHandle SEQ_effect_handle_get(Strip *seq); -int SEQ_effect_get_num_inputs(int seq_type); +SeqEffectHandle SEQ_effect_handle_get(Strip *strip); +int SEQ_effect_get_num_inputs(int strip_type); void SEQ_effect_text_font_unload(TextVars *data, bool do_id_user); void SEQ_effect_text_font_load(TextVars *data, bool do_id_user); -bool SEQ_effects_can_render_text(const Strip *seq); +bool SEQ_effects_can_render_text(const Strip *strip); namespace blender::seq { diff --git a/source/blender/sequencer/SEQ_iterator.hh b/source/blender/sequencer/SEQ_iterator.hh index bc44c69355c0..45e8b027858b 100644 --- a/source/blender/sequencer/SEQ_iterator.hh +++ b/source/blender/sequencer/SEQ_iterator.hh @@ -10,12 +10,14 @@ #include "BLI_vector_set.hh" +struct ListBase; +struct Scene; struct Strip; /** * Callback format for the for_each function below. */ -using SeqForEachFunc = bool (*)(Strip *seq, void *user_data); +using SeqForEachFunc = bool (*)(Strip *strip, void *user_data); /** * Utility function to recursively iterate through all sequence strips in a `seqbase` list. @@ -29,36 +31,36 @@ using SeqForEachFunc = bool (*)(Strip *seq, void *user_data); void SEQ_for_each_callback(ListBase *seqbase, SeqForEachFunc callback, void *user_data); /** - * Expand set by running `seq_query_func()` for each strip, which will be used as reference. + * Expand set by running `strip_query_func()` for each strip, which will be used as reference. * Results of these queries will be merged into provided collection. * * \param seqbase: ListBase in which strips are queried * \param strips: set of strips to be expanded - * \param seq_query_func: query function callback + * \param strip_query_func: query function callback */ void SEQ_iterator_set_expand(const Scene *scene, ListBase *seqbase, blender::VectorSet &strips, - void seq_query_func(const Scene *scene, - Strip *seq_reference, - ListBase *seqbase, - blender::VectorSet &strips)); + void strip_query_func(const Scene *scene, + Strip *strip_reference, + ListBase *seqbase, + blender::VectorSet &strips)); /** - * Query strips from seqbase. seq_reference is used by query function as filter condition. + * Query strips from seqbase. strip_reference is used by query function as filter condition. * - * \param seq_reference: reference strip for query function + * \param strip_reference: reference strip for query function * \param seqbase: ListBase in which strips are queried - * \param seq_query_func: query function callback + * \param strip_query_func: query function callback * \return set of strips */ blender::VectorSet SEQ_query_by_reference( - Strip *seq_reference, + Strip *strip_reference, const Scene *scene, ListBase *seqbase, - void seq_query_func(const Scene *scene, - Strip *seq_reference, - ListBase *seqbase, - blender::VectorSet &strips)); + void strip_query_func(const Scene *scene, + Strip *strip_reference, + ListBase *seqbase, + blender::VectorSet &strips)); /** * Query all selected strips in seqbase. * @@ -89,16 +91,16 @@ blender::VectorSet SEQ_query_all_strips(ListBase *seqbase); blender::VectorSet SEQ_query_all_strips_recursive(const ListBase *seqbase); /** - * Query all effect strips that are directly or indirectly connected to seq_reference. - * This includes all effects of seq_reference, strips used by another inputs and their effects, so - * that whole chain is fully independent of other strips. + * Query all effect strips that are directly or indirectly connected to strip_reference. + * This includes all effects of strip_reference, strips used by another inputs and their effects, + * so that whole chain is fully independent of other strips. * - * \param seq_reference: reference strip + * \param strip_reference: reference strip * \param seqbase: ListBase in which strips are queried * \param strips: set of strips to be filled */ void SEQ_query_strip_effect_chain(const Scene *scene, - Strip *seq_reference, + Strip *strip_reference, ListBase *seqbase, blender::VectorSet &strips); diff --git a/source/blender/sequencer/SEQ_modifier.hh b/source/blender/sequencer/SEQ_modifier.hh index f9bd2b144033..148b347106fa 100644 --- a/source/blender/sequencer/SEQ_modifier.hh +++ b/source/blender/sequencer/SEQ_modifier.hh @@ -45,18 +45,18 @@ struct SequenceModifierTypeInfo { }; const SequenceModifierTypeInfo *SEQ_modifier_type_info_get(int type); -SequenceModifierData *SEQ_modifier_new(Strip *seq, const char *name, int type); -bool SEQ_modifier_remove(Strip *seq, SequenceModifierData *smd); -void SEQ_modifier_clear(Strip *seq); +SequenceModifierData *SEQ_modifier_new(Strip *strip, const char *name, int type); +bool SEQ_modifier_remove(Strip *strip, SequenceModifierData *smd); +void SEQ_modifier_clear(Strip *strip); void SEQ_modifier_free(SequenceModifierData *smd); -void SEQ_modifier_unique_name(Strip *seq, SequenceModifierData *smd); -SequenceModifierData *SEQ_modifier_find_by_name(Strip *seq, const char *name); +void SEQ_modifier_unique_name(Strip *strip, SequenceModifierData *smd); +SequenceModifierData *SEQ_modifier_find_by_name(Strip *strip, const char *name); void SEQ_modifier_apply_stack(const SeqRenderData *context, - const Strip *seq, + const Strip *strip, ImBuf *ibuf, int timeline_frame); -void SEQ_modifier_list_copy(Strip *seqn, Strip *seq); -int SEQ_sequence_supports_modifiers(Strip *seq); +void SEQ_modifier_list_copy(Strip *seqn, Strip *strip); +int SEQ_sequence_supports_modifiers(Strip *strip); void SEQ_modifier_blend_write(BlendWriter *writer, ListBase *modbase); void SEQ_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb); diff --git a/source/blender/sequencer/SEQ_proxy.hh b/source/blender/sequencer/SEQ_proxy.hh index 5ef306b96ca5..d89adb47bb6a 100644 --- a/source/blender/sequencer/SEQ_proxy.hh +++ b/source/blender/sequencer/SEQ_proxy.hh @@ -8,6 +8,8 @@ * \ingroup sequencer */ +#include "DNA_listBase.h" + #include "BLI_set.hh" struct Depsgraph; @@ -24,14 +26,14 @@ struct wmJobWorkerStatus; bool SEQ_proxy_rebuild_context(Main *bmain, Depsgraph *depsgraph, Scene *scene, - Strip *seq, + Strip *strip, blender::Set *processed_paths, ListBase *queue, bool build_only_on_bad_performance); void SEQ_proxy_rebuild(SeqIndexBuildContext *context, wmJobWorkerStatus *worker_status); void SEQ_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop); -void SEQ_proxy_set(Strip *seq, bool value); -bool SEQ_can_use_proxy(const SeqRenderData *context, const Strip *seq, int psize); +void SEQ_proxy_set(Strip *strip, bool value); +bool SEQ_can_use_proxy(const SeqRenderData *context, const Strip *strip, int psize); int SEQ_rendersize_to_proxysize(int render_size); double SEQ_rendersize_to_scale_factor(int render_size); diff --git a/source/blender/sequencer/SEQ_relations.hh b/source/blender/sequencer/SEQ_relations.hh index 2f809e91c1e6..7633602a89dd 100644 --- a/source/blender/sequencer/SEQ_relations.hh +++ b/source/blender/sequencer/SEQ_relations.hh @@ -8,6 +8,8 @@ * \ingroup sequencer */ +#include + struct ListBase; struct Main; struct MovieClip; @@ -22,21 +24,21 @@ bool SEQ_relation_is_effect_of_strip(const Strip *effect, const Strip *input); /** * Function to free imbuf and anim data on changes. */ -void SEQ_relations_sequence_free_anim(Strip *seq); +void SEQ_relations_sequence_free_anim(Strip *strip); bool SEQ_relations_check_scene_recursion(Scene *scene, ReportList *reports); /** - * Check if "seq_main" (indirectly) uses strip "seq". + * Check if "strip_main" (indirectly) uses strip "strip". */ -bool SEQ_relations_render_loop_check(Strip *seq_main, Strip *seq); +bool SEQ_relations_render_loop_check(Strip *strip_main, Strip *strip); void SEQ_relations_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render); -void SEQ_relations_invalidate_cache_raw(Scene *scene, Strip *seq); -void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Strip *seq); -void SEQ_relations_invalidate_cache_composite(Scene *scene, Strip *seq); -void SEQ_relations_invalidate_dependent(Scene *scene, Strip *seq); +void SEQ_relations_invalidate_cache_raw(Scene *scene, Strip *strip); +void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Strip *strip); +void SEQ_relations_invalidate_cache_composite(Scene *scene, Strip *strip); +void SEQ_relations_invalidate_dependent(Scene *scene, Strip *strip); void SEQ_relations_invalidate_scene_strips(Main *bmain, Scene *scene_target); void SEQ_relations_invalidate_movieclip_strips(Main *bmain, MovieClip *clip_target); void SEQ_relations_invalidate_cache_in_range(Scene *scene, - Strip *seq, + Strip *strip, Strip *range_mask, int invalidate_types); /** @@ -58,11 +60,11 @@ void SEQ_cache_iterate( Scene *scene, void *userdata, bool callback_init(void *userdata, size_t item_count), - bool callback_iter(void *userdata, Strip *seq, int timeline_frame, int cache_type)); + bool callback_iter(void *userdata, Strip *strip, int timeline_frame, int cache_type)); /** * Return immediate parent meta of sequence. */ Strip *SEQ_find_metastrip_by_sequence(ListBase *seqbase /* = ed->seqbase */, Strip *meta /* = NULL */, - Strip *seq); -bool SEQ_exists_in_seqbase(const Strip *seq, const ListBase *seqbase); + Strip *strip); +bool SEQ_exists_in_seqbase(const Strip *strip, const ListBase *seqbase); diff --git a/source/blender/sequencer/SEQ_render.hh b/source/blender/sequencer/SEQ_render.hh index c4b17bc5ea0c..ee9dff3fd5c6 100644 --- a/source/blender/sequencer/SEQ_render.hh +++ b/source/blender/sequencer/SEQ_render.hh @@ -57,7 +57,9 @@ struct SeqRenderData { * \note The returned #ImBuf has its reference increased, free after usage! */ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown); -ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, float timeline_frame, Strip *seq); +ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, + float timeline_frame, + Strip *strip); void SEQ_render_new_render_data(Main *bmain, Depsgraph *depsgraph, Scene *scene, @@ -66,12 +68,12 @@ void SEQ_render_new_render_data(Main *bmain, int preview_render_size, int for_render, SeqRenderData *r_context); -StripElem *SEQ_render_give_stripelem(const Scene *scene, const Strip *seq, int timeline_frame); +StripElem *SEQ_render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame); void SEQ_render_imbuf_from_sequencer_space(Scene *scene, ImBuf *ibuf); void SEQ_render_pixel_from_sequencer_space_v4(Scene *scene, float pixel[4]); /** - * Check if `seq` is muted for rendering. + * Check if `strip` is muted for rendering. * This function also checks `SeqTimelineChannel` flag. */ -bool SEQ_render_is_muted(const ListBase *channels, const Strip *seq); +bool SEQ_render_is_muted(const ListBase *channels, const Strip *strip); diff --git a/source/blender/sequencer/SEQ_retiming.hh b/source/blender/sequencer/SEQ_retiming.hh index 2f0e608727bc..a3a68b235cfe 100644 --- a/source/blender/sequencer/SEQ_retiming.hh +++ b/source/blender/sequencer/SEQ_retiming.hh @@ -16,48 +16,48 @@ struct Scene; struct Strip; struct SeqRetimingKey; -blender::MutableSpan SEQ_retiming_keys_get(const Strip *seq); +blender::MutableSpan SEQ_retiming_keys_get(const Strip *strip); blender::Map SEQ_retiming_selection_get(const Editing *ed); -int SEQ_retiming_keys_count(const Strip *seq); -bool SEQ_retiming_is_active(const Strip *seq); -void SEQ_retiming_data_ensure(Strip *seq); -void SEQ_retiming_data_clear(Strip *seq); -void SEQ_retiming_reset(Scene *scene, Strip *seq); -bool SEQ_retiming_is_allowed(const Strip *seq); +int SEQ_retiming_keys_count(const Strip *strip); +bool SEQ_retiming_is_active(const Strip *strip); +void SEQ_retiming_data_ensure(Strip *strip); +void SEQ_retiming_data_clear(Strip *strip); +void SEQ_retiming_reset(Scene *scene, Strip *strip); +bool SEQ_retiming_is_allowed(const Strip *strip); /** * Add new retiming key. * This function always reallocates memory, so when function is used all stored pointers will * become invalid. */ -SeqRetimingKey *SEQ_retiming_add_key(const Scene *scene, Strip *seq, int timeline_frame); -SeqRetimingKey *SEQ_retiming_add_transition(Strip *seq, SeqRetimingKey *key, float offset); +SeqRetimingKey *SEQ_retiming_add_key(const Scene *scene, Strip *strip, int timeline_frame); +SeqRetimingKey *SEQ_retiming_add_transition(Strip *strip, SeqRetimingKey *key, float offset); SeqRetimingKey *SEQ_retiming_add_freeze_frame(const Scene *scene, - Strip *seq, + Strip *strip, SeqRetimingKey *key, const int offset); -bool SEQ_retiming_is_last_key(const Strip *seq, const SeqRetimingKey *key); -SeqRetimingKey *SEQ_retiming_last_key_get(const Strip *seq); -void SEQ_retiming_remove_key(Strip *seq, SeqRetimingKey *key); +bool SEQ_retiming_is_last_key(const Strip *strip, const SeqRetimingKey *key); +SeqRetimingKey *SEQ_retiming_last_key_get(const Strip *strip); +void SEQ_retiming_remove_key(Strip *strip, SeqRetimingKey *key); void SEQ_retiming_transition_key_frame_set(const Scene *scene, - const Strip *seq, + const Strip *strip, SeqRetimingKey *key, int timeline_frame); -float SEQ_retiming_key_speed_get(const Strip *seq, const SeqRetimingKey *key); +float SEQ_retiming_key_speed_get(const Strip *strip, const SeqRetimingKey *key); void SEQ_retiming_key_speed_set( - const Scene *scene, Strip *seq, SeqRetimingKey *key, float speed, bool keep_retiming); -int SEQ_retiming_key_index_get(const Strip *seq, const SeqRetimingKey *key); + const Scene *scene, Strip *strip, SeqRetimingKey *key, float speed, bool keep_retiming); +int SEQ_retiming_key_index_get(const Strip *strip, const SeqRetimingKey *key); SeqRetimingKey *SEQ_retiming_key_get_by_timeline_frame(const Scene *scene, - const Strip *seq, + const Strip *strip, int timeline_frame); -void SEQ_retiming_sound_animation_data_set(const Scene *scene, const Strip *seq); +void SEQ_retiming_sound_animation_data_set(const Scene *scene, const Strip *strip); int SEQ_retiming_key_timeline_frame_get(const Scene *scene, - const Strip *seq, + const Strip *strip, const SeqRetimingKey *key); void SEQ_retiming_key_timeline_frame_set(const Scene *scene, - Strip *seq, + Strip *strip, SeqRetimingKey *key, int timeline_frame); -SeqRetimingKey *SEQ_retiming_find_segment_start_key(const Strip *seq, float frame_index); +SeqRetimingKey *SEQ_retiming_find_segment_start_key(const Strip *strip, float frame_index); bool SEQ_retiming_key_is_transition_type(const SeqRetimingKey *key); bool SEQ_retiming_key_is_transition_start(const SeqRetimingKey *key); SeqRetimingKey *SEQ_retiming_transition_start_get(SeqRetimingKey *key); @@ -66,8 +66,8 @@ bool SEQ_retiming_selection_clear(const Editing *ed); void SEQ_retiming_selection_append(SeqRetimingKey *key); void SEQ_retiming_selection_remove(SeqRetimingKey *key); void SEQ_retiming_selection_copy(SeqRetimingKey *dst, const SeqRetimingKey *src); -void SEQ_retiming_remove_multiple_keys(Strip *seq, +void SEQ_retiming_remove_multiple_keys(Strip *strip, blender::Vector &keys_to_remove); bool SEQ_retiming_selection_contains(const Editing *ed, const SeqRetimingKey *key); bool SEQ_retiming_selection_has_whole_transition(const Editing *ed, SeqRetimingKey *key); -bool SEQ_retiming_data_is_editable(const Strip *seq); +bool SEQ_retiming_data_is_editable(const Strip *strip); diff --git a/source/blender/sequencer/SEQ_select.hh b/source/blender/sequencer/SEQ_select.hh index 89a9c49dec6f..a8154758416b 100644 --- a/source/blender/sequencer/SEQ_select.hh +++ b/source/blender/sequencer/SEQ_select.hh @@ -13,4 +13,4 @@ struct Strip; Strip *SEQ_select_active_get(const Scene *scene); bool SEQ_select_active_get_pair(Scene *scene, Strip **r_seq_act, Strip **r_seq_other); -void SEQ_select_active_set(Scene *scene, Strip *seq); +void SEQ_select_active_set(Scene *scene, Strip *strip); diff --git a/source/blender/sequencer/SEQ_sequencer.hh b/source/blender/sequencer/SEQ_sequencer.hh index 5bb941f35647..8623c00dfb8b 100644 --- a/source/blender/sequencer/SEQ_sequencer.hh +++ b/source/blender/sequencer/SEQ_sequencer.hh @@ -33,9 +33,9 @@ enum { SEQ_SIDE_NO_CHANGE, }; -/* seq_dupli' flags */ -#define SEQ_DUPE_UNIQUE_NAME (1 << 0) -#define SEQ_DUPE_ALL (1 << 3) /* otherwise only selected are copied */ +/* strip_dupli' flags */ +#define STRIP_DUPE_UNIQUE_NAME (1 << 0) +#define STRIP_DUPE_ALL (1 << 3) /* otherwise only selected are copied */ SequencerToolSettings *SEQ_tool_settings_init(); SequencerToolSettings *SEQ_tool_settings_ensure(Scene *scene); @@ -66,7 +66,7 @@ ListBase *SEQ_active_seqbase_get(const Editing *ed); */ void SEQ_seqbase_active_set(Editing *ed, ListBase *seqbase); Strip *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type); -void SEQ_sequence_free(Scene *scene, Strip *seq); +void SEQ_sequence_free(Scene *scene, Strip *strip); /** * Get #MetaStack that corresponds to current level that is being viewed * @@ -87,14 +87,14 @@ void SEQ_meta_stack_set(const Scene *scene, Strip *dst_seq); */ Strip *SEQ_meta_stack_pop(Editing *ed); Strip *SEQ_sequence_dupli_recursive( - const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Strip *seq, int dupe_flag); + const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Strip *strip, int dupe_flag); void SEQ_sequence_base_dupli_recursive(const Scene *scene_src, Scene *scene_dst, ListBase *nseqbase, const ListBase *seqbase, int dupe_flag, int flag); -bool SEQ_is_valid_strip_channel(const Strip *seq); +bool SEQ_is_valid_strip_channel(const Strip *strip); /** * Read and Write functions for `.blend` file data. @@ -114,31 +114,31 @@ void SEQ_doversion_250_sound_proxy_update(Main *bmain, Editing *ed); void SEQ_eval_sequences(Depsgraph *depsgraph, Scene *scene, ListBase *seqbase); /** - * Find a sequence with a given name. + * Find a strip with a given name. * If lookup hash doesn't exist, it will be created. If hash is tagged as invalid, it will be * rebuilt. * * \param scene: scene that owns lookup hash - * \param key: Sequence name without SQ prefix (seq->name + 2) + * \param key: Strip name without SQ prefix (strip->name + 2) * - * \return pointer to Sequence + * \return pointer to Strip */ -Strip *SEQ_sequence_lookup_seq_by_name(const Scene *scene, const char *key); +Strip *SEQ_lookup_strip_by_name(const Scene *scene, const char *key); /** * Find which meta strip the given timeline channel belongs to. Returns nullptr if it is a global * channel. */ -Strip *SEQ_sequence_lookup_owner_by_channel(const Scene *scene, const SeqTimelineChannel *channel); +Strip *SEQ_lookup_strip_by_channel_owner(const Scene *scene, const SeqTimelineChannel *channel); /** * Free lookup hash data. * * \param scene: scene that owns lookup hash */ -void SEQ_sequence_lookup_free(const Scene *scene); +void SEQ_strip_lookup_free(const Scene *scene); /** - * Mark sequence lookup as invalid (i.e. will need rebuilding). + * Mark strip lookup as invalid (i.e. will need rebuilding). */ -void SEQ_sequence_lookup_invalidate(const Scene *scene); +void SEQ_strip_lookup_invalidate(const Scene *scene); diff --git a/source/blender/sequencer/SEQ_sound.hh b/source/blender/sequencer/SEQ_sound.hh index 71a8d43b8e26..7e5bc77c9007 100644 --- a/source/blender/sequencer/SEQ_sound.hh +++ b/source/blender/sequencer/SEQ_sound.hh @@ -27,23 +27,23 @@ struct SoundEqualizerModifierData; #define SOUND_EQUALIZER_SIZE_DEFINITION 1000 void SEQ_sound_update_bounds_all(Scene *scene); -void SEQ_sound_update_bounds(Scene *scene, Strip *seq); +void SEQ_sound_update_bounds(Scene *scene, Strip *strip); void SEQ_sound_update(Scene *scene, bSound *sound); void SEQ_sound_update_length(Main *bmain, Scene *scene); -float SEQ_sound_pitch_get(const Scene *scene, const Strip *seq); +float SEQ_sound_pitch_get(const Scene *scene, const Strip *strip); EQCurveMappingData *SEQ_sound_equalizer_add(SoundEqualizerModifierData *semd, float minX, float maxX); void SEQ_sound_blend_write(BlendWriter *writer, ListBase *soundbase); void SEQ_sound_blend_read_data(BlendDataReader *reader, ListBase *lb); -void *SEQ_sound_modifier_recreator(Strip *seq, SequenceModifierData *smd, void *sound); +void *SEQ_sound_modifier_recreator(Strip *strip, SequenceModifierData *smd, void *sound); void SEQ_sound_equalizermodifier_init_data(SequenceModifierData *smd); void SEQ_sound_equalizermodifier_free(SequenceModifierData *smd); void SEQ_sound_equalizermodifier_copy_data(SequenceModifierData *target, SequenceModifierData *smd); -void *SEQ_sound_equalizermodifier_recreator(Strip *seq, SequenceModifierData *smd, void *sound); +void *SEQ_sound_equalizermodifier_recreator(Strip *strip, SequenceModifierData *smd, void *sound); void SEQ_sound_equalizermodifier_set_graphs(SoundEqualizerModifierData *semd, int number); const SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type); EQCurveMappingData *SEQ_sound_equalizermodifier_add_graph(SoundEqualizerModifierData *semd, @@ -54,5 +54,5 @@ void SEQ_sound_equalizermodifier_remove_graph(SoundEqualizerModifierData *semd, struct SoundModifierWorkerInfo { int type; - void *(*recreator)(Strip *seq, SequenceModifierData *smd, void *sound); + void *(*recreator)(Strip *strip, SequenceModifierData *smd, void *sound); }; diff --git a/source/blender/sequencer/SEQ_thumbnail_cache.hh b/source/blender/sequencer/SEQ_thumbnail_cache.hh index 1162be4a5178..c431c9c3c033 100644 --- a/source/blender/sequencer/SEQ_thumbnail_cache.hh +++ b/source/blender/sequencer/SEQ_thumbnail_cache.hh @@ -14,10 +14,6 @@ struct rctf; struct Strip; struct Scene; -#include "BLI_function_ref.hh" - -#include - namespace blender::seq { static constexpr int SEQ_THUMB_SIZE = 256; @@ -35,7 +31,7 @@ static constexpr int SEQ_THUMB_SIZE = 256; * processed in the background. */ ImBuf *thumbnail_cache_get(const bContext *C, Scene *scene, - const Strip *seq, + const Strip *strip, float timeline_frame); /** @@ -44,7 +40,7 @@ ImBuf *thumbnail_cache_get(const bContext *C, */ void thumbnail_cache_maintain_capacity(Scene *scene); -void thumbnail_cache_invalidate_strip(Scene *scene, const Strip *seq); +void thumbnail_cache_invalidate_strip(Scene *scene, const Strip *strip); /** * Discard in-flight thumbnail loading requests that are outside of the given view (X coordinate: @@ -55,6 +51,6 @@ void thumbnail_cache_discard_requests_outside(Scene *scene, const rctf &rect); void thumbnail_cache_clear(Scene *scene); void thumbnail_cache_destroy(Scene *scene); -bool strip_can_have_thumbnail(const Scene *scene, const Strip *seq); +bool strip_can_have_thumbnail(const Scene *scene, const Strip *strip); } // namespace blender::seq diff --git a/source/blender/sequencer/SEQ_time.hh b/source/blender/sequencer/SEQ_time.hh index 5be5ee2f0f29..8f0afc86798a 100644 --- a/source/blender/sequencer/SEQ_time.hh +++ b/source/blender/sequencer/SEQ_time.hh @@ -39,7 +39,7 @@ void SEQ_timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *r_ * Get FPS rate of source media. Movie, scene and movie-clip strips are supported. * Returns 0 for unsupported strip or if media can't be loaded. */ -float SEQ_time_sequence_get_fps(Scene *scene, Strip *seq); +float SEQ_time_sequence_get_fps(Scene *scene, Strip *strip); /** * Find start or end position of next or previous strip. * \param scene: Video editing scene @@ -63,74 +63,74 @@ int SEQ_time_find_next_prev_edit(Scene *scene, * \param timeline_frame: absolute frame position * \return true if strip intersects with timeline frame. */ -bool SEQ_time_strip_intersects_frame(const Scene *scene, const Strip *seq, int timeline_frame); +bool SEQ_time_strip_intersects_frame(const Scene *scene, const Strip *strip, int timeline_frame); /* Convert timeline frame so strip frame index. */ -float SEQ_give_frame_index(const Scene *scene, const Strip *seq, float timeline_frame); +float SEQ_give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame); /** * Returns true if strip has frames without content to render. */ -bool SEQ_time_has_still_frames(const Scene *scene, const Strip *seq); +bool SEQ_time_has_still_frames(const Scene *scene, const Strip *strip); /** * Returns true if at beginning of strip there is no content to be rendered. */ -bool SEQ_time_has_left_still_frames(const Scene *scene, const Strip *seq); +bool SEQ_time_has_left_still_frames(const Scene *scene, const Strip *strip); /** * Returns true if at end of strip there is no content to be rendered. */ -bool SEQ_time_has_right_still_frames(const Scene *scene, const Strip *seq); +bool SEQ_time_has_right_still_frames(const Scene *scene, const Strip *strip); /** * Get timeline frame where strip boundary starts. */ -int SEQ_time_left_handle_frame_get(const Scene *scene, const Strip *seq); +int SEQ_time_left_handle_frame_get(const Scene *scene, const Strip *strip); /** * Get timeline frame where strip boundary ends. */ -int SEQ_time_right_handle_frame_get(const Scene *scene, const Strip *seq); +int SEQ_time_right_handle_frame_get(const Scene *scene, const Strip *strip); /** * Set frame where strip boundary starts. This function moves only handle, content is not moved. */ -void SEQ_time_left_handle_frame_set(const Scene *scene, Strip *seq, int timeline_frame); +void SEQ_time_left_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame); /** * Set frame where strip boundary ends. * This function moves only handle, content is not moved. */ -void SEQ_time_right_handle_frame_set(const Scene *scene, Strip *seq, int timeline_frame); +void SEQ_time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame); /** * Get number of frames (in timeline) that can be rendered. * This can change depending on scene FPS or strip speed factor. */ -int SEQ_time_strip_length_get(const Scene *scene, const Strip *seq); +int SEQ_time_strip_length_get(const Scene *scene, const Strip *strip); /** * Get timeline frame where strip content starts. */ -float SEQ_time_start_frame_get(const Strip *seq); +float SEQ_time_start_frame_get(const Strip *strip); /** * Get timeline frame where strip content ends. */ -float SEQ_time_content_end_frame_get(const Scene *scene, const Strip *seq); +float SEQ_time_content_end_frame_get(const Scene *scene, const Strip *strip); /** * Set frame where strip content starts. * This function will also move strip handles. */ -void SEQ_time_start_frame_set(const Scene *scene, Strip *seq, int timeline_frame); +void SEQ_time_start_frame_set(const Scene *scene, Strip *strip, int timeline_frame); /** * Update meta strip content start and end, update sound playback range. * To be used after any contained strip length or position has changed. * * \note this function is currently only used internally and in versioning code. */ -void SEQ_time_update_meta_strip_range(const Scene *scene, Strip *seq_meta); +void SEQ_time_update_meta_strip_range(const Scene *scene, Strip *strip_meta); /** * Move contents of a strip without moving the strip handles. */ -void SEQ_time_slip_strip(const Scene *scene, Strip *seq, int delta, float subframe_delta); +void SEQ_time_slip_strip(const Scene *scene, Strip *strip, int delta, float subframe_delta); /** * Get difference between scene and movie strip frame-rate. */ -float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Strip *seq); +float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Strip *strip); /** * Get the sound offset (if any) and round it to the nearest integer. * This is mostly used in places where subframe data is not allowed (like re-timing key positions). * Returns zero if sequence is not a sound strip or if there is no offset. */ -int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Strip *seq); +int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Strip *strip); diff --git a/source/blender/sequencer/SEQ_transform.hh b/source/blender/sequencer/SEQ_transform.hh index 098a37711425..143aa91716b6 100644 --- a/source/blender/sequencer/SEQ_transform.hh +++ b/source/blender/sequencer/SEQ_transform.hh @@ -8,19 +8,21 @@ * \ingroup sequencer */ +#include "BLI_span.hh" + struct ListBase; struct Scene; struct Strip; -bool SEQ_transform_sequence_can_be_translated(const Strip *seq); +bool SEQ_transform_sequence_can_be_translated(const Strip *strip); /** * Used so we can do a quick check for single image seq * since they work a bit differently to normal image seq's (during transform). */ -bool SEQ_transform_single_image_check(const Strip *seq); +bool SEQ_transform_single_image_check(const Strip *strip); bool SEQ_transform_test_overlap(const Scene *scene, ListBase *seqbasep, Strip *test); bool SEQ_transform_test_overlap_seq_seq(const Scene *scene, Strip *seq1, Strip *seq2); -void SEQ_transform_translate_sequence(Scene *evil_scene, Strip *seq, int delta); +void SEQ_transform_translate_sequence(Scene *evil_scene, Strip *strip, int delta); /** * \return 0 if there weren't enough space. */ @@ -71,11 +73,11 @@ void SEQ_transform_offset_after_frame(Scene *scene, * Check if `seq` can be moved. * This function also checks `SeqTimelineChannel` flag. */ -bool SEQ_transform_is_locked(ListBase *channels, const Strip *seq); +bool SEQ_transform_is_locked(ListBase *channels, const Strip *strip); /* Image transformation. */ -void SEQ_image_transform_mirror_factor_get(const Strip *seq, float r_mirror[2]); +void SEQ_image_transform_mirror_factor_get(const Strip *strip, float r_mirror[2]); /** * Get strip transform origin offset from image center * NOTE: This function does not apply axis mirror. @@ -85,7 +87,7 @@ void SEQ_image_transform_mirror_factor_get(const Strip *seq, float r_mirror[2]); * \param r_origin: return value */ void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, - const Strip *seq, + const Strip *strip, float r_origin[2]); /** * Get 4 corner points of strip image, optionally without rotation component applied. @@ -97,7 +99,7 @@ void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, * \param r_quad: array of 4 2D vectors */ void SEQ_image_transform_quad_get(const Scene *scene, - const Strip *seq, + const Strip *strip, bool apply_rotation, float r_quad[4][2]); /** @@ -107,7 +109,9 @@ void SEQ_image_transform_quad_get(const Scene *scene, * \param seq: Sequence to calculate transformed image quad * \param r_quad: array of 4 2D vectors */ -void SEQ_image_transform_final_quad_get(const Scene *scene, const Strip *seq, float r_quad[4][2]); +void SEQ_image_transform_final_quad_get(const Scene *scene, + const Strip *strip, + float r_quad[4][2]); void SEQ_image_preview_unit_to_px(const Scene *scene, const float co_src[2], float co_dst[2]); void SEQ_image_preview_unit_from_px(const Scene *scene, const float co_src[2], float co_dst[2]); @@ -137,5 +141,5 @@ void SEQ_image_transform_bounding_box_from_collection(Scene *scene, * \param r_transform_matrix: Return value */ void SEQ_image_transform_matrix_get(const Scene *scene, - const Strip *seq, + const Strip *strip, float r_transform_matrix[4][4]); diff --git a/source/blender/sequencer/SEQ_utils.hh b/source/blender/sequencer/SEQ_utils.hh index 9de6287c1716..88f31a149ec8 100644 --- a/source/blender/sequencer/SEQ_utils.hh +++ b/source/blender/sequencer/SEQ_utils.hh @@ -17,14 +17,14 @@ struct Scene; struct Strip; struct StripElem; -void SEQ_sequence_base_unique_name_recursive(Scene *scene, ListBase *seqbasep, Strip *seq); -const char *SEQ_sequence_give_name(const Strip *seq); -ListBase *SEQ_get_seqbase_from_sequence(Strip *seq, ListBase **r_channels, int *r_offset); +void SEQ_sequence_base_unique_name_recursive(Scene *scene, ListBase *seqbasep, Strip *strip); +const char *SEQ_sequence_give_name(const Strip *strip); +ListBase *SEQ_get_seqbase_from_sequence(Strip *strip, ListBase **r_channels, int *r_offset); const Strip *SEQ_get_topmost_sequence(const Scene *scene, int frame); /** * In cases where we don't know the sequence's listbase. */ -ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Strip *seq); +ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Strip *strip); /** * Only use as last resort when the StripElem is available but no the Sequence. * (needed for RNA) @@ -32,16 +32,16 @@ ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Strip *seq); Strip *SEQ_sequence_from_strip_elem(ListBase *seqbase, StripElem *se); Strip *SEQ_get_sequence_by_name(ListBase *seqbase, const char *name, bool recursive); Mask *SEQ_active_mask_get(Scene *scene); -void SEQ_alpha_mode_from_file_extension(Strip *seq); +void SEQ_alpha_mode_from_file_extension(Strip *strip); /** * Check if an input referenced by this strip is valid (e.g. scene for a scene strip). * Note that this only checks data block references, for missing media referenced * by paths use #media_presence_is_missing. */ -bool SEQ_sequence_has_valid_data(const Strip *seq); +bool SEQ_sequence_has_valid_data(const Strip *strip); -void SEQ_set_scale_to_fit(const Strip *seq, +void SEQ_set_scale_to_fit(const Strip *strip, int image_width, int image_height, int preview_width, @@ -54,7 +54,7 @@ void SEQ_set_scale_to_fit(const Strip *seq, * \param seq: Sequence which name will be ensured to be unique * \param scene: Scene in which name must be unique */ -void SEQ_ensure_unique_name(Strip *seq, Scene *scene); +void SEQ_ensure_unique_name(Strip *strip, Scene *scene); void SEQ_fontmap_clear(); @@ -69,17 +69,17 @@ namespace blender::seq { * \param seq: Sequencer strip. * \return True if media file is missing. */ -bool media_presence_is_missing(Scene *scene, const Strip *seq); +bool media_presence_is_missing(Scene *scene, const Strip *strip); /** * Set or change the missing media cache value for a given strip. */ -void media_presence_set_missing(Scene *scene, const Strip *seq, bool missing); +void media_presence_set_missing(Scene *scene, const Strip *strip, bool missing); /** * Invalidate media presence cache for the given strip. */ -void media_presence_invalidate_strip(Scene *scene, const Strip *seq); +void media_presence_invalidate_strip(Scene *scene, const Strip *strip); /** * Invalidate media presence cache for the given sound. diff --git a/source/blender/sequencer/intern/animation.cc b/source/blender/sequencer/intern/animation.cc index b8958ccf6572..39720647afe8 100644 --- a/source/blender/sequencer/intern/animation.cc +++ b/source/blender/sequencer/intern/animation.cc @@ -35,13 +35,13 @@ bool SEQ_animation_drivers_exist(Scene *scene) return scene->adt != nullptr && !BLI_listbase_is_empty(&scene->adt->drivers); } -bool SEQ_fcurve_matches(const Strip &seq, const FCurve &fcurve) +bool SEQ_fcurve_matches(const Strip &strip, const FCurve &fcurve) { return animrig::fcurve_matches_collection_path( - fcurve, "sequence_editor.sequences_all[", seq.name + 2); + fcurve, "sequence_editor.sequences_all[", strip.name + 2); } -void SEQ_offset_animdata(Scene *scene, Strip *seq, int ofs) +void SEQ_offset_animdata(Scene *scene, Strip *strip, int ofs) { if (!SEQ_animation_keyframes_exist(scene) || ofs == 0) { return; @@ -49,7 +49,7 @@ void SEQ_offset_animdata(Scene *scene, Strip *seq, int ofs) Vector fcurves = animrig::fcurves_in_action_slot_filtered( scene->adt->action, scene->adt->slot_handle, [&](const FCurve &fcurve) { - return SEQ_fcurve_matches(*seq, fcurve); + return SEQ_fcurve_matches(*strip, fcurve); }); for (FCurve *fcu : fcurves) { @@ -73,7 +73,7 @@ void SEQ_offset_animdata(Scene *scene, Strip *seq, int ofs) DEG_id_tag_update(&scene->adt->action->id, ID_RECALC_ANIMATION); } -void SEQ_free_animdata(Scene *scene, Strip *seq) +void SEQ_free_animdata(Scene *scene, Strip *strip) { if (!SEQ_animation_keyframes_exist(scene)) { return; @@ -81,7 +81,7 @@ void SEQ_free_animdata(Scene *scene, Strip *seq) Vector fcurves = animrig::fcurves_in_action_slot_filtered( scene->adt->action, scene->adt->slot_handle, [&](const FCurve &fcurve) { - return SEQ_fcurve_matches(*seq, fcurve); + return SEQ_fcurve_matches(*strip, fcurve); }); animrig::Action &action = scene->adt->action->wrap(); @@ -142,16 +142,16 @@ void SEQ_animation_restore_original(Scene *scene, SeqAnimationBackup *backup) } /** - * Duplicate the animation in `src` that matches items in `seq` into `dst`. + * Duplicate the animation in `src` that matches items in `strip` into `dst`. */ -static void seq_animation_duplicate(Strip *seq, - animrig::Action &dst, - const animrig::slot_handle_t dst_slot_handle, - SeqAnimationBackup *src) +static void strip_animation_duplicate(Strip *strip, + animrig::Action &dst, + const animrig::slot_handle_t dst_slot_handle, + SeqAnimationBackup *src) { - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, meta_child, &seq->seqbase) { - seq_animation_duplicate(meta_child, dst, dst_slot_handle, src); + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, meta_child, &strip->seqbase) { + strip_animation_duplicate(meta_child, dst, dst_slot_handle, src); } } @@ -162,11 +162,11 @@ static void seq_animation_duplicate(Strip *seq, if (BLI_listbase_is_empty(&src->curves)) { fcurves = animrig::fcurves_in_span_filtered( src->channelbag.fcurves(), - [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*seq, fcurve); }); + [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*strip, fcurve); }); } else { fcurves = animrig::fcurves_in_listbase_filtered( - src->curves, [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*seq, fcurve); }); + src->curves, [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*strip, fcurve); }); } for (const FCurve *fcu : fcurves) { @@ -185,18 +185,18 @@ static void seq_animation_duplicate(Strip *seq, } /** - * Duplicate the drivers in `src` that matches items in `seq` into `dst`. + * Duplicate the drivers in `src` that matches items in `strip` into `dst`. */ -static void seq_drivers_duplicate(Strip *seq, AnimData *dst, SeqAnimationBackup *src) +static void strip_drivers_duplicate(Strip *strip, AnimData *dst, SeqAnimationBackup *src) { - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, meta_child, &seq->seqbase) { - seq_drivers_duplicate(meta_child, dst, src); + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, meta_child, &strip->seqbase) { + strip_drivers_duplicate(meta_child, dst, src); } } Vector fcurves = animrig::fcurves_in_listbase_filtered( - src->drivers, [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*seq, fcurve); }); + src->drivers, [&](const FCurve &fcurve) { return SEQ_fcurve_matches(*strip, fcurve); }); for (const FCurve *fcu : fcurves) { FCurve *fcu_cpy = BKE_fcurve_copy(fcu); @@ -204,18 +204,20 @@ static void seq_drivers_duplicate(Strip *seq, AnimData *dst, SeqAnimationBackup } } -void SEQ_animation_duplicate_backup_to_scene(Scene *scene, Strip *seq, SeqAnimationBackup *backup) +void SEQ_animation_duplicate_backup_to_scene(Scene *scene, + Strip *strip, + SeqAnimationBackup *backup) { BLI_assert(scene != nullptr); if (!BLI_listbase_is_empty(&backup->curves) || !backup->channelbag.fcurves().is_empty()) { BLI_assert(scene->adt != nullptr); BLI_assert(scene->adt->action != nullptr); - seq_animation_duplicate(seq, scene->adt->action->wrap(), scene->adt->slot_handle, backup); + strip_animation_duplicate(strip, scene->adt->action->wrap(), scene->adt->slot_handle, backup); } if (!BLI_listbase_is_empty(&backup->drivers)) { BLI_assert(scene->adt != nullptr); - seq_drivers_duplicate(seq, scene->adt, backup); + strip_drivers_duplicate(strip, scene->adt, backup); } } diff --git a/source/blender/sequencer/intern/channels.cc b/source/blender/sequencer/intern/channels.cc index 18b0dbc1ddc8..341bf3b46ed2 100644 --- a/source/blender/sequencer/intern/channels.cc +++ b/source/blender/sequencer/intern/channels.cc @@ -84,15 +84,15 @@ bool SEQ_channel_is_muted(const SeqTimelineChannel *channel) return (channel->flag & SEQ_CHANNEL_MUTE) != 0; } -ListBase *SEQ_get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *seq) +ListBase *SEQ_get_channels_by_seq(ListBase *seqbase, ListBase *channels, const Strip *strip) { ListBase *lb = nullptr; - LISTBASE_FOREACH (Strip *, iseq, seqbase) { - if (seq == iseq) { + LISTBASE_FOREACH (Strip *, istrip, seqbase) { + if (strip == istrip) { return channels; } - if ((lb = SEQ_get_channels_by_seq(&iseq->seqbase, &iseq->channels, seq))) { + if ((lb = SEQ_get_channels_by_seq(&istrip->seqbase, &istrip->channels, strip))) { return lb; } } diff --git a/source/blender/sequencer/intern/disk_cache.cc b/source/blender/sequencer/intern/disk_cache.cc index 5a9c49307a8d..fd855344a78f 100644 --- a/source/blender/sequencer/intern/disk_cache.cc +++ b/source/blender/sequencer/intern/disk_cache.cc @@ -276,7 +276,7 @@ static void seq_disk_cache_update_file(SeqDiskCache *disk_cache, const char *fil } /* Path format: - * /_seq_cache/-//DCACHE_FNAME_FORMAT + * /_seq_cache/-//DCACHE_FNAME_FORMAT */ static void seq_disk_cache_get_project_dir(SeqDiskCache *disk_cache, @@ -291,19 +291,19 @@ static void seq_disk_cache_get_project_dir(SeqDiskCache *disk_cache, } static void seq_disk_cache_get_dir( - SeqDiskCache *disk_cache, Scene *scene, Strip *seq, char *dirpath, size_t dirpath_maxncpy) + SeqDiskCache *disk_cache, Scene *scene, Strip *strip, char *dirpath, size_t dirpath_maxncpy) { char scene_name[MAX_ID_NAME + 22]; /* + -%PRId64 */ - char seq_name[SEQ_NAME_MAXSTR]; + char strip_name[STRIP_NAME_MAXSTR]; char project_dir[FILE_MAX]; seq_disk_cache_get_project_dir(disk_cache, project_dir, sizeof(project_dir)); SNPRINTF(scene_name, "%s-%" PRId64, scene->id.name, disk_cache->timestamp); - STRNCPY(seq_name, seq->name); + STRNCPY(strip_name, strip->name); BLI_path_make_safe_filename(scene_name); - BLI_path_make_safe_filename(seq_name); + BLI_path_make_safe_filename(strip_name); - BLI_path_join(dirpath, dirpath_maxncpy, project_dir, scene_name, seq_name); + BLI_path_join(dirpath, dirpath_maxncpy, project_dir, scene_name, strip_name); } static void seq_disk_cache_get_file_path(SeqDiskCache *disk_cache, @@ -311,7 +311,7 @@ static void seq_disk_cache_get_file_path(SeqDiskCache *disk_cache, char *filepath, size_t filepath_maxncpy) { - seq_disk_cache_get_dir(disk_cache, key->context.scene, key->seq, filepath, filepath_maxncpy); + seq_disk_cache_get_dir(disk_cache, key->context.scene, key->strip, filepath, filepath_maxncpy); int frameno = int(key->frame_index) / DCACHE_IMAGES_PER_FILE; char cache_filename[FILE_MAXFILE]; SNPRINTF(cache_filename, @@ -369,14 +369,14 @@ static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache) static void seq_disk_cache_delete_invalid_files(SeqDiskCache *disk_cache, Scene *scene, - Strip *seq, + Strip *strip, int invalidate_types, int range_start, int range_end) { DiskCacheFile *next_file, *cache_file = static_cast(disk_cache->files.first); char cache_dir[FILE_MAX]; - seq_disk_cache_get_dir(disk_cache, scene, seq, cache_dir, sizeof(cache_dir)); + seq_disk_cache_get_dir(disk_cache, scene, strip, cache_dir, sizeof(cache_dir)); BLI_path_slash_ensure(cache_dir, sizeof(cache_dir)); while (cache_file) { @@ -384,7 +384,7 @@ static void seq_disk_cache_delete_invalid_files(SeqDiskCache *disk_cache, if (cache_file->cache_type & invalidate_types) { if (STREQ(cache_dir, cache_file->dir)) { int timeline_frame_start = seq_cache_frame_index_to_timeline_frame( - seq, cache_file->start_frame); + strip, cache_file->start_frame); if (timeline_frame_start > range_start && timeline_frame_start <= range_end) { seq_disk_cache_delete_file(disk_cache, cache_file); } @@ -394,18 +394,21 @@ static void seq_disk_cache_delete_invalid_files(SeqDiskCache *disk_cache, } } -void seq_disk_cache_invalidate( - SeqDiskCache *disk_cache, Scene *scene, Strip *seq, Strip *seq_changed, int invalidate_types) +void seq_disk_cache_invalidate(SeqDiskCache *disk_cache, + Scene *scene, + Strip *strip, + Strip *strip_changed, + int invalidate_types) { int start; int end; BLI_mutex_lock(&disk_cache->read_write_mutex); - start = SEQ_time_left_handle_frame_get(scene, seq_changed) - DCACHE_IMAGES_PER_FILE; - end = SEQ_time_right_handle_frame_get(scene, seq_changed); + start = SEQ_time_left_handle_frame_get(scene, strip_changed) - DCACHE_IMAGES_PER_FILE; + end = SEQ_time_right_handle_frame_get(scene, strip_changed); - seq_disk_cache_delete_invalid_files(disk_cache, scene, seq, invalidate_types, start, end); + seq_disk_cache_delete_invalid_files(disk_cache, scene, strip, invalidate_types, start, end); BLI_mutex_unlock(&disk_cache->read_write_mutex); } diff --git a/source/blender/sequencer/intern/disk_cache.hh b/source/blender/sequencer/intern/disk_cache.hh index 8cc97b97a524..0f092aa86059 100644 --- a/source/blender/sequencer/intern/disk_cache.hh +++ b/source/blender/sequencer/intern/disk_cache.hh @@ -25,5 +25,8 @@ bool seq_disk_cache_is_enabled(Main *bmain); ImBuf *seq_disk_cache_read_file(SeqDiskCache *disk_cache, SeqCacheKey *key); bool seq_disk_cache_write_file(SeqDiskCache *disk_cache, SeqCacheKey *key, ImBuf *ibuf); bool seq_disk_cache_enforce_limits(SeqDiskCache *disk_cache); -void seq_disk_cache_invalidate( - SeqDiskCache *disk_cache, Scene *scene, Strip *seq, Strip *seq_changed, int invalidate_types); +void seq_disk_cache_invalidate(SeqDiskCache *disk_cache, + Scene *scene, + Strip *strip, + Strip *strip_changed, + int invalidate_types); diff --git a/source/blender/sequencer/intern/effects/effects.cc b/source/blender/sequencer/intern/effects/effects.cc index 08129172a986..0794ed4fbfa8 100644 --- a/source/blender/sequencer/intern/effects/effects.cc +++ b/source/blender/sequencer/intern/effects/effects.cc @@ -100,23 +100,23 @@ Array make_gaussian_blur_kernel(float rad, int size) return gaussian; } -static void init_noop(Strip * /*seq*/) {} +static void init_noop(Strip * /*strip*/) {} -static void load_noop(Strip * /*seq*/) {} +static void load_noop(Strip * /*strip*/) {} -static void free_noop(Strip * /*seq*/, const bool /*do_id_user*/) {} +static void free_noop(Strip * /*strip*/, const bool /*do_id_user*/) {} static int num_inputs_default() { return 2; } -static StripEarlyOut early_out_noop(const Strip * /*seq*/, float /*fac*/) +static StripEarlyOut early_out_noop(const Strip * /*strip*/, float /*fac*/) { return StripEarlyOut::DoEffect; } -StripEarlyOut early_out_fade(const Strip * /*seq*/, float fac) +StripEarlyOut early_out_fade(const Strip * /*strip*/, float fac) { if (fac == 0.0f) { return StripEarlyOut::UseInput1; @@ -127,7 +127,7 @@ StripEarlyOut early_out_fade(const Strip * /*seq*/, float fac) return StripEarlyOut::DoEffect; } -StripEarlyOut early_out_mul_input2(const Strip * /*seq*/, float fac) +StripEarlyOut early_out_mul_input2(const Strip * /*strip*/, float fac) { if (fac == 0.0f) { return StripEarlyOut::UseInput1; @@ -135,7 +135,7 @@ StripEarlyOut early_out_mul_input2(const Strip * /*seq*/, float fac) return StripEarlyOut::DoEffect; } -StripEarlyOut early_out_mul_input1(const Strip * /*seq*/, float fac) +StripEarlyOut early_out_mul_input1(const Strip * /*strip*/, float fac) { if (fac == 0.0f) { return StripEarlyOut::UseInput2; @@ -144,24 +144,23 @@ StripEarlyOut early_out_mul_input1(const Strip * /*seq*/, float fac) } static void get_default_fac_noop(const Scene * /*scene*/, - const Strip * /*seq*/, + const Strip * /*strip*/, float /*timeline_frame*/, float *fac) { *fac = 1.0f; } -void get_default_fac_fade(const Scene *scene, const Strip *seq, float timeline_frame, float *fac) +void get_default_fac_fade(const Scene *scene, const Strip *strip, float timeline_frame, float *fac) { - *fac = float(timeline_frame - SEQ_time_left_handle_frame_get(scene, seq)); - *fac /= SEQ_time_strip_length_get(scene, seq); + *fac = float(timeline_frame - SEQ_time_left_handle_frame_get(scene, strip)); + *fac /= SEQ_time_strip_length_get(scene, strip); *fac = math::clamp(*fac, 0.0f, 1.0f); } -SeqEffectHandle get_sequence_effect_impl(int seq_type) +SeqEffectHandle get_sequence_effect_impl(int strip_type) { SeqEffectHandle rval; - int sequence_type = seq_type; rval.init = init_noop; rval.num_inputs = num_inputs_default; @@ -172,79 +171,79 @@ SeqEffectHandle get_sequence_effect_impl(int seq_type) rval.execute = nullptr; rval.copy = nullptr; - switch (sequence_type) { - case SEQ_TYPE_CROSS: + switch (strip_type) { + case STRIP_TYPE_CROSS: cross_effect_get_handle(rval); break; - case SEQ_TYPE_GAMCROSS: + case STRIP_TYPE_GAMCROSS: gamma_cross_effect_get_handle(rval); break; - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: add_effect_get_handle(rval); break; - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: sub_effect_get_handle(rval); break; - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: mul_effect_get_handle(rval); break; - case SEQ_TYPE_SCREEN: - case SEQ_TYPE_OVERLAY: - case SEQ_TYPE_COLOR_BURN: - case SEQ_TYPE_LINEAR_BURN: - case SEQ_TYPE_DARKEN: - case SEQ_TYPE_LIGHTEN: - case SEQ_TYPE_DODGE: - case SEQ_TYPE_SOFT_LIGHT: - case SEQ_TYPE_HARD_LIGHT: - case SEQ_TYPE_PIN_LIGHT: - case SEQ_TYPE_LIN_LIGHT: - case SEQ_TYPE_VIVID_LIGHT: - case SEQ_TYPE_BLEND_COLOR: - case SEQ_TYPE_HUE: - case SEQ_TYPE_SATURATION: - case SEQ_TYPE_VALUE: - case SEQ_TYPE_DIFFERENCE: - case SEQ_TYPE_EXCLUSION: + case STRIP_TYPE_SCREEN: + case STRIP_TYPE_OVERLAY: + case STRIP_TYPE_COLOR_BURN: + case STRIP_TYPE_LINEAR_BURN: + case STRIP_TYPE_DARKEN: + case STRIP_TYPE_LIGHTEN: + case STRIP_TYPE_DODGE: + case STRIP_TYPE_SOFT_LIGHT: + case STRIP_TYPE_HARD_LIGHT: + case STRIP_TYPE_PIN_LIGHT: + case STRIP_TYPE_LIN_LIGHT: + case STRIP_TYPE_VIVID_LIGHT: + case STRIP_TYPE_BLEND_COLOR: + case STRIP_TYPE_HUE: + case STRIP_TYPE_SATURATION: + case STRIP_TYPE_VALUE: + case STRIP_TYPE_DIFFERENCE: + case STRIP_TYPE_EXCLUSION: blend_mode_effect_get_handle(rval); break; - case SEQ_TYPE_COLORMIX: + case STRIP_TYPE_COLORMIX: color_mix_effect_get_handle(rval); break; - case SEQ_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAOVER: alpha_over_effect_get_handle(rval); break; - case SEQ_TYPE_OVERDROP: + case STRIP_TYPE_OVERDROP: over_drop_effect_get_handle(rval); break; - case SEQ_TYPE_ALPHAUNDER: + case STRIP_TYPE_ALPHAUNDER: alpha_under_effect_get_handle(rval); break; - case SEQ_TYPE_WIPE: + case STRIP_TYPE_WIPE: wipe_effect_get_handle(rval); break; - case SEQ_TYPE_GLOW: + case STRIP_TYPE_GLOW: glow_effect_get_handle(rval); break; - case SEQ_TYPE_TRANSFORM: + case STRIP_TYPE_TRANSFORM: transform_effect_get_handle(rval); break; - case SEQ_TYPE_SPEED: + case STRIP_TYPE_SPEED: speed_effect_get_handle(rval); break; - case SEQ_TYPE_COLOR: + case STRIP_TYPE_COLOR: solid_color_effect_get_handle(rval); break; - case SEQ_TYPE_MULTICAM: + case STRIP_TYPE_MULTICAM: multi_camera_effect_get_handle(rval); break; - case SEQ_TYPE_ADJUSTMENT: + case STRIP_TYPE_ADJUSTMENT: adjustment_effect_get_handle(rval); break; - case SEQ_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_GAUSSIAN_BLUR: gaussian_blur_effect_get_handle(rval); break; - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: text_effect_get_handle(rval); break; } @@ -252,46 +251,46 @@ SeqEffectHandle get_sequence_effect_impl(int seq_type) return rval; } -SeqEffectHandle SEQ_effect_handle_get(Strip *seq) +SeqEffectHandle SEQ_effect_handle_get(Strip *strip) { SeqEffectHandle rval = {}; - if (seq->type & SEQ_TYPE_EFFECT) { - rval = get_sequence_effect_impl(seq->type); - if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) { - rval.load(seq); - seq->flag &= ~SEQ_EFFECT_NOT_LOADED; + if (strip->type & STRIP_TYPE_EFFECT) { + rval = get_sequence_effect_impl(strip->type); + if ((strip->flag & SEQ_EFFECT_NOT_LOADED) != 0) { + rval.load(strip); + strip->flag &= ~SEQ_EFFECT_NOT_LOADED; } } return rval; } -SeqEffectHandle seq_effect_get_sequence_blend(Strip *seq) +SeqEffectHandle strip_effect_get_sequence_blend(Strip *strip) { SeqEffectHandle rval = {}; - if (seq->blend_mode != 0) { - if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) { + if (strip->blend_mode != 0) { + if ((strip->flag & SEQ_EFFECT_NOT_LOADED) != 0) { /* load the effect first */ - rval = get_sequence_effect_impl(seq->type); - rval.load(seq); + rval = get_sequence_effect_impl(strip->type); + rval.load(strip); } - rval = get_sequence_effect_impl(seq->blend_mode); - if ((seq->flag & SEQ_EFFECT_NOT_LOADED) != 0) { + rval = get_sequence_effect_impl(strip->blend_mode); + if ((strip->flag & SEQ_EFFECT_NOT_LOADED) != 0) { /* now load the blend and unset unloaded flag */ - rval.load(seq); - seq->flag &= ~SEQ_EFFECT_NOT_LOADED; + rval.load(strip); + strip->flag &= ~SEQ_EFFECT_NOT_LOADED; } } return rval; } -int SEQ_effect_get_num_inputs(int seq_type) +int SEQ_effect_get_num_inputs(int strip_type) { - SeqEffectHandle rval = get_sequence_effect_impl(seq_type); + SeqEffectHandle rval = get_sequence_effect_impl(strip_type); int count = rval.num_inputs(); if (rval.execute) { diff --git a/source/blender/sequencer/intern/effects/effects.hh b/source/blender/sequencer/intern/effects/effects.hh index 2d7d2a098996..2315fae74ef4 100644 --- a/source/blender/sequencer/intern/effects/effects.hh +++ b/source/blender/sequencer/intern/effects/effects.hh @@ -19,19 +19,19 @@ struct ImBuf; struct Scene; struct Strip; -SeqEffectHandle seq_effect_get_sequence_blend(Strip *seq); +SeqEffectHandle strip_effect_get_sequence_blend(Strip *strip); /** * Build frame map when speed in mode #SEQ_SPEED_MULTIPLY is animated. * This is, because `target_frame` value is integrated over time. */ -void seq_effect_speed_rebuild_map(Scene *scene, Strip *seq); +void strip_effect_speed_rebuild_map(Scene *scene, Strip *strip); /** * Override timeline_frame when rendering speed effect input. */ -float seq_speed_effect_target_frame_get(Scene *scene, - Strip *seq_speed, - float timeline_frame, - int input); +float strip_speed_effect_target_frame_get(Scene *scene, + Strip *strip_speed, + float timeline_frame, + int input); ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1, @@ -81,9 +81,12 @@ inline void store_opaque_black_pixel(float *dst) StripEarlyOut early_out_mul_input1(const Strip * /*seq*/, float fac); StripEarlyOut early_out_mul_input2(const Strip * /*seq*/, float fac); StripEarlyOut early_out_fade(const Strip * /*seq*/, float fac); -void get_default_fac_fade(const Scene *scene, const Strip *seq, float timeline_frame, float *fac); +void get_default_fac_fade(const Scene *scene, + const Strip *strip, + float timeline_frame, + float *fac); -SeqEffectHandle get_sequence_effect_impl(int seq_type); +SeqEffectHandle get_sequence_effect_impl(int strip_type); void add_effect_get_handle(SeqEffectHandle &rval); void adjustment_effect_get_handle(SeqEffectHandle &rval); diff --git a/source/blender/sequencer/intern/effects/vse_effect_adjustment.cc b/source/blender/sequencer/intern/effects/vse_effect_adjustment.cc index 4e558eaf75f5..434a154399ef 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_adjustment.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_adjustment.cc @@ -23,31 +23,31 @@ static int num_inputs_adjustment() return 0; } -static StripEarlyOut early_out_adjustment(const Strip * /*seq*/, float /*fac*/) +static StripEarlyOut early_out_adjustment(const Strip * /*strip*/, float /*fac*/) { return StripEarlyOut::NoInput; } -static ImBuf *do_adjustment_impl(const SeqRenderData *context, Strip *seq, float timeline_frame) +static ImBuf *do_adjustment_impl(const SeqRenderData *context, Strip *strip, float timeline_frame) { Editing *ed; ImBuf *i = nullptr; ed = context->scene->ed; - ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, seq); - ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, seq); + ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, strip); + ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, strip); /* Clamp timeline_frame to strip range so it behaves as if it had "still frame" offset (last * frame is static after end of strip). This is how most strips behave. This way transition * effects that doesn't overlap or speed effect can't fail rendering outside of strip range. */ timeline_frame = clamp_i(timeline_frame, - SEQ_time_left_handle_frame_get(context->scene, seq), - SEQ_time_right_handle_frame_get(context->scene, seq) - 1); + SEQ_time_left_handle_frame_get(context->scene, strip), + SEQ_time_right_handle_frame_get(context->scene, strip) - 1); - if (seq->machine > 1) { + if (strip->machine > 1) { i = seq_render_give_ibuf_seqbase( - context, timeline_frame, seq->machine - 1, channels, seqbasep); + context, timeline_frame, strip->machine - 1, channels, seqbasep); } /* Found nothing? so let's work the way up the meta-strip stack, so @@ -57,7 +57,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Strip *seq, float if (!i) { Strip *meta; - meta = SEQ_find_metastrip_by_sequence(&ed->seqbase, nullptr, seq); + meta = SEQ_find_metastrip_by_sequence(&ed->seqbase, nullptr, strip); if (meta) { i = do_adjustment_impl(context, meta, timeline_frame); @@ -68,7 +68,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Strip *seq, float } static ImBuf *do_adjustment(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, float /*fac*/, ImBuf * /*ibuf1*/, @@ -83,7 +83,7 @@ static ImBuf *do_adjustment(const SeqRenderData *context, return nullptr; } - out = do_adjustment_impl(context, seq, timeline_frame); + out = do_adjustment_impl(context, strip, timeline_frame); return out; } diff --git a/source/blender/sequencer/intern/effects/vse_effect_blend.cc b/source/blender/sequencer/intern/effects/vse_effect_blend.cc index feaca0971391..541a61b1c4b9 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_blend.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_blend.cc @@ -22,13 +22,13 @@ using namespace blender; /* -------------------------------------------------------------------- */ /* Alpha Over Effect */ -static void init_alpha_over_or_under(Strip *seq) +static void init_alpha_over_or_under(Strip *strip) { - Strip *seq1 = seq->seq1; - Strip *seq2 = seq->seq2; + Strip *seq1 = strip->seq1; + Strip *seq2 = strip->seq2; - seq->seq2 = seq1; - seq->seq1 = seq2; + strip->seq2 = seq1; + strip->seq1 = seq2; } static bool alpha_opaque(uchar alpha) @@ -77,7 +77,7 @@ struct AlphaOverEffectOp { }; static ImBuf *do_alphaover_effect(const SeqRenderData *context, - Strip * /*seq*/, + Strip * /*strip*/, float /*timeline_frame*/, float fac, ImBuf *src1, @@ -126,7 +126,7 @@ struct AlphaUnderEffectOp { }; static ImBuf *do_alphaunder_effect(const SeqRenderData *context, - Strip * /*seq*/, + Strip * /*strip*/, float /*timeline_frame*/, float fac, ImBuf *src1, @@ -163,67 +163,67 @@ static void do_blend_effect_float( float fac, int64_t size, const float *rect1, const float *rect2, int btype, float *out) { switch (btype) { - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: apply_blend_function(fac, size, rect1, rect2, out, blend_color_add_float); break; - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: apply_blend_function(fac, size, rect1, rect2, out, blend_color_sub_float); break; - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: apply_blend_function(fac, size, rect1, rect2, out, blend_color_mul_float); break; - case SEQ_TYPE_DARKEN: + case STRIP_TYPE_DARKEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_darken_float); break; - case SEQ_TYPE_COLOR_BURN: + case STRIP_TYPE_COLOR_BURN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_burn_float); break; - case SEQ_TYPE_LINEAR_BURN: + case STRIP_TYPE_LINEAR_BURN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_linearburn_float); break; - case SEQ_TYPE_SCREEN: + case STRIP_TYPE_SCREEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_screen_float); break; - case SEQ_TYPE_LIGHTEN: + case STRIP_TYPE_LIGHTEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_lighten_float); break; - case SEQ_TYPE_DODGE: + case STRIP_TYPE_DODGE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_dodge_float); break; - case SEQ_TYPE_OVERLAY: + case STRIP_TYPE_OVERLAY: apply_blend_function(fac, size, rect1, rect2, out, blend_color_overlay_float); break; - case SEQ_TYPE_SOFT_LIGHT: + case STRIP_TYPE_SOFT_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_softlight_float); break; - case SEQ_TYPE_HARD_LIGHT: + case STRIP_TYPE_HARD_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_hardlight_float); break; - case SEQ_TYPE_PIN_LIGHT: + case STRIP_TYPE_PIN_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_pinlight_float); break; - case SEQ_TYPE_LIN_LIGHT: + case STRIP_TYPE_LIN_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_linearlight_float); break; - case SEQ_TYPE_VIVID_LIGHT: + case STRIP_TYPE_VIVID_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_vividlight_float); break; - case SEQ_TYPE_BLEND_COLOR: + case STRIP_TYPE_BLEND_COLOR: apply_blend_function(fac, size, rect1, rect2, out, blend_color_color_float); break; - case SEQ_TYPE_HUE: + case STRIP_TYPE_HUE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_hue_float); break; - case SEQ_TYPE_SATURATION: + case STRIP_TYPE_SATURATION: apply_blend_function(fac, size, rect1, rect2, out, blend_color_saturation_float); break; - case SEQ_TYPE_VALUE: + case STRIP_TYPE_VALUE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_luminosity_float); break; - case SEQ_TYPE_DIFFERENCE: + case STRIP_TYPE_DIFFERENCE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_difference_float); break; - case SEQ_TYPE_EXCLUSION: + case STRIP_TYPE_EXCLUSION: apply_blend_function(fac, size, rect1, rect2, out, blend_color_exclusion_float); break; default: @@ -235,67 +235,67 @@ static void do_blend_effect_byte( float fac, int64_t size, const uchar *rect1, const uchar *rect2, int btype, uchar *out) { switch (btype) { - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: apply_blend_function(fac, size, rect1, rect2, out, blend_color_add_byte); break; - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: apply_blend_function(fac, size, rect1, rect2, out, blend_color_sub_byte); break; - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: apply_blend_function(fac, size, rect1, rect2, out, blend_color_mul_byte); break; - case SEQ_TYPE_DARKEN: + case STRIP_TYPE_DARKEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_darken_byte); break; - case SEQ_TYPE_COLOR_BURN: + case STRIP_TYPE_COLOR_BURN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_burn_byte); break; - case SEQ_TYPE_LINEAR_BURN: + case STRIP_TYPE_LINEAR_BURN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_linearburn_byte); break; - case SEQ_TYPE_SCREEN: + case STRIP_TYPE_SCREEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_screen_byte); break; - case SEQ_TYPE_LIGHTEN: + case STRIP_TYPE_LIGHTEN: apply_blend_function(fac, size, rect1, rect2, out, blend_color_lighten_byte); break; - case SEQ_TYPE_DODGE: + case STRIP_TYPE_DODGE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_dodge_byte); break; - case SEQ_TYPE_OVERLAY: + case STRIP_TYPE_OVERLAY: apply_blend_function(fac, size, rect1, rect2, out, blend_color_overlay_byte); break; - case SEQ_TYPE_SOFT_LIGHT: + case STRIP_TYPE_SOFT_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_softlight_byte); break; - case SEQ_TYPE_HARD_LIGHT: + case STRIP_TYPE_HARD_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_hardlight_byte); break; - case SEQ_TYPE_PIN_LIGHT: + case STRIP_TYPE_PIN_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_pinlight_byte); break; - case SEQ_TYPE_LIN_LIGHT: + case STRIP_TYPE_LIN_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_linearlight_byte); break; - case SEQ_TYPE_VIVID_LIGHT: + case STRIP_TYPE_VIVID_LIGHT: apply_blend_function(fac, size, rect1, rect2, out, blend_color_vividlight_byte); break; - case SEQ_TYPE_BLEND_COLOR: + case STRIP_TYPE_BLEND_COLOR: apply_blend_function(fac, size, rect1, rect2, out, blend_color_color_byte); break; - case SEQ_TYPE_HUE: + case STRIP_TYPE_HUE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_hue_byte); break; - case SEQ_TYPE_SATURATION: + case STRIP_TYPE_SATURATION: apply_blend_function(fac, size, rect1, rect2, out, blend_color_saturation_byte); break; - case SEQ_TYPE_VALUE: + case STRIP_TYPE_VALUE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_luminosity_byte); break; - case SEQ_TYPE_DIFFERENCE: + case STRIP_TYPE_DIFFERENCE: apply_blend_function(fac, size, rect1, rect2, out, blend_color_difference_byte); break; - case SEQ_TYPE_EXCLUSION: + case STRIP_TYPE_EXCLUSION: apply_blend_function(fac, size, rect1, rect2, out, blend_color_exclusion_byte); break; default: @@ -313,12 +313,12 @@ struct BlendModeEffectOp { do_blend_effect_byte(this->factor, size, src1, src2, this->blend_mode, dst); } } - int blend_mode; /* SEQ_TYPE_ */ + int blend_mode; /* STRIP_TYPE_ */ float factor; }; static ImBuf *do_blend_mode_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float fac, ImBuf *src1, @@ -327,7 +327,7 @@ static ImBuf *do_blend_mode_effect(const SeqRenderData *context, ImBuf *dst = prepare_effect_imbufs(context, src1, src2); BlendModeEffectOp op; op.factor = fac; - op.blend_mode = seq->blend_mode; + op.blend_mode = strip->blend_mode; apply_effect_op(op, src1, src2, dst); return dst; } @@ -335,26 +335,26 @@ static ImBuf *do_blend_mode_effect(const SeqRenderData *context, /* -------------------------------------------------------------------- */ /* Color Mix Effect */ -static void init_colormix_effect(Strip *seq) +static void init_colormix_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(ColorMixVars), "colormixvars"); - ColorMixVars *data = (ColorMixVars *)seq->effectdata; - data->blend_effect = SEQ_TYPE_OVERLAY; + strip->effectdata = MEM_callocN(sizeof(ColorMixVars), "colormixvars"); + ColorMixVars *data = (ColorMixVars *)strip->effectdata; + data->blend_effect = STRIP_TYPE_OVERLAY; data->factor = 1.0f; } static ImBuf *do_colormix_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float /*fac*/, ImBuf *src1, ImBuf *src2) { ImBuf *dst = prepare_effect_imbufs(context, src1, src2); - const ColorMixVars *data = static_cast(seq->effectdata); + const ColorMixVars *data = static_cast(strip->effectdata); BlendModeEffectOp op; op.blend_mode = data->blend_effect; op.factor = data->factor; @@ -371,13 +371,13 @@ static ImBuf *do_colormix_effect(const SeqRenderData *context, * inputs and thus the effect "fade" factor controlling the other input. */ static ImBuf *do_overdrop_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, float fac, ImBuf *src1, ImBuf *src2) { - return do_alphaover_effect(context, seq, timeline_frame, fac, src1, src2); + return do_alphaover_effect(context, strip, timeline_frame, fac, src1, src2); } static void copy_effect_default(Strip *dst, const Strip *src, const int /*flag*/) @@ -385,9 +385,9 @@ static void copy_effect_default(Strip *dst, const Strip *src, const int /*flag*/ dst->effectdata = MEM_dupallocN(src->effectdata); } -static void free_effect_default(Strip *seq, const bool /*do_id_user*/) +static void free_effect_default(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } void blend_mode_effect_get_handle(SeqEffectHandle &rval) diff --git a/source/blender/sequencer/intern/effects/vse_effect_gaussian_blur.cc b/source/blender/sequencer/intern/effects/vse_effect_gaussian_blur.cc index 685cadd84595..087c91e6afb5 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_gaussian_blur.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_gaussian_blur.cc @@ -19,13 +19,13 @@ using namespace blender; -static void init_gaussian_blur_effect(Strip *seq) +static void init_gaussian_blur_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(GaussianBlurVars), "gaussianblurvars"); + strip->effectdata = MEM_callocN(sizeof(GaussianBlurVars), "gaussianblurvars"); } static int num_inputs_gaussian_blur() @@ -33,9 +33,9 @@ static int num_inputs_gaussian_blur() return 1; } -static void free_gaussian_blur_effect(Strip *seq, const bool /*do_id_user*/) +static void free_gaussian_blur_effect(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_gaussian_blur_effect(Strip *dst, const Strip *src, const int /*flag*/) @@ -43,9 +43,9 @@ static void copy_gaussian_blur_effect(Strip *dst, const Strip *src, const int /* dst->effectdata = MEM_dupallocN(src->effectdata); } -static StripEarlyOut early_out_gaussian_blur(const Strip *seq, float /*fac*/) +static StripEarlyOut early_out_gaussian_blur(const Strip *strip, float /*fac*/) { - GaussianBlurVars *data = static_cast(seq->effectdata); + GaussianBlurVars *data = static_cast(strip->effectdata); if (data->size_x == 0.0f && data->size_y == 0) { return StripEarlyOut::UseInput1; } @@ -136,7 +136,7 @@ static void gaussian_blur_y(const Span gaussian, } static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float /*fac*/, ImBuf *ibuf1, @@ -145,7 +145,7 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context, using namespace blender; /* Create blur kernel weights. */ - const GaussianBlurVars *data = static_cast(seq->effectdata); + const GaussianBlurVars *data = static_cast(strip->effectdata); const int half_size_x = int(data->size_x + 0.5f); const int half_size_y = int(data->size_y + 0.5f); Array gaussian_x = make_gaussian_blur_kernel(data->size_x, half_size_x); diff --git a/source/blender/sequencer/intern/effects/vse_effect_glow.cc b/source/blender/sequencer/intern/effects/vse_effect_glow.cc index ea78d11c7ca3..ec1a9883044e 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_glow.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_glow.cc @@ -124,15 +124,15 @@ static void blur_isolate_highlights(const float4 *in, }); } -static void init_glow_effect(Strip *seq) +static void init_glow_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(GlowVars), "glowvars"); + strip->effectdata = MEM_callocN(sizeof(GlowVars), "glowvars"); - GlowVars *glow = (GlowVars *)seq->effectdata; + GlowVars *glow = (GlowVars *)strip->effectdata; glow->fMini = 0.25; glow->fClamp = 1.0; glow->fBoost = 0.5; @@ -146,9 +146,9 @@ static int num_inputs_glow() return 1; } -static void free_glow_effect(Strip *seq, const bool /*do_id_user*/) +static void free_glow_effect(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_glow_effect(Strip *dst, const Strip *src, const int /*flag*/) @@ -156,7 +156,7 @@ static void copy_glow_effect(Strip *dst, const Strip *src, const int /*flag*/) dst->effectdata = MEM_dupallocN(src->effectdata); } -static void do_glow_effect_byte(Strip *seq, +static void do_glow_effect_byte(Strip *strip, int render_size, float fac, int x, @@ -166,7 +166,7 @@ static void do_glow_effect_byte(Strip *seq, uchar *out) { using namespace blender; - GlowVars *glow = (GlowVars *)seq->effectdata; + GlowVars *glow = (GlowVars *)strip->effectdata; Array inbuf(x * y); Array outbuf(x * y); @@ -199,7 +199,7 @@ static void do_glow_effect_byte(Strip *seq, }); } -static void do_glow_effect_float(Strip *seq, +static void do_glow_effect_float(Strip *strip, int render_size, float fac, int x, @@ -211,7 +211,7 @@ static void do_glow_effect_float(Strip *seq, using namespace blender; float4 *outbuf = reinterpret_cast(out); float4 *inbuf = reinterpret_cast(rect1); - GlowVars *glow = (GlowVars *)seq->effectdata; + GlowVars *glow = (GlowVars *)strip->effectdata; blur_isolate_highlights( inbuf, outbuf, x, y, glow->fMini * 3.0f, glow->fBoost * fac, glow->fClamp); @@ -224,7 +224,7 @@ static void do_glow_effect_float(Strip *seq, } static ImBuf *do_glow_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float fac, ImBuf *ibuf1, @@ -235,7 +235,7 @@ static ImBuf *do_glow_effect(const SeqRenderData *context, int render_size = 100 * context->rectx / context->scene->r.xsch; if (out->float_buffer.data) { - do_glow_effect_float(seq, + do_glow_effect_float(strip, render_size, fac, context->rectx, @@ -245,7 +245,7 @@ static ImBuf *do_glow_effect(const SeqRenderData *context, out->float_buffer.data); } else { - do_glow_effect_byte(seq, + do_glow_effect_byte(strip, render_size, fac, context->rectx, diff --git a/source/blender/sequencer/intern/effects/vse_effect_multi_camera.cc b/source/blender/sequencer/intern/effects/vse_effect_multi_camera.cc index 06df19c02a3f..951e5b7826aa 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_multi_camera.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_multi_camera.cc @@ -22,13 +22,13 @@ static int num_inputs_multicam() return 0; } -static StripEarlyOut early_out_multicam(const Strip * /*seq*/, float /*fac*/) +static StripEarlyOut early_out_multicam(const Strip * /*strip*/, float /*fac*/) { return StripEarlyOut::NoInput; } static ImBuf *do_multicam(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, float /*fac*/, ImBuf * /*ibuf1*/, @@ -37,7 +37,7 @@ static ImBuf *do_multicam(const SeqRenderData *context, ImBuf *out; Editing *ed; - if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) { + if (strip->multicam_source == 0 || strip->multicam_source >= strip->machine) { return nullptr; } @@ -45,14 +45,14 @@ static ImBuf *do_multicam(const SeqRenderData *context, if (!ed) { return nullptr; } - ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, seq); - ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, seq); + ListBase *seqbasep = SEQ_get_seqbase_by_seq(context->scene, strip); + ListBase *channels = SEQ_get_channels_by_seq(&ed->seqbase, &ed->channels, strip); if (!seqbasep) { return nullptr; } out = seq_render_give_ibuf_seqbase( - context, timeline_frame, seq->multicam_source, channels, seqbasep); + context, timeline_frame, strip->multicam_source, channels, seqbasep); return out; } diff --git a/source/blender/sequencer/intern/effects/vse_effect_solid_color.cc b/source/blender/sequencer/intern/effects/vse_effect_solid_color.cc index de62e484420e..b41b9b47ad97 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_solid_color.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_solid_color.cc @@ -17,15 +17,15 @@ using namespace blender; -static void init_solid_color(Strip *seq) +static void init_solid_color(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(SolidColorVars), "solidcolor"); + strip->effectdata = MEM_callocN(sizeof(SolidColorVars), "solidcolor"); - SolidColorVars *cv = (SolidColorVars *)seq->effectdata; + SolidColorVars *cv = (SolidColorVars *)strip->effectdata; cv->col[0] = cv->col[1] = cv->col[2] = 0.5; } @@ -34,9 +34,9 @@ static int num_inputs_color() return 0; } -static void free_solid_color(Strip *seq, const bool /*do_id_user*/) +static void free_solid_color(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_solid_color(Strip *dst, const Strip *src, const int /*flag*/) @@ -44,13 +44,13 @@ static void copy_solid_color(Strip *dst, const Strip *src, const int /*flag*/) dst->effectdata = MEM_dupallocN(src->effectdata); } -static StripEarlyOut early_out_color(const Strip * /*seq*/, float /*fac*/) +static StripEarlyOut early_out_color(const Strip * /*strip*/, float /*fac*/) { return StripEarlyOut::NoInput; } static ImBuf *do_solid_color(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float /*fac*/, ImBuf *ibuf1, @@ -59,7 +59,7 @@ static ImBuf *do_solid_color(const SeqRenderData *context, using namespace blender; ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2); - SolidColorVars *cv = (SolidColorVars *)seq->effectdata; + SolidColorVars *cv = (SolidColorVars *)strip->effectdata; threading::parallel_for(IndexRange(out->y), 64, [&](const IndexRange y_range) { if (out->byte_buffer.data) { diff --git a/source/blender/sequencer/intern/effects/vse_effect_speed.cc b/source/blender/sequencer/intern/effects/vse_effect_speed.cc index 61da453d4db5..9a40a3a0611a 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_speed.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_speed.cc @@ -21,24 +21,24 @@ #include "effects.hh" #include "render.hh" -static void init_speed_effect(Strip *seq) +static void init_speed_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(SpeedControlVars), "speedcontrolvars"); + strip->effectdata = MEM_callocN(sizeof(SpeedControlVars), "speedcontrolvars"); - SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; v->speed_control_type = SEQ_SPEED_STRETCH; v->speed_fader = 1.0f; v->speed_fader_length = 0.0f; v->speed_fader_frame_number = 0.0f; } -static void load_speed_effect(Strip *seq) +static void load_speed_effect(Strip *strip) { - SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; v->frameMap = nullptr; } @@ -47,13 +47,13 @@ static int num_inputs_speed() return 1; } -static void free_speed_effect(Strip *seq, const bool /*do_id_user*/) +static void free_speed_effect(Strip *strip, const bool /*do_id_user*/) { - SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; if (v->frameMap) { MEM_freeN(v->frameMap); } - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_speed_effect(Strip *dst, const Strip *src, const int /*flag*/) @@ -64,31 +64,31 @@ static void copy_speed_effect(Strip *dst, const Strip *src, const int /*flag*/) v->frameMap = nullptr; } -static StripEarlyOut early_out_speed(const Strip * /*seq*/, float /*fac*/) +static StripEarlyOut early_out_speed(const Strip * /*strip*/, float /*fac*/) { return StripEarlyOut::DoEffect; } -static FCurve *seq_effect_speed_speed_factor_curve_get(Scene *scene, Strip *seq) +static FCurve *strip_effect_speed_speed_factor_curve_get(Scene *scene, Strip *strip) { - return id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "speed_factor", 0, nullptr); + return id_data_find_fcurve(&scene->id, strip, &RNA_Strip, "speed_factor", 0, nullptr); } -void seq_effect_speed_rebuild_map(Scene *scene, Strip *seq) +void strip_effect_speed_rebuild_map(Scene *scene, Strip *strip) { - const int effect_strip_length = SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq); + const int effect_strip_length = SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip); - if ((seq->seq1 == nullptr) || (effect_strip_length < 1)) { + if ((strip->seq1 == nullptr) || (effect_strip_length < 1)) { return; /* Make COVERITY happy and check for (CID 598) input strip. */ } - const FCurve *fcu = seq_effect_speed_speed_factor_curve_get(scene, seq); + const FCurve *fcu = strip_effect_speed_speed_factor_curve_get(scene, strip); if (fcu == nullptr) { return; } - SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; if (v->frameMap) { MEM_freeN(v->frameMap); } @@ -98,36 +98,37 @@ void seq_effect_speed_rebuild_map(Scene *scene, Strip *seq) float target_frame = 0; for (int frame_index = 1; frame_index < effect_strip_length; frame_index++) { - target_frame += evaluate_fcurve(fcu, SEQ_time_left_handle_frame_get(scene, seq) + frame_index); - const int target_frame_max = SEQ_time_strip_length_get(scene, seq->seq1); + target_frame += evaluate_fcurve(fcu, + SEQ_time_left_handle_frame_get(scene, strip) + frame_index); + const int target_frame_max = SEQ_time_strip_length_get(scene, strip->seq1); CLAMP(target_frame, 0, target_frame_max); v->frameMap[frame_index] = target_frame; } } -static void seq_effect_speed_frame_map_ensure(Scene *scene, Strip *seq) +static void strip_effect_speed_frame_map_ensure(Scene *scene, Strip *strip) { - const SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; + const SpeedControlVars *v = (SpeedControlVars *)strip->effectdata; if (v->frameMap != nullptr) { return; } - seq_effect_speed_rebuild_map(scene, seq); + strip_effect_speed_rebuild_map(scene, strip); } -float seq_speed_effect_target_frame_get(Scene *scene, - Strip *seq_speed, - float timeline_frame, - int input) +float strip_speed_effect_target_frame_get(Scene *scene, + Strip *strip_speed, + float timeline_frame, + int input) { - if (seq_speed->seq1 == nullptr) { + if (strip_speed->seq1 == nullptr) { return 0.0f; } - SEQ_effect_handle_get(seq_speed); /* Ensure, that data are initialized. */ - int frame_index = round_fl_to_int(SEQ_give_frame_index(scene, seq_speed, timeline_frame)); - SpeedControlVars *s = (SpeedControlVars *)seq_speed->effectdata; - const Strip *source = seq_speed->seq1; + SEQ_effect_handle_get(strip_speed); /* Ensure, that data are initialized. */ + int frame_index = round_fl_to_int(SEQ_give_frame_index(scene, strip_speed, timeline_frame)); + SpeedControlVars *s = (SpeedControlVars *)strip_speed->effectdata; + const Strip *source = strip_speed->seq1; float target_frame = 0.0f; switch (s->speed_control_type) { @@ -135,16 +136,16 @@ float seq_speed_effect_target_frame_get(Scene *scene, /* Only right handle controls effect speed! */ const float target_content_length = SEQ_time_strip_length_get(scene, source) - source->startofs; - const float speed_effetct_length = SEQ_time_right_handle_frame_get(scene, seq_speed) - - SEQ_time_left_handle_frame_get(scene, seq_speed); + const float speed_effetct_length = SEQ_time_right_handle_frame_get(scene, strip_speed) - + SEQ_time_left_handle_frame_get(scene, strip_speed); const float ratio = frame_index / speed_effetct_length; target_frame = target_content_length * ratio; break; } case SEQ_SPEED_MULTIPLY: { - const FCurve *fcu = seq_effect_speed_speed_factor_curve_get(scene, seq_speed); + const FCurve *fcu = strip_effect_speed_speed_factor_curve_get(scene, strip_speed); if (fcu != nullptr) { - seq_effect_speed_frame_map_ensure(scene, seq_speed); + strip_effect_speed_frame_map_ensure(scene, strip_speed); target_frame = s->frameMap[frame_index]; } else { @@ -161,7 +162,7 @@ float seq_speed_effect_target_frame_get(Scene *scene, } CLAMP(target_frame, 0, SEQ_time_strip_length_get(scene, source)); - target_frame += seq_speed->start; + target_frame += strip_speed->start; /* No interpolation. */ if ((s->flags & SEQ_SPEED_USE_INTERPOLATION) == 0) { @@ -174,27 +175,27 @@ float seq_speed_effect_target_frame_get(Scene *scene, } static float speed_effect_interpolation_ratio_get(Scene *scene, - Strip *seq_speed, + Strip *strip_speed, float timeline_frame) { - const float target_frame = seq_speed_effect_target_frame_get( - scene, seq_speed, timeline_frame, 0); + const float target_frame = strip_speed_effect_target_frame_get( + scene, strip_speed, timeline_frame, 0); return target_frame - floor(target_frame); } static ImBuf *do_speed_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2) { - const SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; - SeqEffectHandle cross_effect = get_sequence_effect_impl(SEQ_TYPE_CROSS); + const SpeedControlVars *s = (SpeedControlVars *)strip->effectdata; + SeqEffectHandle cross_effect = get_sequence_effect_impl(STRIP_TYPE_CROSS); ImBuf *out; if (s->flags & SEQ_SPEED_USE_INTERPOLATION) { - fac = speed_effect_interpolation_ratio_get(context->scene, seq, timeline_frame); + fac = speed_effect_interpolation_ratio_get(context->scene, strip, timeline_frame); /* Current frame is ibuf1, next frame is ibuf2. */ out = cross_effect.execute(context, nullptr, timeline_frame, fac, ibuf1, ibuf2); return out; diff --git a/source/blender/sequencer/intern/effects/vse_effect_text.cc b/source/blender/sequencer/intern/effects/vse_effect_text.cc index 834d443a0d1a..fc10080aaec5 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_text.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_text.cc @@ -82,7 +82,7 @@ void SEQ_fontmap_clear() g_font_map.name_to_mem_font_id.clear(); } -static int seq_load_font_file(const std::string &path) +static int strip_load_font_file(const std::string &path) { std::lock_guard lock(g_font_map.mutex); int fontid = g_font_map.path_to_file_font_id.add_or_modify( @@ -109,7 +109,7 @@ static int seq_load_font_file(const std::string &path) return fontid; } -static int seq_load_font_mem(const std::string &name, const uchar *data, int data_size) +static int strip_load_font_mem(const std::string &name, const uchar *data, int data_size) { std::lock_guard lock(g_font_map.mutex); int fontid = g_font_map.name_to_mem_font_id.add_or_modify( @@ -136,7 +136,7 @@ static int seq_load_font_mem(const std::string &name, const uchar *data, int dat return fontid; } -static void seq_unload_font(int fontid) +static void strip_unload_font(int fontid) { std::lock_guard lock(g_font_map.mutex); bool unloaded = BLF_unload_id(fontid); @@ -153,9 +153,9 @@ static void seq_unload_font(int fontid) * \{ */ /* `data->text[0] == 0` is ignored on purpose in order to make it possible to edit */ -bool SEQ_effects_can_render_text(const Strip *seq) +bool SEQ_effects_can_render_text(const Strip *strip) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); if (data->text_size < 1.0f || ((data->color[3] == 0.0f) && (data->shadow_color[3] == 0.0f || (data->flag & SEQ_TEXT_SHADOW) == 0) && @@ -167,14 +167,14 @@ bool SEQ_effects_can_render_text(const Strip *seq) return true; } -static void init_text_effect(Strip *seq) +static void init_text_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } TextVars *data = static_cast( - seq->effectdata = MEM_callocN(sizeof(TextVars), "textvars")); + strip->effectdata = MEM_callocN(sizeof(TextVars), "textvars")); data->text_font = nullptr; data->text_blf_id = -1; data->text_size = 60.0f; @@ -217,7 +217,7 @@ void SEQ_effect_text_font_unload(TextVars *data, const bool do_id_user) /* Unload the font. */ if (data->text_blf_id >= 0) { - seq_unload_font(data->text_blf_id); + strip_unload_font(data->text_blf_id); data->text_blf_id = -1; } } @@ -244,32 +244,32 @@ void SEQ_effect_text_font_load(TextVars *data, const bool do_id_user) char name[MAX_ID_FULL_NAME]; BKE_id_full_name_get(name, &vfont->id, 0); - data->text_blf_id = seq_load_font_mem(name, static_cast(pf->data), pf->size); + data->text_blf_id = strip_load_font_mem(name, static_cast(pf->data), pf->size); } else { char filepath[FILE_MAX]; STRNCPY(filepath, vfont->filepath); BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); - data->text_blf_id = seq_load_font_file(filepath); + data->text_blf_id = strip_load_font_file(filepath); } } -static void free_text_effect(Strip *seq, const bool do_id_user) +static void free_text_effect(Strip *strip, const bool do_id_user) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); SEQ_effect_text_font_unload(data, do_id_user); if (data) { MEM_delete(data->runtime); MEM_freeN(data); - seq->effectdata = nullptr; + strip->effectdata = nullptr; } } -static void load_text_effect(Strip *seq) +static void load_text_effect(Strip *strip) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); SEQ_effect_text_font_load(data, false); } @@ -288,9 +288,9 @@ static int num_inputs_text() return 0; } -static StripEarlyOut early_out_text(const Strip *seq, float /*fac*/) +static StripEarlyOut early_out_text(const Strip *strip, float /*fac*/) { - if (!SEQ_effects_can_render_text(seq)) { + if (!SEQ_effects_can_render_text(strip)) { return StripEarlyOut::UseInput1; } return StripEarlyOut::NoInput; @@ -761,9 +761,9 @@ static void fill_rect_alpha_under( }); } -static int text_effect_line_size_get(const SeqRenderData *context, const Strip *seq) +static int text_effect_line_size_get(const SeqRenderData *context, const Strip *strip) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); /* Compensate text size for preview render size. */ double proxy_size_comp = context->scene->r.size / 100.0; if (context->preview_render_size != SEQ_RENDER_SIZE_SCENE) { @@ -773,17 +773,17 @@ static int text_effect_line_size_get(const SeqRenderData *context, const Strip * return proxy_size_comp * data->text_size; } -static int text_effect_font_init(const SeqRenderData *context, const Strip *seq, int font_flags) +static int text_effect_font_init(const SeqRenderData *context, const Strip *strip, int font_flags) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); int font = blf_mono_font_render; /* In case font got unloaded behind our backs: mark it as needing a load. */ if (data->text_blf_id >= 0 && !BLF_is_loaded_id(data->text_blf_id)) { - data->text_blf_id = SEQ_FONT_NOT_LOADED; + data->text_blf_id = STRIP_FONT_NOT_LOADED; } - if (data->text_blf_id == SEQ_FONT_NOT_LOADED) { + if (data->text_blf_id == STRIP_FONT_NOT_LOADED) { data->text_blf_id = -1; SEQ_effect_text_font_load(data, false); @@ -793,7 +793,7 @@ static int text_effect_font_init(const SeqRenderData *context, const Strip *seq, font = data->text_blf_id; } - BLF_size(font, text_effect_line_size_get(context, seq)); + BLF_size(font, text_effect_line_size_get(context, strip)); BLF_enable(font, font_flags); return font; } @@ -973,9 +973,9 @@ static void apply_text_alignment(const TextVars *data, } } -static void calc_text_runtime(const Strip *seq, int font, const int2 image_size) +static void calc_text_runtime(const Strip *strip, int font, const int2 image_size) { - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); if (data->runtime != nullptr) { MEM_delete(data->runtime); @@ -995,7 +995,7 @@ static void calc_text_runtime(const Strip *seq, int font, const int2 image_size) } static ImBuf *do_text_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float /*fac*/, ImBuf * /*ibuf1*/, @@ -1004,7 +1004,7 @@ static ImBuf *do_text_effect(const SeqRenderData *context, /* NOTE: text rasterization only fills in part of output image, * need to clear it. */ ImBuf *out = prepare_effect_imbufs(context, nullptr, nullptr, false); - TextVars *data = static_cast(seq->effectdata); + TextVars *data = static_cast(strip->effectdata); const char *display_device = context->scene->display_settings.display_device; ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); @@ -1014,9 +1014,9 @@ static ImBuf *do_text_effect(const SeqRenderData *context, /* Guard against parallel accesses to the fonts map. */ std::lock_guard lock(g_font_map.mutex); - const int font = text_effect_font_init(context, seq, font_flags); + const int font = text_effect_font_init(context, strip, font_flags); - calc_text_runtime(seq, font, {out->x, out->y}); + calc_text_runtime(strip, font, {out->x, out->y}); TextVarsRuntime *runtime = data->runtime; rcti outline_rect = draw_text_outline(context, data, runtime, display, out); diff --git a/source/blender/sequencer/intern/effects/vse_effect_transform.cc b/source/blender/sequencer/intern/effects/vse_effect_transform.cc index 47274851897f..3b034ea58b52 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_transform.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_transform.cc @@ -21,15 +21,15 @@ using namespace blender; -static void init_transform_effect(Strip *seq) +static void init_transform_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(TransformVars), "transformvars"); + strip->effectdata = MEM_callocN(sizeof(TransformVars), "transformvars"); - TransformVars *transform = (TransformVars *)seq->effectdata; + TransformVars *transform = (TransformVars *)strip->effectdata; transform->ScalexIni = 1.0f; transform->ScaleyIni = 1.0f; @@ -49,9 +49,9 @@ static int num_inputs_transform() return 1; } -static void free_transform_effect(Strip *seq, const bool /*do_id_user*/) +static void free_transform_effect(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_transform_effect(Strip *dst, const Strip *src, const int /*flag*/) @@ -131,7 +131,7 @@ static void transform_image(int x, } static ImBuf *do_transform_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float /*fac*/, ImBuf *src1, @@ -139,7 +139,7 @@ static ImBuf *do_transform_effect(const SeqRenderData *context, { ImBuf *dst = prepare_effect_imbufs(context, src1, nullptr); - const TransformVars *transform = (TransformVars *)seq->effectdata; + const TransformVars *transform = (TransformVars *)strip->effectdata; /* Scale */ float scale_x, scale_y; diff --git a/source/blender/sequencer/intern/effects/vse_effect_wipe.cc b/source/blender/sequencer/intern/effects/vse_effect_wipe.cc index 1dade625685e..ce1c66fcb811 100644 --- a/source/blender/sequencer/intern/effects/vse_effect_wipe.cc +++ b/source/blender/sequencer/intern/effects/vse_effect_wipe.cc @@ -6,7 +6,6 @@ * \ingroup sequencer */ -#include "BLI_math_vector.hh" #include "BLI_task.hh" #include "DNA_sequence_types.h" @@ -285,13 +284,13 @@ static float check_zone(const WipeZone *wipezone, int x, int y, float fac) return output; } -static void init_wipe_effect(Strip *seq) +static void init_wipe_effect(Strip *strip) { - if (seq->effectdata) { - MEM_freeN(seq->effectdata); + if (strip->effectdata) { + MEM_freeN(strip->effectdata); } - seq->effectdata = MEM_callocN(sizeof(WipeVars), "wipevars"); + strip->effectdata = MEM_callocN(sizeof(WipeVars), "wipevars"); } static int num_inputs_wipe() @@ -299,9 +298,9 @@ static int num_inputs_wipe() return 2; } -static void free_wipe_effect(Strip *seq, const bool /*do_id_user*/) +static void free_wipe_effect(Strip *strip, const bool /*do_id_user*/) { - MEM_SAFE_FREE(seq->effectdata); + MEM_SAFE_FREE(strip->effectdata); } static void copy_wipe_effect(Strip *dst, const Strip *src, const int /*flag*/) @@ -311,10 +310,10 @@ static void copy_wipe_effect(Strip *dst, const Strip *src, const int /*flag*/) template static void do_wipe_effect( - const Strip *seq, float fac, int width, int height, const T *rect1, const T *rect2, T *out) + const Strip *strip, float fac, int width, int height, const T *rect1, const T *rect2, T *out) { using namespace blender; - const WipeVars *wipe = (const WipeVars *)seq->effectdata; + const WipeVars *wipe = (const WipeVars *)strip->effectdata; const WipeZone wipezone = precalc_wipe_zone(wipe, width, height); threading::parallel_for(IndexRange(height), 64, [&](const IndexRange y_range) { @@ -357,7 +356,7 @@ static void do_wipe_effect( } static ImBuf *do_wipe_effect(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/, float fac, ImBuf *ibuf1, @@ -366,7 +365,7 @@ static ImBuf *do_wipe_effect(const SeqRenderData *context, ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2); if (out->float_buffer.data) { - do_wipe_effect(seq, + do_wipe_effect(strip, fac, context->rectx, context->recty, @@ -375,7 +374,7 @@ static ImBuf *do_wipe_effect(const SeqRenderData *context, out->float_buffer.data); } else { - do_wipe_effect(seq, + do_wipe_effect(strip, fac, context->rectx, context->recty, diff --git a/source/blender/sequencer/intern/image_cache.cc b/source/blender/sequencer/intern/image_cache.cc index 89323f48a05c..8cb998774f7a 100644 --- a/source/blender/sequencer/intern/image_cache.cc +++ b/source/blender/sequencer/intern/image_cache.cc @@ -14,13 +14,12 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" -#include "DNA_space_types.h" /* for FILE_MAX. */ #include "IMB_imbuf.hh" #include "IMB_imbuf_types.hh" -#include "BLI_fileops_types.h" #include "BLI_ghash.h" +#include "BLI_math_base.h" #include "BLI_mempool.h" #include "BLI_threads.h" @@ -108,7 +107,7 @@ static uint seq_cache_hashhash(const void *key_) rval ^= *(const uint *)&key->frame_index; rval += key->type; - rval ^= intptr_t(key->seq) << 6; + rval ^= intptr_t(key->strip) << 6; return rval; } @@ -118,29 +117,29 @@ static bool seq_cache_hashcmp(const void *a_, const void *b_) const SeqCacheKey *a = static_cast(a_); const SeqCacheKey *b = static_cast(b_); - return ((a->seq != b->seq) || (a->frame_index != b->frame_index) || (a->type != b->type) || + return ((a->strip != b->strip) || (a->frame_index != b->frame_index) || (a->type != b->type) || seq_cmp_render_data(&a->context, &b->context)); } static float seq_cache_timeline_frame_to_frame_index(const Scene *scene, - const Strip *seq, + const Strip *strip, const float timeline_frame, const int type) { /* With raw images, map timeline_frame to strip input media frame range. This means that static * images or extended frame range of movies will only generate one cache entry. No special * treatment in converting frame index to timeline_frame is needed. */ - bool is_effect = seq->type & SEQ_TYPE_EFFECT; + bool is_effect = strip->type & STRIP_TYPE_EFFECT; if (!is_effect && type == SEQ_CACHE_STORE_RAW) { - return SEQ_give_frame_index(scene, seq, timeline_frame); + return SEQ_give_frame_index(scene, strip, timeline_frame); } - return timeline_frame - SEQ_time_start_frame_get(seq); + return timeline_frame - SEQ_time_start_frame_get(strip); } -float seq_cache_frame_index_to_timeline_frame(Strip *seq, float frame_index) +float seq_cache_frame_index_to_timeline_frame(Strip *strip, float frame_index) { - return frame_index + SEQ_time_start_frame_get(seq); + return frame_index + SEQ_time_start_frame_get(strip); } static SeqCache *seq_cache_get_from_scene(Scene *scene) @@ -195,8 +194,8 @@ static void seq_cache_valfree(void *val) static int get_stored_types_flag(Scene *scene, SeqCacheKey *key) { int flag; - if (key->seq->cache_flag & SEQ_CACHE_OVERRIDE) { - flag = key->seq->cache_flag; + if (key->strip->cache_flag & SEQ_CACHE_OVERRIDE) { + flag = key->strip->cache_flag; } else { flag = scene->ed->cache_flag; @@ -508,15 +507,15 @@ static void seq_cache_create(Main *bmain, Scene *scene) static void seq_cache_populate_key(SeqCacheKey *key, const SeqRenderData *context, - Strip *seq, + Strip *strip, const float timeline_frame, const int type) { key->cache_owner = seq_cache_get_from_scene(context->scene); - key->seq = seq; + key->strip = strip; key->context = *context; key->frame_index = seq_cache_timeline_frame_to_frame_index( - context->scene, seq, timeline_frame, type); + context->scene, strip, timeline_frame, type); key->timeline_frame = timeline_frame; key->type = type; key->link_prev = nullptr; @@ -527,12 +526,12 @@ static void seq_cache_populate_key(SeqCacheKey *key, static SeqCacheKey *seq_cache_allocate_key(SeqCache *cache, const SeqRenderData *context, - Strip *seq, + Strip *strip, const float timeline_frame, const int type) { SeqCacheKey *key = static_cast(BLI_mempool_alloc(cache->keys_pool)); - seq_cache_populate_key(key, context, seq, timeline_frame, type); + seq_cache_populate_key(key, context, strip, timeline_frame, type); return key; } @@ -557,10 +556,10 @@ void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame) if (key->is_temp_cache && key->task_id == id) { /* Use frame_index here to avoid freeing raw images if they are used for multiple frames. */ float frame_index = seq_cache_timeline_frame_to_frame_index( - scene, key->seq, timeline_frame, key->type); + scene, key->strip, timeline_frame, key->type); if (frame_index != key->frame_index || - timeline_frame > SEQ_time_right_handle_frame_get(scene, key->seq) || - timeline_frame < SEQ_time_left_handle_frame_get(scene, key->seq)) + timeline_frame > SEQ_time_right_handle_frame_get(scene, key->strip) || + timeline_frame < SEQ_time_left_handle_frame_get(scene, key->strip)) { seq_cache_key_unlink(key); BLI_ghash_remove(cache->hash, key, seq_cache_keyfree, seq_cache_valfree); @@ -620,8 +619,8 @@ void SEQ_cache_cleanup(Scene *scene) } void seq_cache_cleanup_sequence(Scene *scene, - Strip *seq, - Strip *seq_changed, + Strip *strip, + Strip *strip_changed, int invalidate_types, bool force_seq_changed_range) { @@ -631,24 +630,24 @@ void seq_cache_cleanup_sequence(Scene *scene, } if (seq_disk_cache_is_enabled(cache->bmain) && cache->disk_cache != nullptr) { - seq_disk_cache_invalidate(cache->disk_cache, scene, seq, seq_changed, invalidate_types); + seq_disk_cache_invalidate(cache->disk_cache, scene, strip, strip_changed, invalidate_types); } seq_cache_lock(scene); const int range_start_seq_changed = seq_cache_timeline_frame_to_frame_index( - scene, seq, SEQ_time_left_handle_frame_get(scene, seq_changed), invalidate_types); + scene, strip, SEQ_time_left_handle_frame_get(scene, strip_changed), invalidate_types); const int range_end_seq_changed = seq_cache_timeline_frame_to_frame_index( - scene, seq, SEQ_time_right_handle_frame_get(scene, seq_changed), invalidate_types); + scene, strip, SEQ_time_right_handle_frame_get(scene, strip_changed), invalidate_types); int range_start = range_start_seq_changed; int range_end = range_end_seq_changed; if (!force_seq_changed_range) { const int range_start_seq = seq_cache_timeline_frame_to_frame_index( - scene, seq, SEQ_time_left_handle_frame_get(scene, seq), invalidate_types); + scene, strip, SEQ_time_left_handle_frame_get(scene, strip), invalidate_types); const int range_end_seq = seq_cache_timeline_frame_to_frame_index( - scene, seq, SEQ_time_right_handle_frame_get(scene, seq), invalidate_types); + scene, strip, SEQ_time_right_handle_frame_get(scene, strip), invalidate_types); range_start = max_ii(range_start, range_start_seq); range_end = min_ii(range_end, range_end_seq); @@ -665,14 +664,14 @@ void seq_cache_cleanup_sequence(Scene *scene, BLI_ghashIterator_step(&gh_iter); BLI_assert(key->cache_owner == cache); - /* Clean all final and composite in intersection of seq and seq_changed. */ + /* Clean all final and composite in intersection of strip and strip_changed. */ if (key->type & invalidate_composite && key->frame_index >= range_start && key->frame_index <= range_end) { seq_cache_key_unlink(key); BLI_ghash_remove(cache->hash, key, seq_cache_keyfree, seq_cache_valfree); } - else if (key->type & invalidate_source && key->seq == seq && + else if (key->type & invalidate_source && key->strip == strip && key->frame_index >= range_start_seq_changed && key->frame_index <= range_end_seq_changed) { @@ -684,10 +683,10 @@ void seq_cache_cleanup_sequence(Scene *scene, seq_cache_unlock(scene); } -ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_frame, int type) +ImBuf *seq_cache_get(const SeqRenderData *context, Strip *strip, float timeline_frame, int type) { - if (context->skip_cache || context->is_proxy_render || !seq) { + if (context->skip_cache || context->is_proxy_render || !strip) { return nullptr; } @@ -696,10 +695,10 @@ ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_fr if (context->is_prefetch_render) { context = seq_prefetch_get_original_context(context); scene = context->scene; - seq = seq_prefetch_get_original_sequence(seq, scene); + strip = seq_prefetch_get_original_sequence(strip, scene); } - if (!seq) { + if (!strip) { return nullptr; } @@ -713,8 +712,8 @@ ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_fr SeqCacheKey key; /* Try RAM cache: */ - if (cache && seq) { - seq_cache_populate_key(&key, context, seq, timeline_frame, type); + if (cache && strip) { + seq_cache_populate_key(&key, context, strip, timeline_frame, type); ibuf = seq_cache_get_ex(cache, &key); } seq_cache_unlock(scene); @@ -741,7 +740,7 @@ ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_fr /* Store read image in RAM. Only recycle item for final type. */ if (key.type != SEQ_CACHE_STORE_FINAL_OUT || seq_cache_recycle_item(scene)) { - SeqCacheKey *new_key = seq_cache_allocate_key(cache, context, seq, timeline_frame, type); + SeqCacheKey *new_key = seq_cache_allocate_key(cache, context, strip, timeline_frame, type); seq_cache_put_ex(scene, new_key, ibuf); } } @@ -750,22 +749,22 @@ ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_fr } bool seq_cache_put_if_possible( - const SeqRenderData *context, Strip *seq, float timeline_frame, int type, ImBuf *ibuf) + const SeqRenderData *context, Strip *strip, float timeline_frame, int type, ImBuf *ibuf) { Scene *scene = context->scene; if (context->is_prefetch_render) { context = seq_prefetch_get_original_context(context); scene = context->scene; - seq = seq_prefetch_get_original_sequence(seq, scene); + strip = seq_prefetch_get_original_sequence(strip, scene); } - if (!seq) { + if (!strip) { return false; } if (seq_cache_recycle_item(scene)) { - seq_cache_put(context, seq, timeline_frame, type, ibuf); + seq_cache_put(context, strip, timeline_frame, type, ibuf); return true; } @@ -778,9 +777,9 @@ bool seq_cache_put_if_possible( } void seq_cache_put( - const SeqRenderData *context, Strip *seq, float timeline_frame, int type, ImBuf *i) + const SeqRenderData *context, Strip *strip, float timeline_frame, int type, ImBuf *i) { - if (i == nullptr || context->skip_cache || context->is_proxy_render || !seq) { + if (i == nullptr || context->skip_cache || context->is_proxy_render || !strip) { return; } @@ -789,12 +788,12 @@ void seq_cache_put( if (context->is_prefetch_render) { context = seq_prefetch_get_original_context(context); scene = context->scene; - seq = seq_prefetch_get_original_sequence(seq, scene); - BLI_assert(seq != nullptr); + strip = seq_prefetch_get_original_sequence(strip, scene); + BLI_assert(strip != nullptr); } /* Prevent reinserting, it breaks cache key linking. */ - ImBuf *test = seq_cache_get(context, seq, timeline_frame, type); + ImBuf *test = seq_cache_get(context, strip, timeline_frame, type); if (test) { IMB_freeImBuf(test); return; @@ -806,7 +805,7 @@ void seq_cache_put( seq_cache_lock(scene); SeqCache *cache = seq_cache_get_from_scene(scene); - SeqCacheKey *key = seq_cache_allocate_key(cache, context, seq, timeline_frame, type); + SeqCacheKey *key = seq_cache_allocate_key(cache, context, strip, timeline_frame, type); seq_cache_put_ex(scene, key, i); seq_cache_unlock(scene); @@ -830,7 +829,7 @@ void SEQ_cache_iterate( Scene *scene, void *userdata, bool callback_init(void *userdata, size_t item_count), - bool callback_iter(void *userdata, Strip *seq, int timeline_frame, int cache_type)) + bool callback_iter(void *userdata, Strip *strip, int timeline_frame, int cache_type)) { SeqCache *cache = seq_cache_get_from_scene(scene); if (!cache) { @@ -861,10 +860,10 @@ void SEQ_cache_iterate( * convert RAW frames like that to a timeline frame, we skip doing this as visualizing these * are a developer option that not many people will see. */ - timeline_frame = key->frame_index + SEQ_time_start_frame_get(key->seq); + timeline_frame = key->frame_index + SEQ_time_start_frame_get(key->strip); } - interrupt = callback_iter(userdata, key->seq, timeline_frame, key->type); + interrupt = callback_iter(userdata, key->strip, timeline_frame, key->type); } cache->last_key = nullptr; diff --git a/source/blender/sequencer/intern/image_cache.hh b/source/blender/sequencer/intern/image_cache.hh index 141689564b2d..a292d89ca2a6 100644 --- a/source/blender/sequencer/intern/image_cache.hh +++ b/source/blender/sequencer/intern/image_cache.hh @@ -21,7 +21,7 @@ struct SeqCacheKey { void *userkey; SeqCacheKey *link_prev; /* Used for linking intermediate items to final frame. */ SeqCacheKey *link_next; /* Used for linking intermediate items to final frame. */ - Strip *seq; + Strip *strip; SeqRenderData context; float frame_index; /* Usually same as timeline_frame. Mapped to media for RAW entries. */ float timeline_frame; /* Only for reference - used for freeing when cache is full. */ @@ -32,11 +32,11 @@ struct SeqCacheKey { int type; }; -ImBuf *seq_cache_get(const SeqRenderData *context, Strip *seq, float timeline_frame, int type); +ImBuf *seq_cache_get(const SeqRenderData *context, Strip *strip, float timeline_frame, int type); void seq_cache_put( - const SeqRenderData *context, Strip *seq, float timeline_frame, int type, ImBuf *i); + const SeqRenderData *context, Strip *strip, float timeline_frame, int type, ImBuf *i); bool seq_cache_put_if_possible( - const SeqRenderData *context, Strip *seq, float timeline_frame, int type, ImBuf *ibuf); + const SeqRenderData *context, Strip *strip, float timeline_frame, int type, ImBuf *ibuf); /** * Find only "base" keys. * Sources(other types) for a frame must be freed all at once. @@ -45,9 +45,9 @@ bool seq_cache_recycle_item(Scene *scene); void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame); void seq_cache_destruct(Scene *scene); void seq_cache_cleanup_sequence(Scene *scene, - Strip *seq, - Strip *seq_changed, + Strip *strip, + Strip *strip_changed, int invalidate_types, bool force_seq_changed_range); bool seq_cache_is_full(); -float seq_cache_frame_index_to_timeline_frame(Strip *seq, float frame_index); +float seq_cache_frame_index_to_timeline_frame(Strip *strip, float frame_index); diff --git a/source/blender/sequencer/intern/iterator.cc b/source/blender/sequencer/intern/iterator.cc index 5ed5db8caeec..1605da055405 100644 --- a/source/blender/sequencer/intern/iterator.cc +++ b/source/blender/sequencer/intern/iterator.cc @@ -10,8 +10,6 @@ #include -#include "MEM_guardedalloc.h" - #include "DNA_sequence_types.h" #include "BLI_listbase.h" @@ -24,15 +22,15 @@ using blender::VectorSet; -static bool seq_for_each_recursive(ListBase *seqbase, SeqForEachFunc callback, void *user_data) +static bool strip_for_each_recursive(ListBase *seqbase, SeqForEachFunc callback, void *user_data) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (!callback(seq, user_data)) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (!callback(strip, user_data)) { /* Callback signaled stop, return. */ return false; } - if (seq->type == SEQ_TYPE_META) { - if (!seq_for_each_recursive(&seq->seqbase, callback, user_data)) { + if (strip->type == STRIP_TYPE_META) { + if (!strip_for_each_recursive(&strip->seqbase, callback, user_data)) { return false; } } @@ -42,35 +40,35 @@ static bool seq_for_each_recursive(ListBase *seqbase, SeqForEachFunc callback, v void SEQ_for_each_callback(ListBase *seqbase, SeqForEachFunc callback, void *user_data) { - seq_for_each_recursive(seqbase, callback, user_data); + strip_for_each_recursive(seqbase, callback, user_data); } -VectorSet SEQ_query_by_reference(Strip *seq_reference, +VectorSet SEQ_query_by_reference(Strip *strip_reference, const Scene *scene, ListBase *seqbase, - void seq_query_func(const Scene *scene, - Strip *seq_reference, - ListBase *seqbase, - VectorSet &strips)) + void strip_query_func(const Scene *scene, + Strip *strip_reference, + ListBase *seqbase, + VectorSet &strips)) { VectorSet strips; - seq_query_func(scene, seq_reference, seqbase, strips); + strip_query_func(scene, strip_reference, seqbase, strips); return strips; } void SEQ_iterator_set_expand(const Scene *scene, ListBase *seqbase, VectorSet &strips, - void seq_query_func(const Scene *scene, - Strip *seq_reference, - ListBase *seqbase, - VectorSet &strips)) + void strip_query_func(const Scene *scene, + Strip *strip_reference, + ListBase *seqbase, + VectorSet &strips)) { /* Collect expanded results for each sequence in provided VectorSet. */ VectorSet query_matches; for (Strip *strip : strips) { - query_matches.add_multiple(SEQ_query_by_reference(strip, scene, seqbase, seq_query_func)); + query_matches.add_multiple(SEQ_query_by_reference(strip, scene, seqbase, strip_query_func)); } /* Merge all expanded results in provided VectorSet. */ @@ -80,7 +78,7 @@ void SEQ_iterator_set_expand(const Scene *scene, static void query_all_strips_recursive(const ListBase *seqbase, VectorSet &strips) { LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_META) { + if (seq->type == STRIP_TYPE_META) { query_all_strips_recursive(&seq->seqbase, strips); } strips.add(seq); @@ -137,14 +135,14 @@ static void collection_filter_channel_up_to_incl(VectorSet &strips, con * Order of applying these conditions is important. */ static bool must_render_strip(const VectorSet &strips, Strip *strip) { - bool seq_have_effect_in_stack = false; + bool strip_have_effect_in_stack = false; for (Strip *strip_iter : strips) { /* Strips is below another strip with replace blending are not rendered. */ if (strip_iter->blend_mode == SEQ_BLEND_REPLACE && strip->machine < strip_iter->machine) { return false; } - if ((strip_iter->type & SEQ_TYPE_EFFECT) != 0 && + if ((strip_iter->type & STRIP_TYPE_EFFECT) != 0 && SEQ_relation_is_effect_of_strip(strip_iter, strip)) { /* Strips in same channel or higher than its effect are rendered. */ @@ -152,17 +150,17 @@ static bool must_render_strip(const VectorSet &strips, Strip *strip) return true; } /* Mark that this strip has effect in stack, that is above the strip. */ - seq_have_effect_in_stack = true; + strip_have_effect_in_stack = true; } } /* All non-generator effects are rendered (with respect to conditions above). */ - if ((strip->type & SEQ_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(strip->type) != 0) { + if ((strip->type & STRIP_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(strip->type) != 0) { return true; } /* If strip has effects in stack, and all effects are above this strip, it is not rendered. */ - if (seq_have_effect_in_stack) { + if (strip_have_effect_in_stack) { return false; } @@ -175,7 +173,7 @@ static void collection_filter_rendered_strips(VectorSet &strips, ListBa /* Remove sound strips and muted strips from VectorSet, because these are not rendered. * Function #must_render_strip() don't have to check for these strips anymore. */ strips.remove_if([&](Strip *strip) { - return strip->type == SEQ_TYPE_SOUND_RAM || SEQ_render_is_muted(channels, strip); + return strip->type == STRIP_TYPE_SOUND_RAM || SEQ_render_is_muted(channels, strip); }); strips.remove_if([&](Strip *strip) { return !must_render_strip(strips, strip); }); @@ -219,7 +217,7 @@ void SEQ_query_strip_effect_chain(const Scene *scene, strips.add(reference_strip); /* Find all strips that reference_strip is connected to. */ - if (reference_strip->type & SEQ_TYPE_EFFECT) { + if (reference_strip->type & STRIP_TYPE_EFFECT) { if (reference_strip->seq1) { SEQ_query_strip_effect_chain(scene, reference_strip->seq1, seqbase, strips); } @@ -229,9 +227,9 @@ void SEQ_query_strip_effect_chain(const Scene *scene, } /* Find all strips connected to reference_strip. */ - LISTBASE_FOREACH (Strip *, seq_test, seqbase) { - if (seq_test->seq1 == reference_strip || seq_test->seq2 == reference_strip) { - SEQ_query_strip_effect_chain(scene, seq_test, seqbase, strips); + LISTBASE_FOREACH (Strip *, strip_test, seqbase) { + if (strip_test->seq1 == reference_strip || strip_test->seq2 == reference_strip) { + SEQ_query_strip_effect_chain(scene, strip_test, seqbase, strips); } } } diff --git a/source/blender/sequencer/intern/media_presence.cc b/source/blender/sequencer/intern/media_presence.cc index b75c5ee14aa3..0dec2029fb01 100644 --- a/source/blender/sequencer/intern/media_presence.cc +++ b/source/blender/sequencer/intern/media_presence.cc @@ -21,13 +21,13 @@ namespace blender::seq { static ThreadMutex presence_lock = BLI_MUTEX_INITIALIZER; -static const char *get_seq_base_path(const Strip *seq) +static const char *get_seq_base_path(const Strip *strip) { - return seq->scene ? ID_BLEND_PATH_FROM_GLOBAL(&seq->scene->id) : - BKE_main_blendfile_path_from_global(); + return strip->scene ? ID_BLEND_PATH_FROM_GLOBAL(&strip->scene->id) : + BKE_main_blendfile_path_from_global(); } -static bool check_sound_media_missing(const bSound *sound, const Strip *seq) +static bool check_sound_media_missing(const bSound *sound, const Strip *strip) { if (sound == nullptr) { return false; @@ -35,30 +35,30 @@ static bool check_sound_media_missing(const bSound *sound, const Strip *seq) char filepath[FILE_MAX]; STRNCPY(filepath, sound->filepath); - const char *basepath = get_seq_base_path(seq); + const char *basepath = get_seq_base_path(strip); BLI_path_abs(filepath, basepath); return !BLI_exists(filepath); } -static bool check_media_missing(const Strip *seq) +static bool check_media_missing(const Strip *strip) { - if (seq == nullptr || seq->data == nullptr) { + if (strip == nullptr || strip->data == nullptr) { return false; } /* Images or movies. */ - if (ELEM((seq)->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { - const StripElem *elem = seq->data->stripdata; + if (ELEM((strip)->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { + const StripElem *elem = strip->data->stripdata; if (elem != nullptr) { int paths_count = 1; - if (seq->type == SEQ_TYPE_IMAGE) { + if (strip->type == STRIP_TYPE_IMAGE) { /* Image strip has array of file names. */ paths_count = int(MEM_allocN_len(elem) / sizeof(*elem)); } char filepath[FILE_MAX]; - const char *basepath = get_seq_base_path(seq); + const char *basepath = get_seq_base_path(strip); for (int i = 0; i < paths_count; i++, elem++) { - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, elem->filename); + BLI_path_join(filepath, sizeof(filepath), strip->data->dirpath, elem->filename); BLI_path_abs(filepath, basepath); if (!BLI_exists(filepath)) { return true; @@ -68,8 +68,8 @@ static bool check_media_missing(const Strip *seq) } /* Recurse into meta strips. */ - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, seqn, &seq->seqbase) { + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, seqn, &strip->seqbase) { if (check_media_missing(seqn)) { return true; } @@ -94,9 +94,9 @@ static MediaPresence *get_media_presence_cache(Scene *scene) return *presence; } -bool media_presence_is_missing(Scene *scene, const Strip *seq) +bool media_presence_is_missing(Scene *scene, const Strip *strip) { - if (seq == nullptr || scene == nullptr || scene->ed == nullptr) { + if (strip == nullptr || scene == nullptr || scene->ed == nullptr) { return false; } @@ -109,26 +109,26 @@ bool media_presence_is_missing(Scene *scene, const Strip *seq) /* Strips that reference another data block that has path to media * (e.g. sound strips) need to key the presence cache on that data * block. Since it can be used by multiple strips. */ - if (seq->type == SEQ_TYPE_SOUND_RAM) { - const bSound *sound = seq->sound; + if (strip->type == STRIP_TYPE_SOUND_RAM) { + const bSound *sound = strip->sound; const bool *val = presence->map_sound.lookup_ptr(sound); if (val != nullptr) { missing = *val; } else { - missing = check_sound_media_missing(sound, seq); + missing = check_sound_media_missing(sound, strip); presence->map_sound.add_new(sound, missing); } } else { /* Regular strips that point to media directly. */ - const bool *val = presence->map_seq.lookup_ptr(seq); + const bool *val = presence->map_seq.lookup_ptr(strip); if (val != nullptr) { missing = *val; } else { - missing = check_media_missing(seq); - presence->map_seq.add_new(seq, missing); + missing = check_media_missing(strip); + presence->map_seq.add_new(strip, missing); } } @@ -136,9 +136,9 @@ bool media_presence_is_missing(Scene *scene, const Strip *seq) return missing; } -void media_presence_set_missing(Scene *scene, const Strip *seq, bool missing) +void media_presence_set_missing(Scene *scene, const Strip *strip, bool missing) { - if (seq == nullptr || scene == nullptr || scene->ed == nullptr) { + if (strip == nullptr || scene == nullptr || scene->ed == nullptr) { return; } @@ -146,22 +146,22 @@ void media_presence_set_missing(Scene *scene, const Strip *seq, bool missing) MediaPresence *presence = get_media_presence_cache(scene); - if (seq->type == SEQ_TYPE_SOUND_RAM) { - const bSound *sound = seq->sound; + if (strip->type == STRIP_TYPE_SOUND_RAM) { + const bSound *sound = strip->sound; presence->map_sound.add_overwrite(sound, missing); } else { - presence->map_seq.add_overwrite(seq, missing); + presence->map_seq.add_overwrite(strip, missing); } BLI_mutex_unlock(&presence_lock); } -void media_presence_invalidate_strip(Scene *scene, const Strip *seq) +void media_presence_invalidate_strip(Scene *scene, const Strip *strip) { BLI_mutex_lock(&presence_lock); if (scene != nullptr && scene->ed != nullptr && scene->ed->runtime.media_presence != nullptr) { - scene->ed->runtime.media_presence->map_seq.remove(seq); + scene->ed->runtime.media_presence->map_seq.remove(strip); } BLI_mutex_unlock(&presence_lock); } diff --git a/source/blender/sequencer/intern/modifier.cc b/source/blender/sequencer/intern/modifier.cc index 4a8c7d59f6b4..aad44b5adc75 100644 --- a/source/blender/sequencer/intern/modifier.cc +++ b/source/blender/sequencer/intern/modifier.cc @@ -1197,7 +1197,7 @@ const SequenceModifierTypeInfo *SEQ_modifier_type_info_get(int type) return &modifiersTypes[type]; } -SequenceModifierData *SEQ_modifier_new(Strip *seq, const char *name, int type) +SequenceModifierData *SEQ_modifier_new(Strip *strip, const char *name, int type) { SequenceModifierData *smd; const SequenceModifierTypeInfo *smti = SEQ_modifier_type_info_get(type); @@ -1214,9 +1214,9 @@ SequenceModifierData *SEQ_modifier_new(Strip *seq, const char *name, int type) STRNCPY(smd->name, name); } - BLI_addtail(&seq->modifiers, smd); + BLI_addtail(&strip->modifiers, smd); - SEQ_modifier_unique_name(seq, smd); + SEQ_modifier_unique_name(strip, smd); if (smti->init_data) { smti->init_data(smd); @@ -1225,28 +1225,28 @@ SequenceModifierData *SEQ_modifier_new(Strip *seq, const char *name, int type) return smd; } -bool SEQ_modifier_remove(Strip *seq, SequenceModifierData *smd) +bool SEQ_modifier_remove(Strip *strip, SequenceModifierData *smd) { - if (BLI_findindex(&seq->modifiers, smd) == -1) { + if (BLI_findindex(&strip->modifiers, smd) == -1) { return false; } - BLI_remlink(&seq->modifiers, smd); + BLI_remlink(&strip->modifiers, smd); SEQ_modifier_free(smd); return true; } -void SEQ_modifier_clear(Strip *seq) +void SEQ_modifier_clear(Strip *strip) { SequenceModifierData *smd, *smd_next; - for (smd = static_cast(seq->modifiers.first); smd; smd = smd_next) { + for (smd = static_cast(strip->modifiers.first); smd; smd = smd_next) { smd_next = smd->next; SEQ_modifier_free(smd); } - BLI_listbase_clear(&seq->modifiers); + BLI_listbase_clear(&strip->modifiers); } void SEQ_modifier_free(SequenceModifierData *smd) @@ -1260,11 +1260,11 @@ void SEQ_modifier_free(SequenceModifierData *smd) MEM_freeN(smd); } -void SEQ_modifier_unique_name(Strip *seq, SequenceModifierData *smd) +void SEQ_modifier_unique_name(Strip *strip, SequenceModifierData *smd) { const SequenceModifierTypeInfo *smti = SEQ_modifier_type_info_get(smd->type); - BLI_uniquename(&seq->modifiers, + BLI_uniquename(&strip->modifiers, smd, CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, smti->name), '.', @@ -1272,10 +1272,10 @@ void SEQ_modifier_unique_name(Strip *seq, SequenceModifierData *smd) sizeof(smd->name)); } -SequenceModifierData *SEQ_modifier_find_by_name(Strip *seq, const char *name) +SequenceModifierData *SEQ_modifier_find_by_name(Strip *strip, const char *name) { return static_cast( - BLI_findstring(&(seq->modifiers), name, offsetof(SequenceModifierData, name))); + BLI_findstring(&(strip->modifiers), name, offsetof(SequenceModifierData, name))); } static bool skip_modifier(Scene *scene, const SequenceModifierData *smd, int timeline_frame) @@ -1296,17 +1296,17 @@ static bool skip_modifier(Scene *scene, const SequenceModifierData *smd, int tim } void SEQ_modifier_apply_stack(const SeqRenderData *context, - const Strip *seq, + const Strip *strip, ImBuf *ibuf, int timeline_frame) { - const StripScreenQuad quad = get_strip_screen_quad(context, seq); + const StripScreenQuad quad = get_strip_screen_quad(context, strip); - if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) { + if (strip->modifiers.first && (strip->flag & SEQ_USE_LINEAR_MODIFIERS)) { SEQ_render_imbuf_from_sequencer_space(context->scene, ibuf); } - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { const SequenceModifierTypeInfo *smti = SEQ_modifier_type_info_get(smd->type); /* could happen if modifier is being removed or not exists in current version of blender */ @@ -1322,7 +1322,7 @@ void SEQ_modifier_apply_stack(const SeqRenderData *context, if (smti->apply && !skip_modifier(context->scene, smd, timeline_frame)) { int frame_offset; if (smd->mask_time == SEQUENCE_MASK_TIME_RELATIVE) { - frame_offset = seq->start; + frame_offset = strip->start; } else /* if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE) */ { frame_offset = smd->mask_id ? ((Mask *)smd->mask_id)->sfra : 0; @@ -1336,14 +1336,14 @@ void SEQ_modifier_apply_stack(const SeqRenderData *context, } } - if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) { + if (strip->modifiers.first && (strip->flag & SEQ_USE_LINEAR_MODIFIERS)) { seq_imbuf_to_sequencer_space(context->scene, ibuf, false); } } -void SEQ_modifier_list_copy(Strip *seqn, Strip *seq) +void SEQ_modifier_list_copy(Strip *seqn, Strip *strip) { - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { SequenceModifierData *smdn; const SequenceModifierTypeInfo *smti = SEQ_modifier_type_info_get(smd->type); @@ -1363,9 +1363,9 @@ void SEQ_modifier_list_copy(Strip *seqn, Strip *seq) } } -int SEQ_sequence_supports_modifiers(Strip *seq) +int SEQ_sequence_supports_modifiers(Strip *strip) { - return (seq->type != SEQ_TYPE_SOUND_RAM); + return (strip->type != STRIP_TYPE_SOUND_RAM); } /** \} */ diff --git a/source/blender/sequencer/intern/multiview.cc b/source/blender/sequencer/intern/multiview.cc index c580dc297dc2..033e31d1efc7 100644 --- a/source/blender/sequencer/intern/multiview.cc +++ b/source/blender/sequencer/intern/multiview.cc @@ -14,8 +14,6 @@ #include "BKE_scene.hh" -#include "IMB_imbuf.hh" - #include "MOV_read.hh" #include "multiview.hh" diff --git a/source/blender/sequencer/intern/multiview.hh b/source/blender/sequencer/intern/multiview.hh index 9dd829105935..20b8ba4d6936 100644 --- a/source/blender/sequencer/intern/multiview.hh +++ b/source/blender/sequencer/intern/multiview.hh @@ -8,6 +8,9 @@ * \ingroup sequencer */ +#include + +struct MovieReader; struct Scene; /* ********************************************************************** diff --git a/source/blender/sequencer/intern/prefetch.cc b/source/blender/sequencer/intern/prefetch.cc index ef640109733d..1e378ee5830f 100644 --- a/source/blender/sequencer/intern/prefetch.cc +++ b/source/blender/sequencer/intern/prefetch.cc @@ -19,6 +19,7 @@ #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BLI_vector_set.hh" #include "IMB_imbuf.hh" #include "IMB_imbuf_types.hh" @@ -36,7 +37,6 @@ #include "DEG_depsgraph_query.hh" #include "SEQ_channels.hh" -#include "SEQ_iterator.hh" #include "SEQ_prefetch.hh" #include "SEQ_relations.hh" #include "SEQ_render.hh" @@ -120,15 +120,15 @@ static bool seq_prefetch_job_is_waiting(Scene *scene) return pfjob->waiting; } -static Strip *sequencer_prefetch_get_original_sequence(Strip *seq, ListBase *seqbase) +static Strip *sequencer_prefetch_get_original_sequence(Strip *strip, ListBase *seqbase) { LISTBASE_FOREACH (Strip *, seq_orig, seqbase) { - if (STREQ(seq->name, seq_orig->name)) { + if (STREQ(strip->name, seq_orig->name)) { return seq_orig; } - if (seq_orig->type == SEQ_TYPE_META) { - Strip *match = sequencer_prefetch_get_original_sequence(seq, &seq_orig->seqbase); + if (seq_orig->type == STRIP_TYPE_META) { + Strip *match = sequencer_prefetch_get_original_sequence(strip, &seq_orig->seqbase); if (match != nullptr) { return match; } @@ -138,10 +138,10 @@ static Strip *sequencer_prefetch_get_original_sequence(Strip *seq, ListBase *seq return nullptr; } -Strip *seq_prefetch_get_original_sequence(Strip *seq, Scene *scene) +Strip *seq_prefetch_get_original_sequence(Strip *strip, Scene *scene) { Editing *ed = scene->ed; - return sequencer_prefetch_get_original_sequence(seq, &ed->seqbase); + return sequencer_prefetch_get_original_sequence(strip, &ed->seqbase); } SeqRenderData *seq_prefetch_get_original_context(const SeqRenderData *context) @@ -349,19 +349,19 @@ void seq_prefetch_free(Scene *scene) } static bool seq_prefetch_seq_has_disk_cache(PrefetchJob *pfjob, - Strip *seq, + Strip *strip, bool can_have_final_image) { SeqRenderData *ctx = &pfjob->context_cpy; float cfra = seq_prefetch_cfra(pfjob); - ImBuf *ibuf = seq_cache_get(ctx, seq, cfra, SEQ_CACHE_STORE_PREPROCESSED); + ImBuf *ibuf = seq_cache_get(ctx, strip, cfra, SEQ_CACHE_STORE_PREPROCESSED); if (ibuf != nullptr) { IMB_freeImBuf(ibuf); return true; } - ibuf = seq_cache_get(ctx, seq, cfra, SEQ_CACHE_STORE_RAW); + ibuf = seq_cache_get(ctx, strip, cfra, SEQ_CACHE_STORE_RAW); if (ibuf != nullptr) { IMB_freeImBuf(ibuf); return true; @@ -371,7 +371,7 @@ static bool seq_prefetch_seq_has_disk_cache(PrefetchJob *pfjob, return false; } - ibuf = seq_cache_get(ctx, seq, cfra, SEQ_CACHE_STORE_FINAL_OUT); + ibuf = seq_cache_get(ctx, strip, cfra, SEQ_CACHE_STORE_FINAL_OUT); if (ibuf != nullptr) { IMB_freeImBuf(ibuf); return true; @@ -391,24 +391,24 @@ static bool seq_prefetch_scene_strip_is_rendered(PrefetchJob *pfjob, pfjob->scene_eval, channels, seqbase, cfra, 0); /* Iterate over rendered strips. */ - for (Strip *seq : strips) { - if (seq->type == SEQ_TYPE_META && + for (Strip *strip : strips) { + if (strip->type == STRIP_TYPE_META && seq_prefetch_scene_strip_is_rendered( - pfjob, &seq->channels, &seq->seqbase, scene_strips, true)) + pfjob, &strip->channels, &strip->seqbase, scene_strips, true)) { return true; } /* Disable prefetching 3D scene strips, but check for disk cache. */ - if (seq->type == SEQ_TYPE_SCENE && (seq->flag & SEQ_SCENE_STRIPS) == 0 && - !seq_prefetch_seq_has_disk_cache(pfjob, seq, !is_recursive_check)) + if (strip->type == STRIP_TYPE_SCENE && (strip->flag & SEQ_SCENE_STRIPS) == 0 && + !seq_prefetch_seq_has_disk_cache(pfjob, strip, !is_recursive_check)) { return true; } /* Check if strip is effect of scene strip or uses it as modifier. This is recursive check. */ for (Strip *seq_scene : scene_strips) { - if (SEQ_relations_render_loop_check(seq, seq_scene)) { + if (SEQ_relations_render_loop_check(strip, seq_scene)) { return true; } } @@ -419,9 +419,9 @@ static bool seq_prefetch_scene_strip_is_rendered(PrefetchJob *pfjob, static blender::VectorSet query_scene_strips(ListBase *seqbase) { blender::VectorSet strips; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_SCENE && (seq->flag & SEQ_SCENE_STRIPS) == 0) { - strips.add(seq); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type == STRIP_TYPE_SCENE && (strip->flag & SEQ_SCENE_STRIPS) == 0) { + strips.add(strip); } } return strips; diff --git a/source/blender/sequencer/intern/prefetch.hh b/source/blender/sequencer/intern/prefetch.hh index 25bd7560abff..e24360b01bfd 100644 --- a/source/blender/sequencer/intern/prefetch.hh +++ b/source/blender/sequencer/intern/prefetch.hh @@ -26,4 +26,4 @@ SeqRenderData *seq_prefetch_get_original_context(const SeqRenderData *context); /** * For cache context swapping. */ -Strip *seq_prefetch_get_original_sequence(Strip *seq, Scene *scene); +Strip *seq_prefetch_get_original_sequence(Strip *strip, Scene *scene); diff --git a/source/blender/sequencer/intern/proxy.cc b/source/blender/sequencer/intern/proxy.cc index 9fc33ca2fdee..9a86dbd4ac26 100644 --- a/source/blender/sequencer/intern/proxy.cc +++ b/source/blender/sequencer/intern/proxy.cc @@ -62,7 +62,7 @@ struct SeqIndexBuildContext { Main *bmain; Depsgraph *depsgraph; Scene *scene; - Strip *seq, *orig_seq; + Strip *strip, *orig_seq; SessionUID orig_seq_uid; }; @@ -94,12 +94,12 @@ double SEQ_rendersize_to_scale_factor(int render_size) return 1.0; } -bool seq_proxy_get_custom_file_filepath(Strip *seq, char *filepath, const int view_id) +bool seq_proxy_get_custom_file_filepath(Strip *strip, char *filepath, const int view_id) { /* Ideally this would be #PROXY_MAXFILE however BLI_path_abs clamps to #FILE_MAX. */ char filepath_temp[FILE_MAX]; char suffix[24]; - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; if (proxy == nullptr) { return false; @@ -123,7 +123,7 @@ bool seq_proxy_get_custom_file_filepath(Strip *seq, char *filepath, const int vi } static bool seq_proxy_get_filepath(Scene *scene, - Strip *seq, + Strip *strip, int timeline_frame, eSpaceSeq_Proxy_RenderSize render_size, char *filepath, @@ -132,7 +132,7 @@ static bool seq_proxy_get_filepath(Scene *scene, char dirpath[PROXY_MAXFILE]; char suffix[24] = {'\0'}; Editing *ed = SEQ_editing_get(scene); - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; if (proxy == nullptr) { return false; @@ -147,7 +147,7 @@ static bool seq_proxy_get_filepath(Scene *scene, if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE && ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE) { - if (seq_proxy_get_custom_file_filepath(seq, filepath, view_id)) { + if (seq_proxy_get_custom_file_filepath(strip, filepath, view_id)) { return true; } } @@ -165,10 +165,10 @@ static bool seq_proxy_get_filepath(Scene *scene, else { /* Pre strip with custom dir. */ if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) { - STRNCPY(dirpath, seq->data->proxy->dirpath); + STRNCPY(dirpath, strip->data->proxy->dirpath); } else { /* Per strip default. */ - SNPRINTF(dirpath, "%s" SEP_STR "BL_proxy", seq->data->dirpath); + SNPRINTF(dirpath, "%s" SEP_STR "BL_proxy", strip->data->dirpath); } } @@ -180,62 +180,63 @@ static bool seq_proxy_get_filepath(Scene *scene, "%s" SEP_STR "images" SEP_STR "%d" SEP_STR "%s_proxy%s.jpg", dirpath, proxy_size_number, - SEQ_render_give_stripelem(scene, seq, timeline_frame)->filename, + SEQ_render_give_stripelem(scene, strip, timeline_frame)->filename, suffix); BLI_path_abs(filepath, BKE_main_blendfile_path_from_global()); return true; } -bool SEQ_can_use_proxy(const SeqRenderData *context, const Strip *seq, int psize) +bool SEQ_can_use_proxy(const SeqRenderData *context, const Strip *strip, int psize) { - if (seq->data->proxy == nullptr || !context->use_proxies) { + if (strip->data->proxy == nullptr || !context->use_proxies) { return false; } - short size_flags = seq->data->proxy->build_size_flags; - return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; + short size_flags = strip->data->proxy->build_size_flags; + return (strip->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && + (size_flags & psize) != 0; } -ImBuf *seq_proxy_fetch(const SeqRenderData *context, Strip *seq, int timeline_frame) +ImBuf *seq_proxy_fetch(const SeqRenderData *context, Strip *strip, int timeline_frame) { char filepath[PROXY_MAXFILE]; - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; const eSpaceSeq_Proxy_RenderSize psize = eSpaceSeq_Proxy_RenderSize( context->preview_render_size); StripAnim *sanim; /* only use proxies, if they are enabled (even if present!) */ - if (!SEQ_can_use_proxy(context, seq, SEQ_rendersize_to_proxysize(psize))) { + if (!SEQ_can_use_proxy(context, strip, SEQ_rendersize_to_proxysize(psize))) { return nullptr; } if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - int frameno = round_fl_to_int(SEQ_give_frame_index(context->scene, seq, timeline_frame)) + - seq->anim_startofs; + int frameno = round_fl_to_int(SEQ_give_frame_index(context->scene, strip, timeline_frame)) + + strip->anim_startofs; if (proxy->anim == nullptr) { if (seq_proxy_get_filepath( - context->scene, seq, timeline_frame, psize, filepath, context->view_id) == 0) + context->scene, strip, timeline_frame, psize, filepath, context->view_id) == 0) { return nullptr; } - proxy->anim = openanim(filepath, IB_rect, 0, seq->data->colorspace_settings.name); + proxy->anim = openanim(filepath, IB_rect, 0, strip->data->colorspace_settings.name); } if (proxy->anim == nullptr) { return nullptr; } - seq_open_anim_file(context->scene, seq, true); - sanim = static_cast(seq->anims.first); + strip_open_anim_file(context->scene, strip, true); + sanim = static_cast(strip->anims.first); frameno = MOV_calc_frame_index_with_timecode( - sanim ? sanim->anim : nullptr, IMB_Timecode_Type(seq->data->proxy->tc), frameno); + sanim ? sanim->anim : nullptr, IMB_Timecode_Type(strip->data->proxy->tc), frameno); return MOV_decode_frame(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } if (seq_proxy_get_filepath( - context->scene, seq, timeline_frame, psize, filepath, context->view_id) == 0) + context->scene, strip, timeline_frame, psize, filepath, context->view_id) == 0) { return nullptr; } @@ -255,7 +256,7 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Strip *seq, int timeline_fr static void seq_proxy_build_frame(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, int timeline_frame, int proxy_render_size, const bool overwrite) @@ -265,7 +266,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, Scene *scene = context->scene; if (!seq_proxy_get_filepath(scene, - seq, + strip, timeline_frame, eSpaceSeq_Proxy_RenderSize(proxy_render_size), filepath, @@ -278,7 +279,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, return; } - ibuf_tmp = seq_render_strip(context, state, seq, timeline_frame); + ibuf_tmp = seq_render_strip(context, state, strip, timeline_frame); int rectx = (proxy_render_size * ibuf_tmp->x) / 100; int recty = (proxy_render_size * ibuf_tmp->y) / 100; @@ -291,7 +292,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, ibuf = ibuf_tmp; } - const int quality = seq->data->proxy->quality; + const int quality = strip->data->proxy->quality; const bool save_float = ibuf->float_buffer.data != nullptr; ibuf->foptions.quality = quality; if (save_float) { @@ -334,7 +335,7 @@ struct MultiViewPrefixVars { * \note This function must first a `view_id` of zero, to initialize `prefix_vars` * for use with other views. */ -static bool seq_proxy_multiview_context_invalid(Strip *seq, +static bool seq_proxy_multiview_context_invalid(Strip *strip, Scene *scene, const int view_id, MultiViewPrefixVars *prefix_vars) @@ -343,7 +344,7 @@ static bool seq_proxy_multiview_context_invalid(Strip *seq, return false; } - if ((seq->type == SEQ_TYPE_IMAGE) && (seq->views_format == R_IMF_VIEWS_INDIVIDUAL)) { + if ((strip->type == STRIP_TYPE_IMAGE) && (strip->views_format == R_IMF_VIEWS_INDIVIDUAL)) { if (view_id == 0) { /* Clear on first use. */ prefix_vars->prefix[0] = '\0'; @@ -351,7 +352,7 @@ static bool seq_proxy_multiview_context_invalid(Strip *seq, char filepath[FILE_MAX]; BLI_path_join( - filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); BLI_path_abs(filepath, BKE_main_blendfile_path_from_global()); BKE_scene_multiview_view_prefix_get(scene, filepath, prefix_vars->prefix, &prefix_vars->ext); } @@ -374,7 +375,7 @@ static bool seq_proxy_multiview_context_invalid(Strip *seq, /** * This returns the maximum possible number of required contexts */ -static int seq_proxy_context_count(Strip *seq, Scene *scene) +static int seq_proxy_context_count(Strip *strip, Scene *scene) { int num_views = 1; @@ -382,13 +383,13 @@ static int seq_proxy_context_count(Strip *seq, Scene *scene) return 1; } - switch (seq->type) { - case SEQ_TYPE_MOVIE: { - num_views = BLI_listbase_count(&seq->anims); + switch (strip->type) { + case STRIP_TYPE_MOVIE: { + num_views = BLI_listbase_count(&strip->anims); break; } - case SEQ_TYPE_IMAGE: { - switch (seq->views_format) { + case STRIP_TYPE_IMAGE: { + switch (strip->views_format) { case R_IMF_VIEWS_INDIVIDUAL: num_views = BKE_scene_multiview_num_views_get(&scene->r); break; @@ -408,13 +409,13 @@ static int seq_proxy_context_count(Strip *seq, Scene *scene) return num_views; } -static bool seq_proxy_need_rebuild(Strip *seq, MovieReader *anim) +static bool seq_proxy_need_rebuild(Strip *strip, MovieReader *anim) { - if ((seq->data->proxy->build_flags & SEQ_PROXY_SKIP_EXISTING) == 0) { + if ((strip->data->proxy->build_flags & SEQ_PROXY_SKIP_EXISTING) == 0) { return true; } - IMB_Proxy_Size required_proxies = IMB_Proxy_Size(seq->data->proxy->build_size_flags); + IMB_Proxy_Size required_proxies = IMB_Proxy_Size(strip->data->proxy->build_size_flags); int built_proxies = MOV_get_existing_proxies(anim); return (required_proxies & built_proxies) != required_proxies; } @@ -422,7 +423,7 @@ static bool seq_proxy_need_rebuild(Strip *seq, MovieReader *anim) bool SEQ_proxy_rebuild_context(Main *bmain, Depsgraph *depsgraph, Scene *scene, - Strip *seq, + Strip *strip, blender::Set *processed_paths, ListBase *queue, bool build_only_on_bad_performance) @@ -433,36 +434,36 @@ bool SEQ_proxy_rebuild_context(Main *bmain, int num_files; int i; - if (!seq->data || !seq->data->proxy) { + if (!strip->data || !strip->data->proxy) { return true; } - if (!(seq->flag & SEQ_USE_PROXY)) { + if (!(strip->flag & SEQ_USE_PROXY)) { return true; } - num_files = seq_proxy_context_count(seq, scene); + num_files = seq_proxy_context_count(strip, scene); MultiViewPrefixVars prefix_vars; /* Initialized by #seq_proxy_multiview_context_invalid. */ for (i = 0; i < num_files; i++) { - if (seq_proxy_multiview_context_invalid(seq, scene, i, &prefix_vars)) { + if (seq_proxy_multiview_context_invalid(strip, scene, i, &prefix_vars)) { continue; } /* Check if proxies are already built here, because actually opening anims takes a lot of * time. */ - seq_open_anim_file(scene, seq, false); - StripAnim *sanim = static_cast(BLI_findlink(&seq->anims, i)); - if (sanim->anim && !seq_proxy_need_rebuild(seq, sanim->anim)) { + strip_open_anim_file(scene, strip, false); + StripAnim *sanim = static_cast(BLI_findlink(&strip->anims, i)); + if (sanim->anim && !seq_proxy_need_rebuild(strip, sanim->anim)) { continue; } - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); context = static_cast( - MEM_callocN(sizeof(SeqIndexBuildContext), "seq proxy rebuild context")); + MEM_callocN(sizeof(SeqIndexBuildContext), "strip proxy rebuild context")); - nseq = SEQ_sequence_dupli_recursive(scene, scene, nullptr, seq, 0); + nseq = SEQ_sequence_dupli_recursive(scene, scene, nullptr, strip, 0); context->tc_flags = nseq->data->proxy->build_tc_flags; context->size_flags = nseq->data->proxy->build_size_flags; @@ -472,14 +473,14 @@ bool SEQ_proxy_rebuild_context(Main *bmain, context->bmain = bmain; context->depsgraph = depsgraph; context->scene = scene; - context->orig_seq = seq; - context->orig_seq_uid = seq->runtime.session_uid; - context->seq = nseq; + context->orig_seq = strip; + context->orig_seq_uid = strip->runtime.session_uid; + context->strip = nseq; context->view_id = i; /* only for images */ - if (nseq->type == SEQ_TYPE_MOVIE) { - seq_open_anim_file(scene, nseq, true); + if (nseq->type == STRIP_TYPE_MOVIE) { + strip_open_anim_file(scene, nseq, true); sanim = static_cast(BLI_findlink(&nseq->anims, i)); if (sanim->anim) { @@ -508,12 +509,12 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, wmJobWorkerStatus *worker_ { const bool overwrite = context->overwrite; SeqRenderData render_context; - Strip *seq = context->seq; + Strip *strip = context->strip; Scene *scene = context->scene; Main *bmain = context->bmain; int timeline_frame; - if (seq->type == SEQ_TYPE_MOVIE) { + if (strip->type == STRIP_TYPE_MOVIE) { if (context->proxy_builder) { MOV_proxy_builder_process(context->proxy_builder, &worker_status->stop, @@ -524,12 +525,12 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, wmJobWorkerStatus *worker_ return; } - if (!(seq->flag & SEQ_USE_PROXY)) { + if (!(strip->flag & SEQ_USE_PROXY)) { return; } /* that's why it is called custom... */ - if (seq->data->proxy && seq->data->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { + if (strip->data->proxy && strip->data->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { return; } @@ -546,26 +547,27 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, wmJobWorkerStatus *worker_ SeqRenderState state; - for (timeline_frame = SEQ_time_left_handle_frame_get(scene, seq); - timeline_frame < SEQ_time_right_handle_frame_get(scene, seq); + for (timeline_frame = SEQ_time_left_handle_frame_get(scene, strip); + timeline_frame < SEQ_time_right_handle_frame_get(scene, strip); timeline_frame++) { if (context->size_flags & IMB_PROXY_25) { - seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 25, overwrite); + seq_proxy_build_frame(&render_context, &state, strip, timeline_frame, 25, overwrite); } if (context->size_flags & IMB_PROXY_50) { - seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 50, overwrite); + seq_proxy_build_frame(&render_context, &state, strip, timeline_frame, 50, overwrite); } if (context->size_flags & IMB_PROXY_75) { - seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 75, overwrite); + seq_proxy_build_frame(&render_context, &state, strip, timeline_frame, 75, overwrite); } if (context->size_flags & IMB_PROXY_100) { - seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 100, overwrite); + seq_proxy_build_frame(&render_context, &state, strip, timeline_frame, 100, overwrite); } - worker_status->progress = float(timeline_frame - SEQ_time_left_handle_frame_get(scene, seq)) / - (SEQ_time_right_handle_frame_get(scene, seq) - - SEQ_time_left_handle_frame_get(scene, seq)); + worker_status->progress = float(timeline_frame - + SEQ_time_left_handle_frame_get(scene, strip)) / + (SEQ_time_right_handle_frame_get(scene, strip) - + SEQ_time_left_handle_frame_get(scene, strip)); worker_status->do_update = true; if (worker_status->stop || G.is_break) { @@ -577,28 +579,28 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, wmJobWorkerStatus *worker_ void SEQ_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop) { if (context->proxy_builder) { - LISTBASE_FOREACH (StripAnim *, sanim, &context->seq->anims) { + LISTBASE_FOREACH (StripAnim *, sanim, &context->strip->anims) { MOV_close_proxies(sanim->anim); } MOV_proxy_builder_finish(context->proxy_builder, stop); } - seq_free_sequence_recurse(nullptr, context->seq, true); + seq_free_sequence_recurse(nullptr, context->strip, true); MEM_freeN(context); } -void SEQ_proxy_set(Strip *seq, bool value) +void SEQ_proxy_set(Strip *strip, bool value) { if (value) { - seq->flag |= SEQ_USE_PROXY; - if (seq->data->proxy == nullptr) { - seq->data->proxy = seq_strip_proxy_alloc(); + strip->flag |= SEQ_USE_PROXY; + if (strip->data->proxy == nullptr) { + strip->data->proxy = seq_strip_proxy_alloc(); } } else { - seq->flag &= ~SEQ_USE_PROXY; + strip->flag &= ~SEQ_USE_PROXY; } } @@ -612,10 +614,10 @@ void seq_proxy_index_dir_set(MovieReader *anim, const char *base_dir) MOV_set_custom_proxy_dir(anim, dirname); } -void free_proxy_seq(Strip *seq) +void free_proxy_seq(Strip *strip) { - if (seq->data && seq->data->proxy && seq->data->proxy->anim) { - MOV_close(seq->data->proxy->anim); - seq->data->proxy->anim = nullptr; + if (strip->data && strip->data->proxy && strip->data->proxy->anim) { + MOV_close(strip->data->proxy->anim); + strip->data->proxy->anim = nullptr; } } diff --git a/source/blender/sequencer/intern/proxy.hh b/source/blender/sequencer/intern/proxy.hh index 884bbe7dcedb..af744123258d 100644 --- a/source/blender/sequencer/intern/proxy.hh +++ b/source/blender/sequencer/intern/proxy.hh @@ -9,12 +9,13 @@ */ struct ImBuf; +struct MovieReader; struct SeqRenderData; struct Strip; struct anim; #define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE) -ImBuf *seq_proxy_fetch(const SeqRenderData *context, Strip *seq, int timeline_frame); -bool seq_proxy_get_custom_file_filepath(Strip *seq, char *filepath, int view_id); -void free_proxy_seq(Strip *seq); +ImBuf *seq_proxy_fetch(const SeqRenderData *context, Strip *strip, int timeline_frame); +bool seq_proxy_get_custom_file_filepath(Strip *strip, char *filepath, int view_id); +void free_proxy_seq(Strip *strip); void seq_proxy_index_dir_set(MovieReader *anim, const char *base_dir); diff --git a/source/blender/sequencer/intern/render.cc b/source/blender/sequencer/intern/render.cc index d357b2fa999b..01893d148b7d 100644 --- a/source/blender/sequencer/intern/render.cc +++ b/source/blender/sequencer/intern/render.cc @@ -247,22 +247,22 @@ void SEQ_render_new_render_data(Main *bmain, r_context->is_prefetch_render = false; } -StripElem *SEQ_render_give_stripelem(const Scene *scene, const Strip *seq, int timeline_frame) +StripElem *SEQ_render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame) { - StripElem *se = seq->data->stripdata; + StripElem *se = strip->data->stripdata; - if (seq->type == SEQ_TYPE_IMAGE) { + if (strip->type == STRIP_TYPE_IMAGE) { /* only IMAGE strips use the whole array, MOVIE strips use only the first element, * all other strips don't use this... */ - int frame_index = round_fl_to_int(SEQ_give_frame_index(scene, seq, timeline_frame)); + int frame_index = round_fl_to_int(SEQ_give_frame_index(scene, strip, timeline_frame)); if (frame_index == -1 || se == nullptr) { return nullptr; } - se += frame_index + seq->anim_startofs; + se += frame_index + strip->anim_startofs; } return se; } @@ -290,7 +290,7 @@ Vector seq_get_shown_sequences(const Scene *scene, return strips_vec; } -StripScreenQuad get_strip_screen_quad(const SeqRenderData *context, const Strip *seq) +StripScreenQuad get_strip_screen_quad(const SeqRenderData *context, const Strip *strip) { Scene *scene = context->scene; const int x = context->rectx; @@ -298,8 +298,12 @@ StripScreenQuad get_strip_screen_quad(const SeqRenderData *context, const Strip float2 offset{x * 0.5f, y * 0.5f}; float quad[4][2]; - SEQ_image_transform_final_quad_get(scene, seq, quad); - return StripScreenQuad{quad[0] + offset, quad[1] + offset, quad[2] + offset, quad[3] + offset}; + SEQ_image_transform_final_quad_get(scene, strip, quad); + const float scale = SEQ_rendersize_to_scale_factor(context->preview_render_size); + return StripScreenQuad{float2(quad[0]) * scale + offset, + float2(quad[1]) * scale + offset, + float2(quad[2]) * scale + offset, + float2(quad[3]) * scale + offset}; } /* Is quad `a` fully contained (i.e. covered by) quad `b`? For that to happen, @@ -328,9 +332,9 @@ struct OpaqueQuadTracker { * completely covered by any other strip. It does not detect case where * a strip is not covered by a single strip, but is behind of the union * of the strips above. */ - bool is_occluded(const SeqRenderData *context, const Strip *seq, int order_index) const + bool is_occluded(const SeqRenderData *context, const Strip *strip, int order_index) const { - StripScreenQuad quad = get_strip_screen_quad(context, seq); + StripScreenQuad quad = get_strip_screen_quad(context, strip); if (quad.is_empty()) { /* Strip size is not initialized/valid, we can't know if it is occluded. */ return false; @@ -343,9 +347,9 @@ struct OpaqueQuadTracker { return false; } - void add_occluder(const SeqRenderData *context, const Strip *seq, int order_index) + void add_occluder(const SeqRenderData *context, const Strip *strip, int order_index) { - StripScreenQuad quad = get_strip_screen_quad(context, seq); + StripScreenQuad quad = get_strip_screen_quad(context, strip); if (!quad.is_empty()) { opaques.append({quad, order_index}); } @@ -357,7 +361,8 @@ struct OpaqueQuadTracker { /* -------------------------------------------------------------------- */ /** \name Preprocessing & Effects * - * Input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE. + * Input preprocessing for STRIP_TYPE_IMAGE, STRIP_TYPE_MOVIE, STRIP_TYPE_MOVIECLIP and + * STRIP_TYPE_SCENE. * * Do all the things you can't really do afterwards using sequence effects * (read: before re-scaling to render resolution has been done). @@ -374,9 +379,9 @@ struct OpaqueQuadTracker { * - Pre-multiply. * \{ */ -static bool sequencer_use_transform(const Strip *seq) +static bool sequencer_use_transform(const Strip *strip) { - const StripTransform *transform = seq->data->transform; + const StripTransform *transform = strip->data->transform; if (transform->xofs != 0 || transform->yofs != 0 || transform->scale_x != 1 || transform->scale_y != 1 || transform->rotation != 0) @@ -387,9 +392,9 @@ static bool sequencer_use_transform(const Strip *seq) return false; } -static bool sequencer_use_crop(const Strip *seq) +static bool sequencer_use_crop(const Strip *strip) { - const StripCrop *crop = seq->data->crop; + const StripCrop *crop = strip->data->crop; if (crop->left > 0 || crop->right > 0 || crop->top > 0 || crop->bottom > 0) { return true; } @@ -398,7 +403,7 @@ static bool sequencer_use_crop(const Strip *seq) } static bool seq_input_have_to_preprocess(const SeqRenderData *context, - Strip *seq, + Strip *strip, float /*timeline_frame*/) { float mul; @@ -407,27 +412,27 @@ static bool seq_input_have_to_preprocess(const SeqRenderData *context, return false; } - if ((seq->flag & (SEQ_FILTERY | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_FLOAT)) || - sequencer_use_crop(seq) || sequencer_use_transform(seq)) + if ((strip->flag & (SEQ_FILTERY | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_FLOAT)) || + sequencer_use_crop(strip) || sequencer_use_transform(strip)) { return true; } - mul = seq->mul; + mul = strip->mul; - if (seq->blend_mode == SEQ_BLEND_REPLACE) { - mul *= seq->blend_opacity / 100.0f; + if (strip->blend_mode == SEQ_BLEND_REPLACE) { + mul *= strip->blend_opacity / 100.0f; } if (mul != 1.0f) { return true; } - if (seq->sat != 1.0f) { + if (strip->sat != 1.0f) { return true; } - if (seq->modifiers.first) { + if (strip->modifiers.first) { return true; } @@ -440,28 +445,28 @@ static bool seq_input_have_to_preprocess(const SeqRenderData *context, * Other strip types are rendered with original media resolution, unless proxies are * enabled for them. With proxies `is_proxy_image` will be set correctly to true. */ -static bool seq_need_scale_to_render_size(const Strip *seq, bool is_proxy_image) +static bool seq_need_scale_to_render_size(const Strip *strip, bool is_proxy_image) { if (is_proxy_image) { return true; } - if ((seq->type & SEQ_TYPE_EFFECT) != 0 || seq->type == SEQ_TYPE_MASK || - seq->type == SEQ_TYPE_META || - (seq->type == SEQ_TYPE_SCENE && ((seq->flag & SEQ_SCENE_STRIPS) != 0))) + if ((strip->type & STRIP_TYPE_EFFECT) != 0 || strip->type == STRIP_TYPE_MASK || + strip->type == STRIP_TYPE_META || + (strip->type == STRIP_TYPE_SCENE && ((strip->flag & SEQ_SCENE_STRIPS) != 0))) { return true; } return false; } -static void sequencer_image_crop_transform_matrix(const Strip *seq, +static void sequencer_image_crop_transform_matrix(const Strip *strip, const ImBuf *in, const ImBuf *out, const float image_scale_factor, const float preview_scale_factor, float r_transform_matrix[4][4]) { - const StripTransform *transform = seq->data->transform; + const StripTransform *transform = strip->data->transform; const float scale_x = transform->scale_x * image_scale_factor; const float scale_y = transform->scale_y * image_scale_factor; const float image_center_offs_x = (out->x - in->x) / 2; @@ -480,12 +485,12 @@ static void sequencer_image_crop_transform_matrix(const Strip *seq, invert_m4(r_transform_matrix); } -static void sequencer_image_crop_init(const Strip *seq, +static void sequencer_image_crop_init(const Strip *strip, const ImBuf *in, float crop_scale_factor, rctf *r_crop) { - const StripCrop *c = seq->data->crop; + const StripCrop *c = strip->data->crop; const int left = c->left * crop_scale_factor; const int right = c->right * crop_scale_factor; const int top = c->top * crop_scale_factor; @@ -494,7 +499,7 @@ static void sequencer_image_crop_init(const Strip *seq, BLI_rctf_init(r_crop, left, in->x - right, bottom, in->y - top); } -static bool is_strip_covering_screen(const SeqRenderData *context, const Strip *seq) +static bool is_strip_covering_screen(const SeqRenderData *context, const Strip *strip) { /* The check is done by checking whether all corners of viewport fit inside * of the transformed strip. If they do not, the strip does not cover @@ -509,7 +514,10 @@ static bool is_strip_covering_screen(const SeqRenderData *context, const Strip * x0 = xmid - (xmid - x0) * x_aspect; x1 = xmid + (x1 - xmid) * x_aspect; } - StripScreenQuad quad = get_strip_screen_quad(context, seq); + StripScreenQuad quad = get_strip_screen_quad(context, strip); + if (quad.is_empty()) { + return false; /* Strip is zero size. */ + } StripScreenQuad screen{float2(x0, y0), float2(x1, y0), float2(x0, y1), float2(x1, y1)}; return is_quad_a_inside_b(screen, quad); @@ -540,31 +548,31 @@ static eIMBInterpolationFilterMode get_auto_filter(const StripTransform *transfo } static void sequencer_preprocess_transform_crop( - ImBuf *in, ImBuf *out, const SeqRenderData *context, Strip *seq, const bool is_proxy_image) + ImBuf *in, ImBuf *out, const SeqRenderData *context, Strip *strip, const bool is_proxy_image) { const Scene *scene = context->scene; const float preview_scale_factor = context->preview_render_size == SEQ_RENDER_SIZE_SCENE ? float(scene->r.size) / 100 : SEQ_rendersize_to_scale_factor( context->preview_render_size); - const bool do_scale_to_render_size = seq_need_scale_to_render_size(seq, is_proxy_image); + const bool do_scale_to_render_size = seq_need_scale_to_render_size(strip, is_proxy_image); const float image_scale_factor = do_scale_to_render_size ? 1.0f : preview_scale_factor; float transform_matrix[4][4]; sequencer_image_crop_transform_matrix( - seq, in, out, image_scale_factor, preview_scale_factor, transform_matrix); + strip, in, out, image_scale_factor, preview_scale_factor, transform_matrix); /* Proxy image is smaller, so crop values must be corrected by proxy scale factor. * Proxy scale factor always matches preview_scale_factor. */ rctf source_crop; const float crop_scale_factor = do_scale_to_render_size ? preview_scale_factor : 1.0f; - sequencer_image_crop_init(seq, in, crop_scale_factor, &source_crop); + sequencer_image_crop_init(strip, in, crop_scale_factor, &source_crop); - const StripTransform *transform = seq->data->transform; + const StripTransform *transform = strip->data->transform; eIMBInterpolationFilterMode filter = IMB_FILTER_NEAREST; switch (transform->filter) { case SEQ_TRANSFORM_FILTER_AUTO: - filter = get_auto_filter(seq->data->transform); + filter = get_auto_filter(strip->data->transform); break; case SEQ_TRANSFORM_FILTER_NEAREST: filter = IMB_FILTER_NEAREST; @@ -585,7 +593,7 @@ static void sequencer_preprocess_transform_crop( IMB_transform(in, out, IMB_TRANSFORM_MODE_CROP_SRC, filter, transform_matrix, &source_crop); - if (is_strip_covering_screen(context, seq)) { + if (is_strip_covering_screen(context, strip)) { out->planes = in->planes; } else { @@ -633,7 +641,7 @@ static void multiply_ibuf(ImBuf *ibuf, const float fmul, const bool multiply_alp } static ImBuf *input_preprocess(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, ImBuf *ibuf, const bool is_proxy_image) @@ -642,7 +650,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, ImBuf *preprocessed_ibuf = nullptr; /* Deinterlace. */ - if ((seq->flag & SEQ_FILTERY) && !ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP)) { + if ((strip->flag & SEQ_FILTERY) && !ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_MOVIECLIP)) { /* Change original image pointer to avoid another duplication in SEQ_USE_TRANSFORM. */ preprocessed_ibuf = IMB_makeSingleUser(ibuf); ibuf = preprocessed_ibuf; @@ -650,14 +658,14 @@ static ImBuf *input_preprocess(const SeqRenderData *context, IMB_filtery(preprocessed_ibuf); } - if (sequencer_use_crop(seq) || sequencer_use_transform(seq) || context->rectx != ibuf->x || + if (sequencer_use_crop(strip) || sequencer_use_transform(strip) || context->rectx != ibuf->x || context->recty != ibuf->y) { const int x = context->rectx; const int y = context->recty; preprocessed_ibuf = IMB_allocImBuf(x, y, 32, ibuf->float_buffer.data ? IB_rectfloat : IB_rect); - sequencer_preprocess_transform_crop(ibuf, preprocessed_ibuf, context, seq, is_proxy_image); + sequencer_preprocess_transform_crop(ibuf, preprocessed_ibuf, context, strip, is_proxy_image); seq_imbuf_assign_spaces(scene, preprocessed_ibuf); IMB_metadata_copy(preprocessed_ibuf, ibuf); @@ -669,19 +677,19 @@ static ImBuf *input_preprocess(const SeqRenderData *context, preprocessed_ibuf = IMB_makeSingleUser(ibuf); } - if (seq->flag & SEQ_FLIPX) { + if (strip->flag & SEQ_FLIPX) { IMB_flipx(preprocessed_ibuf); } - if (seq->flag & SEQ_FLIPY) { + if (strip->flag & SEQ_FLIPY) { IMB_flipy(preprocessed_ibuf); } - if (seq->sat != 1.0f) { - IMB_saturation(preprocessed_ibuf, seq->sat); + if (strip->sat != 1.0f) { + IMB_saturation(preprocessed_ibuf, strip->sat); } - if (seq->flag & SEQ_MAKE_FLOAT) { + if (strip->flag & SEQ_MAKE_FLOAT) { if (!preprocessed_ibuf->float_buffer.data) { seq_imbuf_to_sequencer_space(scene, preprocessed_ibuf, true); } @@ -691,25 +699,25 @@ static ImBuf *input_preprocess(const SeqRenderData *context, } } - float mul = seq->mul; - if (seq->blend_mode == SEQ_BLEND_REPLACE) { - mul *= seq->blend_opacity / 100.0f; + float mul = strip->mul; + if (strip->blend_mode == SEQ_BLEND_REPLACE) { + mul *= strip->blend_opacity / 100.0f; } if (mul != 1.0f) { - const bool multiply_alpha = (seq->flag & SEQ_MULTIPLY_ALPHA); + const bool multiply_alpha = (strip->flag & SEQ_MULTIPLY_ALPHA); multiply_ibuf(preprocessed_ibuf, mul, multiply_alpha); } - if (seq->modifiers.first) { - SEQ_modifier_apply_stack(context, seq, preprocessed_ibuf, timeline_frame); + if (strip->modifiers.first) { + SEQ_modifier_apply_stack(context, strip, preprocessed_ibuf, timeline_frame); } return preprocessed_ibuf; } static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, - Strip *seq, + Strip *strip, ImBuf *ibuf, float timeline_frame, bool use_preprocess, @@ -722,29 +730,29 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, } /* Proxies and non-generator effect strips are not stored in cache. */ - const bool is_effect_with_inputs = (seq->type & SEQ_TYPE_EFFECT) != 0 && - SEQ_effect_get_num_inputs(seq->type) != 0; + const bool is_effect_with_inputs = (strip->type & STRIP_TYPE_EFFECT) != 0 && + SEQ_effect_get_num_inputs(strip->type) != 0; if (!is_proxy_image && !is_effect_with_inputs) { - seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf); + seq_cache_put(context, strip, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf); } if (use_preprocess) { - ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image); + ibuf = input_preprocess(context, strip, timeline_frame, ibuf, is_proxy_image); } - seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf); + seq_cache_put(context, strip, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf); return ibuf; } static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, float timeline_frame) { Scene *scene = context->scene; float fac; int i; - SeqEffectHandle sh = SEQ_effect_handle_get(seq); + SeqEffectHandle sh = SEQ_effect_handle_get(strip); const FCurve *fcu = nullptr; ImBuf *ibuf[2]; Strip *input[2]; @@ -752,8 +760,8 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, ibuf[0] = ibuf[1] = nullptr; - input[0] = seq->seq1; - input[1] = seq->seq2; + input[0] = strip->seq1; + input[1] = strip->seq2; if (!sh.execute) { /* effect not supported in this version... */ @@ -761,33 +769,34 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, return out; } - if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { - sh.get_default_fac(scene, seq, timeline_frame, &fac); + if (strip->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { + sh.get_default_fac(scene, strip, timeline_frame, &fac); } else { - fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Strip, "effect_fader", 0, nullptr); + fcu = id_data_find_fcurve(&scene->id, strip, &RNA_Strip, "effect_fader", 0, nullptr); if (fcu) { fac = evaluate_fcurve(fcu, timeline_frame); } else { - fac = seq->effect_fader; + fac = strip->effect_fader; } } - StripEarlyOut early_out = sh.early_out(seq, fac); + StripEarlyOut early_out = sh.early_out(strip, fac); switch (early_out) { case StripEarlyOut::NoInput: - out = sh.execute(context, seq, timeline_frame, fac, nullptr, nullptr); + out = sh.execute(context, strip, timeline_frame, fac, nullptr, nullptr); break; case StripEarlyOut::DoEffect: for (i = 0; i < 2; i++) { /* Speed effect requires time remapping of `timeline_frame` for input(s). */ - if (input[0] && seq->type == SEQ_TYPE_SPEED) { - float target_frame = seq_speed_effect_target_frame_get(scene, seq, timeline_frame, i); + if (input[0] && strip->type == STRIP_TYPE_SPEED) { + float target_frame = strip_speed_effect_target_frame_get( + scene, strip, timeline_frame, i); /* Only convert to int when interpolation is not used. */ - SpeedControlVars *s = reinterpret_cast(seq->effectdata); + SpeedControlVars *s = reinterpret_cast(strip->effectdata); if ((s->flags & SEQ_SPEED_USE_INTERPOLATION) != 0) { target_frame = std::floor(target_frame); } @@ -801,8 +810,8 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, } } - if (ibuf[0] && (ibuf[1] || SEQ_effect_get_num_inputs(seq->type) == 1)) { - out = sh.execute(context, seq, timeline_frame, fac, ibuf[0], ibuf[1]); + if (ibuf[0] && (ibuf[1] || SEQ_effect_get_num_inputs(strip->type) == 1)) { + out = sh.execute(context, strip, timeline_frame, fac, ibuf[0], ibuf[1]); } break; case StripEarlyOut::UseInput1: @@ -834,11 +843,35 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, /** \name Individual strip rendering functions * \{ */ +static void convert_multilayer_ibuf(ImBuf *ibuf) +{ + /* Load the combined/RGB layer, if this is a multi-layer image. */ + BKE_movieclip_convert_multilayer_ibuf(ibuf); + + /* Combined layer might be non-4 channels, however the rest + * of sequencer assumes RGBA everywhere. Convert to 4 channel if needed. */ + if (ibuf->float_buffer.data != nullptr && ibuf->channels != 4) { + float *dst = static_cast(MEM_mallocN(sizeof(float[4]) * ibuf->x * ibuf->y, __func__)); + IMB_buffer_float_from_float_threaded(dst, + ibuf->float_buffer.data, + ibuf->channels, + IB_PROFILE_LINEAR_RGB, + IB_PROFILE_LINEAR_RGB, + false, + ibuf->x, + ibuf->y, + ibuf->x, + ibuf->x); + IMB_assign_float_buffer(ibuf, dst, IB_TAKE_OWNERSHIP); + ibuf->channels = 4; + } +} + /** * Render individual view for multi-view or single (default view) for mono-view. */ static ImBuf *seq_render_image_strip_view(const SeqRenderData *context, - Strip *seq, + Strip *strip, char *filepath, char *prefix, const char *ext, @@ -846,24 +879,25 @@ static ImBuf *seq_render_image_strip_view(const SeqRenderData *context, { ImBuf *ibuf = nullptr; - int flag = IB_rect | IB_metadata; - if (seq->alpha_mode == SEQ_ALPHA_PREMUL) { + int flag = IB_rect | IB_metadata | IB_multilayer; + if (strip->alpha_mode == SEQ_ALPHA_PREMUL) { flag |= IB_alphamode_premul; } if (prefix[0] == '\0') { - ibuf = IMB_loadiffname(filepath, flag, seq->data->colorspace_settings.name); + ibuf = IMB_loadiffname(filepath, flag, strip->data->colorspace_settings.name); } else { char filepath_view[FILE_MAX]; BKE_scene_multiview_view_prefix_get(context->scene, filepath, prefix, &ext); seq_multiview_name(context->scene, view_id, prefix, ext, filepath_view, FILE_MAX); - ibuf = IMB_loadiffname(filepath_view, flag, seq->data->colorspace_settings.name); + ibuf = IMB_loadiffname(filepath_view, flag, strip->data->colorspace_settings.name); } if (ibuf == nullptr) { return nullptr; } + convert_multilayer_ibuf(ibuf); /* We don't need both (speed reasons)! */ if (ibuf->float_buffer.data != nullptr && ibuf->byte_buffer.data != nullptr) { @@ -877,7 +911,7 @@ static ImBuf *seq_render_image_strip_view(const SeqRenderData *context, } static bool seq_image_strip_is_multiview_render(Scene *scene, - Strip *seq, + Strip *strip, int totfiles, const char *filepath, char *r_prefix, @@ -893,7 +927,7 @@ static bool seq_image_strip_is_multiview_render(Scene *scene, r_prefix[0] = '\0'; } - return (seq->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; + return (strip->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; } static ImBuf *create_missing_media_image(const SeqRenderData *context, int width, int height) @@ -914,7 +948,7 @@ static ImBuf *create_missing_media_image(const SeqRenderData *context, int width } static ImBuf *seq_render_image_strip(const SeqRenderData *context, - Strip *seq, + Strip *strip, int timeline_frame, bool *r_is_proxy_image) { @@ -923,25 +957,25 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, char prefix[FILE_MAX]; ImBuf *ibuf = nullptr; - StripElem *s_elem = SEQ_render_give_stripelem(context->scene, seq, timeline_frame); + StripElem *s_elem = SEQ_render_give_stripelem(context->scene, strip, timeline_frame); if (s_elem == nullptr) { return nullptr; } - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, s_elem->filename); + BLI_path_join(filepath, sizeof(filepath), strip->data->dirpath, s_elem->filename); BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&context->scene->id)); /* Try to get a proxy image. */ - ibuf = seq_proxy_fetch(context, seq, timeline_frame); + ibuf = seq_proxy_fetch(context, strip, timeline_frame); if (ibuf != nullptr) { *r_is_proxy_image = true; return ibuf; } /* Proxy not found, render original. */ - const int totfiles = seq_num_files(context->scene, seq->views_format, true); + const int totfiles = seq_num_files(context->scene, strip->views_format, true); bool is_multiview_render = seq_image_strip_is_multiview_render( - context->scene, seq, totfiles, filepath, prefix, ext); + context->scene, strip, totfiles, filepath, prefix, ext); if (is_multiview_render) { int totviews = BKE_scene_multiview_num_views_get(&context->scene->r); @@ -950,15 +984,15 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, for (int view_id = 0; view_id < totfiles; view_id++) { ibufs_arr[view_id] = seq_render_image_strip_view( - context, seq, filepath, prefix, ext, view_id); + context, strip, filepath, prefix, ext, view_id); } if (ibufs_arr[0] == nullptr) { return nullptr; } - if (seq->views_format == R_IMF_VIEWS_STEREO_3D) { - IMB_ImBufFromStereo3d(seq->stereo3d_format, ibufs_arr[0], &ibufs_arr[0], &ibufs_arr[1]); + if (strip->views_format == R_IMF_VIEWS_STEREO_3D) { + IMB_ImBufFromStereo3d(strip->stereo3d_format, ibufs_arr[0], &ibufs_arr[0], &ibufs_arr[1]); } for (int view_id = 0; view_id < totviews; view_id++) { @@ -967,7 +1001,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, if (view_id != context->view_id) { ibufs_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibufs_arr[view_id], timeline_frame, true, false); + &localcontext, strip, ibufs_arr[view_id], timeline_frame, true, false); } } @@ -984,10 +1018,10 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, MEM_freeN(ibufs_arr); } else { - ibuf = seq_render_image_strip_view(context, seq, filepath, prefix, ext, context->view_id); + ibuf = seq_render_image_strip_view(context, strip, filepath, prefix, ext, context->view_id); } - blender::seq::media_presence_set_missing(context->scene, seq, ibuf == nullptr); + blender::seq::media_presence_set_missing(context->scene, strip, ibuf == nullptr); if (ibuf == nullptr) { return create_missing_media_image(context, s_elem->orig_width, s_elem->orig_height); } @@ -999,41 +1033,41 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, } static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, - Strip *seq, + Strip *strip, int timeline_frame) { char filepath[PROXY_MAXFILE]; - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; if (proxy->anim == nullptr) { - if (seq_proxy_get_custom_file_filepath(seq, filepath, context->view_id)) { - proxy->anim = openanim(filepath, IB_rect, 0, seq->data->colorspace_settings.name); + if (seq_proxy_get_custom_file_filepath(strip, filepath, context->view_id)) { + proxy->anim = openanim(filepath, IB_rect, 0, strip->data->colorspace_settings.name); } if (proxy->anim == nullptr) { return nullptr; } } - int frameno = round_fl_to_int(SEQ_give_frame_index(context->scene, seq, timeline_frame)) + - seq->anim_startofs; + int frameno = round_fl_to_int(SEQ_give_frame_index(context->scene, strip, timeline_frame)) + + strip->anim_startofs; return MOV_decode_frame(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } -static IMB_Timecode_Type seq_render_movie_strip_timecode_get(Strip *seq) +static IMB_Timecode_Type seq_render_movie_strip_timecode_get(Strip *strip) { - bool use_timecodes = (seq->flag & SEQ_USE_PROXY) != 0; + bool use_timecodes = (strip->flag & SEQ_USE_PROXY) != 0; if (!use_timecodes) { return IMB_TC_NONE; } - return IMB_Timecode_Type(seq->data->proxy ? IMB_Timecode_Type(seq->data->proxy->tc) : - IMB_TC_NONE); + return IMB_Timecode_Type(strip->data->proxy ? IMB_Timecode_Type(strip->data->proxy->tc) : + IMB_TC_NONE); } /** * Render individual view for multi-view or single (default view) for mono-view. */ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, StripAnim *sanim, bool *r_is_proxy_image) @@ -1041,20 +1075,20 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, ImBuf *ibuf = nullptr; IMB_Proxy_Size psize = IMB_Proxy_Size(SEQ_rendersize_to_proxysize(context->preview_render_size)); const int frame_index = round_fl_to_int( - SEQ_give_frame_index(context->scene, seq, timeline_frame)); + SEQ_give_frame_index(context->scene, strip, timeline_frame)); - if (SEQ_can_use_proxy(context, seq, psize)) { + if (SEQ_can_use_proxy(context, strip, psize)) { /* Try to get a proxy image. * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */ if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE && - seq->data->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) + strip->data->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, timeline_frame); + ibuf = seq_render_movie_strip_custom_file_proxy(context, strip, timeline_frame); } else { ibuf = MOV_decode_frame(sanim->anim, - frame_index + seq->anim_startofs, - seq_render_movie_strip_timecode_get(seq), + frame_index + strip->anim_startofs, + seq_render_movie_strip_timecode_get(strip), psize); } @@ -1066,8 +1100,8 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, /* Fetching for requested proxy size failed, try fetching the original instead. */ if (ibuf == nullptr) { ibuf = MOV_decode_frame(sanim->anim, - frame_index + seq->anim_startofs, - seq_render_movie_strip_timecode_get(seq), + frame_index + strip->anim_startofs, + seq_render_movie_strip_timecode_get(strip), IMB_PROXY_NONE); } if (ibuf == nullptr) { @@ -1085,19 +1119,19 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, } static ImBuf *seq_render_movie_strip(const SeqRenderData *context, - Strip *seq, + Strip *strip, float timeline_frame, bool *r_is_proxy_image) { /* Load all the videos. */ - seq_open_anim_file(context->scene, seq, false); + strip_open_anim_file(context->scene, strip, false); ImBuf *ibuf = nullptr; - StripAnim *sanim = static_cast(seq->anims.first); - const int totfiles = seq_num_files(context->scene, seq->views_format, true); - bool is_multiview_render = (seq->flag & SEQ_USE_VIEWS) != 0 && + StripAnim *sanim = static_cast(strip->anims.first); + const int totfiles = seq_num_files(context->scene, strip->views_format, true); + bool is_multiview_render = (strip->flag & SEQ_USE_VIEWS) != 0 && (context->scene->r.scemode & R_MULTIVIEW) != 0 && - BLI_listbase_count_is_equal_to(&seq->anims, totfiles); + BLI_listbase_count_is_equal_to(&strip->anims, totfiles); if (is_multiview_render) { ImBuf **ibuf_arr; @@ -1106,23 +1140,23 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context, MEM_callocN(sizeof(ImBuf *) * totviews, "Sequence Image Views Imbufs")); int ibuf_view_id; - for (ibuf_view_id = 0, sanim = static_cast(seq->anims.first); sanim; + for (ibuf_view_id = 0, sanim = static_cast(strip->anims.first); sanim; sanim = sanim->next, ibuf_view_id++) { if (sanim->anim) { ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view( - context, seq, timeline_frame, sanim, r_is_proxy_image); + context, strip, timeline_frame, sanim, r_is_proxy_image); } } - if (seq->views_format == R_IMF_VIEWS_STEREO_3D) { + if (strip->views_format == R_IMF_VIEWS_STEREO_3D) { if (ibuf_arr[0] == nullptr) { /* Probably proxy hasn't been created yet. */ MEM_freeN(ibuf_arr); return nullptr; } - IMB_ImBufFromStereo3d(seq->stereo3d_format, ibuf_arr[0], &ibuf_arr[0], &ibuf_arr[1]); + IMB_ImBufFromStereo3d(strip->stereo3d_format, ibuf_arr[0], &ibuf_arr[0], &ibuf_arr[1]); } for (int view_id = 0; view_id < totviews; view_id++) { @@ -1131,7 +1165,7 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context, if (view_id != context->view_id && ibuf_arr[view_id]) { ibuf_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibuf_arr[view_id], timeline_frame, true, false); + &localcontext, strip, ibuf_arr[view_id], timeline_frame, true, false); } } @@ -1148,41 +1182,42 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context, MEM_freeN(ibuf_arr); } else { - ibuf = seq_render_movie_strip_view(context, seq, timeline_frame, sanim, r_is_proxy_image); + ibuf = seq_render_movie_strip_view(context, strip, timeline_frame, sanim, r_is_proxy_image); } - blender::seq::media_presence_set_missing(context->scene, seq, ibuf == nullptr); + blender::seq::media_presence_set_missing(context->scene, strip, ibuf == nullptr); if (ibuf == nullptr) { return create_missing_media_image( - context, seq->data->stripdata->orig_width, seq->data->stripdata->orig_height); + context, strip->data->stripdata->orig_width, strip->data->stripdata->orig_height); } if (*r_is_proxy_image == false) { if (sanim && sanim->anim) { - seq->data->stripdata->orig_fps = MOV_get_fps(sanim->anim); + strip->data->stripdata->orig_fps = MOV_get_fps(sanim->anim); } - seq->data->stripdata->orig_width = ibuf->x; - seq->data->stripdata->orig_height = ibuf->y; + strip->data->stripdata->orig_width = ibuf->x; + strip->data->stripdata->orig_height = ibuf->y; } return ibuf; } -static ImBuf *seq_get_movieclip_ibuf(Strip *seq, MovieClipUser user) +static ImBuf *seq_get_movieclip_ibuf(Strip *strip, MovieClipUser user) { ImBuf *ibuf = nullptr; float tloc[2], tscale, tangle; - if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) { - ibuf = BKE_movieclip_get_stable_ibuf(seq->clip, &user, 0, tloc, &tscale, &tangle); + if (strip->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) { + ibuf = BKE_movieclip_get_stable_ibuf(strip->clip, &user, 0, tloc, &tscale, &tangle); } else { - ibuf = BKE_movieclip_get_ibuf_flag(seq->clip, &user, seq->clip->flag, MOVIECLIP_CACHE_SKIP); + ibuf = BKE_movieclip_get_ibuf_flag( + strip->clip, &user, strip->clip->flag, MOVIECLIP_CACHE_SKIP); } return ibuf; } static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, - Strip *seq, + Strip *strip, float frame_index, bool *r_is_proxy_image) { @@ -1190,11 +1225,12 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, MovieClipUser user = *DNA_struct_default_get(MovieClipUser); IMB_Proxy_Size psize = IMB_Proxy_Size(SEQ_rendersize_to_proxysize(context->preview_render_size)); - if (!seq->clip) { + if (!strip->clip) { return nullptr; } - BKE_movieclip_user_set_frame(&user, frame_index + seq->anim_startofs + seq->clip->start_frame); + BKE_movieclip_user_set_frame(&user, + frame_index + strip->anim_startofs + strip->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; switch (psize) { @@ -1215,22 +1251,22 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, break; } - if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) { + if (strip->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) { user.render_flag |= MCLIP_PROXY_RENDER_UNDISTORT; } /* Try to get a proxy image. */ - ibuf = seq_get_movieclip_ibuf(seq, user); + ibuf = seq_get_movieclip_ibuf(strip, user); /* If clip doesn't use proxies, it will fallback to full size render of original file. */ - if (ibuf != nullptr && psize != IMB_PROXY_NONE && BKE_movieclip_proxy_enabled(seq->clip)) { + if (ibuf != nullptr && psize != IMB_PROXY_NONE && BKE_movieclip_proxy_enabled(strip->clip)) { *r_is_proxy_image = true; } /* If proxy is not found, grab full-size frame. */ if (ibuf == nullptr) { user.render_flag |= MCLIP_PROXY_RENDER_USE_FALLBACK_RENDER; - ibuf = seq_get_movieclip_ibuf(seq, user); + ibuf = seq_get_movieclip_ibuf(strip, user); } return ibuf; @@ -1322,15 +1358,15 @@ ImBuf *seq_render_mask(const SeqRenderData *context, return ibuf; } -static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Strip *seq, float frame_index) +static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Strip *strip, float frame_index) { - bool make_float = (seq->flag & SEQ_MAKE_FLOAT) != 0; + bool make_float = (strip->flag & SEQ_MAKE_FLOAT) != 0; - return seq_render_mask(context, seq->mask, frame_index, make_float); + return seq_render_mask(context, strip->mask, frame_index, make_float); } static ImBuf *seq_render_scene_strip(const SeqRenderData *context, - Strip *seq, + Strip *strip, float frame_index, float timeline_frame) { @@ -1350,7 +1386,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, /* Old info: * Hack! This function can be called from do_render_seq(), in that case - * the seq->scene can already have a Render initialized with same name, + * the strip->scene can already have a Render initialized with same name, * so we have to use a default name. (compositor uses scene name to * find render). * However, when called from within the UI (image preview in sequencer) @@ -1388,18 +1424,18 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, bool is_frame_update = false; Scene *scene; - /* don't refer to seq->scene above this point!, it can be nullptr */ - if (seq->scene == nullptr) { + /* don't refer to strip->scene above this point!, it can be nullptr */ + if (strip->scene == nullptr) { return create_missing_media_image(context, context->rectx, context->recty); } /* Prevent rendering scene recursively. */ - if (seq->scene == context->scene) { + if (strip->scene == context->scene) { return nullptr; } - scene = seq->scene; - frame = double(scene->r.sfra) + double(frame_index) + double(seq->anim_startofs); + scene = strip->scene; + frame = double(scene->r.sfra) + double(frame_index) + double(strip->anim_startofs); #if 0 /* UNUSED */ have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first; @@ -1420,8 +1456,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, BKE_scene_frame_set(scene, frame); - if (seq->scene_camera) { - camera = seq->scene_camera; + if (strip->scene_camera) { + camera = strip->scene_camera; } else { BKE_scene_camera_switch_update(scene); @@ -1432,7 +1468,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, goto finally; } - if (seq->flag & SEQ_SCENE_NO_ANNOTATION) { + if (strip->flag & SEQ_SCENE_NO_ANNOTATION) { use_gpencil = false; } @@ -1559,7 +1595,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, } if (view_id != context->view_id) { - seq_cache_put(&localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id]); + seq_cache_put( + &localcontext, strip, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id]); } RE_ReleaseResultImage(re); @@ -1600,7 +1637,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, */ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, float frame_index) { ImBuf *ibuf = nullptr; @@ -1608,11 +1645,11 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, ListBase *channels = nullptr; int offset; - seqbase = SEQ_get_seqbase_from_sequence(seq, &channels, &offset); + seqbase = SEQ_get_seqbase_from_sequence(strip, &channels, &offset); if (seqbase && !BLI_listbase_is_empty(seqbase)) { - if (seq->flag & SEQ_SCENE_STRIPS && seq->scene) { + if (strip->flag & SEQ_SCENE_STRIPS && strip->scene) { BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, frame_index + offset); } @@ -1636,39 +1673,39 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, static ImBuf *do_render_strip_uncached(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, float timeline_frame, bool *r_is_proxy_image) { ImBuf *ibuf = nullptr; - float frame_index = SEQ_give_frame_index(context->scene, seq, timeline_frame); - int type = (seq->type & SEQ_TYPE_EFFECT) ? SEQ_TYPE_EFFECT : seq->type; + float frame_index = SEQ_give_frame_index(context->scene, strip, timeline_frame); + int type = (strip->type & STRIP_TYPE_EFFECT) ? STRIP_TYPE_EFFECT : strip->type; switch (type) { - case SEQ_TYPE_META: { - ibuf = do_render_strip_seqbase(context, state, seq, frame_index); + case STRIP_TYPE_META: { + ibuf = do_render_strip_seqbase(context, state, strip, frame_index); break; } - case SEQ_TYPE_SCENE: { - if (seq->flag & SEQ_SCENE_STRIPS) { - if (seq->scene && (context->scene != seq->scene)) { + case STRIP_TYPE_SCENE: { + if (strip->flag & SEQ_SCENE_STRIPS) { + if (strip->scene && (context->scene != strip->scene)) { /* recursive check */ - if (BLI_linklist_index(state->scene_parents, seq->scene) != -1) { + if (BLI_linklist_index(state->scene_parents, strip->scene) != -1) { break; } LinkNode scene_parent{}; scene_parent.next = state->scene_parents; - scene_parent.link = seq->scene; + scene_parent.link = strip->scene; state->scene_parents = &scene_parent; /* end check */ /* Use the Scene sequence-strip's scene for the context when rendering the * scene's sequences (necessary for multi-cam selector among others). */ SeqRenderData local_context = *context; - local_context.scene = seq->scene; + local_context.scene = strip->scene; local_context.skip_cache = true; - ibuf = do_render_strip_seqbase(&local_context, state, seq, frame_index); + ibuf = do_render_strip_seqbase(&local_context, state, strip, frame_index); /* step back in the list */ state->scene_parents = state->scene_parents->next; @@ -1676,30 +1713,30 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, } else { /* scene can be nullptr after deletions */ - ibuf = seq_render_scene_strip(context, seq, frame_index, timeline_frame); + ibuf = seq_render_scene_strip(context, strip, frame_index, timeline_frame); } break; } - case SEQ_TYPE_EFFECT: { - ibuf = seq_render_effect_strip_impl(context, state, seq, timeline_frame); + case STRIP_TYPE_EFFECT: { + ibuf = seq_render_effect_strip_impl(context, state, strip, timeline_frame); break; } - case SEQ_TYPE_IMAGE: { - ibuf = seq_render_image_strip(context, seq, timeline_frame, r_is_proxy_image); + case STRIP_TYPE_IMAGE: { + ibuf = seq_render_image_strip(context, strip, timeline_frame, r_is_proxy_image); break; } - case SEQ_TYPE_MOVIE: { - ibuf = seq_render_movie_strip(context, seq, timeline_frame, r_is_proxy_image); + case STRIP_TYPE_MOVIE: { + ibuf = seq_render_movie_strip(context, strip, timeline_frame, r_is_proxy_image); break; } - case SEQ_TYPE_MOVIECLIP: { + case STRIP_TYPE_MOVIECLIP: { ibuf = seq_render_movieclip_strip( - context, seq, round_fl_to_int(frame_index), r_is_proxy_image); + context, strip, round_fl_to_int(frame_index), r_is_proxy_image); if (ibuf) { /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */ @@ -1715,9 +1752,9 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, break; } - case SEQ_TYPE_MASK: { + case STRIP_TYPE_MASK: { /* ibuf is always new */ - ibuf = seq_render_mask_strip(context, seq, frame_index); + ibuf = seq_render_mask_strip(context, strip, frame_index); break; } } @@ -1731,32 +1768,33 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, ImBuf *seq_render_strip(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, float timeline_frame) { ImBuf *ibuf = nullptr; bool use_preprocess = false; bool is_proxy_image = false; - ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED); + ibuf = seq_cache_get(context, strip, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED); if (ibuf != nullptr) { return ibuf; } /* Proxies are not stored in cache. */ - if (!SEQ_can_use_proxy(context, seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) + if (!SEQ_can_use_proxy( + context, strip, SEQ_rendersize_to_proxysize(context->preview_render_size))) { - ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW); + ibuf = seq_cache_get(context, strip, timeline_frame, SEQ_CACHE_STORE_RAW); } if (ibuf == nullptr) { - ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); + ibuf = do_render_strip_uncached(context, state, strip, timeline_frame, &is_proxy_image); } if (ibuf) { - use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame); + use_preprocess = seq_input_have_to_preprocess(context, strip, timeline_frame); ibuf = seq_render_preprocess_ibuf( - context, seq, ibuf, timeline_frame, use_preprocess, is_proxy_image); + context, strip, ibuf, timeline_frame, use_preprocess, is_proxy_image); } if (ibuf == nullptr) { @@ -1767,31 +1805,31 @@ ImBuf *seq_render_strip(const SeqRenderData *context, return ibuf; } -static bool seq_must_swap_input_in_blend_mode(Strip *seq) +static bool seq_must_swap_input_in_blend_mode(Strip *strip) { bool swap_input = false; /* bad hack, to fix crazy input ordering of * those two effects */ - if (ELEM(seq->blend_mode, SEQ_TYPE_ALPHAOVER, SEQ_TYPE_ALPHAUNDER, SEQ_TYPE_OVERDROP)) { + if (ELEM(strip->blend_mode, STRIP_TYPE_ALPHAOVER, STRIP_TYPE_ALPHAUNDER, STRIP_TYPE_OVERDROP)) { swap_input = true; } return swap_input; } -static StripEarlyOut seq_get_early_out_for_blend_mode(Strip *seq) +static StripEarlyOut strip_get_early_out_for_blend_mode(Strip *strip) { - SeqEffectHandle sh = seq_effect_get_sequence_blend(seq); - float fac = seq->blend_opacity / 100.0f; - StripEarlyOut early_out = sh.early_out(seq, fac); + SeqEffectHandle sh = strip_effect_get_sequence_blend(strip); + float fac = strip->blend_opacity / 100.0f; + StripEarlyOut early_out = sh.early_out(strip, fac); if (ELEM(early_out, StripEarlyOut::DoEffect, StripEarlyOut::NoInput)) { return early_out; } - if (seq_must_swap_input_in_blend_mode(seq)) { + if (seq_must_swap_input_in_blend_mode(strip)) { if (early_out == StripEarlyOut::UseInput2) { return StripEarlyOut::UseInput1; } @@ -1803,35 +1841,35 @@ static StripEarlyOut seq_get_early_out_for_blend_mode(Strip *seq) } static ImBuf *seq_render_strip_stack_apply_effect( - const SeqRenderData *context, Strip *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2) + const SeqRenderData *context, Strip *strip, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2) { ImBuf *out; - SeqEffectHandle sh = seq_effect_get_sequence_blend(seq); - float fac = seq->blend_opacity / 100.0f; - int swap_input = seq_must_swap_input_in_blend_mode(seq); + SeqEffectHandle sh = strip_effect_get_sequence_blend(strip); + float fac = strip->blend_opacity / 100.0f; + int swap_input = seq_must_swap_input_in_blend_mode(strip); if (swap_input) { - out = sh.execute(context, seq, timeline_frame, fac, ibuf2, ibuf1); + out = sh.execute(context, strip, timeline_frame, fac, ibuf2, ibuf1); } else { - out = sh.execute(context, seq, timeline_frame, fac, ibuf1, ibuf2); + out = sh.execute(context, strip, timeline_frame, fac, ibuf1, ibuf2); } return out; } -static bool is_opaque_alpha_over(const Strip *seq) +static bool is_opaque_alpha_over(const Strip *strip) { - if (seq->blend_mode != SEQ_TYPE_ALPHAOVER) { + if (strip->blend_mode != STRIP_TYPE_ALPHAOVER) { return false; } - if (seq->blend_opacity < 100.0f) { + if (strip->blend_opacity < 100.0f) { return false; } - if (seq->mul < 1.0f && (seq->flag & SEQ_MULTIPLY_ALPHA) != 0) { + if (strip->mul < 1.0f && (strip->flag & SEQ_MULTIPLY_ALPHA) != 0) { return false; } - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { /* Assume result is not opaque if there is an enabled Mask modifier. */ if ((smd->flag & SEQUENCE_MODIFIER_MUTE) == 0 && smd->type == seqModifierType_Mask) { return false; @@ -1858,21 +1896,21 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, int64_t i; ImBuf *out = nullptr; for (i = strips.size() - 1; i >= 0; i--) { - Strip *seq = strips[i]; + Strip *strip = strips[i]; - out = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE); + out = seq_cache_get(context, strip, timeline_frame, SEQ_CACHE_STORE_COMPOSITE); if (out) { break; } - if (seq->blend_mode == SEQ_BLEND_REPLACE) { - out = seq_render_strip(context, state, seq, timeline_frame); + if (strip->blend_mode == SEQ_BLEND_REPLACE) { + out = seq_render_strip(context, state, strip, timeline_frame); break; } - StripEarlyOut early_out = seq_get_early_out_for_blend_mode(seq); + StripEarlyOut early_out = strip_get_early_out_for_blend_mode(strip); - if (early_out == StripEarlyOut::DoEffect && opaques.is_occluded(context, seq, i)) { + if (early_out == StripEarlyOut::DoEffect && opaques.is_occluded(context, strip, i)) { early_out = StripEarlyOut::UseInput1; } @@ -1881,8 +1919,8 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, * - Likewise, if we are at the bottom of the stack; the input can be used as-is. * - If we are rendering a strip that is known to be opaque, we mark it as an occluder, * so that strips below can check if they are completely hidden. */ - if (out == nullptr && early_out == StripEarlyOut::DoEffect && is_opaque_alpha_over(seq)) { - ImBuf *test = seq_render_strip(context, state, seq, timeline_frame); + if (out == nullptr && early_out == StripEarlyOut::DoEffect && is_opaque_alpha_over(strip)) { + ImBuf *test = seq_render_strip(context, state, strip, timeline_frame); if (ELEM(test->planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB) || i == 0) { early_out = StripEarlyOut::UseInput2; } @@ -1894,10 +1932,10 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, /* Check whether the raw (before preprocessing, which can add alpha) strip content * was opaque. */ - ImBuf *ibuf_raw = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW); + ImBuf *ibuf_raw = seq_cache_get(context, strip, timeline_frame, SEQ_CACHE_STORE_RAW); if (ibuf_raw != nullptr) { if (ibuf_raw->planes != R_IMF_PLANES_RGBA) { - opaques.add_occluder(context, seq, i); + opaques.add_occluder(context, strip, i); } IMB_freeImBuf(ibuf_raw); } @@ -1906,7 +1944,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, switch (early_out) { case StripEarlyOut::NoInput: case StripEarlyOut::UseInput2: - out = seq_render_strip(context, state, seq, timeline_frame); + out = seq_render_strip(context, state, strip, timeline_frame); break; case StripEarlyOut::UseInput1: if (i == 0) { @@ -1919,13 +1957,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, /* This is an effect at the bottom of the stack, so one of the inputs does not exist yet: * create one that is transparent black. Extra optimization for an alpha over strip at * the bottom, we can just return it instead of blending with black. */ - ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); + ImBuf *ibuf2 = seq_render_strip(context, state, strip, timeline_frame); const bool use_float = ibuf2 && ibuf2->float_buffer.data; ImBuf *ibuf1 = IMB_allocImBuf( context->rectx, context->recty, 32, use_float ? IB_rectfloat : IB_rect); seq_imbuf_assign_spaces(context->scene, ibuf1); - out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, strip, timeline_frame, ibuf1, ibuf2); IMB_metadata_copy(out, ibuf2); seq_cache_put(context, strips[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out); @@ -1943,17 +1981,17 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, i++; for (; i < strips.size(); i++) { - Strip *seq = strips[i]; + Strip *strip = strips[i]; - if (opaques.is_occluded(context, seq, i)) { + if (opaques.is_occluded(context, strip, i)) { continue; } - if (seq_get_early_out_for_blend_mode(seq) == StripEarlyOut::DoEffect) { + if (strip_get_early_out_for_blend_mode(strip) == StripEarlyOut::DoEffect) { ImBuf *ibuf1 = out; - ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); + ImBuf *ibuf2 = seq_render_strip(context, state, strip, timeline_frame); - out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, strip, timeline_frame, ibuf1, ibuf2); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -2031,19 +2069,20 @@ ImBuf *seq_render_give_ibuf_seqbase(const SeqRenderData *context, return seq_render_strip_stack(context, &state, channels, seqbasep, timeline_frame, chan_shown); } -ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, float timeline_frame, Strip *seq) +ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, + float timeline_frame, + Strip *strip) { SeqRenderState state; - ImBuf *ibuf = seq_render_strip(context, &state, seq, timeline_frame); + ImBuf *ibuf = seq_render_strip(context, &state, strip, timeline_frame); return ibuf; } -bool SEQ_render_is_muted(const ListBase *channels, const Strip *seq) +bool SEQ_render_is_muted(const ListBase *channels, const Strip *strip) { - - SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, seq->machine); - return seq->flag & SEQ_MUTE || SEQ_channel_is_muted(channel); + SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, strip->machine); + return strip->flag & SEQ_MUTE || SEQ_channel_is_muted(channel); } /** \} */ diff --git a/source/blender/sequencer/intern/render.hh b/source/blender/sequencer/intern/render.hh index 2099e93c3541..d7eb63adf311 100644 --- a/source/blender/sequencer/intern/render.hh +++ b/source/blender/sequencer/intern/render.hh @@ -14,6 +14,7 @@ struct ImBuf; struct LinkNode; struct ListBase; +struct Mask; struct Scene; struct SeqEffectHandle; struct SeqRenderData; @@ -45,7 +46,7 @@ blender::Vector seq_get_shown_sequences( const Scene *scene, ListBase *channels, ListBase *seqbase, int timeline_frame, int chanshown); ImBuf *seq_render_strip(const SeqRenderData *context, SeqRenderState *state, - Strip *seq, + Strip *strip, float timeline_frame); /* Renders Mask into an image suitable for sequencer: @@ -56,4 +57,4 @@ ImBuf *seq_render_mask(const SeqRenderData *context, bool make_float); void seq_imbuf_assign_spaces(const Scene *scene, ImBuf *ibuf); -StripScreenQuad get_strip_screen_quad(const SeqRenderData *context, const Strip *seq); +StripScreenQuad get_strip_screen_quad(const SeqRenderData *context, const Strip *strip); diff --git a/source/blender/sequencer/intern/sequence_lookup.cc b/source/blender/sequencer/intern/sequence_lookup.cc deleted file mode 100644 index 4f1799aec40f..000000000000 --- a/source/blender/sequencer/intern/sequence_lookup.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* SPDX-FileCopyrightText: 2021-2024 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -/** \file - * \ingroup sequencer - */ - -#include "SEQ_sequencer.hh" -#include "sequencer.hh" - -#include "DNA_listBase.h" -#include "DNA_scene_types.h" -#include "DNA_sequence_types.h" - -#include "BLI_listbase.h" -#include "BLI_map.hh" -#include "BLI_sys_types.h" -#include "BLI_vector_set.hh" - -#include -#include - -#include "MEM_guardedalloc.h" - -static std::mutex lookup_lock; - -struct SequenceLookup { - blender::Map seq_by_name; - blender::Map meta_by_seq; - blender::Map> effects_by_seq; - blender::Map owner_by_channel; - bool is_valid = false; -}; - -static void seq_sequence_lookup_append_effect(const Strip *input, - Strip *effect, - SequenceLookup *lookup) -{ - if (input == nullptr) { - return; - } - - blender::VectorSet &effects = lookup->effects_by_seq.lookup_or_add_default(input); - - effects.add(effect); -} - -static void seq_sequence_lookup_build_effect(Strip *seq, SequenceLookup *lookup) -{ - if ((seq->type & SEQ_TYPE_EFFECT) == 0) { - return; - } - - seq_sequence_lookup_append_effect(seq->seq1, seq, lookup); - seq_sequence_lookup_append_effect(seq->seq2, seq, lookup); -} - -static void seq_sequence_lookup_build_from_seqbase(Strip *parent_meta, - const ListBase *seqbase, - SequenceLookup *lookup) -{ - if (parent_meta != nullptr) { - LISTBASE_FOREACH (SeqTimelineChannel *, channel, &parent_meta->channels) { - lookup->owner_by_channel.add(channel, parent_meta); - } - } - - LISTBASE_FOREACH (Strip *, seq, seqbase) { - lookup->seq_by_name.add(seq->name + 2, seq); - lookup->meta_by_seq.add(seq, parent_meta); - seq_sequence_lookup_build_effect(seq, lookup); - - if (seq->type == SEQ_TYPE_META) { - seq_sequence_lookup_build_from_seqbase(seq, &seq->seqbase, lookup); - } - } -} - -static void seq_sequence_lookup_build(const Scene *scene, SequenceLookup *lookup) -{ - Editing *ed = SEQ_editing_get(scene); - seq_sequence_lookup_build_from_seqbase(nullptr, &ed->seqbase, lookup); - lookup->is_valid = true; -} - -static SequenceLookup *seq_sequence_lookup_new() -{ - SequenceLookup *lookup = MEM_new(__func__); - return lookup; -} - -static void seq_sequence_lookup_free(SequenceLookup **lookup) -{ - MEM_delete(*lookup); - *lookup = nullptr; -} - -static void seq_sequence_lookup_rebuild(const Scene *scene, SequenceLookup **lookup) -{ - seq_sequence_lookup_free(lookup); - *lookup = seq_sequence_lookup_new(); - seq_sequence_lookup_build(scene, *lookup); -} - -static void seq_sequence_lookup_update_if_needed(const Scene *scene, SequenceLookup **lookup) -{ - if (!scene->ed) { - return; - } - if (*lookup && (*lookup)->is_valid) { - return; - } - - seq_sequence_lookup_rebuild(scene, lookup); -} - -void SEQ_sequence_lookup_free(const Scene *scene) -{ - BLI_assert(scene->ed); - std::lock_guard lock(lookup_lock); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - seq_sequence_lookup_free(&lookup); -} - -Strip *SEQ_sequence_lookup_seq_by_name(const Scene *scene, const char *key) -{ - BLI_assert(scene->ed); - std::lock_guard lock(lookup_lock); - seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - return lookup->seq_by_name.lookup_default(key, nullptr); -} - -Strip *seq_sequence_lookup_meta_by_seq(const Scene *scene, const Strip *key) -{ - BLI_assert(scene->ed); - std::lock_guard lock(lookup_lock); - seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - return lookup->meta_by_seq.lookup_default(key, nullptr); -} - -blender::Span seq_sequence_lookup_effects_by_seq(const Scene *scene, const Strip *key) -{ - BLI_assert(scene->ed); - std::lock_guard lock(lookup_lock); - seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - blender::VectorSet &effects = lookup->effects_by_seq.lookup_or_add_default(key); - return effects.as_span(); -} - -Strip *SEQ_sequence_lookup_owner_by_channel(const Scene *scene, const SeqTimelineChannel *channel) -{ - BLI_assert(scene->ed); - std::lock_guard lock(lookup_lock); - seq_sequence_lookup_update_if_needed(scene, &scene->ed->runtime.sequence_lookup); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - return lookup->owner_by_channel.lookup_default(channel, nullptr); -} - -void SEQ_sequence_lookup_invalidate(const Scene *scene) -{ - if (scene == nullptr || scene->ed == nullptr) { - return; - } - - std::lock_guard lock(lookup_lock); - SequenceLookup *lookup = scene->ed->runtime.sequence_lookup; - if (lookup != nullptr) { - lookup->is_valid = false; - } -} diff --git a/source/blender/sequencer/intern/sequencer.cc b/source/blender/sequencer/intern/sequencer.cc index 2473381e5f0b..9de95e4c5604 100644 --- a/source/blender/sequencer/intern/sequencer.cc +++ b/source/blender/sequencer/intern/sequencer.cc @@ -17,7 +17,6 @@ #include "MEM_guardedalloc.h" -#include "DNA_anim_types.h" #include "DNA_listBase.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -35,8 +34,6 @@ #include "DEG_depsgraph.hh" -#include "IMB_imbuf.hh" - #include "MOV_read.hh" #include "SEQ_channels.hh" @@ -80,7 +77,7 @@ static StripData *seq_strip_alloc(int type) { StripData *data = static_cast(MEM_callocN(sizeof(StripData), "strip")); - if (type != SEQ_TYPE_SOUND_RAM) { + if (type != STRIP_TYPE_SOUND_RAM) { data->transform = static_cast( MEM_callocN(sizeof(StripTransform), "StripTransform")); data->transform->scale_x = 1; @@ -129,71 +126,71 @@ static void seq_free_strip(StripData *data) Strip *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type) { - Strip *seq; + Strip *strip; - seq = static_cast(MEM_callocN(sizeof(Strip), "addseq")); - BLI_addtail(lb, seq); + strip = static_cast(MEM_callocN(sizeof(Strip), "addseq")); + BLI_addtail(lb, strip); - *((short *)seq->name) = ID_SEQ; - seq->name[2] = 0; + *((short *)strip->name) = ID_SEQ; + strip->name[2] = 0; - seq->flag = SELECT; - seq->start = timeline_frame; - seq->machine = machine; - seq->sat = 1.0; - seq->mul = 1.0; - seq->blend_opacity = 100.0; - seq->volume = 1.0f; - seq->scene_sound = nullptr; - seq->type = type; - seq->media_playback_rate = 0.0f; - seq->speed_factor = 1.0f; + strip->flag = SELECT; + strip->start = timeline_frame; + strip->machine = machine; + strip->sat = 1.0; + strip->mul = 1.0; + strip->blend_opacity = 100.0; + strip->volume = 1.0f; + strip->scene_sound = nullptr; + strip->type = type; + strip->media_playback_rate = 0.0f; + strip->speed_factor = 1.0f; - if (seq->type == SEQ_TYPE_ADJUSTMENT) { - seq->blend_mode = SEQ_TYPE_CROSS; + if (strip->type == STRIP_TYPE_ADJUSTMENT) { + strip->blend_mode = STRIP_TYPE_CROSS; } else { - seq->blend_mode = SEQ_TYPE_ALPHAOVER; + strip->blend_mode = STRIP_TYPE_ALPHAOVER; } - seq->data = seq_strip_alloc(type); - seq->stereo3d_format = static_cast( + strip->data = seq_strip_alloc(type); + strip->stereo3d_format = static_cast( MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format")); - seq->color_tag = SEQUENCE_COLOR_NONE; + strip->color_tag = STRIP_COLOR_NONE; - if (seq->type == SEQ_TYPE_META) { - SEQ_channels_ensure(&seq->channels); + if (strip->type == STRIP_TYPE_META) { + SEQ_channels_ensure(&strip->channels); } - SEQ_relations_session_uid_generate(seq); + SEQ_relations_session_uid_generate(strip); - return seq; + return strip; } /* only give option to skip cache locally (static func) */ static void seq_sequence_free_ex(Scene *scene, - Strip *seq, + Strip *strip, const bool do_cache, const bool do_id_user) { - if (seq->data) { - seq_free_strip(seq->data); + if (strip->data) { + seq_free_strip(strip->data); } - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); - if (seq->type & SEQ_TYPE_EFFECT) { - SeqEffectHandle sh = SEQ_effect_handle_get(seq); - sh.free(seq, do_id_user); + if (strip->type & STRIP_TYPE_EFFECT) { + SeqEffectHandle sh = SEQ_effect_handle_get(strip); + sh.free(strip, do_id_user); } - if (seq->sound && do_id_user) { - id_us_min((ID *)seq->sound); + if (strip->sound && do_id_user) { + id_us_min((ID *)strip->sound); } - if (seq->stereo3d_format) { - MEM_freeN(seq->stereo3d_format); + if (strip->stereo3d_format) { + MEM_freeN(strip->stereo3d_format); } /* clipboard has no scene and will never have a sound handle or be active @@ -202,25 +199,25 @@ static void seq_sequence_free_ex(Scene *scene, if (scene) { Editing *ed = scene->ed; - if (ed->act_seq == seq) { + if (ed->act_seq == strip) { ed->act_seq = nullptr; } - if (seq->scene_sound && ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { - BKE_sound_remove_scene_sound(scene, seq->scene_sound); + if (strip->scene_sound && ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SCENE)) { + BKE_sound_remove_scene_sound(scene, strip->scene_sound); } } - if (seq->prop) { - IDP_FreePropertyContent_ex(seq->prop, do_id_user); - MEM_freeN(seq->prop); + if (strip->prop) { + IDP_FreePropertyContent_ex(strip->prop, do_id_user); + MEM_freeN(strip->prop); } /* free modifiers */ - SEQ_modifier_clear(seq); + SEQ_modifier_clear(strip); - if (SEQ_is_strip_connected(seq)) { - SEQ_disconnect(seq); + if (SEQ_is_strip_connected(strip)) { + SEQ_disconnect(strip); } /* free cached data used by this strip, @@ -233,37 +230,37 @@ static void seq_sequence_free_ex(Scene *scene, */ if (do_cache) { if (scene) { - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); } } - if (seq->type == SEQ_TYPE_META) { - SEQ_channels_free(&seq->channels); + if (strip->type == STRIP_TYPE_META) { + SEQ_channels_free(&strip->channels); } - if (seq->retiming_keys != nullptr) { - MEM_freeN(seq->retiming_keys); - seq->retiming_keys = nullptr; - seq->retiming_keys_num = 0; + if (strip->retiming_keys != nullptr) { + MEM_freeN(strip->retiming_keys); + strip->retiming_keys = nullptr; + strip->retiming_keys_num = 0; } - MEM_freeN(seq); + MEM_freeN(strip); } -void SEQ_sequence_free(Scene *scene, Strip *seq) +void SEQ_sequence_free(Scene *scene, Strip *strip) { - seq_sequence_free_ex(scene, seq, true, true); + seq_sequence_free_ex(scene, strip, true, true); } -void seq_free_sequence_recurse(Scene *scene, Strip *seq, const bool do_id_user) +void seq_free_sequence_recurse(Scene *scene, Strip *strip, const bool do_id_user) { Strip *iseq, *iseq_next; - for (iseq = static_cast(seq->seqbase.first); iseq; iseq = iseq_next) { + for (iseq = static_cast(strip->seqbase.first); iseq; iseq = iseq_next) { iseq_next = iseq->next; seq_free_sequence_recurse(scene, iseq, do_id_user); } - seq_sequence_free_ex(scene, seq, false, do_id_user); + seq_sequence_free_ex(scene, strip, false, do_id_user); } Editing *SEQ_editing_get(const Scene *scene) @@ -300,12 +297,12 @@ void SEQ_editing_free(Scene *scene, const bool do_id_user) seq_cache_destruct(scene); /* handle cache freeing above */ - LISTBASE_FOREACH_MUTABLE (Strip *, seq, &ed->seqbase) { - seq_free_sequence_recurse(scene, seq, do_id_user); + LISTBASE_FOREACH_MUTABLE (Strip *, strip, &ed->seqbase) { + seq_free_sequence_recurse(scene, strip, do_id_user); } BLI_freelistN(&ed->metastack); - SEQ_sequence_lookup_free(scene); + SEQ_strip_lookup_free(scene); blender::seq::media_presence_free(scene); blender::seq::thumbnail_cache_destroy(scene); SEQ_channels_free(&ed->channels); @@ -315,25 +312,25 @@ void SEQ_editing_free(Scene *scene, const bool do_id_user) scene->ed = nullptr; } -static void seq_new_fix_links_recursive(Strip *seq, blender::Map strip_map) +static void seq_new_fix_links_recursive(Strip *strip, blender::Map strip_map) { - if (seq->type & SEQ_TYPE_EFFECT) { - seq->seq1 = strip_map.lookup_default(seq->seq1, seq->seq1); - seq->seq2 = strip_map.lookup_default(seq->seq2, seq->seq2); + if (strip->type & STRIP_TYPE_EFFECT) { + strip->seq1 = strip_map.lookup_default(strip->seq1, strip->seq1); + strip->seq2 = strip_map.lookup_default(strip->seq2, strip->seq2); } - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { smd->mask_sequence = strip_map.lookup_default(smd->mask_sequence, smd->mask_sequence); } - if (SEQ_is_strip_connected(seq)) { - LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) { + if (SEQ_is_strip_connected(strip)) { + LISTBASE_FOREACH (SeqConnection *, con, &strip->connections) { con->seq_ref = strip_map.lookup_default(con->seq_ref, con->seq_ref); } } - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, seqn, &seq->seqbase) { + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, seqn, &strip->seqbase) { seq_new_fix_links_recursive(seqn, strip_map); } } @@ -427,16 +424,16 @@ void SEQ_seqbase_active_set(Editing *ed, ListBase *seqbase) ed->seqbasep = seqbase; } -static MetaStack *seq_meta_stack_alloc(const Scene *scene, Strip *seq_meta) +static MetaStack *seq_meta_stack_alloc(const Scene *scene, Strip *strip_meta) { Editing *ed = SEQ_editing_get(scene); MetaStack *ms = static_cast(MEM_mallocN(sizeof(MetaStack), "metastack")); BLI_addhead(&ed->metastack, ms); - ms->parseq = seq_meta; + ms->parseq = strip_meta; /* Reference to previously displayed timeline data. */ - Strip *higher_level_meta = seq_sequence_lookup_meta_by_seq(scene, seq_meta); + Strip *higher_level_meta = SEQ_lookup_meta_by_strip(scene, strip_meta); ms->oldbasep = higher_level_meta ? &higher_level_meta->seqbase : &ed->seqbase; ms->old_channels = higher_level_meta ? &higher_level_meta->channels : &ed->channels; @@ -464,7 +461,7 @@ void SEQ_meta_stack_set(const Scene *scene, Strip *dst_seq) /* Allocate meta stack in a way, that represents meta hierarchy in timeline. */ seq_meta_stack_alloc(scene, dst_seq); Strip *meta_parent = dst_seq; - while ((meta_parent = seq_sequence_lookup_meta_by_seq(scene, meta_parent))) { + while ((meta_parent = SEQ_lookup_meta_by_strip(scene, meta_parent))) { seq_meta_stack_alloc(scene, meta_parent); } @@ -495,93 +492,93 @@ Strip *SEQ_meta_stack_pop(Editing *ed) /** \name Duplicate Functions * \{ */ -static Strip *seq_dupli(const Scene *scene_src, - Scene *scene_dst, - ListBase *new_seq_list, - Strip *seq, - int dupe_flag, - const int flag, - blender::Map &strip_map) +static Strip *strip_dupli(const Scene *scene_src, + Scene *scene_dst, + ListBase *new_seq_list, + Strip *strip, + int dupe_flag, + const int flag, + blender::Map &strip_map) { - Strip *seqn = static_cast(MEM_dupallocN(seq)); - strip_map.add(seq, seqn); + Strip *seqn = static_cast(MEM_dupallocN(strip)); + strip_map.add(strip, seqn); if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) { SEQ_relations_session_uid_generate(seqn); } - seqn->data = static_cast(MEM_dupallocN(seq->data)); + seqn->data = static_cast(MEM_dupallocN(strip->data)); - seqn->stereo3d_format = static_cast(MEM_dupallocN(seq->stereo3d_format)); + seqn->stereo3d_format = static_cast(MEM_dupallocN(strip->stereo3d_format)); /* XXX: add F-Curve duplication stuff? */ - if (seq->data->crop) { - seqn->data->crop = static_cast(MEM_dupallocN(seq->data->crop)); + if (strip->data->crop) { + seqn->data->crop = static_cast(MEM_dupallocN(strip->data->crop)); } - if (seq->data->transform) { - seqn->data->transform = static_cast(MEM_dupallocN(seq->data->transform)); + if (strip->data->transform) { + seqn->data->transform = static_cast(MEM_dupallocN(strip->data->transform)); } - if (seq->data->proxy) { - seqn->data->proxy = static_cast(MEM_dupallocN(seq->data->proxy)); + if (strip->data->proxy) { + seqn->data->proxy = static_cast(MEM_dupallocN(strip->data->proxy)); seqn->data->proxy->anim = nullptr; } - if (seq->prop) { - seqn->prop = IDP_CopyProperty_ex(seq->prop, flag); + if (strip->prop) { + seqn->prop = IDP_CopyProperty_ex(strip->prop, flag); } if (seqn->modifiers.first) { BLI_listbase_clear(&seqn->modifiers); - SEQ_modifier_list_copy(seqn, seq); + SEQ_modifier_list_copy(seqn, strip); } - if (SEQ_is_strip_connected(seq)) { + if (SEQ_is_strip_connected(strip)) { BLI_listbase_clear(&seqn->connections); - SEQ_connections_duplicate(&seqn->connections, &seq->connections); + SEQ_connections_duplicate(&seqn->connections, &strip->connections); } - if (seq->type == SEQ_TYPE_META) { + if (strip->type == STRIP_TYPE_META) { seqn->data->stripdata = nullptr; BLI_listbase_clear(&seqn->seqbase); BLI_listbase_clear(&seqn->channels); - SEQ_channels_duplicate(&seqn->channels, &seq->channels); + SEQ_channels_duplicate(&seqn->channels, &strip->channels); } - else if (seq->type == SEQ_TYPE_SCENE) { + else if (strip->type == STRIP_TYPE_SCENE) { seqn->data->stripdata = nullptr; - if (seq->scene_sound) { + if (strip->scene_sound) { seqn->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene_dst, seqn); } } - else if (seq->type == SEQ_TYPE_MOVIECLIP) { + else if (strip->type == STRIP_TYPE_MOVIECLIP) { /* avoid assert */ } - else if (seq->type == SEQ_TYPE_MASK) { + else if (strip->type == STRIP_TYPE_MASK) { /* avoid assert */ } - else if (seq->type == SEQ_TYPE_MOVIE) { - seqn->data->stripdata = static_cast(MEM_dupallocN(seq->data->stripdata)); + else if (strip->type == STRIP_TYPE_MOVIE) { + seqn->data->stripdata = static_cast(MEM_dupallocN(strip->data->stripdata)); BLI_listbase_clear(&seqn->anims); } - else if (seq->type == SEQ_TYPE_SOUND_RAM) { - seqn->data->stripdata = static_cast(MEM_dupallocN(seq->data->stripdata)); + else if (strip->type == STRIP_TYPE_SOUND_RAM) { + seqn->data->stripdata = static_cast(MEM_dupallocN(strip->data->stripdata)); seqn->scene_sound = nullptr; if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { id_us_plus((ID *)seqn->sound); } } - else if (seq->type == SEQ_TYPE_IMAGE) { - seqn->data->stripdata = static_cast(MEM_dupallocN(seq->data->stripdata)); + else if (strip->type == STRIP_TYPE_IMAGE) { + seqn->data->stripdata = static_cast(MEM_dupallocN(strip->data->stripdata)); } - else if (seq->type & SEQ_TYPE_EFFECT) { + else if (strip->type & STRIP_TYPE_EFFECT) { SeqEffectHandle sh; - sh = SEQ_effect_handle_get(seq); + sh = SEQ_effect_handle_get(strip); if (sh.copy) { - sh.copy(seqn, seq, flag); + sh.copy(seqn, strip, flag); } seqn->data->stripdata = nullptr; @@ -591,7 +588,7 @@ static Strip *seq_dupli(const Scene *scene_src, BLI_assert_unreachable(); } - /* When using #SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container + /* When using #STRIP_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container * (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty * and hence we miss all sequence-strips in that meta that have already been duplicated, * (see #55668). Note that unique name check itself could be done at a later step in calling @@ -602,14 +599,14 @@ static Strip *seq_dupli(const Scene *scene_src, } if (scene_src == scene_dst) { - if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) { + if (dupe_flag & STRIP_DUPE_UNIQUE_NAME) { SEQ_sequence_base_unique_name_recursive(scene_dst, &scene_dst->ed->seqbase, seqn); } } - if (seq->retiming_keys != nullptr) { - seqn->retiming_keys = static_cast(MEM_dupallocN(seq->retiming_keys)); - seqn->retiming_keys_num = seq->retiming_keys_num; + if (strip->retiming_keys != nullptr) { + seqn->retiming_keys = static_cast(MEM_dupallocN(strip->retiming_keys)); + seqn->retiming_keys_num = strip->retiming_keys_num; } return seqn; @@ -618,13 +615,13 @@ static Strip *seq_dupli(const Scene *scene_src, static Strip *sequence_dupli_recursive_do(const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, - Strip *seq, + Strip *strip, const int dupe_flag, blender::Map &strip_map) { - Strip *seqn = seq_dupli(scene_src, scene_dst, new_seq_list, seq, dupe_flag, 0, strip_map); - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, s, &seq->seqbase) { + Strip *seqn = strip_dupli(scene_src, scene_dst, new_seq_list, strip, dupe_flag, 0, strip_map); + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, s, &strip->seqbase) { sequence_dupli_recursive_do(scene_src, scene_dst, &seqn->seqbase, s, dupe_flag, strip_map); } } @@ -632,12 +629,12 @@ static Strip *sequence_dupli_recursive_do(const Scene *scene_src, } Strip *SEQ_sequence_dupli_recursive( - const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Strip *seq, int dupe_flag) + const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Strip *strip, int dupe_flag) { blender::Map strip_map; Strip *seqn = sequence_dupli_recursive_do( - scene_src, scene_dst, new_seq_list, seq, dupe_flag, strip_map); + scene_src, scene_dst, new_seq_list, strip, dupe_flag, strip_map); seq_new_fix_links_recursive(seqn, strip_map); if (SEQ_is_strip_connected(seqn)) { @@ -655,21 +652,21 @@ static void seqbase_dupli_recursive(const Scene *scene_src, const int flag, blender::Map &strip_map) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if ((seq->flag & SELECT) == 0 && (dupe_flag & SEQ_DUPE_ALL) == 0) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if ((strip->flag & SELECT) == 0 && (dupe_flag & STRIP_DUPE_ALL) == 0) { continue; } - Strip *seqn = seq_dupli(scene_src, scene_dst, nseqbase, seq, dupe_flag, flag, strip_map); + Strip *seqn = strip_dupli(scene_src, scene_dst, nseqbase, strip, dupe_flag, flag, strip_map); BLI_assert(seqn != nullptr); - if (seq->type == SEQ_TYPE_META) { + if (strip->type == STRIP_TYPE_META) { /* Always include meta all strip children. */ - int dupe_flag_recursive = dupe_flag | SEQ_DUPE_ALL; + int dupe_flag_recursive = dupe_flag | STRIP_DUPE_ALL; seqbase_dupli_recursive(scene_src, scene_dst, &seqn->seqbase, - &seq->seqbase, + &strip->seqbase, dupe_flag_recursive, flag, strip_map); @@ -689,20 +686,20 @@ void SEQ_sequence_base_dupli_recursive(const Scene *scene_src, seqbase_dupli_recursive(scene_src, scene_dst, nseqbase, seqbase, dupe_flag, flag, strip_map); /* Fix effect, modifier, and connected strip links. */ - LISTBASE_FOREACH (Strip *, seq, nseqbase) { - seq_new_fix_links_recursive(seq, strip_map); + LISTBASE_FOREACH (Strip *, strip, nseqbase) { + seq_new_fix_links_recursive(strip, strip_map); } /* One-way connections cannot be cut until after all connections are resolved. */ - LISTBASE_FOREACH (Strip *, seq, nseqbase) { - if (SEQ_is_strip_connected(seq)) { - SEQ_cut_one_way_connections(seq); + LISTBASE_FOREACH (Strip *, strip, nseqbase) { + if (SEQ_is_strip_connected(strip)) { + SEQ_cut_one_way_connections(strip); } } } -bool SEQ_is_valid_strip_channel(const Strip *seq) +bool SEQ_is_valid_strip_channel(const Strip *strip) { - return seq->machine >= 1 && seq->machine <= SEQ_MAX_CHANNELS; + return strip->machine >= 1 && strip->machine <= SEQ_MAX_CHANNELS; } SequencerToolSettings *SEQ_tool_settings_copy(SequencerToolSettings *tool_settings) @@ -714,54 +711,54 @@ SequencerToolSettings *SEQ_tool_settings_copy(SequencerToolSettings *tool_settin /** \} */ -static bool seq_set_strip_done_cb(Strip *seq, void * /*userdata*/) +static bool seq_set_strip_done_cb(Strip *strip, void * /*userdata*/) { - if (seq->data) { - seq->data->done = false; + if (strip->data) { + strip->data->done = false; } return true; } -static bool seq_write_data_cb(Strip *seq, void *userdata) +static bool strip_write_data_cb(Strip *strip, void *userdata) { BlendWriter *writer = (BlendWriter *)userdata; - BLO_write_struct(writer, Strip, seq); - if (seq->data && seq->data->done == 0) { + BLO_write_struct(writer, Strip, strip); + if (strip->data && strip->data->done == 0) { /* Write strip with 'done' at 0 because read-file. */ /* TODO this doesn't depend on the `Strip` data to be present? */ - if (seq->effectdata) { - switch (seq->type) { - case SEQ_TYPE_COLOR: - BLO_write_struct(writer, SolidColorVars, seq->effectdata); + if (strip->effectdata) { + switch (strip->type) { + case STRIP_TYPE_COLOR: + BLO_write_struct(writer, SolidColorVars, strip->effectdata); break; - case SEQ_TYPE_SPEED: - BLO_write_struct(writer, SpeedControlVars, seq->effectdata); + case STRIP_TYPE_SPEED: + BLO_write_struct(writer, SpeedControlVars, strip->effectdata); break; - case SEQ_TYPE_WIPE: - BLO_write_struct(writer, WipeVars, seq->effectdata); + case STRIP_TYPE_WIPE: + BLO_write_struct(writer, WipeVars, strip->effectdata); break; - case SEQ_TYPE_GLOW: - BLO_write_struct(writer, GlowVars, seq->effectdata); + case STRIP_TYPE_GLOW: + BLO_write_struct(writer, GlowVars, strip->effectdata); break; - case SEQ_TYPE_TRANSFORM: - BLO_write_struct(writer, TransformVars, seq->effectdata); + case STRIP_TYPE_TRANSFORM: + BLO_write_struct(writer, TransformVars, strip->effectdata); break; - case SEQ_TYPE_GAUSSIAN_BLUR: - BLO_write_struct(writer, GaussianBlurVars, seq->effectdata); + case STRIP_TYPE_GAUSSIAN_BLUR: + BLO_write_struct(writer, GaussianBlurVars, strip->effectdata); break; - case SEQ_TYPE_TEXT: - BLO_write_struct(writer, TextVars, seq->effectdata); + case STRIP_TYPE_TEXT: + BLO_write_struct(writer, TextVars, strip->effectdata); break; - case SEQ_TYPE_COLORMIX: - BLO_write_struct(writer, ColorMixVars, seq->effectdata); + case STRIP_TYPE_COLORMIX: + BLO_write_struct(writer, ColorMixVars, strip->effectdata); break; } } - BLO_write_struct(writer, Stereo3dFormat, seq->stereo3d_format); + BLO_write_struct(writer, Stereo3dFormat, strip->stereo3d_format); - StripData *data = seq->data; + StripData *data = strip->data; BLO_write_struct(writer, StripData, data); if (data->crop) { BLO_write_struct(writer, StripCrop, data->crop); @@ -772,34 +769,34 @@ static bool seq_write_data_cb(Strip *seq, void *userdata) if (data->proxy) { BLO_write_struct(writer, StripProxy, data->proxy); } - if (seq->type == SEQ_TYPE_IMAGE) { + if (strip->type == STRIP_TYPE_IMAGE) { BLO_write_struct_array( writer, StripElem, MEM_allocN_len(data->stripdata) / sizeof(StripElem), data->stripdata); } - else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM)) { + else if (ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_SOUND_RAM)) { BLO_write_struct(writer, StripElem, data->stripdata); } data->done = true; } - if (seq->prop) { - IDP_BlendWrite(writer, seq->prop); + if (strip->prop) { + IDP_BlendWrite(writer, strip->prop); } - SEQ_modifier_blend_write(writer, &seq->modifiers); + SEQ_modifier_blend_write(writer, &strip->modifiers); - LISTBASE_FOREACH (SeqTimelineChannel *, channel, &seq->channels) { + LISTBASE_FOREACH (SeqTimelineChannel *, channel, &strip->channels) { BLO_write_struct(writer, SeqTimelineChannel, channel); } - LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) { + LISTBASE_FOREACH (SeqConnection *, con, &strip->connections) { BLO_write_struct(writer, SeqConnection, con); } - if (seq->retiming_keys != nullptr) { - int size = SEQ_retiming_keys_count(seq); - BLO_write_struct_array(writer, SeqRetimingKey, size, seq->retiming_keys); + if (strip->retiming_keys != nullptr) { + int size = SEQ_retiming_keys_count(strip); + BLO_write_struct_array(writer, SeqRetimingKey, size, strip->retiming_keys); } return true; @@ -810,264 +807,272 @@ void SEQ_blend_write(BlendWriter *writer, ListBase *seqbase) /* reset write flags */ SEQ_for_each_callback(seqbase, seq_set_strip_done_cb, nullptr); - SEQ_for_each_callback(seqbase, seq_write_data_cb, writer); + SEQ_for_each_callback(seqbase, strip_write_data_cb, writer); } -static bool seq_read_data_cb(Strip *seq, void *user_data) +static bool strip_read_data_cb(Strip *strip, void *user_data) { BlendDataReader *reader = (BlendDataReader *)user_data; /* Runtime data cleanup. */ - seq->scene_sound = nullptr; - BLI_listbase_clear(&seq->anims); + strip->scene_sound = nullptr; + BLI_listbase_clear(&strip->anims); /* Do as early as possible, so that other parts of reading can rely on valid session UID. */ - SEQ_relations_session_uid_generate(seq); + SEQ_relations_session_uid_generate(strip); - BLO_read_struct(reader, Strip, &seq->seq1); - BLO_read_struct(reader, Strip, &seq->seq2); + BLO_read_struct(reader, Strip, &strip->seq1); + BLO_read_struct(reader, Strip, &strip->seq2); - if (seq->effectdata) { - switch (seq->type) { - case SEQ_TYPE_COLOR: - BLO_read_struct(reader, SolidColorVars, &seq->effectdata); + if (strip->effectdata) { + switch (strip->type) { + case STRIP_TYPE_COLOR: + BLO_read_struct(reader, SolidColorVars, &strip->effectdata); break; - case SEQ_TYPE_SPEED: - BLO_read_struct(reader, SpeedControlVars, &seq->effectdata); + case STRIP_TYPE_SPEED: + BLO_read_struct(reader, SpeedControlVars, &strip->effectdata); break; - case SEQ_TYPE_WIPE: - BLO_read_struct(reader, WipeVars, &seq->effectdata); + case STRIP_TYPE_WIPE: + BLO_read_struct(reader, WipeVars, &strip->effectdata); break; - case SEQ_TYPE_GLOW: - BLO_read_struct(reader, GlowVars, &seq->effectdata); + case STRIP_TYPE_GLOW: + BLO_read_struct(reader, GlowVars, &strip->effectdata); break; - case SEQ_TYPE_TRANSFORM: - BLO_read_struct(reader, TransformVars, &seq->effectdata); + case STRIP_TYPE_TRANSFORM: + BLO_read_struct(reader, TransformVars, &strip->effectdata); break; - case SEQ_TYPE_GAUSSIAN_BLUR: - BLO_read_struct(reader, GaussianBlurVars, &seq->effectdata); + case STRIP_TYPE_GAUSSIAN_BLUR: + BLO_read_struct(reader, GaussianBlurVars, &strip->effectdata); break; - case SEQ_TYPE_TEXT: - BLO_read_struct(reader, TextVars, &seq->effectdata); + case STRIP_TYPE_TEXT: + BLO_read_struct(reader, TextVars, &strip->effectdata); break; - case SEQ_TYPE_COLORMIX: - BLO_read_struct(reader, ColorMixVars, &seq->effectdata); + case STRIP_TYPE_COLORMIX: + BLO_read_struct(reader, ColorMixVars, &strip->effectdata); break; default: BLI_assert_unreachable(); - seq->effectdata = nullptr; + strip->effectdata = nullptr; break; } } - BLO_read_struct(reader, Stereo3dFormat, &seq->stereo3d_format); + BLO_read_struct(reader, Stereo3dFormat, &strip->stereo3d_format); - if (seq->type & SEQ_TYPE_EFFECT) { - seq->flag |= SEQ_EFFECT_NOT_LOADED; + if (strip->type & STRIP_TYPE_EFFECT) { + strip->flag |= SEQ_EFFECT_NOT_LOADED; } - if (seq->type == SEQ_TYPE_TEXT) { - TextVars *t = static_cast(seq->effectdata); - t->text_blf_id = SEQ_FONT_NOT_LOADED; + if (strip->type == STRIP_TYPE_TEXT) { + TextVars *t = static_cast(strip->effectdata); + t->text_blf_id = STRIP_FONT_NOT_LOADED; t->runtime = nullptr; } - BLO_read_struct(reader, IDProperty, &seq->prop); - IDP_BlendDataRead(reader, &seq->prop); + BLO_read_struct(reader, IDProperty, &strip->prop); + IDP_BlendDataRead(reader, &strip->prop); - BLO_read_struct(reader, StripData, &seq->data); - if (seq->data && seq->data->done == 0) { - seq->data->done = true; + BLO_read_struct(reader, StripData, &strip->data); + if (strip->data && strip->data->done == 0) { + strip->data->done = true; - /* `SEQ_TYPE_SOUND_HD` case needs to be kept here, for backward compatibility. */ - if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { - /* FIXME In #SEQ_TYPE_IMAGE case, there is currently no available information about the + /* `STRIP_TYPE_SOUND_HD` case needs to be kept here, for backward compatibility. */ + if (ELEM(strip->type, + STRIP_TYPE_IMAGE, + STRIP_TYPE_MOVIE, + STRIP_TYPE_SOUND_RAM, + STRIP_TYPE_SOUND_HD)) + { + /* FIXME In #STRIP_TYPE_IMAGE case, there is currently no available information about the * length of the stored array of #StripElem. * * This is 'not a problem' because the reading code only checks that the loaded buffer is at * least large enough for the requested data (here a single #StripElem item), and always * assign the whole read memory (without any truncating). But relying on this behavior is * weak and should be addressed. */ - BLO_read_struct(reader, StripElem, &seq->data->stripdata); + BLO_read_struct(reader, StripElem, &strip->data->stripdata); } else { - seq->data->stripdata = nullptr; + strip->data->stripdata = nullptr; } - BLO_read_struct(reader, StripCrop, &seq->data->crop); - BLO_read_struct(reader, StripTransform, &seq->data->transform); - BLO_read_struct(reader, StripProxy, &seq->data->proxy); - if (seq->data->proxy) { - seq->data->proxy->anim = nullptr; + BLO_read_struct(reader, StripCrop, &strip->data->crop); + BLO_read_struct(reader, StripTransform, &strip->data->transform); + BLO_read_struct(reader, StripProxy, &strip->data->proxy); + if (strip->data->proxy) { + strip->data->proxy->anim = nullptr; } - else if (seq->flag & SEQ_USE_PROXY) { - SEQ_proxy_set(seq, true); + else if (strip->flag & SEQ_USE_PROXY) { + SEQ_proxy_set(strip, true); } /* need to load color balance to it could be converted to modifier */ - BLO_read_struct(reader, StripColorBalance, &seq->data->color_balance); + BLO_read_struct(reader, StripColorBalance, &strip->data->color_balance); } - SEQ_modifier_blend_read_data(reader, &seq->modifiers); + SEQ_modifier_blend_read_data(reader, &strip->modifiers); - BLO_read_struct_list(reader, SeqConnection, &seq->connections); - LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) { + BLO_read_struct_list(reader, SeqConnection, &strip->connections); + LISTBASE_FOREACH (SeqConnection *, con, &strip->connections) { if (con->seq_ref) { BLO_read_struct(reader, Strip, &con->seq_ref); } } - BLO_read_struct_list(reader, SeqTimelineChannel, &seq->channels); + BLO_read_struct_list(reader, SeqTimelineChannel, &strip->channels); - if (seq->retiming_keys != nullptr) { - const int size = SEQ_retiming_keys_count(seq); - BLO_read_struct_array(reader, SeqRetimingKey, size, &seq->retiming_keys); + if (strip->retiming_keys != nullptr) { + const int size = SEQ_retiming_keys_count(strip); + BLO_read_struct_array(reader, SeqRetimingKey, size, &strip->retiming_keys); } return true; } void SEQ_blend_read(BlendDataReader *reader, ListBase *seqbase) { - SEQ_for_each_callback(seqbase, seq_read_data_cb, reader); + SEQ_for_each_callback(seqbase, strip_read_data_cb, reader); } -static bool seq_doversion_250_sound_proxy_update_cb(Strip *seq, void *user_data) +static bool strip_doversion_250_sound_proxy_update_cb(Strip *strip, void *user_data) { Main *bmain = static_cast
(user_data); - if (seq->type == SEQ_TYPE_SOUND_HD) { + if (strip->type == STRIP_TYPE_SOUND_HD) { char filepath_abs[FILE_MAX]; - BLI_path_join( - filepath_abs, sizeof(filepath_abs), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join(filepath_abs, + sizeof(filepath_abs), + strip->data->dirpath, + strip->data->stripdata->filename); BLI_path_abs(filepath_abs, BKE_main_blendfile_path(bmain)); - seq->sound = BKE_sound_new_file(bmain, filepath_abs); - seq->type = SEQ_TYPE_SOUND_RAM; + strip->sound = BKE_sound_new_file(bmain, filepath_abs); + strip->type = STRIP_TYPE_SOUND_RAM; } return true; } void SEQ_doversion_250_sound_proxy_update(Main *bmain, Editing *ed) { - SEQ_for_each_callback(&ed->seqbase, seq_doversion_250_sound_proxy_update_cb, bmain); + SEQ_for_each_callback(&ed->seqbase, strip_doversion_250_sound_proxy_update_cb, bmain); } /* Depsgraph update functions. */ -static bool seq_mute_sound_strips_cb(Strip *seq, void *user_data) +static bool seq_mute_sound_strips_cb(Strip *strip, void *user_data) { Scene *scene = (Scene *)user_data; - if (seq->scene_sound != nullptr) { - BKE_sound_remove_scene_sound(scene, seq->scene_sound); - seq->scene_sound = nullptr; + if (strip->scene_sound != nullptr) { + BKE_sound_remove_scene_sound(scene, strip->scene_sound); + strip->scene_sound = nullptr; } return true; } /* Adds sound of strip to the `scene->sound_scene` - "sound timeline". */ -static void seq_update_mix_sounds(Scene *scene, Strip *seq) +static void strip_update_mix_sounds(Scene *scene, Strip *strip) { - if (seq->scene_sound != nullptr) { + if (strip->scene_sound != nullptr) { return; } - if (seq->sound != nullptr) { - /* Adds `seq->sound->playback_handle` to `scene->sound_scene` */ - seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq); + if (strip->sound != nullptr) { + /* Adds `strip->sound->playback_handle` to `scene->sound_scene` */ + strip->scene_sound = BKE_sound_add_scene_sound_defaults(scene, strip); } - else if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) { - /* Adds `seq->scene->sound_scene` to `scene->sound_scene`. */ - BKE_sound_ensure_scene(seq->scene); - seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, seq); + else if (strip->type == STRIP_TYPE_SCENE && strip->scene != nullptr) { + /* Adds `strip->scene->sound_scene` to `scene->sound_scene`. */ + BKE_sound_ensure_scene(strip->scene); + strip->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, strip); } } -static void seq_update_sound_properties(const Scene *scene, const Strip *seq) +static void strip_update_sound_properties(const Scene *scene, const Strip *strip) { const int frame = BKE_scene_frame_get(scene); BKE_sound_set_scene_sound_volume_at_frame( - seq->scene_sound, frame, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); - SEQ_retiming_sound_animation_data_set(scene, seq); + strip->scene_sound, frame, strip->volume, (strip->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0); + SEQ_retiming_sound_animation_data_set(scene, strip); BKE_sound_set_scene_sound_pan_at_frame( - seq->scene_sound, frame, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); + strip->scene_sound, frame, strip->pan, (strip->flag & SEQ_AUDIO_PAN_ANIMATED) != 0); } -static void seq_update_sound_modifiers(Strip *seq) +static void strip_update_sound_modifiers(Strip *strip) { - void *sound_handle = seq->sound->playback_handle; - if (!BLI_listbase_is_empty(&seq->modifiers)) { - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) { - sound_handle = SEQ_sound_modifier_recreator(seq, smd, sound_handle); + void *sound_handle = strip->sound->playback_handle; + if (!BLI_listbase_is_empty(&strip->modifiers)) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip->modifiers) { + sound_handle = SEQ_sound_modifier_recreator(strip, smd, sound_handle); } } - /* Assign modified sound back to `seq`. */ - BKE_sound_update_sequence_handle(seq->scene_sound, sound_handle); + /* Assign modified sound back to `strip`. */ + BKE_sound_update_sequence_handle(strip->scene_sound, sound_handle); } -static bool must_update_strip_sound(Scene *scene, Strip *seq) +static bool must_update_strip_sound(Scene *scene, Strip *strip) { return (scene->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0 || - (seq->sound->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0; + (strip->sound->id.recalc & (ID_RECALC_AUDIO | ID_RECALC_SYNC_TO_EVAL)) != 0; } -static void seq_update_sound_strips(Scene *scene, Strip *seq) +static void seq_update_sound_strips(Scene *scene, Strip *strip) { - if (seq->sound == nullptr || !must_update_strip_sound(scene, seq)) { + if (strip->sound == nullptr || !must_update_strip_sound(scene, strip)) { return; } /* Ensure strip is playing correct sound. */ - BKE_sound_update_scene_sound(seq->scene_sound, seq->sound); - seq_update_sound_modifiers(seq); + BKE_sound_update_scene_sound(strip->scene_sound, strip->sound); + strip_update_sound_modifiers(strip); } static bool scene_sequencer_is_used(const Scene *scene, ListBase *seqbase) { bool sequencer_is_used = false; - LISTBASE_FOREACH (Strip *, seq_iter, seqbase) { - if (seq_iter->scene == scene && (seq_iter->flag & SEQ_SCENE_STRIPS) != 0) { + LISTBASE_FOREACH (Strip *, strip_iter, seqbase) { + if (strip_iter->scene == scene && (strip_iter->flag & SEQ_SCENE_STRIPS) != 0) { sequencer_is_used = true; } - if (seq_iter->type == SEQ_TYPE_META) { - sequencer_is_used |= scene_sequencer_is_used(scene, &seq_iter->seqbase); + if (strip_iter->type == STRIP_TYPE_META) { + sequencer_is_used |= scene_sequencer_is_used(scene, &strip_iter->seqbase); } } return sequencer_is_used; } -static void seq_update_scene_strip_sound(const Scene *scene, Strip *seq) +static void seq_update_scene_strip_sound(const Scene *scene, Strip *strip) { - if (seq->type != SEQ_TYPE_SCENE || seq->scene == nullptr) { + if (strip->type != STRIP_TYPE_SCENE || strip->scene == nullptr) { return; } - /* Set `seq->scene` volume. + /* Set `strip->scene` volume. * NOTE: Currently this doesn't work well, when this property is animated. Scene strip volume is - * also controlled by `seq_update_sound_properties()` via `seq->volume` which works if animated. + * also controlled by `strip_update_sound_properties()` via `strip->volume` which works if + * animated. * * Ideally, the entire `BKE_scene_update_sound()` will happen from a dependency graph, so * then it is no longer needed to do such manual forced updates. */ - BKE_sound_set_scene_volume(seq->scene, seq->scene->audio.volume); + BKE_sound_set_scene_volume(strip->scene, strip->scene->audio.volume); /* Mute sound when all scene strips using particular scene are not rendering sequencer strips. */ - bool sequencer_is_used = scene_sequencer_is_used(seq->scene, &scene->ed->seqbase); + bool sequencer_is_used = scene_sequencer_is_used(strip->scene, &scene->ed->seqbase); - if (!sequencer_is_used && seq->scene->sound_scene != nullptr && seq->scene->ed != nullptr) { - SEQ_for_each_callback(&seq->scene->ed->seqbase, seq_mute_sound_strips_cb, seq->scene); + if (!sequencer_is_used && strip->scene->sound_scene != nullptr && strip->scene->ed != nullptr) { + SEQ_for_each_callback(&strip->scene->ed->seqbase, seq_mute_sound_strips_cb, strip->scene); } } -static bool seq_sound_update_cb(Strip *seq, void *user_data) +static bool strip_sound_update_cb(Strip *strip, void *user_data) { Scene *scene = (Scene *)user_data; - seq_update_mix_sounds(scene, seq); + strip_update_mix_sounds(scene, strip); - if (seq->scene_sound == nullptr) { + if (strip->scene_sound == nullptr) { return true; } - seq_update_sound_strips(scene, seq); - seq_update_scene_strip_sound(scene, seq); - seq_update_sound_properties(scene, seq); + seq_update_sound_strips(scene, strip); + seq_update_scene_strip_sound(scene, strip); + strip_update_sound_properties(scene, strip); return true; } @@ -1076,7 +1081,7 @@ void SEQ_eval_sequences(Depsgraph *depsgraph, Scene *scene, ListBase *seqbase) DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene); BKE_sound_ensure_scene(scene); - SEQ_for_each_callback(seqbase, seq_sound_update_cb, scene); + SEQ_for_each_callback(seqbase, strip_sound_update_cb, scene); SEQ_edit_update_muting(scene->ed); SEQ_sound_update_bounds_all(scene); diff --git a/source/blender/sequencer/intern/sequencer.hh b/source/blender/sequencer/intern/sequencer.hh index ed0a1dae8360..3d7d2a648fe0 100644 --- a/source/blender/sequencer/intern/sequencer.hh +++ b/source/blender/sequencer/intern/sequencer.hh @@ -4,12 +4,12 @@ #pragma once -#include "BLI_vector_set.hh" - /** \file * \ingroup sequencer */ +#include "BLI_span.hh" + struct Scene; struct Strip; struct StripProxy; @@ -17,7 +17,7 @@ struct StripProxy; * Cache must be freed before calling this function * since it leaves the #Editing::seqbase in an invalid state. */ -void seq_free_sequence_recurse(Scene *scene, Strip *seq, bool do_id_user); +void seq_free_sequence_recurse(Scene *scene, Strip *strip, bool do_id_user); StripProxy *seq_strip_proxy_alloc(); /** * Find meta strip, that contains strip `key`. @@ -25,19 +25,19 @@ StripProxy *seq_strip_proxy_alloc(); * rebuilt. * * \param scene: scene that owns lookup hash - * \param key: pointer to Sequence inside of meta strip + * \param key: pointer to Strip inside of meta strip * * \return pointer to meta strip */ -Strip *seq_sequence_lookup_meta_by_seq(const Scene *scene, const Strip *key); +Strip *SEQ_lookup_meta_by_strip(const Scene *scene, const Strip *key); /** - * Find effect strips, that use strip `seq` as one of inputs. + * Find effect strips, that use strip `strip` as one of inputs. * If lookup hash doesn't exist, it will be created. If hash is tagged as invalid, it will be * rebuilt. * * \param scene: scene that owns lookup hash - * \param key: pointer to Sequence inside of meta strip + * \param key: pointer to Strip inside of meta strip * * \return collection of effect strips */ -blender::Span seq_sequence_lookup_effects_by_seq(const Scene *scene, const Strip *key); +blender::Span SEQ_lookup_effects_by_strip(const Scene *scene, const Strip *key); diff --git a/source/blender/sequencer/intern/sound.cc b/source/blender/sequencer/intern/sound.cc index ebb71c8ffd5a..47efe2b8a99e 100644 --- a/source/blender/sequencer/intern/sound.cc +++ b/source/blender/sequencer/intern/sound.cc @@ -45,27 +45,28 @@ static bool sequencer_refresh_sound_length_recursive(Main *bmain, Scene *scene, { bool changed = false; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_META) { - if (sequencer_refresh_sound_length_recursive(bmain, scene, &seq->seqbase)) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type == STRIP_TYPE_META) { + if (sequencer_refresh_sound_length_recursive(bmain, scene, &strip->seqbase)) { changed = true; } } - else if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound) { + else if (strip->type == STRIP_TYPE_SOUND_RAM && strip->sound) { SoundInfo info; - if (!BKE_sound_info_get(bmain, seq->sound, &info)) { + if (!BKE_sound_info_get(bmain, strip->sound, &info)) { continue; } - int old = seq->len; + int old = strip->len; float fac; - seq->len = std::max(1, int(round((info.length - seq->sound->offset_time) * FPS))); - fac = float(seq->len) / float(old); - old = seq->startofs; - seq->startofs *= fac; - seq->endofs *= fac; - seq->start += (old - seq->startofs); /* So that visual/"real" start frame does not change! */ + strip->len = std::max(1, int(round((info.length - strip->sound->offset_time) * FPS))); + fac = float(strip->len) / float(old); + old = strip->startofs; + strip->startofs *= fac; + strip->endofs *= fac; + strip->start += (old - + strip->startofs); /* So that visual/"real" start frame does not change! */ changed = true; } @@ -90,47 +91,47 @@ void SEQ_sound_update_bounds_all(Scene *scene) Editing *ed = scene->ed; if (ed) { - LISTBASE_FOREACH (Strip *, seq, &ed->seqbase) { - if (seq->type == SEQ_TYPE_META) { - seq_update_sound_bounds_recursive(scene, seq); + LISTBASE_FOREACH (Strip *, strip, &ed->seqbase) { + if (strip->type == STRIP_TYPE_META) { + strip_update_sound_bounds_recursive(scene, strip); } - else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { - SEQ_sound_update_bounds(scene, seq); + else if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SCENE)) { + SEQ_sound_update_bounds(scene, strip); } } } } -void SEQ_sound_update_bounds(Scene *scene, Strip *seq) +void SEQ_sound_update_bounds(Scene *scene, Strip *strip) { - if (seq->type == SEQ_TYPE_SCENE) { - if (seq->scene && seq->scene_sound) { + if (strip->type == STRIP_TYPE_SCENE) { + if (strip->scene && strip->scene_sound) { /* We have to take into account start frame of the sequence's scene! */ - int startofs = seq->startofs + seq->anim_startofs + seq->scene->r.sfra; + int startofs = strip->startofs + strip->anim_startofs + strip->scene->r.sfra; BKE_sound_move_scene_sound(scene, - seq->scene_sound, - SEQ_time_left_handle_frame_get(scene, seq), - SEQ_time_right_handle_frame_get(scene, seq), + strip->scene_sound, + SEQ_time_left_handle_frame_get(scene, strip), + SEQ_time_right_handle_frame_get(scene, strip), startofs, 0.0); } } else { - BKE_sound_move_scene_sound_defaults(scene, seq); + BKE_sound_move_scene_sound_defaults(scene, strip); } - /* mute is set in seq_update_muting_recursive */ + /* mute is set in strip_update_muting_recursive */ } -static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound *sound) +static void strip_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound *sound) { - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - if (seq->type == SEQ_TYPE_META) { - seq_update_sound_recursive(scene, &seq->seqbase, sound); + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + if (strip->type == STRIP_TYPE_META) { + strip_update_sound_recursive(scene, &strip->seqbase, sound); } - else if (seq->type == SEQ_TYPE_SOUND_RAM) { - if (seq->scene_sound && sound == seq->sound) { - BKE_sound_update_scene_sound(seq->scene_sound, sound); + else if (strip->type == STRIP_TYPE_SOUND_RAM) { + if (strip->scene_sound && sound == strip->sound) { + BKE_sound_update_scene_sound(strip->scene_sound, sound); } } } @@ -139,17 +140,17 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound void SEQ_sound_update(Scene *scene, bSound *sound) { if (scene->ed) { - seq_update_sound_recursive(scene, &scene->ed->seqbase, sound); + strip_update_sound_recursive(scene, &scene->ed->seqbase, sound); } } -float SEQ_sound_pitch_get(const Scene *scene, const Strip *seq) +float SEQ_sound_pitch_get(const Scene *scene, const Strip *strip) { - const Strip *meta_parent = seq_sequence_lookup_meta_by_seq(scene, seq); + const Strip *meta_parent = SEQ_lookup_meta_by_strip(scene, strip); if (meta_parent != nullptr) { - return seq->speed_factor * SEQ_sound_pitch_get(scene, meta_parent); + return strip->speed_factor * SEQ_sound_pitch_get(scene, meta_parent); } - return seq->speed_factor; + return strip->speed_factor; } EQCurveMappingData *SEQ_sound_equalizer_add(SoundEqualizerModifierData *semd, @@ -265,10 +266,10 @@ void SEQ_sound_equalizermodifier_copy_data(SequenceModifierData *target, Sequenc } } -void *SEQ_sound_equalizermodifier_recreator(Strip *seq, SequenceModifierData *smd, void *sound) +void *SEQ_sound_equalizermodifier_recreator(Strip *strip, SequenceModifierData *smd, void *sound) { #ifdef WITH_CONVOLUTION - UNUSED_VARS(seq); + UNUSED_VARS(strip); SoundEqualizerModifierData *semd = (SoundEqualizerModifierData *)smd; @@ -321,7 +322,7 @@ void *SEQ_sound_equalizermodifier_recreator(Strip *seq, SequenceModifierData *sm return equ; #else - UNUSED_VARS(seq, smd, sound); + UNUSED_VARS(strip, smd, sound); return nullptr; #endif } @@ -336,12 +337,12 @@ const SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type) return nullptr; } -void *SEQ_sound_modifier_recreator(Strip *seq, SequenceModifierData *smd, void *sound) +void *SEQ_sound_modifier_recreator(Strip *strip, SequenceModifierData *smd, void *sound) { if (!(smd->flag & SEQUENCE_MODIFIER_MUTE)) { const SoundModifierWorkerInfo *smwi = SEQ_sound_modifier_worker_info_get(smd->type); - return smwi->recreator(seq, smd, sound); + return smwi->recreator(strip, smd, sound); } return sound; } diff --git a/source/blender/sequencer/intern/strip_add.cc b/source/blender/sequencer/intern/strip_add.cc index 93d7883e3b8b..6732f4727ac4 100644 --- a/source/blender/sequencer/intern/strip_add.cc +++ b/source/blender/sequencer/intern/strip_add.cc @@ -72,42 +72,42 @@ void SEQ_add_load_data_init(SeqLoadData *load_data, load_data->channel = channel; } -static void seq_add_generic_update(Scene *scene, Strip *seq) +static void strip_add_generic_update(Scene *scene, Strip *strip) { - SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq); - SEQ_relations_invalidate_cache_composite(scene, seq); - SEQ_sequence_lookup_invalidate(scene); - seq_time_effect_range_set(scene, seq); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, strip); + SEQ_relations_invalidate_cache_composite(scene, strip); + SEQ_strip_lookup_invalidate(scene); + strip_time_effect_range_set(scene, strip); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -static void seq_add_set_name(Scene *scene, Strip *seq, SeqLoadData *load_data) +static void strip_add_set_name(Scene *scene, Strip *strip, SeqLoadData *load_data) { if (load_data->name[0] != '\0') { - SEQ_edit_sequence_name_set(scene, seq, load_data->name); + SEQ_edit_sequence_name_set(scene, strip, load_data->name); } else { - if (seq->type == SEQ_TYPE_SCENE) { - SEQ_edit_sequence_name_set(scene, seq, load_data->scene->id.name + 2); + if (strip->type == STRIP_TYPE_SCENE) { + SEQ_edit_sequence_name_set(scene, strip, load_data->scene->id.name + 2); } - else if (seq->type == SEQ_TYPE_MOVIECLIP) { - SEQ_edit_sequence_name_set(scene, seq, load_data->clip->id.name + 2); + else if (strip->type == STRIP_TYPE_MOVIECLIP) { + SEQ_edit_sequence_name_set(scene, strip, load_data->clip->id.name + 2); } - else if (seq->type == SEQ_TYPE_MASK) { - SEQ_edit_sequence_name_set(scene, seq, load_data->mask->id.name + 2); + else if (strip->type == STRIP_TYPE_MASK) { + SEQ_edit_sequence_name_set(scene, strip, load_data->mask->id.name + 2); } - else if ((seq->type & SEQ_TYPE_EFFECT) != 0) { - SEQ_edit_sequence_name_set(scene, seq, SEQ_sequence_give_name(seq)); + else if ((strip->type & STRIP_TYPE_EFFECT) != 0) { + SEQ_edit_sequence_name_set(scene, strip, SEQ_sequence_give_name(strip)); } else { /* Image, sound and movie. */ - SEQ_edit_sequence_name_set(scene, seq, load_data->name); + SEQ_edit_sequence_name_set(scene, strip, load_data->name); } } } -static void seq_add_set_view_transform(Scene *scene, Strip *seq, SeqLoadData *load_data) +static void strip_add_set_view_transform(Scene *scene, Strip *strip, SeqLoadData *load_data) { - const char *strip_colorspace = seq->data->colorspace_settings.name; + const char *strip_colorspace = strip->data->colorspace_settings.name; if (load_data->flags & SEQ_LOAD_SET_VIEW_TRANSFORM) { const char *role_colorspace_byte; @@ -125,101 +125,103 @@ static void seq_add_set_view_transform(Scene *scene, Strip *seq, SeqLoadData *lo Strip *SEQ_add_scene_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data) { - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_SCENE); - seq->scene = load_data->scene; - seq->len = load_data->scene->r.efra - load_data->scene->r.sfra + 1; + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_SCENE); + strip->scene = load_data->scene; + strip->len = load_data->scene->r.efra - load_data->scene->r.sfra + 1; id_us_ensure_real((ID *)load_data->scene); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); - return seq; + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); + return strip; } Strip *SEQ_add_movieclip_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data) { - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_MOVIECLIP); - seq->clip = load_data->clip; - seq->len = BKE_movieclip_get_duration(load_data->clip); + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MOVIECLIP); + strip->clip = load_data->clip; + strip->len = BKE_movieclip_get_duration(load_data->clip); id_us_ensure_real((ID *)load_data->clip); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); - return seq; + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); + return strip; } Strip *SEQ_add_mask_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data) { - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_MASK); - seq->mask = load_data->mask; - seq->len = BKE_mask_get_duration(load_data->mask); + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MASK); + strip->mask = load_data->mask; + strip->len = BKE_mask_get_duration(load_data->mask); id_us_ensure_real((ID *)load_data->mask); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); - return seq; + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); + return strip; } Strip *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_data) { - Strip *seq = SEQ_sequence_alloc( + Strip *strip = SEQ_sequence_alloc( seqbase, load_data->start_frame, load_data->channel, load_data->effect.type); - seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; - SeqEffectHandle sh = SEQ_effect_handle_get(seq); - sh.init(seq); - seq->seq1 = load_data->effect.seq1; - seq->seq2 = load_data->effect.seq2; + strip->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; + SeqEffectHandle sh = SEQ_effect_handle_get(strip); + sh.init(strip); + strip->seq1 = load_data->effect.seq1; + strip->seq2 = load_data->effect.seq2; - if (SEQ_effect_get_num_inputs(seq->type) == 1) { - seq->blend_mode = seq->seq1->blend_mode; - seq->blend_opacity = seq->seq1->blend_opacity; + if (SEQ_effect_get_num_inputs(strip->type) == 1) { + strip->blend_mode = strip->seq1->blend_mode; + strip->blend_opacity = strip->seq1->blend_opacity; } if (!load_data->effect.seq1) { - seq->len = 1; /* Effect is generator, set non zero length. */ - seq->flag |= SEQ_SINGLE_FRAME_CONTENT; - SEQ_time_right_handle_frame_set(scene, seq, load_data->effect.end_frame); + strip->len = 1; /* Effect is generator, set non zero length. */ + strip->flag |= SEQ_SINGLE_FRAME_CONTENT; + SEQ_time_right_handle_frame_set(scene, strip, load_data->effect.end_frame); } - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); - return seq; + return strip; } -void SEQ_add_image_set_directory(Strip *seq, const char *dirpath) +void SEQ_add_image_set_directory(Strip *strip, const char *dirpath) { - STRNCPY(seq->data->dirpath, dirpath); + STRNCPY(strip->data->dirpath, dirpath); } -void SEQ_add_image_load_file(Scene *scene, Strip *seq, size_t strip_frame, const char *filename) +void SEQ_add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename) { StripElem *se = SEQ_render_give_stripelem( - scene, seq, SEQ_time_start_frame_get(seq) + strip_frame); + scene, strip, SEQ_time_start_frame_get(strip) + strip_frame); STRNCPY(se->filename, filename); } -void SEQ_add_image_init_alpha_mode(Strip *seq) +void SEQ_add_image_init_alpha_mode(Strip *strip) { - if (seq->data && seq->data->stripdata) { + if (strip->data && strip->data->stripdata) { char filepath[FILE_MAX]; ImBuf *ibuf; - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join( + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); BLI_path_abs(filepath, BKE_main_blendfile_path_from_global()); /* Initialize input color space. */ - if (seq->type == SEQ_TYPE_IMAGE) { - ibuf = IMB_loadiffname( - filepath, IB_test | IB_alphamode_detect, seq->data->colorspace_settings.name); + if (strip->type == STRIP_TYPE_IMAGE) { + ibuf = IMB_loadiffname(filepath, + IB_test | IB_multilayer | IB_alphamode_detect, + strip->data->colorspace_settings.name); /* Byte images are default to straight alpha, however sequencer * works in premul space, so mark strip to be premultiplied first. */ - seq->alpha_mode = SEQ_ALPHA_STRAIGHT; + strip->alpha_mode = SEQ_ALPHA_STRAIGHT; if (ibuf) { if (ibuf->flags & IB_alphamode_premul) { - seq->alpha_mode = IMA_ALPHA_PREMUL; + strip->alpha_mode = IMA_ALPHA_PREMUL; } IMB_freeImBuf(ibuf); @@ -230,31 +232,32 @@ void SEQ_add_image_init_alpha_mode(Strip *seq) Strip *SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data) { - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_IMAGE); - seq->len = load_data->image.len; - StripData *data = seq->data; + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_IMAGE); + strip->len = load_data->image.len; + StripData *data = strip->data; data->stripdata = static_cast( MEM_callocN(load_data->image.len * sizeof(StripElem), "stripelem")); - if (seq->len == 1) { - seq->flag |= SEQ_SINGLE_FRAME_CONTENT; + if (strip->len == 1) { + strip->flag |= SEQ_SINGLE_FRAME_CONTENT; } /* Multiview settings. */ if (load_data->use_multiview) { - seq->flag |= SEQ_USE_VIEWS; - seq->views_format = load_data->views_format; + strip->flag |= SEQ_USE_VIEWS; + strip->views_format = load_data->views_format; } if (load_data->stereo3d_format) { - seq->stereo3d_format = load_data->stereo3d_format; + strip->stereo3d_format = load_data->stereo3d_format; } /* Set initial scale based on load_data->fit_method. */ char file_path[FILE_MAX]; STRNCPY(file_path, load_data->path); BLI_path_abs(file_path, BKE_main_blendfile_path(bmain)); - ImBuf *ibuf = IMB_loadiffname(file_path, IB_rect, seq->data->colorspace_settings.name); + ImBuf *ibuf = IMB_loadiffname( + file_path, IB_rect | IB_multilayer, strip->data->colorspace_settings.name); if (ibuf != nullptr) { /* Set image resolution. Assume that all images in sequence are same size. This fields are only * informative. */ @@ -266,22 +269,22 @@ Strip *SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad } SEQ_set_scale_to_fit( - seq, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method); + strip, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method); IMB_freeImBuf(ibuf); } /* Set Last active directory. */ - STRNCPY(scene->ed->act_imagedir, seq->data->dirpath); - seq_add_set_view_transform(scene, seq, load_data); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); + STRNCPY(scene->ed->act_imagedir, strip->data->dirpath); + strip_add_set_view_transform(scene, strip, load_data); + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); - return seq; + return strip; } #ifdef WITH_AUDASPACE -void SEQ_add_sound_av_sync(Main *bmain, Scene *scene, Strip *seq, SeqLoadData *load_data) +void SEQ_add_sound_av_sync(Main *bmain, Scene *scene, Strip *strip, SeqLoadData *load_data) { SoundStreamInfo sound_stream; if (!BKE_sound_stream_info_get(bmain, load_data->path, 0, &sound_stream)) { @@ -291,8 +294,8 @@ void SEQ_add_sound_av_sync(Main *bmain, Scene *scene, Strip *seq, SeqLoadData *l const double av_stream_offset = sound_stream.start - load_data->r_video_stream_start; const int frame_offset = av_stream_offset * FPS; /* Set sub-frame offset. */ - seq->sound->offset_time = (double(frame_offset) / FPS) - av_stream_offset; - SEQ_transform_translate_sequence(scene, seq, frame_offset); + strip->sound->offset_time = (double(frame_offset) / FPS) - av_stream_offset; + SEQ_transform_translate_sequence(scene, strip, frame_offset); } Strip *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data) @@ -311,53 +314,53 @@ Strip *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad return nullptr; } - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_SOUND_RAM); - seq->sound = sound; - seq->scene_sound = nullptr; + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_SOUND_RAM); + strip->sound = sound; + strip->scene_sound = nullptr; /* We round the frame duration as the audio sample lengths usually does not * line up with the video frames. Therefore we round this number to the * nearest frame as the audio track usually overshoots or undershoots the * end frame of the video by a little bit. * See #47135 for under shoot example. */ - seq->len = std::max(1, int(round((info.length - sound->offset_time) * FPS))); + strip->len = std::max(1, int(round((info.length - sound->offset_time) * FPS))); - StripData *data = seq->data; + StripData *data = strip->data; /* We only need 1 element to store the filename. */ StripElem *se = data->stripdata = static_cast( MEM_callocN(sizeof(StripElem), "stripelem")); BLI_path_split_dir_file( load_data->path, data->dirpath, sizeof(data->dirpath), se->filename, sizeof(se->filename)); - if (seq->sound != nullptr) { + if (strip->sound != nullptr) { if (load_data->flags & SEQ_LOAD_SOUND_MONO) { - seq->sound->flags |= SOUND_FLAGS_MONO; + strip->sound->flags |= SOUND_FLAGS_MONO; } if (load_data->flags & SEQ_LOAD_SOUND_CACHE) { - if (seq->sound) { - seq->sound->flags |= SOUND_FLAGS_CACHING; + if (strip->sound) { + strip->sound->flags |= SOUND_FLAGS_CACHING; } } /* Turn on Display Waveform by default. */ - seq->flag |= SEQ_AUDIO_DRAW_WAVEFORM; + strip->flag |= SEQ_AUDIO_DRAW_WAVEFORM; } /* Set Last active directory. */ BLI_strncpy(scene->ed->act_sounddir, data->dirpath, FILE_MAXDIR); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); - return seq; + return strip; } #else // WITH_AUDASPACE void SEQ_add_sound_av_sync(Main * /*bmain*/, Scene * /*scene*/, - Strip * /*seq*/, + Strip * /*strip*/, SeqLoadData * /*load_data*/) { } @@ -375,16 +378,16 @@ Strip *SEQ_add_meta_strip(Scene *scene, ListBase *seqbase, SeqLoadData *load_dat { /* Allocate sequence. */ Strip *seqm = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_META); + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_META); /* Set name. */ - seq_add_set_name(scene, seqm, load_data); + strip_add_set_name(scene, seqm, load_data); /* Set frames start and length. */ seqm->start = load_data->start_frame; seqm->len = 1; - seq_add_generic_update(scene, seqm); + strip_add_generic_update(scene, seqm); return seqm; } @@ -457,22 +460,22 @@ Strip *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad load_data->r_video_stream_start = MOV_get_start_offset_seconds(anim_arr[0]); } - Strip *seq = SEQ_sequence_alloc( - seqbase, load_data->start_frame, load_data->channel, SEQ_TYPE_MOVIE); + Strip *strip = SEQ_sequence_alloc( + seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MOVIE); /* Multiview settings. */ if (load_data->use_multiview) { - seq->flag |= SEQ_USE_VIEWS; - seq->views_format = load_data->views_format; + strip->flag |= SEQ_USE_VIEWS; + strip->views_format = load_data->views_format; } if (load_data->stereo3d_format) { - seq->stereo3d_format = load_data->stereo3d_format; + strip->stereo3d_format = load_data->stereo3d_format; } for (i = 0; i < totfiles; i++) { if (anim_arr[i]) { StripAnim *sanim = static_cast(MEM_mallocN(sizeof(StripAnim), "Strip Anim")); - BLI_addtail(&seq->anims, sanim); + BLI_addtail(&strip->anims, sanim); sanim->anim = anim_arr[i]; } else { @@ -481,7 +484,7 @@ Strip *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad } if (anim_arr[0] != nullptr) { - seq->len = MOV_get_duration_frames(anim_arr[0], IMB_TC_RECORD_RUN); + strip->len = MOV_get_duration_frames(anim_arr[0], IMB_TC_RECORD_RUN); MOV_load_metadata(anim_arr[0]); @@ -489,22 +492,22 @@ Strip *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad orig_width = MOV_get_image_width(anim_arr[0]); orig_height = MOV_get_image_height(anim_arr[0]); SEQ_set_scale_to_fit( - seq, orig_width, orig_height, scene->r.xsch, scene->r.ysch, load_data->fit_method); + strip, orig_width, orig_height, scene->r.xsch, scene->r.ysch, load_data->fit_method); float fps = MOV_get_fps(anim_arr[0]); if (fps > 0.0f) { - seq->media_playback_rate = fps; + strip->media_playback_rate = fps; } } - seq->len = std::max(1, seq->len); + strip->len = std::max(1, strip->len); if (load_data->adjust_playback_rate) { - seq->flag |= SEQ_AUTO_PLAYBACK_RATE; + strip->flag |= SEQ_AUTO_PLAYBACK_RATE; } - STRNCPY(seq->data->colorspace_settings.name, colorspace); + STRNCPY(strip->data->colorspace_settings.name, colorspace); - StripData *data = seq->data; + StripData *data = strip->data; /* We only need 1 element for MOVIE strips. */ StripElem *se; data->stripdata = se = static_cast(MEM_callocN(sizeof(StripElem), "stripelem")); @@ -514,67 +517,67 @@ Strip *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoad BLI_path_split_dir_file( load_data->path, data->dirpath, sizeof(data->dirpath), se->filename, sizeof(se->filename)); - seq_add_set_view_transform(scene, seq, load_data); - seq_add_set_name(scene, seq, load_data); - seq_add_generic_update(scene, seq); + strip_add_set_view_transform(scene, strip, load_data); + strip_add_set_name(scene, strip, load_data); + strip_add_generic_update(scene, strip); MEM_freeN(anim_arr); - return seq; + return strip; } -void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *seq, const bool lock_range) +void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *strip, const bool lock_range) { int prev_startdisp = 0, prev_enddisp = 0; /* NOTE: don't rename the strip, will break animation curves. */ - if (ELEM(seq->type, - SEQ_TYPE_MOVIE, - SEQ_TYPE_IMAGE, - SEQ_TYPE_SOUND_RAM, - SEQ_TYPE_SCENE, - SEQ_TYPE_META, - SEQ_TYPE_MOVIECLIP, - SEQ_TYPE_MASK) == 0) + if (ELEM(strip->type, + STRIP_TYPE_MOVIE, + STRIP_TYPE_IMAGE, + STRIP_TYPE_SOUND_RAM, + STRIP_TYPE_SCENE, + STRIP_TYPE_META, + STRIP_TYPE_MOVIECLIP, + STRIP_TYPE_MASK) == 0) { return; } if (lock_range) { /* keep so we don't have to move the actual start and end points (only the data) */ - prev_startdisp = SEQ_time_left_handle_frame_get(scene, seq); - prev_enddisp = SEQ_time_right_handle_frame_get(scene, seq); + prev_startdisp = SEQ_time_left_handle_frame_get(scene, strip); + prev_enddisp = SEQ_time_right_handle_frame_get(scene, strip); } - switch (seq->type) { - case SEQ_TYPE_IMAGE: { + switch (strip->type) { + case STRIP_TYPE_IMAGE: { /* Hack? */ - size_t olen = MEM_allocN_len(seq->data->stripdata) / sizeof(StripElem); + size_t olen = MEM_allocN_len(strip->data->stripdata) / sizeof(StripElem); - seq->len = olen; - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + strip->len = olen; + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } break; } - case SEQ_TYPE_MOVIE: { + case STRIP_TYPE_MOVIE: { char filepath[FILE_MAX]; StripAnim *sanim; bool is_multiview_loaded = false; - const bool is_multiview = (seq->flag & SEQ_USE_VIEWS) != 0 && + const bool is_multiview = (strip->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; BLI_path_join( - filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); BLI_path_abs(filepath, BKE_main_blendfile_path_from_global()); - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); - if (is_multiview && (seq->views_format == R_IMF_VIEWS_INDIVIDUAL)) { + if (is_multiview && (strip->views_format == R_IMF_VIEWS_INDIVIDUAL)) { char prefix[FILE_MAX]; const char *ext = nullptr; - const int totfiles = seq_num_files(scene, seq->views_format, true); + const int totfiles = seq_num_files(scene, strip->views_format, true); int i = 0; BKE_scene_multiview_view_prefix_get(scene, filepath, prefix, &ext); @@ -586,14 +589,14 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *seq, const bool l seq_multiview_name(scene, i, prefix, ext, filepath_view, sizeof(filepath_view)); anim = openanim(filepath_view, - IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), - seq->streamindex, - seq->data->colorspace_settings.name); + IB_rect | ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), + strip->streamindex, + strip->data->colorspace_settings.name); if (anim) { seq_anim_add_suffix(scene, anim, i); sanim = static_cast(MEM_mallocN(sizeof(StripAnim), "Strip Anim")); - BLI_addtail(&seq->anims, sanim); + BLI_addtail(&strip->anims, sanim); sanim->anim = anim; } } @@ -604,18 +607,18 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *seq, const bool l if (is_multiview_loaded == false) { MovieReader *anim; anim = openanim(filepath, - IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), - seq->streamindex, - seq->data->colorspace_settings.name); + IB_rect | ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), + strip->streamindex, + strip->data->colorspace_settings.name); if (anim) { sanim = static_cast(MEM_mallocN(sizeof(StripAnim), "Strip Anim")); - BLI_addtail(&seq->anims, sanim); + BLI_addtail(&strip->anims, sanim); sanim->anim = anim; } } /* use the first video as reference for everything */ - sanim = static_cast(seq->anims.first); + sanim = static_cast(strip->anims.first); if ((!sanim) || (!sanim->anim)) { return; @@ -623,83 +626,83 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Strip *seq, const bool l MOV_load_metadata(sanim->anim); - seq->len = MOV_get_duration_frames( + strip->len = MOV_get_duration_frames( sanim->anim, - IMB_Timecode_Type(seq->data->proxy ? IMB_Timecode_Type(seq->data->proxy->tc) : - IMB_TC_RECORD_RUN)); + IMB_Timecode_Type(strip->data->proxy ? IMB_Timecode_Type(strip->data->proxy->tc) : + IMB_TC_RECORD_RUN)); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } break; } - case SEQ_TYPE_MOVIECLIP: - if (seq->clip == nullptr) { + case STRIP_TYPE_MOVIECLIP: + if (strip->clip == nullptr) { return; } - seq->len = BKE_movieclip_get_duration(seq->clip); + strip->len = BKE_movieclip_get_duration(strip->clip); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } break; - case SEQ_TYPE_MASK: - if (seq->mask == nullptr) { + case STRIP_TYPE_MASK: + if (strip->mask == nullptr) { return; } - seq->len = BKE_mask_get_duration(seq->mask); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + strip->len = BKE_mask_get_duration(strip->mask); + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } break; - case SEQ_TYPE_SOUND_RAM: + case STRIP_TYPE_SOUND_RAM: #ifdef WITH_AUDASPACE - if (!seq->sound) { + if (!strip->sound) { return; } - seq->len = ceil(double(BKE_sound_get_length(bmain, seq->sound)) * FPS); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + strip->len = ceil(double(BKE_sound_get_length(bmain, strip->sound)) * FPS); + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } #else UNUSED_VARS(bmain); return; #endif break; - case SEQ_TYPE_SCENE: { - seq->len = (seq->scene) ? seq->scene->r.efra - seq->scene->r.sfra + 1 : 0; - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + case STRIP_TYPE_SCENE: { + strip->len = (strip->scene) ? strip->scene->r.efra - strip->scene->r.sfra + 1 : 0; + strip->len -= strip->anim_startofs; + strip->len -= strip->anim_endofs; + if (strip->len < 0) { + strip->len = 0; } break; } } - free_proxy_seq(seq); + free_proxy_seq(strip); if (lock_range) { - SEQ_time_left_handle_frame_set(scene, seq, prev_startdisp); - SEQ_time_right_handle_frame_set(scene, seq, prev_enddisp); + SEQ_time_left_handle_frame_set(scene, strip, prev_startdisp); + SEQ_time_right_handle_frame_set(scene, strip, prev_enddisp); } - SEQ_relations_invalidate_cache_raw(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, strip); } void SEQ_add_movie_reload_if_needed( - Main *bmain, Scene *scene, Strip *seq, bool *r_was_reloaded, bool *r_can_produce_frames) + Main *bmain, Scene *scene, Strip *strip, bool *r_was_reloaded, bool *r_can_produce_frames) { - BLI_assert_msg(seq->type == SEQ_TYPE_MOVIE, + BLI_assert_msg(strip->type == STRIP_TYPE_MOVIE, "This function is only implemented for movie strips."); bool must_reload = false; @@ -708,12 +711,12 @@ void SEQ_add_movie_reload_if_needed( * This function will return true only if there is at least one 'anim' AND all anims can * produce frames. */ - if (BLI_listbase_is_empty(&seq->anims)) { + if (BLI_listbase_is_empty(&strip->anims)) { /* No anim present, so reloading is always necessary. */ must_reload = true; } else { - LISTBASE_FOREACH (StripAnim *, sanim, &seq->anims) { + LISTBASE_FOREACH (StripAnim *, sanim, &strip->anims) { if (!MOV_is_initialized_and_valid(sanim->anim)) { /* Anim cannot produce frames, try reloading. */ must_reload = true; @@ -729,17 +732,17 @@ void SEQ_add_movie_reload_if_needed( return; } - SEQ_add_reload_new_file(bmain, scene, seq, true); + SEQ_add_reload_new_file(bmain, scene, strip, true); *r_was_reloaded = true; - if (BLI_listbase_is_empty(&seq->anims)) { + if (BLI_listbase_is_empty(&strip->anims)) { /* No anims present after reloading => no frames can be produced. */ *r_can_produce_frames = false; return; } /* Check if there are still anims that cannot produce frames. */ - LISTBASE_FOREACH (StripAnim *, sanim, &seq->anims) { + LISTBASE_FOREACH (StripAnim *, sanim, &strip->anims) { if (!MOV_is_initialized_and_valid(sanim->anim)) { /* There still is an anim that cannot produce frames. */ *r_can_produce_frames = false; diff --git a/source/blender/sequencer/intern/strip_connect.cc b/source/blender/sequencer/intern/strip_connect.cc index 0045ce51f411..9c18f7ab2154 100644 --- a/source/blender/sequencer/intern/strip_connect.cc +++ b/source/blender/sequencer/intern/strip_connect.cc @@ -11,14 +11,13 @@ #include "DNA_sequence_types.h" #include "SEQ_connect.hh" -#include "SEQ_time.hh" -static void seq_connections_free(Strip *seq) +static void strip_connections_free(Strip *strip) { - if (seq == nullptr) { + if (strip == nullptr) { return; } - ListBase *connections = &seq->connections; + ListBase *connections = &strip->connections; LISTBASE_FOREACH_MUTABLE (SeqConnection *, con, connections) { MEM_delete(con); } @@ -33,54 +32,54 @@ void SEQ_connections_duplicate(ListBase *connections_dst, ListBase *connections_ } } -bool SEQ_disconnect(Strip *seq) +bool SEQ_disconnect(Strip *strip) { - if (seq == nullptr || BLI_listbase_is_empty(&seq->connections)) { + if (strip == nullptr || BLI_listbase_is_empty(&strip->connections)) { return false; } - /* Remove `SeqConnections` from other strips' `connections` list that point to `seq`. */ - LISTBASE_FOREACH (SeqConnection *, con_seq, &seq->connections) { + /* Remove `SeqConnections` from other strips' `connections` list that point to `strip`. */ + LISTBASE_FOREACH (SeqConnection *, con_seq, &strip->connections) { Strip *other = con_seq->seq_ref; LISTBASE_FOREACH_MUTABLE (SeqConnection *, con_other, &other->connections) { - if (con_other->seq_ref == seq) { + if (con_other->seq_ref == strip) { BLI_remlink(&other->connections, con_other); MEM_delete(con_other); } } } - /* Now clear `connections` for `seq` itself. */ - seq_connections_free(seq); + /* Now clear `connections` for `strip` itself. */ + strip_connections_free(strip); return true; } -bool SEQ_disconnect(blender::VectorSet &seq_list) +bool SEQ_disconnect(blender::VectorSet &strip_list) { bool changed = false; - for (Strip *seq : seq_list) { - changed |= SEQ_disconnect(seq); + for (Strip *strip : strip_list) { + changed |= SEQ_disconnect(strip); } return changed; } -void SEQ_cut_one_way_connections(Strip *seq) +void SEQ_cut_one_way_connections(Strip *strip) { - if (seq == nullptr) { + if (strip == nullptr) { return; } - LISTBASE_FOREACH_MUTABLE (SeqConnection *, con_seq, &seq->connections) { + LISTBASE_FOREACH_MUTABLE (SeqConnection *, con_seq, &strip->connections) { Strip *other = con_seq->seq_ref; bool is_one_way = true; LISTBASE_FOREACH (SeqConnection *, con_other, &other->connections) { - if (con_other->seq_ref == seq) { - /* The `other` sequence has a bidirectional connection with `seq`. */ + if (con_other->seq_ref == strip) { + /* The `other` sequence has a bidirectional connection with `strip`. */ is_one_way = false; break; } } if (is_one_way) { - BLI_remlink(&seq->connections, con_seq); + BLI_remlink(&strip->connections, con_seq); MEM_delete(con_seq); } } @@ -91,20 +90,20 @@ void SEQ_connect(Strip *seq1, Strip *seq2) if (seq1 == nullptr || seq2 == nullptr) { return; } - blender::VectorSet seq_list; - seq_list.add(seq1); - seq_list.add(seq2); + blender::VectorSet strip_list; + strip_list.add(seq1); + strip_list.add(seq2); - SEQ_connect(seq_list); + SEQ_connect(strip_list); } -void SEQ_connect(blender::VectorSet &seq_list) +void SEQ_connect(blender::VectorSet &strip_list) { - seq_list.remove_if([&](Strip *seq) { return seq == nullptr; }); + strip_list.remove_if([&](Strip *strip) { return strip == nullptr; }); - for (Strip *seq1 : seq_list) { + for (Strip *seq1 : strip_list) { SEQ_disconnect(seq1); - for (Strip *seq2 : seq_list) { + for (Strip *seq2 : strip_list) { if (seq1 == seq2) { continue; } @@ -115,36 +114,36 @@ void SEQ_connect(blender::VectorSet &seq_list) } } -blender::VectorSet SEQ_get_connected_strips(const Strip *seq) +blender::VectorSet SEQ_get_connected_strips(const Strip *strip) { blender::VectorSet connections; - if (seq != nullptr) { - LISTBASE_FOREACH (SeqConnection *, con, &seq->connections) { + if (strip != nullptr) { + LISTBASE_FOREACH (SeqConnection *, con, &strip->connections) { connections.add(con->seq_ref); } } return connections; } -bool SEQ_is_strip_connected(const Strip *seq) +bool SEQ_is_strip_connected(const Strip *strip) { - if (seq == nullptr) { + if (strip == nullptr) { return false; } - return !BLI_listbase_is_empty(&seq->connections); + return !BLI_listbase_is_empty(&strip->connections); } -bool SEQ_are_strips_connected_together(blender::VectorSet &seq_list) +bool SEQ_are_strips_connected_together(blender::VectorSet &strip_list) { - const int expected_connection_num = seq_list.size() - 1; - for (Strip *seq1 : seq_list) { + const int expected_connection_num = strip_list.size() - 1; + for (Strip *seq1 : strip_list) { blender::VectorSet connections = SEQ_get_connected_strips(seq1); int found_connection_num = connections.size(); if (found_connection_num != expected_connection_num) { return false; } for (Strip *seq2 : connections) { - if (!seq_list.contains(seq2)) { + if (!strip_list.contains(seq2)) { return false; } } diff --git a/source/blender/sequencer/intern/strip_edit.cc b/source/blender/sequencer/intern/strip_edit.cc index 8766f9dfa19f..c2a0f106acad 100644 --- a/source/blender/sequencer/intern/strip_edit.cc +++ b/source/blender/sequencer/intern/strip_edit.cc @@ -39,81 +39,81 @@ #include -bool SEQ_edit_sequence_swap(Scene *scene, Strip *seq_a, Strip *seq_b, const char **r_error_str) +bool SEQ_edit_sequence_swap(Scene *scene, Strip *strip_a, Strip *strip_b, const char **r_error_str) { - char name[sizeof(seq_a->name)]; + char name[sizeof(strip_a->name)]; - if (SEQ_time_strip_length_get(scene, seq_a) != SEQ_time_strip_length_get(scene, seq_b)) { + if (SEQ_time_strip_length_get(scene, strip_a) != SEQ_time_strip_length_get(scene, strip_b)) { *r_error_str = N_("Strips must be the same length"); return false; } /* type checking, could be more advanced but disallow sound vs non-sound copy */ - if (seq_a->type != seq_b->type) { - if (seq_a->type == SEQ_TYPE_SOUND_RAM || seq_b->type == SEQ_TYPE_SOUND_RAM) { + if (strip_a->type != strip_b->type) { + if (strip_a->type == STRIP_TYPE_SOUND_RAM || strip_b->type == STRIP_TYPE_SOUND_RAM) { *r_error_str = N_("Strips were not compatible"); return false; } /* disallow effects to swap with non-effects strips */ - if ((seq_a->type & SEQ_TYPE_EFFECT) != (seq_b->type & SEQ_TYPE_EFFECT)) { + if ((strip_a->type & STRIP_TYPE_EFFECT) != (strip_b->type & STRIP_TYPE_EFFECT)) { *r_error_str = N_("Strips were not compatible"); return false; } - if ((seq_a->type & SEQ_TYPE_EFFECT) && (seq_b->type & SEQ_TYPE_EFFECT)) { - if (SEQ_effect_get_num_inputs(seq_a->type) != SEQ_effect_get_num_inputs(seq_b->type)) { + if ((strip_a->type & STRIP_TYPE_EFFECT) && (strip_b->type & STRIP_TYPE_EFFECT)) { + if (SEQ_effect_get_num_inputs(strip_a->type) != SEQ_effect_get_num_inputs(strip_b->type)) { *r_error_str = N_("Strips must have the same number of inputs"); return false; } } } - blender::dna::shallow_swap(*seq_a, *seq_b); + blender::dna::shallow_swap(*strip_a, *strip_b); /* swap back names so animation fcurves don't get swapped */ - STRNCPY(name, seq_a->name + 2); - BLI_strncpy(seq_a->name + 2, seq_b->name + 2, sizeof(seq_b->name) - 2); - BLI_strncpy(seq_b->name + 2, name, sizeof(seq_b->name) - 2); + STRNCPY(name, strip_a->name + 2); + BLI_strncpy(strip_a->name + 2, strip_b->name + 2, sizeof(strip_b->name) - 2); + BLI_strncpy(strip_b->name + 2, name, sizeof(strip_b->name) - 2); /* swap back opacity, and overlay mode */ - std::swap(seq_a->blend_mode, seq_b->blend_mode); - std::swap(seq_a->blend_opacity, seq_b->blend_opacity); - - std::swap(seq_a->prev, seq_b->prev); - std::swap(seq_a->next, seq_b->next); - std::swap(seq_a->start, seq_b->start); - std::swap(seq_a->startofs, seq_b->startofs); - std::swap(seq_a->endofs, seq_b->endofs); - std::swap(seq_a->machine, seq_b->machine); - seq_time_effect_range_set(scene, seq_a); - seq_time_effect_range_set(scene, seq_b); + std::swap(strip_a->blend_mode, strip_b->blend_mode); + std::swap(strip_a->blend_opacity, strip_b->blend_opacity); + + std::swap(strip_a->prev, strip_b->prev); + std::swap(strip_a->next, strip_b->next); + std::swap(strip_a->start, strip_b->start); + std::swap(strip_a->startofs, strip_b->startofs); + std::swap(strip_a->endofs, strip_b->endofs); + std::swap(strip_a->machine, strip_b->machine); + strip_time_effect_range_set(scene, strip_a); + strip_time_effect_range_set(scene, strip_b); return true; } -static void seq_update_muting_recursive(ListBase *channels, - ListBase *seqbasep, - Strip *metaseq, - const bool mute) +static void strip_update_muting_recursive(ListBase *channels, + ListBase *seqbasep, + Strip *metaseq, + const bool mute) { /* For sound we go over full meta tree to update muted state, * since sound is played outside of evaluating the imbufs. */ - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - bool seqmute = (mute || SEQ_render_is_muted(channels, seq)); + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + bool seqmute = (mute || SEQ_render_is_muted(channels, strip)); - if (seq->type == SEQ_TYPE_META) { + if (strip->type == STRIP_TYPE_META) { /* if this is the current meta sequence, unmute because * all sequences above this were set to mute */ - if (seq == metaseq) { + if (strip == metaseq) { seqmute = false; } - seq_update_muting_recursive(&seq->channels, &seq->seqbase, metaseq, seqmute); + strip_update_muting_recursive(&strip->channels, &strip->seqbase, metaseq, seqmute); } - else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { - if (seq->scene_sound) { - BKE_sound_mute_scene_sound(seq->scene_sound, seqmute); + else if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SCENE)) { + if (strip->scene_sound) { + BKE_sound_mute_scene_sound(strip->scene_sound, seqmute); } } } @@ -126,31 +126,31 @@ void SEQ_edit_update_muting(Editing *ed) MetaStack *ms = static_cast(ed->metastack.last); if (ms) { - seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, true); + strip_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, true); } else { - seq_update_muting_recursive(&ed->channels, &ed->seqbase, nullptr, false); + strip_update_muting_recursive(&ed->channels, &ed->seqbase, nullptr, false); } } } -static void sequencer_flag_users_for_removal(Scene *scene, ListBase *seqbase, Strip *seq) +static void sequencer_flag_users_for_removal(Scene *scene, ListBase *seqbase, Strip *strip) { LISTBASE_FOREACH (Strip *, user_seq, seqbase) { - /* Look in meta-strips for usage of seq. */ - if (user_seq->type == SEQ_TYPE_META) { - sequencer_flag_users_for_removal(scene, &user_seq->seqbase, seq); + /* Look in meta-strips for usage of strip. */ + if (user_seq->type == STRIP_TYPE_META) { + sequencer_flag_users_for_removal(scene, &user_seq->seqbase, strip); } - /* Clear seq from modifiers. */ + /* Clear strip from modifiers. */ LISTBASE_FOREACH (SequenceModifierData *, smd, &user_seq->modifiers) { - if (smd->mask_sequence == seq) { + if (smd->mask_sequence == strip) { smd->mask_sequence = nullptr; } } - /* Remove effects, that use seq. */ - if (SEQ_relation_is_effect_of_strip(user_seq, seq)) { + /* Remove effects, that use strip. */ + if (SEQ_relation_is_effect_of_strip(user_seq, strip)) { user_seq->flag |= SEQ_FLAG_DELETE; /* Strips can be used as mask even if not in same seqbase. */ sequencer_flag_users_for_removal(scene, &scene->ed->seqbase, user_seq); @@ -158,51 +158,51 @@ static void sequencer_flag_users_for_removal(Scene *scene, ListBase *seqbase, St } } -void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Strip *seq) +void SEQ_edit_flag_for_removal(Scene *scene, ListBase *seqbase, Strip *strip) { - if (seq == nullptr || (seq->flag & SEQ_FLAG_DELETE) != 0) { + if (strip == nullptr || (strip->flag & SEQ_FLAG_DELETE) != 0) { return; } /* Flag and remove meta children. */ - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, meta_child, &seq->seqbase) { - SEQ_edit_flag_for_removal(scene, &seq->seqbase, meta_child); + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, meta_child, &strip->seqbase) { + SEQ_edit_flag_for_removal(scene, &strip->seqbase, meta_child); } } - seq->flag |= SEQ_FLAG_DELETE; - sequencer_flag_users_for_removal(scene, seqbase, seq); + strip->flag |= SEQ_FLAG_DELETE; + sequencer_flag_users_for_removal(scene, seqbase, strip); } void SEQ_edit_remove_flagged_sequences(Scene *scene, ListBase *seqbase) { - LISTBASE_FOREACH_MUTABLE (Strip *, seq, seqbase) { - if (seq->flag & SEQ_FLAG_DELETE) { - if (seq->type == SEQ_TYPE_META) { - SEQ_edit_remove_flagged_sequences(scene, &seq->seqbase); + LISTBASE_FOREACH_MUTABLE (Strip *, strip, seqbase) { + if (strip->flag & SEQ_FLAG_DELETE) { + if (strip->type == STRIP_TYPE_META) { + SEQ_edit_remove_flagged_sequences(scene, &strip->seqbase); } - SEQ_free_animdata(scene, seq); - BLI_remlink(seqbase, seq); - SEQ_sequence_free(scene, seq); - SEQ_sequence_lookup_invalidate(scene); + SEQ_free_animdata(scene, strip); + BLI_remlink(seqbase, strip); + SEQ_sequence_free(scene, strip); + SEQ_strip_lookup_invalidate(scene); } } } bool SEQ_edit_move_strip_to_seqbase(Scene *scene, ListBase *seqbase, - Strip *seq, + Strip *strip, ListBase *dst_seqbase) { /* Move to meta. */ - BLI_remlink(seqbase, seq); - BLI_addtail(dst_seqbase, seq); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + BLI_remlink(seqbase, strip); + BLI_addtail(dst_seqbase, strip); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); /* Update meta. */ - if (SEQ_transform_test_overlap(scene, dst_seqbase, seq)) { - SEQ_transform_seqbase_shuffle(dst_seqbase, seq, scene); + if (SEQ_transform_test_overlap(scene, dst_seqbase, strip)) { + SEQ_transform_seqbase_shuffle(dst_seqbase, strip, scene); } return true; @@ -217,7 +217,7 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, Editing *ed = SEQ_editing_get(scene); ListBase *seqbase = SEQ_get_seqbase_by_seq(scene, src_seq); - if (dst_seqm->type != SEQ_TYPE_META) { + if (dst_seqm->type != STRIP_TYPE_META) { *r_error_str = N_("Cannot move strip to non-meta strip"); return false; } @@ -232,7 +232,7 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, return false; } - if (src_seq->type == SEQ_TYPE_META && SEQ_exists_in_seqbase(dst_seqm, &src_seq->seqbase)) { + if (src_seq->type == STRIP_TYPE_META && SEQ_exists_in_seqbase(dst_seqm, &src_seq->seqbase)) { *r_error_str = N_("Moved strip is parent of provided meta strip"); return false; } @@ -246,9 +246,9 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, strips.add(src_seq); SEQ_iterator_set_expand(scene, seqbase, strips, SEQ_query_strip_effect_chain); - for (Strip *seq : strips) { + for (Strip *strip : strips) { /* Move to meta. */ - SEQ_edit_move_strip_to_seqbase(scene, seqbase, seq, &dst_seqm->seqbase); + SEQ_edit_move_strip_to_seqbase(scene, seqbase, strip, &dst_seqm->seqbase); } return true; @@ -256,63 +256,63 @@ bool SEQ_edit_move_strip_to_meta(Scene *scene, static void seq_split_set_right_hold_offset(Main *bmain, Scene *scene, - Strip *seq, + Strip *strip, int timeline_frame) { - const float content_start = SEQ_time_start_frame_get(seq); - const float content_end = SEQ_time_content_end_frame_get(scene, seq); + const float content_start = SEQ_time_start_frame_get(strip); + const float content_end = SEQ_time_content_end_frame_get(scene, strip); /* Adjust within range of extended still-frames before strip. */ if (timeline_frame < content_start) { const float offset = content_start + 1 - timeline_frame; - seq->start -= offset; - seq->startofs += offset; + strip->start -= offset; + strip->startofs += offset; } /* Adjust within range of strip contents. */ else if ((timeline_frame >= content_start) && (timeline_frame <= content_end)) { - seq->endofs = 0; - float speed_factor = SEQ_time_media_playback_rate_factor_get(scene, seq); - seq->anim_endofs += round_fl_to_int((content_end - timeline_frame) * speed_factor); + strip->endofs = 0; + float speed_factor = SEQ_time_media_playback_rate_factor_get(scene, strip); + strip->anim_endofs += round_fl_to_int((content_end - timeline_frame) * speed_factor); } - /* Needed only to set `seq->len`. */ - SEQ_add_reload_new_file(bmain, scene, seq, false); - SEQ_time_right_handle_frame_set(scene, seq, timeline_frame); + /* Needed only to set `strip->len`. */ + SEQ_add_reload_new_file(bmain, scene, strip, false); + SEQ_time_right_handle_frame_set(scene, strip, timeline_frame); } static void seq_split_set_left_hold_offset(Main *bmain, Scene *scene, - Strip *seq, + Strip *strip, int timeline_frame) { - const float content_start = SEQ_time_start_frame_get(seq); - const float content_end = SEQ_time_content_end_frame_get(scene, seq); + const float content_start = SEQ_time_start_frame_get(strip); + const float content_end = SEQ_time_content_end_frame_get(scene, strip); /* Adjust within range of strip contents. */ if ((timeline_frame >= content_start) && (timeline_frame <= content_end)) { - float speed_factor = SEQ_time_media_playback_rate_factor_get(scene, seq); - seq->anim_startofs += round_fl_to_int((timeline_frame - content_start) * speed_factor); - seq->start = timeline_frame; - seq->startofs = 0; + float speed_factor = SEQ_time_media_playback_rate_factor_get(scene, strip); + strip->anim_startofs += round_fl_to_int((timeline_frame - content_start) * speed_factor); + strip->start = timeline_frame; + strip->startofs = 0; } /* Adjust within range of extended still-frames after strip. */ else if (timeline_frame > content_end) { const float offset = timeline_frame - content_end + 1; - seq->start += offset; - seq->endofs += offset; + strip->start += offset; + strip->endofs += offset; } - /* Needed only to set `seq->len`. */ - SEQ_add_reload_new_file(bmain, scene, seq, false); - SEQ_time_left_handle_frame_set(scene, seq, timeline_frame); + /* Needed only to set `strip->len`. */ + SEQ_add_reload_new_file(bmain, scene, strip, false); + SEQ_time_left_handle_frame_set(scene, strip, timeline_frame); } static bool seq_edit_split_intersect_check(const Scene *scene, - const Strip *seq, + const Strip *strip, const int timeline_frame) { - return timeline_frame > SEQ_time_left_handle_frame_get(scene, seq) && - timeline_frame < SEQ_time_right_handle_frame_get(scene, seq); + return timeline_frame > SEQ_time_left_handle_frame_get(scene, strip) && + timeline_frame < SEQ_time_right_handle_frame_get(scene, strip); } static void seq_edit_split_handle_strip_offsets(Main *bmain, @@ -346,22 +346,22 @@ static void seq_edit_split_handle_strip_offsets(Main *bmain, } static bool seq_edit_split_effect_inputs_intersect(const Scene *scene, - const Strip *seq, + const Strip *strip, const int timeline_frame) { bool input_does_intersect = false; - if (seq->seq1) { - input_does_intersect |= seq_edit_split_intersect_check(scene, seq->seq1, timeline_frame); - if ((seq->seq1->type & SEQ_TYPE_EFFECT) != 0) { + if (strip->seq1) { + input_does_intersect |= seq_edit_split_intersect_check(scene, strip->seq1, timeline_frame); + if ((strip->seq1->type & STRIP_TYPE_EFFECT) != 0) { input_does_intersect |= seq_edit_split_effect_inputs_intersect( - scene, seq->seq1, timeline_frame); + scene, strip->seq1, timeline_frame); } } - if (seq->seq2) { - input_does_intersect |= seq_edit_split_intersect_check(scene, seq->seq2, timeline_frame); - if ((seq->seq1->type & SEQ_TYPE_EFFECT) != 0) { + if (strip->seq2) { + input_does_intersect |= seq_edit_split_intersect_check(scene, strip->seq2, timeline_frame); + if ((strip->seq1->type & STRIP_TYPE_EFFECT) != 0) { input_does_intersect |= seq_edit_split_effect_inputs_intersect( - scene, seq->seq2, timeline_frame); + scene, strip->seq2, timeline_frame); } } return input_does_intersect; @@ -372,26 +372,26 @@ static bool seq_edit_split_operation_permitted_check(const Scene *scene, const int timeline_frame, const char **r_error) { - for (Strip *seq : strips) { + for (Strip *strip : strips) { ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(scene)); - if (SEQ_transform_is_locked(channels, seq)) { + if (SEQ_transform_is_locked(channels, strip)) { *r_error = "Strip is locked."; return false; } - if ((seq->type & SEQ_TYPE_EFFECT) == 0) { + if ((strip->type & STRIP_TYPE_EFFECT) == 0) { continue; } - if (!seq_edit_split_intersect_check(scene, seq, timeline_frame)) { + if (!seq_edit_split_intersect_check(scene, strip, timeline_frame)) { continue; } - if (SEQ_effect_get_num_inputs(seq->type) <= 1) { + if (SEQ_effect_get_num_inputs(strip->type) <= 1) { continue; } - if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) { + if (ELEM(strip->type, STRIP_TYPE_CROSS, STRIP_TYPE_GAMCROSS, STRIP_TYPE_WIPE)) { *r_error = "Splitting transition effect is not permitted."; return false; } - if (!seq_edit_split_effect_inputs_intersect(scene, seq, timeline_frame)) { + if (!seq_edit_split_effect_inputs_intersect(scene, strip, timeline_frame)) { *r_error = "Effect inputs don't overlap. Can not split such effect."; return false; } @@ -402,18 +402,18 @@ static bool seq_edit_split_operation_permitted_check(const Scene *scene, Strip *SEQ_edit_strip_split(Main *bmain, Scene *scene, ListBase *seqbase, - Strip *seq, + Strip *strip, const int timeline_frame, const eSeqSplitMethod method, const char **r_error) { - if (!seq_edit_split_intersect_check(scene, seq, timeline_frame)) { + if (!seq_edit_split_intersect_check(scene, strip, timeline_frame)) { return nullptr; } /* Whole strip effect chain must be duplicated in order to preserve relationships. */ blender::VectorSet strips; - strips.add(seq); + strips.add(strip); SEQ_iterator_set_expand(scene, seqbase, strips, SEQ_query_strip_effect_chain); /* All connected strips (that are selected and at the cut frame) must also be duplicated. */ @@ -439,18 +439,18 @@ Strip *SEQ_edit_strip_split(Main *bmain, SEQ_animation_backup_original(scene, &animation_backup); ListBase left_strips = {nullptr, nullptr}; - for (Strip *seq_iter : strips) { + for (Strip *strip_iter : strips) { /* Move strips in collection from seqbase to new ListBase. */ - BLI_remlink(seqbase, seq_iter); - BLI_addtail(&left_strips, seq_iter); + BLI_remlink(seqbase, strip_iter); + BLI_addtail(&left_strips, strip_iter); /* Duplicate curves from backup, so they can be renamed along with split strips. */ - SEQ_animation_duplicate_backup_to_scene(scene, seq_iter, &animation_backup); + SEQ_animation_duplicate_backup_to_scene(scene, strip_iter, &animation_backup); } /* Duplicate ListBase. */ ListBase right_strips = {nullptr, nullptr}; - SEQ_sequence_base_dupli_recursive(scene, scene, &right_strips, &left_strips, SEQ_DUPE_ALL, 0); + SEQ_sequence_base_dupli_recursive(scene, scene, &right_strips, &left_strips, STRIP_DUPE_ALL, 0); Strip *left_seq = static_cast(left_strips.first); Strip *right_seq = static_cast(right_strips.first); @@ -462,9 +462,9 @@ Strip *SEQ_edit_strip_split(Main *bmain, /* Rename duplicated strips. This has to be done immediately after adding * strips to seqbase, for lookup cache to work correctly. */ - Strip *seq_rename = right_seq; - for (; seq_rename; seq_rename = seq_rename->next) { - SEQ_ensure_unique_name(seq_rename, scene); + Strip *strip_rename = right_seq; + for (; strip_rename; strip_rename = strip_rename->next) { + SEQ_ensure_unique_name(strip_rename, scene); } /* Split strips. */ @@ -517,9 +517,9 @@ bool SEQ_edit_remove_gaps(Scene *scene, return true; } -void SEQ_edit_sequence_name_set(Scene *scene, Strip *seq, const char *new_name) +void SEQ_edit_sequence_name_set(Scene *scene, Strip *strip, const char *new_name) { - BLI_strncpy_utf8(seq->name + 2, new_name, MAX_NAME - 2); - BLI_str_utf8_invalid_strip(seq->name + 2, strlen(seq->name + 2)); - SEQ_sequence_lookup_invalidate(scene); + BLI_strncpy_utf8(strip->name + 2, new_name, MAX_NAME - 2); + BLI_str_utf8_invalid_strip(strip->name + 2, strlen(strip->name + 2)); + SEQ_strip_lookup_invalidate(scene); } diff --git a/source/blender/sequencer/intern/strip_lookup.cc b/source/blender/sequencer/intern/strip_lookup.cc new file mode 100644 index 000000000000..d06a556a3ee5 --- /dev/null +++ b/source/blender/sequencer/intern/strip_lookup.cc @@ -0,0 +1,171 @@ +/* SPDX-FileCopyrightText: 2021-2024 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup sequencer + */ + +#include "SEQ_sequencer.hh" +#include "sequencer.hh" + +#include "DNA_listBase.h" +#include "DNA_scene_types.h" +#include "DNA_sequence_types.h" + +#include "BLI_listbase.h" +#include "BLI_map.hh" +#include "BLI_vector_set.hh" + +#include +#include + +#include "MEM_guardedalloc.h" + +static std::mutex lookup_lock; + +struct StripLookup { + blender::Map strip_by_name; + blender::Map meta_by_strip; + blender::Map> effects_by_strip; + blender::Map owner_by_channel; + bool is_valid = false; +}; + +static void strip_lookup_append_effect(const Strip *input, Strip *effect, StripLookup *lookup) +{ + if (input == nullptr) { + return; + } + + blender::VectorSet &effects = lookup->effects_by_strip.lookup_or_add_default(input); + + effects.add(effect); +} + +static void strip_lookup_build_effect(Strip *strip, StripLookup *lookup) +{ + if ((strip->type & STRIP_TYPE_EFFECT) == 0) { + return; + } + + strip_lookup_append_effect(strip->seq1, strip, lookup); + strip_lookup_append_effect(strip->seq2, strip, lookup); +} + +static void strip_lookup_build_from_seqbase(Strip *parent_meta, + const ListBase *seqbase, + StripLookup *lookup) +{ + if (parent_meta != nullptr) { + LISTBASE_FOREACH (SeqTimelineChannel *, channel, &parent_meta->channels) { + lookup->owner_by_channel.add(channel, parent_meta); + } + } + + LISTBASE_FOREACH (Strip *, strip, seqbase) { + lookup->strip_by_name.add(strip->name + 2, strip); + lookup->meta_by_strip.add(strip, parent_meta); + strip_lookup_build_effect(strip, lookup); + + if (strip->type == STRIP_TYPE_META) { + strip_lookup_build_from_seqbase(strip, &strip->seqbase, lookup); + } + } +} + +static void strip_lookup_build(const Scene *scene, StripLookup *lookup) +{ + Editing *ed = SEQ_editing_get(scene); + strip_lookup_build_from_seqbase(nullptr, &ed->seqbase, lookup); + lookup->is_valid = true; +} + +static StripLookup *strip_lookup_new() +{ + StripLookup *lookup = MEM_new(__func__); + return lookup; +} + +static void strip_lookup_free(StripLookup **lookup) +{ + MEM_delete(*lookup); + *lookup = nullptr; +} + +static void strip_lookup_rebuild(const Scene *scene, StripLookup **lookup) +{ + strip_lookup_free(lookup); + *lookup = strip_lookup_new(); + strip_lookup_build(scene, *lookup); +} + +static void strip_lookup_update_if_needed(const Scene *scene, StripLookup **lookup) +{ + if (!scene->ed) { + return; + } + if (*lookup && (*lookup)->is_valid) { + return; + } + + strip_lookup_rebuild(scene, lookup); +} + +void SEQ_strip_lookup_free(const Scene *scene) +{ + BLI_assert(scene->ed); + std::lock_guard lock(lookup_lock); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + strip_lookup_free(&lookup); +} + +Strip *SEQ_lookup_strip_by_name(const Scene *scene, const char *key) +{ + BLI_assert(scene->ed); + std::lock_guard lock(lookup_lock); + strip_lookup_update_if_needed(scene, &scene->ed->runtime.strip_lookup); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + return lookup->strip_by_name.lookup_default(key, nullptr); +} + +Strip *SEQ_lookup_meta_by_strip(const Scene *scene, const Strip *key) +{ + BLI_assert(scene->ed); + std::lock_guard lock(lookup_lock); + strip_lookup_update_if_needed(scene, &scene->ed->runtime.strip_lookup); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + return lookup->meta_by_strip.lookup_default(key, nullptr); +} + +blender::Span SEQ_lookup_effects_by_strip(const Scene *scene, const Strip *key) +{ + BLI_assert(scene->ed); + std::lock_guard lock(lookup_lock); + strip_lookup_update_if_needed(scene, &scene->ed->runtime.strip_lookup); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + blender::VectorSet &effects = lookup->effects_by_strip.lookup_or_add_default(key); + return effects.as_span(); +} + +Strip *SEQ_lookup_strip_by_channel_owner(const Scene *scene, const SeqTimelineChannel *channel) +{ + BLI_assert(scene->ed); + std::lock_guard lock(lookup_lock); + strip_lookup_update_if_needed(scene, &scene->ed->runtime.strip_lookup); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + return lookup->owner_by_channel.lookup_default(channel, nullptr); +} + +void SEQ_strip_lookup_invalidate(const Scene *scene) +{ + if (scene == nullptr || scene->ed == nullptr) { + return; + } + + std::lock_guard lock(lookup_lock); + StripLookup *lookup = scene->ed->runtime.strip_lookup; + if (lookup != nullptr) { + lookup->is_valid = false; + } +} diff --git a/source/blender/sequencer/intern/strip_relations.cc b/source/blender/sequencer/intern/strip_relations.cc index 457a27514cec..48600edaa33f 100644 --- a/source/blender/sequencer/intern/strip_relations.cc +++ b/source/blender/sequencer/intern/strip_relations.cc @@ -21,8 +21,6 @@ #include "DEG_depsgraph.hh" -#include "IMB_imbuf.hh" - #include "MOV_read.hh" #include "SEQ_iterator.hh" @@ -42,30 +40,30 @@ bool SEQ_relation_is_effect_of_strip(const Strip *effect, const Strip *input) } /* check whether sequence cur depends on seq */ -static bool seq_relations_check_depend(const Scene *scene, Strip *seq, Strip *cur) +static bool strip_relations_check_depend(const Scene *scene, Strip *strip, Strip *cur) { - if (SEQ_relation_is_effect_of_strip(cur, seq)) { + if (SEQ_relation_is_effect_of_strip(cur, strip)) { return true; } /* sequences are not intersecting in time, assume no dependency exists between them */ - if (SEQ_time_right_handle_frame_get(scene, cur) < SEQ_time_left_handle_frame_get(scene, seq) || - SEQ_time_left_handle_frame_get(scene, cur) > SEQ_time_right_handle_frame_get(scene, seq)) + if (SEQ_time_right_handle_frame_get(scene, cur) < SEQ_time_left_handle_frame_get(scene, strip) || + SEQ_time_left_handle_frame_get(scene, cur) > SEQ_time_right_handle_frame_get(scene, strip)) { return false; } /* checking sequence is below reference one, not dependent on it */ - if (cur->machine < seq->machine) { + if (cur->machine < strip->machine) { return false; } /* sequence is not blending with lower machines, no dependency here occurs * check for non-effects only since effect could use lower machines as input */ - if ((cur->type & SEQ_TYPE_EFFECT) == 0 && + if ((cur->type & STRIP_TYPE_EFFECT) == 0 && ((cur->blend_mode == SEQ_BLEND_REPLACE) || - (cur->blend_mode == SEQ_TYPE_CROSS && cur->blend_opacity == 100.0f))) + (cur->blend_mode == STRIP_TYPE_CROSS && cur->blend_opacity == 100.0f))) { return false; } @@ -73,56 +71,56 @@ static bool seq_relations_check_depend(const Scene *scene, Strip *seq, Strip *cu return true; } -static void sequence_do_invalidate_dependent(Scene *scene, Strip *seq, ListBase *seqbase) +static void sequence_do_invalidate_dependent(Scene *scene, Strip *strip, ListBase *seqbase) { LISTBASE_FOREACH (Strip *, cur, seqbase) { - if (cur == seq) { + if (cur == strip) { continue; } - if (seq_relations_check_depend(scene, seq, cur)) { - /* Effect must be invalidated completely if they depend on invalidated seq. */ - if ((cur->type & SEQ_TYPE_EFFECT) != 0) { - seq_cache_cleanup_sequence(scene, cur, seq, SEQ_CACHE_ALL_TYPES, false); + if (strip_relations_check_depend(scene, strip, cur)) { + /* Effect must be invalidated completely if they depend on invalidated strip. */ + if ((cur->type & STRIP_TYPE_EFFECT) != 0) { + seq_cache_cleanup_sequence(scene, cur, strip, SEQ_CACHE_ALL_TYPES, false); } else { /* In case of alpha over for example only invalidate composite image */ seq_cache_cleanup_sequence( - scene, cur, seq, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT, false); + scene, cur, strip, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT, false); } } if (cur->seqbase.first) { - sequence_do_invalidate_dependent(scene, seq, &cur->seqbase); + sequence_do_invalidate_dependent(scene, strip, &cur->seqbase); } } } static void sequence_invalidate_cache(Scene *scene, - Strip *seq, + Strip *strip, bool invalidate_self, int invalidate_types) { Editing *ed = scene->ed; if (invalidate_self) { - seq_cache_cleanup_sequence(scene, seq, seq, invalidate_types, false); + seq_cache_cleanup_sequence(scene, strip, strip, invalidate_types, false); } - if (seq->effectdata && seq->type == SEQ_TYPE_SPEED) { - seq_effect_speed_rebuild_map(scene, seq); + if (strip->effectdata && strip->type == STRIP_TYPE_SPEED) { + strip_effect_speed_rebuild_map(scene, strip); } - blender::seq::media_presence_invalidate_strip(scene, seq); - sequence_do_invalidate_dependent(scene, seq, &ed->seqbase); + blender::seq::media_presence_invalidate_strip(scene, strip); + sequence_do_invalidate_dependent(scene, strip, &ed->seqbase); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); SEQ_prefetch_stop(scene); } /* Find meta-strips that contain invalidated_seq and invalidate them. */ -static bool seq_relations_find_and_invalidate_metas(Scene *scene, - Strip *invalidated_seq, - Strip *meta_seq) +static bool strip_relations_find_and_invalidate_metas(Scene *scene, + Strip *invalidated_seq, + Strip *meta_seq) { ListBase *seqbase; @@ -134,14 +132,14 @@ static bool seq_relations_find_and_invalidate_metas(Scene *scene, seqbase = &meta_seq->seqbase; } - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_META) { - if (seq_relations_find_and_invalidate_metas(scene, invalidated_seq, seq)) { - sequence_invalidate_cache(scene, seq, true, SEQ_CACHE_ALL_TYPES); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type == STRIP_TYPE_META) { + if (strip_relations_find_and_invalidate_metas(scene, invalidated_seq, strip)) { + sequence_invalidate_cache(scene, strip, true, SEQ_CACHE_ALL_TYPES); return true; } } - if (seq == invalidated_seq && meta_seq != nullptr) { + if (strip == invalidated_seq && meta_seq != nullptr) { sequence_invalidate_cache(scene, meta_seq, true, SEQ_CACHE_ALL_TYPES); return true; } @@ -150,61 +148,62 @@ static bool seq_relations_find_and_invalidate_metas(Scene *scene, } void SEQ_relations_invalidate_cache_in_range(Scene *scene, - Strip *seq, + Strip *strip, Strip *range_mask, int invalidate_types) { - seq_cache_cleanup_sequence(scene, seq, range_mask, invalidate_types, true); - seq_relations_find_and_invalidate_metas(scene, seq, nullptr); + seq_cache_cleanup_sequence(scene, strip, range_mask, invalidate_types, true); + strip_relations_find_and_invalidate_metas(scene, strip, nullptr); } -void SEQ_relations_invalidate_cache_raw(Scene *scene, Strip *seq) +void SEQ_relations_invalidate_cache_raw(Scene *scene, Strip *strip) { - sequence_invalidate_cache(scene, seq, true, SEQ_CACHE_ALL_TYPES); - seq_relations_find_and_invalidate_metas(scene, seq, nullptr); + sequence_invalidate_cache(scene, strip, true, SEQ_CACHE_ALL_TYPES); + strip_relations_find_and_invalidate_metas(scene, strip, nullptr); } -void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Strip *seq) +void SEQ_relations_invalidate_cache_preprocessed(Scene *scene, Strip *strip) { sequence_invalidate_cache(scene, - seq, + strip, true, SEQ_CACHE_STORE_PREPROCESSED | SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT); - seq_relations_find_and_invalidate_metas(scene, seq, nullptr); + strip_relations_find_and_invalidate_metas(scene, strip, nullptr); } -void SEQ_relations_invalidate_cache_composite(Scene *scene, Strip *seq) +void SEQ_relations_invalidate_cache_composite(Scene *scene, Strip *strip) { - if (seq->type == SEQ_TYPE_SOUND_RAM) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { return; } sequence_invalidate_cache( - scene, seq, true, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT); - seq_relations_find_and_invalidate_metas(scene, seq, nullptr); + scene, strip, true, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT); + strip_relations_find_and_invalidate_metas(scene, strip, nullptr); } -void SEQ_relations_invalidate_dependent(Scene *scene, Strip *seq) +void SEQ_relations_invalidate_dependent(Scene *scene, Strip *strip) { - if (seq->type == SEQ_TYPE_SOUND_RAM) { + if (strip->type == STRIP_TYPE_SOUND_RAM) { return; } sequence_invalidate_cache( - scene, seq, false, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT); - seq_relations_find_and_invalidate_metas(scene, seq, nullptr); + scene, strip, false, SEQ_CACHE_STORE_COMPOSITE | SEQ_CACHE_STORE_FINAL_OUT); + strip_relations_find_and_invalidate_metas(scene, strip, nullptr); } static void invalidate_scene_strips(Scene *scene, Scene *scene_target, ListBase *seqbase) { - for (Strip *seq = static_cast(seqbase->first); seq != nullptr; seq = seq->next) { - if (seq->scene == scene_target) { - SEQ_relations_invalidate_cache_raw(scene, seq); + for (Strip *strip = static_cast(seqbase->first); strip != nullptr; strip = strip->next) + { + if (strip->scene == scene_target) { + SEQ_relations_invalidate_cache_raw(scene, strip); } - if (seq->seqbase.first != nullptr) { - invalidate_scene_strips(scene, scene_target, &seq->seqbase); + if (strip->seqbase.first != nullptr) { + invalidate_scene_strips(scene, scene_target, &strip->seqbase); } } } @@ -222,13 +221,14 @@ void SEQ_relations_invalidate_scene_strips(Main *bmain, Scene *scene_target) static void invalidate_movieclip_strips(Scene *scene, MovieClip *clip_target, ListBase *seqbase) { - for (Strip *seq = static_cast(seqbase->first); seq != nullptr; seq = seq->next) { - if (seq->clip == clip_target) { - SEQ_relations_invalidate_cache_raw(scene, seq); + for (Strip *strip = static_cast(seqbase->first); strip != nullptr; strip = strip->next) + { + if (strip->clip == clip_target) { + SEQ_relations_invalidate_cache_raw(scene, strip); } - if (seq->seqbase.first != nullptr) { - invalidate_movieclip_strips(scene, clip_target, &seq->seqbase); + if (strip->seqbase.first != nullptr) { + invalidate_movieclip_strips(scene, clip_target, &strip->seqbase); } } } @@ -253,23 +253,23 @@ void SEQ_relations_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render) SEQ_cache_cleanup(scene); SEQ_prefetch_stop(scene); - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (for_render && SEQ_time_strip_intersects_frame(scene, seq, scene->r.cfra)) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (for_render && SEQ_time_strip_intersects_frame(scene, strip, scene->r.cfra)) { continue; } - if (seq->data) { - if (seq->type == SEQ_TYPE_MOVIE) { - SEQ_relations_sequence_free_anim(seq); + if (strip->data) { + if (strip->type == STRIP_TYPE_MOVIE) { + SEQ_relations_sequence_free_anim(strip); } - if (seq->type == SEQ_TYPE_SPEED) { - seq_effect_speed_rebuild_map(scene, seq); + if (strip->type == STRIP_TYPE_SPEED) { + strip_effect_speed_rebuild_map(scene, strip); } } - if (seq->type == SEQ_TYPE_META) { - SEQ_relations_free_imbuf(scene, &seq->seqbase, for_render); + if (strip->type == STRIP_TYPE_META) { + SEQ_relations_free_imbuf(scene, &strip->seqbase, for_render); } - if (seq->type == SEQ_TYPE_SCENE) { + if (strip->type == STRIP_TYPE_SCENE) { /* FIXME: recurse downwards, * but do recurse protection somehow! */ } @@ -282,27 +282,28 @@ static void sequencer_all_free_anim_ibufs(const Scene *scene, const int frame_range[2]) { Editing *ed = SEQ_editing_get(scene); - for (Strip *seq = static_cast(seqbase->first); seq != nullptr; seq = seq->next) { - if (!SEQ_time_strip_intersects_frame(scene, seq, timeline_frame) || + for (Strip *strip = static_cast(seqbase->first); strip != nullptr; strip = strip->next) + { + if (!SEQ_time_strip_intersects_frame(scene, strip, timeline_frame) || !((frame_range[0] <= timeline_frame) && (frame_range[1] > timeline_frame))) { - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); } - if (seq->type == SEQ_TYPE_META) { + if (strip->type == STRIP_TYPE_META) { int meta_range[2]; MetaStack *ms = SEQ_meta_stack_active_get(ed); - if (ms != nullptr && ms->parseq == seq) { + if (ms != nullptr && ms->parseq == strip) { meta_range[0] = -MAXFRAME; meta_range[1] = MAXFRAME; } else { /* Limit frame range to meta strip. */ - meta_range[0] = max_ii(frame_range[0], SEQ_time_left_handle_frame_get(scene, seq)); - meta_range[1] = min_ii(frame_range[1], SEQ_time_right_handle_frame_get(scene, seq)); + meta_range[0] = max_ii(frame_range[0], SEQ_time_left_handle_frame_get(scene, strip)); + meta_range[1] = min_ii(frame_range[1], SEQ_time_right_handle_frame_get(scene, strip)); } - sequencer_all_free_anim_ibufs(scene, &seq->seqbase, timeline_frame, meta_range); + sequencer_all_free_anim_ibufs(scene, &strip->seqbase, timeline_frame, meta_range); } } } @@ -320,21 +321,22 @@ void SEQ_relations_free_all_anim_ibufs(Scene *scene, int timeline_frame) static Strip *sequencer_check_scene_recursion(Scene *scene, ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->type == SEQ_TYPE_SCENE && seq->scene == scene) { - return seq; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->type == STRIP_TYPE_SCENE && strip->scene == scene) { + return strip; } - if (seq->type == SEQ_TYPE_SCENE && (seq->flag & SEQ_SCENE_STRIPS)) { - if (seq->scene && seq->scene->ed && - sequencer_check_scene_recursion(scene, &seq->scene->ed->seqbase)) + if (strip->type == STRIP_TYPE_SCENE && (strip->flag & SEQ_SCENE_STRIPS)) { + if (strip->scene && strip->scene->ed && + sequencer_check_scene_recursion(scene, &strip->scene->ed->seqbase)) { - return seq; + return strip; } } - if (seq->type == SEQ_TYPE_META && sequencer_check_scene_recursion(scene, &seq->seqbase)) { - return seq; + if (strip->type == STRIP_TYPE_META && sequencer_check_scene_recursion(scene, &strip->seqbase)) + { + return strip; } } @@ -357,8 +359,8 @@ bool SEQ_relations_check_scene_recursion(Scene *scene, ReportList *reports) recursive_seq->name + 2, SEQ_time_left_handle_frame_get(scene, recursive_seq)); - LISTBASE_FOREACH (Strip *, seq, &ed->seqbase) { - if (seq->type != SEQ_TYPE_SCENE && sequencer_seq_generates_image(seq)) { + LISTBASE_FOREACH (Strip *, strip, &ed->seqbase) { + if (strip->type != STRIP_TYPE_SCENE && sequencer_seq_generates_image(strip)) { /* There are other strips to render, so render them. */ return false; } @@ -370,24 +372,24 @@ bool SEQ_relations_check_scene_recursion(Scene *scene, ReportList *reports) return false; } -bool SEQ_relations_render_loop_check(Strip *seq_main, Strip *seq) +bool SEQ_relations_render_loop_check(Strip *strip_main, Strip *strip) { - if (seq_main == nullptr || seq == nullptr) { + if (strip_main == nullptr || strip == nullptr) { return false; } - if (seq_main == seq) { + if (strip_main == strip) { return true; } - if ((seq_main->seq1 && SEQ_relations_render_loop_check(seq_main->seq1, seq)) || - (seq_main->seq2 && SEQ_relations_render_loop_check(seq_main->seq2, seq))) + if ((strip_main->seq1 && SEQ_relations_render_loop_check(strip_main->seq1, strip)) || + (strip_main->seq2 && SEQ_relations_render_loop_check(strip_main->seq2, strip))) { return true; } - LISTBASE_FOREACH (SequenceModifierData *, smd, &seq_main->modifiers) { - if (smd->mask_sequence && SEQ_relations_render_loop_check(smd->mask_sequence, seq)) { + LISTBASE_FOREACH (SequenceModifierData *, smd, &strip_main->modifiers) { + if (smd->mask_sequence && SEQ_relations_render_loop_check(smd->mask_sequence, strip)) { return true; } } @@ -395,19 +397,19 @@ bool SEQ_relations_render_loop_check(Strip *seq_main, Strip *seq) return false; } -void SEQ_relations_sequence_free_anim(Strip *seq) +void SEQ_relations_sequence_free_anim(Strip *strip) { - while (seq->anims.last) { - StripAnim *sanim = static_cast(seq->anims.last); + while (strip->anims.last) { + StripAnim *sanim = static_cast(strip->anims.last); if (sanim->anim) { MOV_close(sanim->anim); sanim->anim = nullptr; } - BLI_freelinkN(&seq->anims, sanim); + BLI_freelinkN(&strip->anims, sanim); } - BLI_listbase_clear(&seq->anims); + BLI_listbase_clear(&strip->anims); } void SEQ_relations_session_uid_generate(Strip *sequence) @@ -415,17 +417,17 @@ void SEQ_relations_session_uid_generate(Strip *sequence) sequence->runtime.session_uid = BLI_session_uid_generate(); } -static bool get_uids_cb(Strip *seq, void *user_data) +static bool get_uids_cb(Strip *strip, void *user_data) { GSet *used_uids = (GSet *)user_data; - const SessionUID *session_uid = &seq->runtime.session_uid; + const SessionUID *session_uid = &strip->runtime.session_uid; if (!BLI_session_uid_is_generated(session_uid)) { - printf("Sequence %s does not have UID generated.\n", seq->name); + printf("Sequence %s does not have UID generated.\n", strip->name); return true; } if (BLI_gset_lookup(used_uids, session_uid) != nullptr) { - printf("Sequence %s has duplicate UID generated.\n", seq->name); + printf("Sequence %s has duplicate UID generated.\n", strip->name); return true; } @@ -447,15 +449,16 @@ void SEQ_relations_check_uids_unique_and_report(const Scene *scene) BLI_gset_free(used_uids, nullptr); } -Strip *SEQ_find_metastrip_by_sequence(ListBase *seqbase, Strip *meta, Strip *seq) +Strip *SEQ_find_metastrip_by_sequence(ListBase *seqbase, Strip *meta, Strip *strip) { LISTBASE_FOREACH (Strip *, iseq, seqbase) { Strip *rval; - if (seq == iseq) { + if (strip == iseq) { return meta; } - if (iseq->seqbase.first && (rval = SEQ_find_metastrip_by_sequence(&iseq->seqbase, iseq, seq))) + if (iseq->seqbase.first && + (rval = SEQ_find_metastrip_by_sequence(&iseq->seqbase, iseq, strip))) { return rval; } @@ -464,13 +467,14 @@ Strip *SEQ_find_metastrip_by_sequence(ListBase *seqbase, Strip *meta, Strip *seq return nullptr; } -bool SEQ_exists_in_seqbase(const Strip *seq, const ListBase *seqbase) +bool SEQ_exists_in_seqbase(const Strip *strip, const ListBase *seqbase) { - LISTBASE_FOREACH (Strip *, seq_test, seqbase) { - if (seq_test->type == SEQ_TYPE_META && SEQ_exists_in_seqbase(seq, &seq_test->seqbase)) { + LISTBASE_FOREACH (Strip *, strip_test, seqbase) { + if (strip_test->type == STRIP_TYPE_META && SEQ_exists_in_seqbase(strip, &strip_test->seqbase)) + { return true; } - if (seq_test == seq) { + if (strip_test == strip) { return true; } } diff --git a/source/blender/sequencer/intern/strip_retiming.cc b/source/blender/sequencer/intern/strip_retiming.cc index 03ed3d0dad0a..ca04bc06ed94 100644 --- a/source/blender/sequencer/intern/strip_retiming.cc +++ b/source/blender/sequencer/intern/strip_retiming.cc @@ -33,40 +33,42 @@ using blender::MutableSpan; -MutableSpan SEQ_retiming_keys_get(const Strip *seq) +MutableSpan SEQ_retiming_keys_get(const Strip *strip) { - blender::MutableSpan handles(seq->retiming_keys, seq->retiming_keys_num); + blender::MutableSpan handles(strip->retiming_keys, strip->retiming_keys_num); return handles; } -bool SEQ_retiming_is_last_key(const Strip *seq, const SeqRetimingKey *key) +bool SEQ_retiming_is_last_key(const Strip *strip, const SeqRetimingKey *key) { - return SEQ_retiming_key_index_get(seq, key) == seq->retiming_keys_num - 1; + return SEQ_retiming_key_index_get(strip, key) == strip->retiming_keys_num - 1; } -SeqRetimingKey *SEQ_retiming_last_key_get(const Strip *seq) +SeqRetimingKey *SEQ_retiming_last_key_get(const Strip *strip) { - return seq->retiming_keys + seq->retiming_keys_num - 1; + return strip->retiming_keys + strip->retiming_keys_num - 1; } -int SEQ_retiming_key_index_get(const Strip *seq, const SeqRetimingKey *key) +int SEQ_retiming_key_index_get(const Strip *strip, const SeqRetimingKey *key) { - return key - seq->retiming_keys; + return key - strip->retiming_keys; } -static int content_frame_index_get(const Scene *scene, const Strip *seq, const int timeline_frame) +static int content_frame_index_get(const Scene *scene, + const Strip *strip, + const int timeline_frame) { - const int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); - return (timeline_frame - SEQ_time_start_frame_get(seq) - sound_offset) * - SEQ_time_media_playback_rate_factor_get(scene, seq); + const int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); + return (timeline_frame - SEQ_time_start_frame_get(strip) - sound_offset) * + SEQ_time_media_playback_rate_factor_get(scene, strip); } SeqRetimingKey *SEQ_retiming_key_get_by_timeline_frame(const Scene *scene, - const Strip *seq, + const Strip *strip, const int timeline_frame) { - for (auto &key : SEQ_retiming_keys_get(seq)) { - const int key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, &key); + for (auto &key : SEQ_retiming_keys_get(strip)) { + const int key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, &key); if (key_timeline_frame == timeline_frame) { return &key; } @@ -75,11 +77,11 @@ SeqRetimingKey *SEQ_retiming_key_get_by_timeline_frame(const Scene *scene, return nullptr; } -SeqRetimingKey *SEQ_retiming_find_segment_start_key(const Strip *seq, float frame_index) +SeqRetimingKey *SEQ_retiming_find_segment_start_key(const Strip *strip, float frame_index) { SeqRetimingKey *start_key = nullptr; - for (auto &key : SEQ_retiming_keys_get(seq)) { - if (SEQ_retiming_is_last_key(seq, &key)) { + for (auto &key : SEQ_retiming_keys_get(strip)) { + if (SEQ_retiming_is_last_key(strip, &key)) { break; } if (key.strip_frame_index > frame_index) { @@ -92,108 +94,108 @@ SeqRetimingKey *SEQ_retiming_find_segment_start_key(const Strip *seq, float fram return start_key; } -int SEQ_retiming_keys_count(const Strip *seq) +int SEQ_retiming_keys_count(const Strip *strip) { - return seq->retiming_keys_num; + return strip->retiming_keys_num; } -void SEQ_retiming_data_ensure(Strip *seq) +void SEQ_retiming_data_ensure(Strip *strip) { - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { return; } - if (SEQ_retiming_is_active(seq)) { + if (SEQ_retiming_is_active(strip)) { return; } - seq->retiming_keys = (SeqRetimingKey *)MEM_calloc_arrayN(2, sizeof(SeqRetimingKey), __func__); - SeqRetimingKey *key = seq->retiming_keys + 1; - key->strip_frame_index = seq->len - 1; + strip->retiming_keys = (SeqRetimingKey *)MEM_calloc_arrayN(2, sizeof(SeqRetimingKey), __func__); + SeqRetimingKey *key = strip->retiming_keys + 1; + key->strip_frame_index = strip->len - 1; key->retiming_factor = 1.0f; - seq->retiming_keys_num = 2; + strip->retiming_keys_num = 2; } -void SEQ_retiming_data_clear(Strip *seq) +void SEQ_retiming_data_clear(Strip *strip) { - if (seq->retiming_keys != nullptr) { - MEM_freeN(seq->retiming_keys); - seq->retiming_keys = nullptr; - seq->retiming_keys_num = 0; + if (strip->retiming_keys != nullptr) { + MEM_freeN(strip->retiming_keys); + strip->retiming_keys = nullptr; + strip->retiming_keys_num = 0; } - seq->flag &= ~SEQ_SHOW_RETIMING; + strip->flag &= ~SEQ_SHOW_RETIMING; } -static void retiming_key_overlap(Scene *scene, Strip *seq) +static void retiming_key_overlap(Scene *scene, Strip *strip) { ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene)); blender::VectorSet strips; blender::VectorSet dependant; - dependant.add(seq); + dependant.add(strip); SEQ_iterator_set_expand(scene, seqbase, dependant, SEQ_query_strip_effect_chain); strips.add_multiple(dependant); - dependant.remove(seq); + dependant.remove(strip); SEQ_transform_handle_overlap(scene, seqbase, strips, dependant, true); } -void SEQ_retiming_reset(Scene *scene, Strip *seq) +void SEQ_retiming_reset(Scene *scene, Strip *strip) { - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { return; } - SEQ_retiming_data_clear(seq); + SEQ_retiming_data_clear(strip); - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); - retiming_key_overlap(scene, seq); + retiming_key_overlap(scene, strip); } -bool SEQ_retiming_is_active(const Strip *seq) +bool SEQ_retiming_is_active(const Strip *strip) { - return seq->retiming_keys_num > 1; + return strip->retiming_keys_num > 1; } -bool SEQ_retiming_data_is_editable(const Strip *seq) +bool SEQ_retiming_data_is_editable(const Strip *strip) { - return seq->flag & SEQ_SHOW_RETIMING; + return strip->flag & SEQ_SHOW_RETIMING; } -bool SEQ_retiming_is_allowed(const Strip *seq) +bool SEQ_retiming_is_allowed(const Strip *strip) { - if (seq->len < 2) { + if (strip->len < 2) { return false; } - return ELEM(seq->type, - SEQ_TYPE_SOUND_RAM, - SEQ_TYPE_IMAGE, - SEQ_TYPE_META, - SEQ_TYPE_SCENE, - SEQ_TYPE_MOVIE, - SEQ_TYPE_MOVIECLIP, - SEQ_TYPE_MASK); + return ELEM(strip->type, + STRIP_TYPE_SOUND_RAM, + STRIP_TYPE_IMAGE, + STRIP_TYPE_META, + STRIP_TYPE_SCENE, + STRIP_TYPE_MOVIE, + STRIP_TYPE_MOVIECLIP, + STRIP_TYPE_MASK); } -static int seq_retiming_segment_length_get(const SeqRetimingKey *start_key) +static int strip_retiming_segment_length_get(const SeqRetimingKey *start_key) { const SeqRetimingKey *end_key = start_key + 1; return end_key->strip_frame_index - start_key->strip_frame_index; } -static float seq_retiming_segment_step_get(const SeqRetimingKey *start_key) +static float strip_retiming_segment_step_get(const SeqRetimingKey *start_key) { const SeqRetimingKey *end_key = start_key + 1; - const int segment_length = seq_retiming_segment_length_get(start_key); + const int segment_length = strip_retiming_segment_length_get(start_key); const float segment_fac_diff = end_key->retiming_factor - start_key->retiming_factor; return segment_fac_diff / segment_length; } -static void seq_retiming_segment_as_line_segment(const SeqRetimingKey *start_key, - double r_v1[2], - double r_v2[2]) +static void strip_retiming_segment_as_line_segment(const SeqRetimingKey *start_key, + double r_v1[2], + double r_v2[2]) { const SeqRetimingKey *end_key = start_key + 1; r_v1[0] = start_key->strip_frame_index; @@ -202,15 +204,15 @@ static void seq_retiming_segment_as_line_segment(const SeqRetimingKey *start_key r_v2[1] = end_key->retiming_factor; } -static void seq_retiming_line_segments_tangent_circle(const SeqRetimingKey *start_key, - double r_center[2], - double *radius) +static void strip_retiming_line_segments_tangent_circle(const SeqRetimingKey *start_key, + double r_center[2], + double *radius) { blender::double2 s1_1, s1_2, s2_1, s2_2, p1_2; /* Get 2 segments. */ - seq_retiming_segment_as_line_segment(start_key - 1, s1_1, s1_2); - seq_retiming_segment_as_line_segment(start_key + 1, s2_1, s2_2); + strip_retiming_segment_as_line_segment(start_key - 1, s1_1, s1_2); + strip_retiming_segment_as_line_segment(start_key + 1, s2_1, s2_2); /* Backup first segment end point - needed to calculate arc radius. */ copy_v2_v2_db(p1_2, s1_2); /* Convert segments to vectors. */ @@ -263,64 +265,65 @@ bool SEQ_retiming_key_is_freeze_frame(const SeqRetimingKey *key) /* Check colinearity of 2 segments allowing for some imprecision. * `isect_seg_seg_v2_lambda_mu_db()` return value does not work well in this case. */ -static bool seq_retiming_transition_is_linear(const Strip *seq, const SeqRetimingKey *key) +static bool strip_retiming_transition_is_linear(const Strip *strip, const SeqRetimingKey *key) { - const float prev_speed = SEQ_retiming_key_speed_get(seq, key - 1); - const float next_speed = SEQ_retiming_key_speed_get(seq, key + 2); + const float prev_speed = SEQ_retiming_key_speed_get(strip, key - 1); + const float next_speed = SEQ_retiming_key_speed_get(strip, key + 2); return abs(prev_speed - next_speed) < 0.01f; } -static float seq_retiming_evaluate_arc_segment(const SeqRetimingKey *key, const float frame_index) +static float strip_retiming_evaluate_arc_segment(const SeqRetimingKey *key, + const float frame_index) { double c[2], r; - seq_retiming_line_segments_tangent_circle(key, c, &r); + strip_retiming_line_segments_tangent_circle(key, c, &r); const int side = c[1] > key->retiming_factor ? -1 : 1; const float y = c[1] + side * sqrt(pow(r, 2) - pow((frame_index - c[0]), 2)); return y; } -float seq_retiming_evaluate(const Strip *seq, const float frame_index) +float strip_retiming_evaluate(const Strip *strip, const float frame_index) { - const SeqRetimingKey *start_key = SEQ_retiming_find_segment_start_key(seq, frame_index); + const SeqRetimingKey *start_key = SEQ_retiming_find_segment_start_key(strip, frame_index); - const int start_key_index = start_key - seq->retiming_keys; - BLI_assert(start_key_index < seq->retiming_keys_num); + const int start_key_index = start_key - strip->retiming_keys; + BLI_assert(start_key_index < strip->retiming_keys_num); const float segment_frame_index = frame_index - start_key->strip_frame_index; if (!SEQ_retiming_key_is_transition_start(start_key)) { - const float segment_step = seq_retiming_segment_step_get(start_key); + const float segment_step = strip_retiming_segment_step_get(start_key); return std::min(1.0f, start_key->retiming_factor + segment_step * segment_frame_index); } - if (seq_retiming_transition_is_linear(seq, start_key)) { - const float segment_step = seq_retiming_segment_step_get(start_key - 1); + if (strip_retiming_transition_is_linear(strip, start_key)) { + const float segment_step = strip_retiming_segment_step_get(start_key - 1); return std::min(1.0f, start_key->retiming_factor + segment_step * segment_frame_index); } /* Sanity check for transition type. */ BLI_assert(start_key_index > 0); - BLI_assert(start_key_index < seq->retiming_keys_num - 1); + BLI_assert(start_key_index < strip->retiming_keys_num - 1); UNUSED_VARS_NDEBUG(start_key_index); - return std::min(1.0f, seq_retiming_evaluate_arc_segment(start_key, frame_index)); + return std::min(1.0f, strip_retiming_evaluate_arc_segment(start_key, frame_index)); } -static SeqRetimingKey *seq_retiming_add_key(Strip *seq, float frame_index) +static SeqRetimingKey *strip_retiming_add_key(Strip *strip, float frame_index) { - if (!SEQ_retiming_is_allowed(seq)) { + if (!SEQ_retiming_is_allowed(strip)) { return nullptr; } /* Clamp timeline frame to strip content range. */ if (frame_index <= 0) { - return &seq->retiming_keys[0]; + return &strip->retiming_keys[0]; } - if (frame_index >= SEQ_retiming_last_key_get(seq)->strip_frame_index) { - return SEQ_retiming_last_key_get(seq); /* This is expected for strips with no offsets. */ + if (frame_index >= SEQ_retiming_last_key_get(strip)->strip_frame_index) { + return SEQ_retiming_last_key_get(strip); /* This is expected for strips with no offsets. */ } - SeqRetimingKey *start_key = SEQ_retiming_find_segment_start_key(seq, frame_index); + SeqRetimingKey *start_key = SEQ_retiming_find_segment_start_key(strip, frame_index); if (start_key->strip_frame_index == frame_index) { return start_key; /* Retiming key already exists. */ @@ -332,10 +335,10 @@ static SeqRetimingKey *seq_retiming_add_key(Strip *seq, float frame_index) return nullptr; } - float value = seq_retiming_evaluate(seq, frame_index); + float value = strip_retiming_evaluate(strip, frame_index); - SeqRetimingKey *keys = seq->retiming_keys; - size_t keys_count = SEQ_retiming_keys_count(seq); + SeqRetimingKey *keys = strip->retiming_keys; + size_t keys_count = SEQ_retiming_keys_count(strip); const int new_key_index = start_key - keys + 1; BLI_assert(new_key_index >= 0); BLI_assert(new_key_index < keys_count); @@ -351,8 +354,8 @@ static SeqRetimingKey *seq_retiming_add_key(Strip *seq, float frame_index) (keys_count - new_key_index) * sizeof(SeqRetimingKey)); } MEM_freeN(keys); - seq->retiming_keys = new_keys; - seq->retiming_keys_num++; + strip->retiming_keys = new_keys; + strip->retiming_keys_num++; SeqRetimingKey *added_key = (new_keys + new_key_index); added_key->strip_frame_index = frame_index; @@ -361,13 +364,13 @@ static SeqRetimingKey *seq_retiming_add_key(Strip *seq, float frame_index) return added_key; } -SeqRetimingKey *SEQ_retiming_add_key(const Scene *scene, Strip *seq, const int timeline_frame) +SeqRetimingKey *SEQ_retiming_add_key(const Scene *scene, Strip *strip, const int timeline_frame) { - return seq_retiming_add_key(seq, content_frame_index_get(scene, seq, timeline_frame)); + return strip_retiming_add_key(strip, content_frame_index_get(scene, strip, timeline_frame)); } void SEQ_retiming_transition_key_frame_set(const Scene *scene, - const Strip *seq, + const Strip *strip, SeqRetimingKey *key, const int timeline_frame) { @@ -375,10 +378,10 @@ void SEQ_retiming_transition_key_frame_set(const Scene *scene, SeqRetimingKey *key_end = key_start + 1; const int start_frame_index = key_start->strip_frame_index; const int midpoint = key_start->original_strip_frame_index; - const int new_frame_index = content_frame_index_get(scene, seq, timeline_frame); + const int new_frame_index = content_frame_index_get(scene, strip, timeline_frame); int new_midpoint_offset = new_frame_index - midpoint; - const float prev_segment_step = seq_retiming_segment_step_get(key_start - 1); - const float next_segment_step = seq_retiming_segment_step_get(key_end); + const float prev_segment_step = strip_retiming_segment_step_get(key_start - 1); + const float next_segment_step = strip_retiming_segment_step_get(key_end); /* Prevent keys crossing eachother. */ SeqRetimingKey *prev_segment_end = key_start - 1, *next_segment_start = key_end + 1; @@ -396,7 +399,7 @@ void SEQ_retiming_transition_key_frame_set(const Scene *scene, key_end->retiming_factor -= offset * next_segment_step; } -static void seq_retiming_cleanup_freeze_frame(SeqRetimingKey *key) +static void strip_retiming_cleanup_freeze_frame(SeqRetimingKey *key) { if ((key->flag & SEQ_FREEZE_FRAME_IN) != 0) { SeqRetimingKey *next_key = key + 1; @@ -410,7 +413,7 @@ static void seq_retiming_cleanup_freeze_frame(SeqRetimingKey *key) } } -void SEQ_retiming_remove_multiple_keys(Strip *seq, +void SEQ_retiming_remove_multiple_keys(Strip *strip, blender::Vector &keys_to_remove) { /* Transitions need special treatment, so separate these from `keys_to_remove`. */ @@ -419,7 +422,7 @@ void SEQ_retiming_remove_multiple_keys(Strip *seq, /* Cleanup freeze frames and extract transition keys. */ for (SeqRetimingKey *key : keys_to_remove) { if (SEQ_retiming_key_is_freeze_frame(key)) { - seq_retiming_cleanup_freeze_frame(key); + strip_retiming_cleanup_freeze_frame(key); } if ((key->flag & SEQ_SPEED_TRANSITION_IN) != 0) { transitions.append_non_duplicates(key); @@ -433,18 +436,18 @@ void SEQ_retiming_remove_multiple_keys(Strip *seq, /* Sanitize keys to be removed. */ keys_to_remove.remove_if([&](const SeqRetimingKey *key) { - return key->strip_frame_index == 0 || SEQ_retiming_is_last_key(seq, key) || + return key->strip_frame_index == 0 || SEQ_retiming_is_last_key(strip, key) || SEQ_retiming_key_is_transition_type(key); }); - const size_t keys_count = SEQ_retiming_keys_count(seq); + const size_t keys_count = SEQ_retiming_keys_count(strip); size_t new_keys_count = keys_count - keys_to_remove.size() - transitions.size() / 2; SeqRetimingKey *new_keys = (SeqRetimingKey *)MEM_callocN(new_keys_count * sizeof(SeqRetimingKey), __func__); int keys_copied = 0; /* Copy keys to new array. */ - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { /* Create key that was used to make transition in new array. */ if (transitions.contains(&key) && SEQ_retiming_key_is_transition_start(&key)) { SeqRetimingKey *new_key = new_keys + keys_copied; @@ -460,37 +463,37 @@ void SEQ_retiming_remove_multiple_keys(Strip *seq, keys_copied++; } - MEM_freeN(seq->retiming_keys); - seq->retiming_keys = new_keys; - seq->retiming_keys_num = new_keys_count; + MEM_freeN(strip->retiming_keys); + strip->retiming_keys = new_keys; + strip->retiming_keys_num = new_keys_count; } -static void seq_retiming_remove_key_ex(Strip *seq, SeqRetimingKey *key) +static void strip_retiming_remove_key_ex(Strip *strip, SeqRetimingKey *key) { - if (key->strip_frame_index == 0 || SEQ_retiming_is_last_key(seq, key)) { + if (key->strip_frame_index == 0 || SEQ_retiming_is_last_key(strip, key)) { return; /* First and last key can not be removed. */ } if (SEQ_retiming_key_is_freeze_frame(key)) { - seq_retiming_cleanup_freeze_frame(key); + strip_retiming_cleanup_freeze_frame(key); } - size_t keys_count = SEQ_retiming_keys_count(seq); + size_t keys_count = SEQ_retiming_keys_count(strip); SeqRetimingKey *keys = (SeqRetimingKey *)MEM_callocN((keys_count - 1) * sizeof(SeqRetimingKey), __func__); - const int key_index = key - seq->retiming_keys; - memcpy(keys, seq->retiming_keys, (key_index) * sizeof(SeqRetimingKey)); + const int key_index = key - strip->retiming_keys; + memcpy(keys, strip->retiming_keys, (key_index) * sizeof(SeqRetimingKey)); memcpy(keys + key_index, - seq->retiming_keys + key_index + 1, + strip->retiming_keys + key_index + 1, (keys_count - key_index - 1) * sizeof(SeqRetimingKey)); - MEM_freeN(seq->retiming_keys); - seq->retiming_keys = keys; - seq->retiming_keys_num--; + MEM_freeN(strip->retiming_keys); + strip->retiming_keys = keys; + strip->retiming_keys_num--; } /* This function removes transition segment and creates retiming key where it originally was. */ -static SeqRetimingKey *seq_retiming_remove_transition(Strip *seq, SeqRetimingKey *key) +static SeqRetimingKey *strip_retiming_remove_transition(Strip *strip, SeqRetimingKey *key) { SeqRetimingKey *transition_start = key; if ((key->flag & SEQ_SPEED_TRANSITION_OUT) != 0) { @@ -501,28 +504,28 @@ static SeqRetimingKey *seq_retiming_remove_transition(Strip *seq, SeqRetimingKey const float orig_retiming_factor = transition_start->original_retiming_factor; /* Remove both keys defining transition. */ - int key_index = SEQ_retiming_key_index_get(seq, transition_start); - seq_retiming_remove_key_ex(seq, transition_start); - seq_retiming_remove_key_ex(seq, seq->retiming_keys + key_index); + int key_index = SEQ_retiming_key_index_get(strip, transition_start); + strip_retiming_remove_key_ex(strip, transition_start); + strip_retiming_remove_key_ex(strip, strip->retiming_keys + key_index); /* Create original linear key. */ - SeqRetimingKey *orig_key = seq_retiming_add_key(seq, orig_frame_index); + SeqRetimingKey *orig_key = strip_retiming_add_key(strip, orig_frame_index); orig_key->retiming_factor = orig_retiming_factor; return orig_key; } -void SEQ_retiming_remove_key(Strip *seq, SeqRetimingKey *key) +void SEQ_retiming_remove_key(Strip *strip, SeqRetimingKey *key) { if (SEQ_retiming_key_is_transition_type(key)) { - seq_retiming_remove_transition(seq, key); + strip_retiming_remove_transition(strip, key); return; } - seq_retiming_remove_key_ex(seq, key); + strip_retiming_remove_key_ex(strip, key); } -static float seq_retiming_clamp_create_offset(SeqRetimingKey *key, float offset) +static float strip_retiming_clamp_create_offset(SeqRetimingKey *key, float offset) { SeqRetimingKey *prev_key = key - 1; SeqRetimingKey *next_key = key + 1; @@ -532,7 +535,7 @@ static float seq_retiming_clamp_create_offset(SeqRetimingKey *key, float offset) } SeqRetimingKey *SEQ_retiming_add_freeze_frame(const Scene *scene, - Strip *seq, + Strip *strip, SeqRetimingKey *key, const int offset) { @@ -542,15 +545,15 @@ SeqRetimingKey *SEQ_retiming_add_freeze_frame(const Scene *scene, return nullptr; } - int clamped_offset = seq_retiming_clamp_create_offset( - key, offset * SEQ_time_media_playback_rate_factor_get(scene, seq)); + int clamped_offset = strip_retiming_clamp_create_offset( + key, offset * SEQ_time_media_playback_rate_factor_get(scene, strip)); - const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key); + const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key); const float orig_retiming_factor = key->retiming_factor; key->strip_frame_index += clamped_offset; key->flag |= SEQ_FREEZE_FRAME_OUT; - SeqRetimingKey *new_key = SEQ_retiming_add_key(scene, seq, orig_timeline_frame); + SeqRetimingKey *new_key = SEQ_retiming_add_key(scene, strip, orig_timeline_frame); if (new_key == nullptr) { key->strip_frame_index -= clamped_offset; @@ -566,9 +569,9 @@ SeqRetimingKey *SEQ_retiming_add_freeze_frame(const Scene *scene, return new_key + 1; } -SeqRetimingKey *SEQ_retiming_add_transition(Strip *seq, SeqRetimingKey *key, float offset) +SeqRetimingKey *SEQ_retiming_add_transition(Strip *strip, SeqRetimingKey *key, float offset) { - BLI_assert(!SEQ_retiming_is_last_key(seq, key)); + BLI_assert(!SEQ_retiming_is_last_key(strip, key)); BLI_assert(key->strip_frame_index != 0); SeqRetimingKey *prev_key = key - 1; @@ -582,25 +585,26 @@ SeqRetimingKey *SEQ_retiming_add_transition(Strip *seq, SeqRetimingKey *key, flo return nullptr; } - float clamped_offset = seq_retiming_clamp_create_offset(key, offset); + float clamped_offset = strip_retiming_clamp_create_offset(key, offset); - const int orig_key_index = SEQ_retiming_key_index_get(seq, key); + const int orig_key_index = SEQ_retiming_key_index_get(strip, key); const int orig_frame_index = key->strip_frame_index; const float orig_retiming_factor = key->retiming_factor; - SeqRetimingKey *transition_out = seq_retiming_add_key(seq, orig_frame_index + clamped_offset); + SeqRetimingKey *transition_out = strip_retiming_add_key(strip, + orig_frame_index + clamped_offset); transition_out->flag |= SEQ_SPEED_TRANSITION_OUT; - SeqRetimingKey *transition_in = seq_retiming_add_key(seq, orig_frame_index - clamped_offset); + SeqRetimingKey *transition_in = strip_retiming_add_key(strip, orig_frame_index - clamped_offset); transition_in->flag |= SEQ_SPEED_TRANSITION_IN; transition_in->original_strip_frame_index = orig_frame_index; transition_in->original_retiming_factor = orig_retiming_factor; - seq_retiming_remove_key_ex(seq, seq->retiming_keys + orig_key_index + 1); - return seq->retiming_keys + orig_key_index + 1; + strip_retiming_remove_key_ex(strip, strip->retiming_keys + orig_key_index + 1); + return strip->retiming_keys + orig_key_index + 1; } -static int seq_retiming_clamp_transition_offset(SeqRetimingKey *start_key, int offset) +static int strip_retiming_clamp_transition_offset(SeqRetimingKey *start_key, int offset) { SeqRetimingKey *end_key = start_key + 1; SeqRetimingKey *prev_key = start_key - 1; @@ -616,20 +620,20 @@ static int seq_retiming_clamp_transition_offset(SeqRetimingKey *start_key, int o } } -static void seq_retiming_transition_offset(const Scene *scene, - Strip *seq, - SeqRetimingKey *key, - const int offset) +static void strip_retiming_transition_offset(const Scene *scene, + Strip *strip, + SeqRetimingKey *key, + const int offset) { - int clamped_offset = seq_retiming_clamp_transition_offset(key, offset); + int clamped_offset = strip_retiming_clamp_transition_offset(key, offset); const float duration = (key->original_strip_frame_index - key->strip_frame_index); const bool was_selected = SEQ_retiming_selection_contains(SEQ_editing_get(scene), key); - SeqRetimingKey *original_key = seq_retiming_remove_transition(seq, key); + SeqRetimingKey *original_key = strip_retiming_remove_transition(strip, key); original_key->strip_frame_index += clamped_offset * - SEQ_time_media_playback_rate_factor_get(scene, seq); + SEQ_time_media_playback_rate_factor_get(scene, strip); - SeqRetimingKey *transition_out = SEQ_retiming_add_transition(seq, original_key, duration); + SeqRetimingKey *transition_out = SEQ_retiming_add_transition(strip, original_key, duration); if (was_selected) { SEQ_retiming_selection_append(transition_out); @@ -637,25 +641,25 @@ static void seq_retiming_transition_offset(const Scene *scene, } } -static int seq_retiming_clamp_timeline_frame(const Scene *scene, - Strip *seq, - SeqRetimingKey *key, - const int timeline_frame) +static int strip_retiming_clamp_timeline_frame(const Scene *scene, + Strip *strip, + SeqRetimingKey *key, + const int timeline_frame) { int prev_key_timeline_frame = -MAXFRAME; int next_key_timeline_frame = MAXFRAME; if (key->strip_frame_index > 0) { SeqRetimingKey *prev_key = key - 1; - prev_key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, prev_key); + prev_key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, prev_key); } - if (!SEQ_retiming_is_last_key(seq, key)) { + if (!SEQ_retiming_is_last_key(strip, key)) { SeqRetimingKey *next_key = key + 1; - next_key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, next_key); + next_key_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, next_key); } - const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key); + const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key); int clamped_timeline_frame = timeline_frame; if (timeline_frame < orig_timeline_frame) { @@ -671,69 +675,69 @@ static int seq_retiming_clamp_timeline_frame(const Scene *scene, * Alternative solution is to find where in arc segment the `y` value is closest to key * retiming factor, then trim transition to that point. This would change transition length. */ -static void seq_retiming_fix_transition(Strip *seq, SeqRetimingKey *key) +static void strip_retiming_fix_transition(Strip *strip, SeqRetimingKey *key) { - const int keys_num = seq->retiming_keys_num; + const int keys_num = strip->retiming_keys_num; const float transition_duration = (key->original_strip_frame_index - key->strip_frame_index); - SeqRetimingKey *orig_key = seq_retiming_remove_transition(seq, key); - SEQ_retiming_add_transition(seq, orig_key, transition_duration); - BLI_assert(keys_num == seq->retiming_keys_num); + SeqRetimingKey *orig_key = strip_retiming_remove_transition(strip, key); + SEQ_retiming_add_transition(strip, orig_key, transition_duration); + BLI_assert(keys_num == strip->retiming_keys_num); UNUSED_VARS_NDEBUG(keys_num); } -static void seq_retiming_fix_transitions(Strip *seq, SeqRetimingKey *key) +static void strip_retiming_fix_transitions(Strip *strip, SeqRetimingKey *key) { - if (SEQ_retiming_key_index_get(seq, key) <= 1) { + if (SEQ_retiming_key_index_get(strip, key) <= 1) { return; } - const int key_index = SEQ_retiming_key_index_get(seq, key); + const int key_index = SEQ_retiming_key_index_get(strip, key); /* Store value, since handles array will be reallocated. */ - bool is_last_key = SEQ_retiming_is_last_key(seq, key); + bool is_last_key = SEQ_retiming_is_last_key(strip, key); SeqRetimingKey *prev_key = key - 2; if (SEQ_retiming_key_is_transition_start(prev_key)) { - seq_retiming_fix_transition(seq, prev_key); + strip_retiming_fix_transition(strip, prev_key); } if (is_last_key) { return; } - SeqRetimingKey *next_key = &SEQ_retiming_keys_get(seq)[key_index + 1]; + SeqRetimingKey *next_key = &SEQ_retiming_keys_get(strip)[key_index + 1]; if (SEQ_retiming_key_is_transition_start(next_key)) { - seq_retiming_fix_transition(seq, next_key); + strip_retiming_fix_transition(strip, next_key); } } -static void seq_retiming_key_offset(const Scene *scene, - Strip *seq, - SeqRetimingKey *key, - const int offset) +static void strip_retiming_key_offset(const Scene *scene, + Strip *strip, + SeqRetimingKey *key, + const int offset) { if ((key->flag & SEQ_SPEED_TRANSITION_IN) != 0) { - seq_retiming_transition_offset(scene, seq, key, offset); + strip_retiming_transition_offset(scene, strip, key, offset); } else { - key->strip_frame_index += offset * SEQ_time_media_playback_rate_factor_get(scene, seq); - seq_retiming_fix_transitions(seq, key); + key->strip_frame_index += offset * SEQ_time_media_playback_rate_factor_get(scene, strip); + strip_retiming_fix_transitions(strip, key); } } int SEQ_retiming_key_timeline_frame_get(const Scene *scene, - const Strip *seq, + const Strip *strip, const SeqRetimingKey *key) { - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); - return round_fl_to_int(SEQ_time_start_frame_get(seq) + sound_offset + + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); + return round_fl_to_int(SEQ_time_start_frame_get(strip) + sound_offset + key->strip_frame_index / - SEQ_time_media_playback_rate_factor_get(scene, seq)); + SEQ_time_media_playback_rate_factor_get(scene, strip)); } void SEQ_retiming_key_timeline_frame_set(const Scene *scene, - Strip *seq, + Strip *strip, SeqRetimingKey *key, const int timeline_frame) { @@ -741,39 +745,39 @@ void SEQ_retiming_key_timeline_frame_set(const Scene *scene, return; } - const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key); - const int clamped_timeline_frame = seq_retiming_clamp_timeline_frame( - scene, seq, key, timeline_frame); + const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key); + const int clamped_timeline_frame = strip_retiming_clamp_timeline_frame( + scene, strip, key, timeline_frame); const int offset = clamped_timeline_frame - orig_timeline_frame; - const int key_count = SEQ_retiming_keys_get(seq).size(); - const int key_index = SEQ_retiming_key_index_get(seq, key); + const int key_count = SEQ_retiming_keys_get(strip).size(); + const int key_index = SEQ_retiming_key_index_get(strip, key); - if (orig_timeline_frame == SEQ_time_right_handle_frame_get(scene, seq)) { + if (orig_timeline_frame == SEQ_time_right_handle_frame_get(scene, strip)) { for (int i = key_index; i < key_count; i++) { - SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(seq)[i]; - seq_retiming_key_offset(scene, seq, key_iter, offset); + SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(strip)[i]; + strip_retiming_key_offset(scene, strip, key_iter, offset); } } - else if (orig_timeline_frame == SEQ_time_left_handle_frame_get(scene, seq) || + else if (orig_timeline_frame == SEQ_time_left_handle_frame_get(scene, strip) || key->strip_frame_index == 0) { - seq->start += offset; + strip->start += offset; for (int i = key_index + 1; i < key_count; i++) { - SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(seq)[i]; - seq_retiming_key_offset(scene, seq, key_iter, -offset); + SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(strip)[i]; + strip_retiming_key_offset(scene, strip, key_iter, -offset); } } else { - seq_retiming_key_offset(scene, seq, key, offset); + strip_retiming_key_offset(scene, strip, key, offset); } - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -float SEQ_retiming_key_speed_get(const Strip *seq, const SeqRetimingKey *key) +float SEQ_retiming_key_speed_get(const Strip *strip, const SeqRetimingKey *key) { if (key->strip_frame_index == 0) { return 1.0f; @@ -781,7 +785,7 @@ float SEQ_retiming_key_speed_get(const Strip *seq, const SeqRetimingKey *key) const SeqRetimingKey *key_prev = key - 1; - const int frame_index_max = seq->len - 1; + const int frame_index_max = strip->len - 1; const int frame_retimed_prev = round_fl_to_int(key_prev->retiming_factor * frame_index_max); const int frame_index_prev = key_prev->strip_frame_index; const int frame_retimed = round_fl_to_int(key->retiming_factor * frame_index_max); @@ -795,7 +799,7 @@ float SEQ_retiming_key_speed_get(const Strip *seq, const SeqRetimingKey *key) } void SEQ_retiming_key_speed_set( - const Scene *scene, Strip *seq, SeqRetimingKey *key, const float speed, bool keep_retiming) + const Scene *scene, Strip *strip, SeqRetimingKey *key, const float speed, bool keep_retiming) { if (key->strip_frame_index == 0) { return; @@ -804,26 +808,26 @@ void SEQ_retiming_key_speed_set( const SeqRetimingKey *key_prev = key - 1; const float speed_fac = 100.0f / speed; - const int frame_index_max = seq->len - 1; + const int frame_index_max = strip->len - 1; const int frame_retimed_prev = round_fl_to_int(key_prev->retiming_factor * frame_index_max); const int frame_retimed = round_fl_to_int(key->retiming_factor * frame_index_max); const int segment_duration = (frame_retimed - frame_retimed_prev) / - SEQ_time_media_playback_rate_factor_get(scene, seq); + SEQ_time_media_playback_rate_factor_get(scene, strip); const int new_duration = segment_duration * speed_fac; - const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key); - const int new_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, seq, key_prev) + + const int orig_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key); + const int new_timeline_frame = SEQ_retiming_key_timeline_frame_get(scene, strip, key_prev) + new_duration; - SEQ_retiming_key_timeline_frame_set(scene, seq, key, new_timeline_frame); + SEQ_retiming_key_timeline_frame_set(scene, strip, key, new_timeline_frame); if (keep_retiming) { - const int key_index = SEQ_retiming_key_index_get(seq, key); + const int key_index = SEQ_retiming_key_index_get(strip, key); const int offset = new_timeline_frame - orig_timeline_frame; - for (int i = key_index + 1; i < SEQ_retiming_keys_count(seq); i++) { - SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(seq)[i]; - seq_retiming_key_offset(scene, seq, key_iter, offset); + for (int i = key_index + 1; i < SEQ_retiming_keys_count(strip); i++) { + SeqRetimingKey *key_iter = &SEQ_retiming_keys_get(strip)[i]; + strip_retiming_key_offset(scene, strip, key_iter, offset); } } } @@ -848,12 +852,12 @@ class RetimingRange { blender::Vector speed_table; eRangeType type; - RetimingRange(const Strip *seq, int start_frame, int end_frame, float speed, eRangeType type) + RetimingRange(const Strip *strip, int start_frame, int end_frame, float speed, eRangeType type) : start(start_frame), end(end_frame), speed(speed), type(type) { if (type == TRANSITION) { this->speed = 1.0f; - claculate_speed_table_from_seq(seq); + claculate_speed_table_from_seq(strip); } } @@ -933,16 +937,16 @@ class RetimingRange { return new_range; } - void claculate_speed_table_from_seq(const Strip *seq) + void claculate_speed_table_from_seq(const Strip *strip) { for (int timeline_frame = start; timeline_frame <= end; timeline_frame++) { /* We need number actual number of frames here. */ - const double normal_step = 1 / double(seq->len - 1); + const double normal_step = 1 / double(strip->len - 1); - const int frame_index = timeline_frame - SEQ_time_start_frame_get(seq); + const int frame_index = timeline_frame - SEQ_time_start_frame_get(strip); /* Who needs calculus, when you can have slow code? */ - const double val_prev = seq_retiming_evaluate(seq, frame_index - 1); - const double val = seq_retiming_evaluate(seq, frame_index); + const double val_prev = strip_retiming_evaluate(strip, frame_index - 1); + const double val = strip_retiming_evaluate(strip, frame_index); const double speed_at_frame = (val - val_prev) / normal_step; speed_table.append(speed_at_frame); } @@ -969,19 +973,19 @@ class RetimingRange { class RetimingRangeData { public: blender::Vector ranges; - RetimingRangeData(const Strip *seq) + RetimingRangeData(const Strip *strip) { - for (const SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + for (const SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { if (key.strip_frame_index == 0) { continue; } const SeqRetimingKey *key_prev = &key - 1; - float speed = SEQ_retiming_key_speed_get(seq, &key); - int frame_start = SEQ_time_start_frame_get(seq) + key_prev->strip_frame_index; - int frame_end = SEQ_time_start_frame_get(seq) + key.strip_frame_index; + float speed = SEQ_retiming_key_speed_get(strip, &key); + int frame_start = SEQ_time_start_frame_get(strip) + key_prev->strip_frame_index; + int frame_end = SEQ_time_start_frame_get(strip) + key.strip_frame_index; eRangeType type = SEQ_retiming_key_is_transition_start(key_prev) ? TRANSITION : LINEAR; - RetimingRange range = RetimingRange(seq, frame_start, frame_end, speed, type); + RetimingRange range = RetimingRange(strip, frame_start, frame_end, speed, type); ranges.append(range); } } @@ -1031,11 +1035,11 @@ class RetimingRangeData { } }; -static RetimingRangeData seq_retiming_range_data_get(const Scene *scene, const Strip *seq) +static RetimingRangeData strip_retiming_range_data_get(const Scene *scene, const Strip *strip) { - RetimingRangeData strip_retiming_data = RetimingRangeData(seq); + RetimingRangeData strip_retiming_data = RetimingRangeData(strip); - const Strip *meta_parent = seq_sequence_lookup_meta_by_seq(scene, seq); + const Strip *meta_parent = SEQ_lookup_meta_by_strip(scene, strip); if (meta_parent == nullptr) { return strip_retiming_data; } @@ -1045,19 +1049,19 @@ static RetimingRangeData seq_retiming_range_data_get(const Scene *scene, const S return strip_retiming_data; } -void SEQ_retiming_sound_animation_data_set(const Scene *scene, const Strip *seq) +void SEQ_retiming_sound_animation_data_set(const Scene *scene, const Strip *strip) { /* Content cut off by `anim_startofs` is as if it does not exist for sequencer. But Audaspace * seeking relies on having animation buffer initialized for whole sequence. */ - if (seq->anim_startofs > 0) { - const int seq_start = SEQ_time_start_frame_get(seq); + if (strip->anim_startofs > 0) { + const int strip_start = SEQ_time_start_frame_get(strip); BKE_sound_set_scene_sound_pitch_constant_range( - seq->scene_sound, seq_start - seq->anim_startofs, seq_start, 1.0f); + strip->scene_sound, strip_start - strip->anim_startofs, strip_start, 1.0f); } - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); - RetimingRangeData retiming_data = seq_retiming_range_data_get(scene, seq); + RetimingRangeData retiming_data = strip_retiming_range_data_get(scene, strip); for (int i = 0; i < retiming_data.ranges.size(); i++) { RetimingRange range = retiming_data.ranges[i]; if (range.type == TRANSITION) { @@ -1066,12 +1070,12 @@ void SEQ_retiming_sound_animation_data_set(const Scene *scene, const Strip *seq) for (int i = 0; i <= range_length; i++) { const int frame = range.start + i; BKE_sound_set_scene_sound_pitch_at_frame( - seq->scene_sound, frame + sound_offset, range.speed_table[i], true); + strip->scene_sound, frame + sound_offset, range.speed_table[i], true); } } else { BKE_sound_set_scene_sound_pitch_constant_range( - seq->scene_sound, range.start + sound_offset, range.end + sound_offset, range.speed); + strip->scene_sound, range.start + sound_offset, range.end + sound_offset, range.speed); } } } @@ -1080,8 +1084,8 @@ bool SEQ_retiming_selection_clear(const Editing *ed) { bool was_empty = true; - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { was_empty &= (key.flag & SEQ_KEY_SELECTED) == 0; key.flag &= ~SEQ_KEY_SELECTED; } @@ -1113,10 +1117,10 @@ blender::Map SEQ_retiming_selection_get(const Editing if (!ed) { return selection; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - for (SeqRetimingKey &key : SEQ_retiming_keys_get(seq)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + for (SeqRetimingKey &key : SEQ_retiming_keys_get(strip)) { if ((key.flag & SEQ_KEY_SELECTED) != 0) { - selection.add(&key, seq); + selection.add(&key, strip); } } } @@ -1125,8 +1129,8 @@ blender::Map SEQ_retiming_selection_get(const Editing bool SEQ_retiming_selection_contains(const Editing *ed, const SeqRetimingKey *key) { - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - for (const SeqRetimingKey &key_iter : SEQ_retiming_keys_get(seq)) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + for (const SeqRetimingKey &key_iter : SEQ_retiming_keys_get(strip)) { if ((key_iter.flag & SEQ_KEY_SELECTED) != 0 && &key_iter == key) { return true; } diff --git a/source/blender/sequencer/intern/strip_select.cc b/source/blender/sequencer/intern/strip_select.cc index 107de0d27896..66d912a24d5c 100644 --- a/source/blender/sequencer/intern/strip_select.cc +++ b/source/blender/sequencer/intern/strip_select.cc @@ -25,7 +25,7 @@ Strip *SEQ_select_active_get(const Scene *scene) return ed->act_seq; } -void SEQ_select_active_set(Scene *scene, Strip *seq) +void SEQ_select_active_set(Scene *scene, Strip *strip) { Editing *ed = SEQ_editing_get(scene); @@ -33,7 +33,7 @@ void SEQ_select_active_set(Scene *scene, Strip *seq) return; } - ed->act_seq = seq; + ed->act_seq = strip; } bool SEQ_select_active_get_pair(Scene *scene, Strip **r_seq_act, Strip **r_seq_other) @@ -48,13 +48,13 @@ bool SEQ_select_active_get_pair(Scene *scene, Strip **r_seq_act, Strip **r_seq_o *r_seq_other = nullptr; - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { - if (seq->flag & SELECT && (seq != (*r_seq_act))) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && (strip != (*r_seq_act))) { if (*r_seq_other) { return false; } - *r_seq_other = seq; + *r_seq_other = strip; } } diff --git a/source/blender/sequencer/intern/strip_time.cc b/source/blender/sequencer/intern/strip_time.cc index b5b4466f9c65..cc26aed93f49 100644 --- a/source/blender/sequencer/intern/strip_time.cc +++ b/source/blender/sequencer/intern/strip_time.cc @@ -8,8 +8,6 @@ * \ingroup bke */ -#include "MEM_guardedalloc.h" - #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -21,8 +19,6 @@ #include "DNA_sound_types.h" -#include "IMB_imbuf.hh" - #include "MOV_read.hh" #include "SEQ_channels.hh" @@ -37,37 +33,37 @@ #include "strip_time.hh" #include "utils.hh" -float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Strip *seq) +float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Strip *strip) { - if ((seq->flag & SEQ_AUTO_PLAYBACK_RATE) == 0) { + if ((strip->flag & SEQ_AUTO_PLAYBACK_RATE) == 0) { return 1.0f; } - if (seq->media_playback_rate == 0.0f) { + if (strip->media_playback_rate == 0.0f) { return 1.0f; } float scene_playback_rate = float(scene->r.frs_sec) / scene->r.frs_sec_base; - return seq->media_playback_rate / scene_playback_rate; + return strip->media_playback_rate / scene_playback_rate; } -int seq_time_strip_original_content_length_get(const Scene *scene, const Strip *seq) +int seq_time_strip_original_content_length_get(const Scene *scene, const Strip *strip) { - if (seq->type == SEQ_TYPE_SOUND_RAM) { - return seq->len; + if (strip->type == STRIP_TYPE_SOUND_RAM) { + return strip->len; } - return seq->len / SEQ_time_media_playback_rate_factor_get(scene, seq); + return strip->len / SEQ_time_media_playback_rate_factor_get(scene, strip); } -float SEQ_give_frame_index(const Scene *scene, const Strip *seq, float timeline_frame) +float SEQ_give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame) { float frame_index; - float sta = SEQ_time_start_frame_get(seq); - float end = SEQ_time_content_end_frame_get(scene, seq) - 1; - float frame_index_max = seq->len - 1; + float sta = SEQ_time_start_frame_get(strip); + float end = SEQ_time_content_end_frame_get(scene, strip) - 1; + float frame_index_max = strip->len - 1; - if (seq->type & SEQ_TYPE_EFFECT) { - end = SEQ_time_right_handle_frame_get(scene, seq); + if (strip->type & STRIP_TYPE_EFFECT) { + end = SEQ_time_right_handle_frame_get(scene, strip); frame_index_max = end - sta; } @@ -75,11 +71,11 @@ float SEQ_give_frame_index(const Scene *scene, const Strip *seq, float timeline_ return -1; } - if (seq->type == SEQ_TYPE_IMAGE && SEQ_transform_single_image_check(seq)) { + if (strip->type == STRIP_TYPE_IMAGE && SEQ_transform_single_image_check(strip)) { return 0; } - if (seq->flag & SEQ_REVERSE_FRAMES) { + if (strip->flag & SEQ_REVERSE_FRAMES) { frame_index = end - timeline_frame; } else { @@ -88,17 +84,17 @@ float SEQ_give_frame_index(const Scene *scene, const Strip *seq, float timeline_ frame_index = max_ff(frame_index, 0); - frame_index *= SEQ_time_media_playback_rate_factor_get(scene, seq); + frame_index *= SEQ_time_media_playback_rate_factor_get(scene, strip); - if (SEQ_retiming_is_active(seq)) { - const float retiming_factor = seq_retiming_evaluate(seq, frame_index); + if (SEQ_retiming_is_active(strip)) { + const float retiming_factor = strip_retiming_evaluate(strip, frame_index); frame_index = retiming_factor * frame_index_max; } /* Clamp frame index to strip content frame range. */ frame_index = clamp_f(frame_index, 0, frame_index_max); - if (seq->strobe > 1.0f) { - frame_index -= fmodf(double(frame_index), double(seq->strobe)); + if (strip->strobe > 1.0f) { + frame_index -= fmodf(double(frame_index), double(strip->strobe)); } return frame_index; @@ -114,133 +110,135 @@ static int metaseq_end(Strip *metaseq) return metaseq->start + metaseq->len - metaseq->endofs; } -static void seq_update_sound_bounds_recursive_impl(const Scene *scene, - Strip *metaseq, - int start, - int end) +static void strip_update_sound_bounds_recursive_impl(const Scene *scene, + Strip *metaseq, + int start, + int end) { /* For sound we go over full meta tree to update bounds of the sound strips, * since sound is played outside of evaluating the image-buffers (#ImBuf). */ - LISTBASE_FOREACH (Strip *, seq, &metaseq->seqbase) { - if (seq->type == SEQ_TYPE_META) { - seq_update_sound_bounds_recursive_impl( - scene, seq, max_ii(start, metaseq_start(seq)), min_ii(end, metaseq_end(seq))); + LISTBASE_FOREACH (Strip *, strip, &metaseq->seqbase) { + if (strip->type == STRIP_TYPE_META) { + strip_update_sound_bounds_recursive_impl( + scene, strip, max_ii(start, metaseq_start(strip)), min_ii(end, metaseq_end(strip))); } - else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { - if (seq->scene_sound) { - int startofs = seq->startofs; - int endofs = seq->endofs; - if (seq->startofs + seq->start < start) { - startofs = start - seq->start; + else if (ELEM(strip->type, STRIP_TYPE_SOUND_RAM, STRIP_TYPE_SCENE)) { + if (strip->scene_sound) { + int startofs = strip->startofs; + int endofs = strip->endofs; + if (strip->startofs + strip->start < start) { + startofs = start - strip->start; } - if (seq->start + seq->len - seq->endofs > end) { - endofs = seq->start + seq->len - end; + if (strip->start + strip->len - strip->endofs > end) { + endofs = strip->start + strip->len - end; } double offset_time = 0.0f; - if (seq->sound != nullptr) { - offset_time = seq->sound->offset_time + seq->sound_offset; + if (strip->sound != nullptr) { + offset_time = strip->sound->offset_time + strip->sound_offset; } BKE_sound_move_scene_sound(scene, - seq->scene_sound, - seq->start + startofs, - seq->start + seq->len - endofs, - startofs + seq->anim_startofs, + strip->scene_sound, + strip->start + startofs, + strip->start + strip->len - endofs, + startofs + strip->anim_startofs, offset_time); } } } } -void seq_update_sound_bounds_recursive(const Scene *scene, Strip *metaseq) +void strip_update_sound_bounds_recursive(const Scene *scene, Strip *metaseq) { - seq_update_sound_bounds_recursive_impl( + strip_update_sound_bounds_recursive_impl( scene, metaseq, metaseq_start(metaseq), metaseq_end(metaseq)); } -void SEQ_time_update_meta_strip_range(const Scene *scene, Strip *seq_meta) +void SEQ_time_update_meta_strip_range(const Scene *scene, Strip *strip_meta) { - if (seq_meta == nullptr) { + if (strip_meta == nullptr) { return; } - if (BLI_listbase_is_empty(&seq_meta->seqbase)) { + if (BLI_listbase_is_empty(&strip_meta->seqbase)) { return; } - const int strip_start = SEQ_time_left_handle_frame_get(scene, seq_meta); - const int strip_end = SEQ_time_right_handle_frame_get(scene, seq_meta); + const int strip_start = SEQ_time_left_handle_frame_get(scene, strip_meta); + const int strip_end = SEQ_time_right_handle_frame_get(scene, strip_meta); int min = MAXFRAME * 2; int max = -MAXFRAME * 2; - LISTBASE_FOREACH (Strip *, seq, &seq_meta->seqbase) { - min = min_ii(SEQ_time_left_handle_frame_get(scene, seq), min); - max = max_ii(SEQ_time_right_handle_frame_get(scene, seq), max); + LISTBASE_FOREACH (Strip *, strip, &strip_meta->seqbase) { + min = min_ii(SEQ_time_left_handle_frame_get(scene, strip), min); + max = max_ii(SEQ_time_right_handle_frame_get(scene, strip), max); } - seq_meta->start = min + seq_meta->anim_startofs; - seq_meta->len = max - min; - seq_meta->len -= seq_meta->anim_startofs; - seq_meta->len -= seq_meta->anim_endofs; + strip_meta->start = min + strip_meta->anim_startofs; + strip_meta->len = max - min; + strip_meta->len -= strip_meta->anim_startofs; + strip_meta->len -= strip_meta->anim_endofs; /* Functions `SEQ_time_*_handle_frame_set()` can not be used here, because they are clamped, so * change must be done at once. */ - seq_meta->startofs = strip_start - seq_meta->start; - seq_meta->startdisp = strip_start; /* Only to make files usable in older versions. */ - seq_meta->endofs = seq_meta->start + SEQ_time_strip_length_get(scene, seq_meta) - strip_end; - seq_meta->enddisp = strip_end; /* Only to make files usable in older versions. */ + strip_meta->startofs = strip_start - strip_meta->start; + strip_meta->startdisp = strip_start; /* Only to make files usable in older versions. */ + strip_meta->endofs = strip_meta->start + SEQ_time_strip_length_get(scene, strip_meta) - + strip_end; + strip_meta->enddisp = strip_end; /* Only to make files usable in older versions. */ - seq_update_sound_bounds_recursive(scene, seq_meta); - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq_meta); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq_meta)); + strip_update_sound_bounds_recursive(scene, strip_meta); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip_meta); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip_meta)); } -void seq_time_effect_range_set(const Scene *scene, Strip *seq) +void strip_time_effect_range_set(const Scene *scene, Strip *strip) { - if (seq->seq1 == nullptr && seq->seq2 == nullptr) { + if (strip->seq1 == nullptr && strip->seq2 == nullptr) { return; } - if (seq->seq1 && seq->seq2) { /* 2 - input effect. */ - seq->startdisp = max_ii(SEQ_time_left_handle_frame_get(scene, seq->seq1), - SEQ_time_left_handle_frame_get(scene, seq->seq2)); - seq->enddisp = min_ii(SEQ_time_right_handle_frame_get(scene, seq->seq1), - SEQ_time_right_handle_frame_get(scene, seq->seq2)); + if (strip->seq1 && strip->seq2) { /* 2 - input effect. */ + strip->startdisp = max_ii(SEQ_time_left_handle_frame_get(scene, strip->seq1), + SEQ_time_left_handle_frame_get(scene, strip->seq2)); + strip->enddisp = min_ii(SEQ_time_right_handle_frame_get(scene, strip->seq1), + SEQ_time_right_handle_frame_get(scene, strip->seq2)); } - else if (seq->seq1) { /* Single input effect. */ - seq->startdisp = SEQ_time_right_handle_frame_get(scene, seq->seq1); - seq->enddisp = SEQ_time_left_handle_frame_get(scene, seq->seq1); + else if (strip->seq1) { /* Single input effect. */ + strip->startdisp = SEQ_time_right_handle_frame_get(scene, strip->seq1); + strip->enddisp = SEQ_time_left_handle_frame_get(scene, strip->seq1); } - else if (seq->seq2) { /* Strip may be missing one of inputs. */ - seq->startdisp = SEQ_time_right_handle_frame_get(scene, seq->seq2); - seq->enddisp = SEQ_time_left_handle_frame_get(scene, seq->seq2); + else if (strip->seq2) { /* Strip may be missing one of inputs. */ + strip->startdisp = SEQ_time_right_handle_frame_get(scene, strip->seq2); + strip->enddisp = SEQ_time_left_handle_frame_get(scene, strip->seq2); } - if (seq->startdisp > seq->enddisp) { - std::swap(seq->startdisp, seq->enddisp); + if (strip->startdisp > strip->enddisp) { + std::swap(strip->startdisp, strip->enddisp); } /* Values unusable for effects, these should be always 0. */ - seq->startofs = seq->endofs = seq->anim_startofs = seq->anim_endofs = 0; - seq->start = seq->startdisp; - seq->len = seq->enddisp - seq->startdisp; + strip->startofs = strip->endofs = strip->anim_startofs = strip->anim_endofs = 0; + strip->start = strip->startdisp; + strip->len = strip->enddisp - strip->startdisp; } -void seq_time_update_effects_strip_range(const Scene *scene, const blender::Span effects) +void strip_time_update_effects_strip_range(const Scene *scene, + const blender::Span effects) { /* First pass: Update length of immediate effects. */ - for (Strip *seq : effects) { - seq_time_effect_range_set(scene, seq); + for (Strip *strip : effects) { + strip_time_effect_range_set(scene, strip); } /* Second pass: Recursive call to update effects in chain and in order, so they inherit length * correctly. */ - for (Strip *seq : effects) { - blender::Span effects_recurse = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects_recurse); + for (Strip *strip : effects) { + blender::Span effects_recurse = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects_recurse); } } @@ -255,7 +253,7 @@ int SEQ_time_find_next_prev_edit(Scene *scene, ListBase *channels = SEQ_channels_displayed_get(ed); int dist, best_dist, best_frame = timeline_frame; - int seq_frames[2], seq_frames_tot; + int strip_frames[2], strip_frames_tot; /* In case where both is passed, * frame just finds the nearest end while frame_left the nearest start. */ @@ -266,53 +264,53 @@ int SEQ_time_find_next_prev_edit(Scene *scene, return timeline_frame; } - LISTBASE_FOREACH (Strip *, seq, ed->seqbasep) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { int i; - if (do_skip_mute && SEQ_render_is_muted(channels, seq)) { + if (do_skip_mute && SEQ_render_is_muted(channels, strip)) { continue; } - if (do_unselected && (seq->flag & SELECT)) { + if (do_unselected && (strip->flag & SELECT)) { continue; } if (do_center) { - seq_frames[0] = (SEQ_time_left_handle_frame_get(scene, seq) + - SEQ_time_right_handle_frame_get(scene, seq)) / - 2; - seq_frames_tot = 1; + strip_frames[0] = (SEQ_time_left_handle_frame_get(scene, strip) + + SEQ_time_right_handle_frame_get(scene, strip)) / + 2; + strip_frames_tot = 1; } else { - seq_frames[0] = SEQ_time_left_handle_frame_get(scene, seq); - seq_frames[1] = SEQ_time_right_handle_frame_get(scene, seq); + strip_frames[0] = SEQ_time_left_handle_frame_get(scene, strip); + strip_frames[1] = SEQ_time_right_handle_frame_get(scene, strip); - seq_frames_tot = 2; + strip_frames_tot = 2; } - for (i = 0; i < seq_frames_tot; i++) { - const int seq_frame = seq_frames[i]; + for (i = 0; i < strip_frames_tot; i++) { + const int strip_frame = strip_frames[i]; dist = MAXFRAME * 2; switch (side) { case SEQ_SIDE_LEFT: - if (seq_frame < timeline_frame) { - dist = timeline_frame - seq_frame; + if (strip_frame < timeline_frame) { + dist = timeline_frame - strip_frame; } break; case SEQ_SIDE_RIGHT: - if (seq_frame > timeline_frame) { - dist = seq_frame - timeline_frame; + if (strip_frame > timeline_frame) { + dist = strip_frame - timeline_frame; } break; case SEQ_SIDE_BOTH: - dist = abs(seq_frame - timeline_frame); + dist = abs(strip_frame - timeline_frame); break; } if (dist < best_dist) { - best_frame = seq_frame; + best_frame = strip_frame; best_dist = dist; } } @@ -321,28 +319,28 @@ int SEQ_time_find_next_prev_edit(Scene *scene, return best_frame; } -float SEQ_time_sequence_get_fps(Scene *scene, Strip *seq) +float SEQ_time_sequence_get_fps(Scene *scene, Strip *strip) { - switch (seq->type) { - case SEQ_TYPE_MOVIE: { - seq_open_anim_file(scene, seq, true); - if (BLI_listbase_is_empty(&seq->anims)) { + switch (strip->type) { + case STRIP_TYPE_MOVIE: { + strip_open_anim_file(scene, strip, true); + if (BLI_listbase_is_empty(&strip->anims)) { return 0.0f; } - StripAnim *strip_anim = static_cast(seq->anims.first); + StripAnim *strip_anim = static_cast(strip->anims.first); if (strip_anim->anim == nullptr) { return 0.0f; } return MOV_get_fps(strip_anim->anim); } - case SEQ_TYPE_MOVIECLIP: - if (seq->clip != nullptr) { - return BKE_movieclip_get_fps(seq->clip); + case STRIP_TYPE_MOVIECLIP: + if (strip->clip != nullptr) { + return BKE_movieclip_get_fps(strip->clip); } break; - case SEQ_TYPE_SCENE: - if (seq->scene != nullptr) { - return float(seq->scene->r.frs_sec) / seq->scene->r.frs_sec_base; + case STRIP_TYPE_SCENE: + if (strip->scene != nullptr) { + return float(strip->scene->r.frs_sec) / strip->scene->r.frs_sec_base; } break; } @@ -363,16 +361,16 @@ void SEQ_timeline_expand_boundbox(const Scene *scene, const ListBase *seqbase, r return; } - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (rect->xmin > SEQ_time_left_handle_frame_get(scene, seq) - 1) { - rect->xmin = SEQ_time_left_handle_frame_get(scene, seq) - 1; + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (rect->xmin > SEQ_time_left_handle_frame_get(scene, strip) - 1) { + rect->xmin = SEQ_time_left_handle_frame_get(scene, strip) - 1; } - if (rect->xmax < SEQ_time_right_handle_frame_get(scene, seq) + 1) { - rect->xmax = SEQ_time_right_handle_frame_get(scene, seq) + 1; + if (rect->xmax < SEQ_time_right_handle_frame_get(scene, strip) + 1) { + rect->xmax = SEQ_time_right_handle_frame_get(scene, strip) + 1; } - if (rect->ymax < seq->machine + 1.0f) { + if (rect->ymax < strip->machine + 1.0f) { /* We do +1 here to account for the channel thickness. Channel n has range of . */ - rect->ymax = seq->machine + 1.0f; + rect->ymax = strip->machine + 1.0f; } } } @@ -387,8 +385,8 @@ static bool strip_exists_at_frame(const Scene *scene, blender::Span strips, const int timeline_frame) { - for (Strip *seq : strips) { - if (SEQ_time_strip_intersects_frame(scene, seq, timeline_frame)) { + for (Strip *strip : strips) { + if (SEQ_time_strip_intersects_frame(scene, strip, timeline_frame)) { return true; } } @@ -441,137 +439,139 @@ void seq_time_gap_info_get(const Scene *scene, } bool SEQ_time_strip_intersects_frame(const Scene *scene, - const Strip *seq, + const Strip *strip, const int timeline_frame) { - return (SEQ_time_left_handle_frame_get(scene, seq) <= timeline_frame) && - (SEQ_time_right_handle_frame_get(scene, seq) > timeline_frame); + return (SEQ_time_left_handle_frame_get(scene, strip) <= timeline_frame) && + (SEQ_time_right_handle_frame_get(scene, strip) > timeline_frame); } -bool SEQ_time_has_left_still_frames(const Scene *scene, const Strip *seq) +bool SEQ_time_has_left_still_frames(const Scene *scene, const Strip *strip) { - return SEQ_time_left_handle_frame_get(scene, seq) < SEQ_time_start_frame_get(seq); + return SEQ_time_left_handle_frame_get(scene, strip) < SEQ_time_start_frame_get(strip); } -bool SEQ_time_has_right_still_frames(const Scene *scene, const Strip *seq) +bool SEQ_time_has_right_still_frames(const Scene *scene, const Strip *strip) { - return SEQ_time_right_handle_frame_get(scene, seq) > SEQ_time_content_end_frame_get(scene, seq); + return SEQ_time_right_handle_frame_get(scene, strip) > + SEQ_time_content_end_frame_get(scene, strip); } -bool SEQ_time_has_still_frames(const Scene *scene, const Strip *seq) +bool SEQ_time_has_still_frames(const Scene *scene, const Strip *strip) { - return SEQ_time_has_right_still_frames(scene, seq) || SEQ_time_has_left_still_frames(scene, seq); + return SEQ_time_has_right_still_frames(scene, strip) || + SEQ_time_has_left_still_frames(scene, strip); } -int SEQ_time_strip_length_get(const Scene *scene, const Strip *seq) +int SEQ_time_strip_length_get(const Scene *scene, const Strip *strip) { - if (SEQ_retiming_is_active(seq)) { + if (SEQ_retiming_is_active(strip)) { const int last_key_frame = SEQ_retiming_key_timeline_frame_get( - scene, seq, SEQ_retiming_last_key_get(seq)); + scene, strip, SEQ_retiming_last_key_get(strip)); /* Last key is mapped to last frame index. Numbering starts from 0. */ - int sound_offset = SEQ_time_get_rounded_sound_offset(scene, seq); - return last_key_frame + 1 - SEQ_time_start_frame_get(seq) - sound_offset; + int sound_offset = SEQ_time_get_rounded_sound_offset(scene, strip); + return last_key_frame + 1 - SEQ_time_start_frame_get(strip) - sound_offset; } - return seq->len / SEQ_time_media_playback_rate_factor_get(scene, seq); + return strip->len / SEQ_time_media_playback_rate_factor_get(scene, strip); } -float SEQ_time_start_frame_get(const Strip *seq) +float SEQ_time_start_frame_get(const Strip *strip) { - return seq->start; + return strip->start; } -void SEQ_time_start_frame_set(const Scene *scene, Strip *seq, int timeline_frame) +void SEQ_time_start_frame_set(const Scene *scene, Strip *strip, int timeline_frame) { - seq->start = timeline_frame; - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + strip->start = timeline_frame; + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -float SEQ_time_content_end_frame_get(const Scene *scene, const Strip *seq) +float SEQ_time_content_end_frame_get(const Scene *scene, const Strip *strip) { - return SEQ_time_start_frame_get(seq) + SEQ_time_strip_length_get(scene, seq); + return SEQ_time_start_frame_get(strip) + SEQ_time_strip_length_get(scene, strip); } -int SEQ_time_left_handle_frame_get(const Scene * /*scene*/, const Strip *seq) +int SEQ_time_left_handle_frame_get(const Scene * /*scene*/, const Strip *strip) { - if (seq->seq1 || seq->seq2) { - return seq->startdisp; + if (strip->seq1 || strip->seq2) { + return strip->startdisp; } - return seq->start + seq->startofs; + return strip->start + strip->startofs; } -int SEQ_time_right_handle_frame_get(const Scene *scene, const Strip *seq) +int SEQ_time_right_handle_frame_get(const Scene *scene, const Strip *strip) { - if (seq->seq1 || seq->seq2) { - return seq->enddisp; + if (strip->seq1 || strip->seq2) { + return strip->enddisp; } - return SEQ_time_content_end_frame_get(scene, seq) - seq->endofs; + return SEQ_time_content_end_frame_get(scene, strip) - strip->endofs; } -void SEQ_time_left_handle_frame_set(const Scene *scene, Strip *seq, int timeline_frame) +void SEQ_time_left_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame) { - const float right_handle_orig_frame = SEQ_time_right_handle_frame_get(scene, seq); + const float right_handle_orig_frame = SEQ_time_right_handle_frame_get(scene, strip); if (timeline_frame >= right_handle_orig_frame) { timeline_frame = right_handle_orig_frame - 1; } - float offset = timeline_frame - SEQ_time_start_frame_get(seq); + float offset = timeline_frame - SEQ_time_start_frame_get(strip); - if (SEQ_transform_single_image_check(seq)) { + if (SEQ_transform_single_image_check(strip)) { /* This strip has only 1 frame of content, that is always stretched to whole strip length. * Therefore, strip start should be moved instead of adjusting offset. */ - SEQ_time_start_frame_set(scene, seq, timeline_frame); - seq->endofs += offset; + SEQ_time_start_frame_set(scene, strip, timeline_frame); + strip->endofs += offset; } else { - seq->startofs = offset; + strip->startofs = offset; } - seq->startdisp = timeline_frame; /* Only to make files usable in older versions. */ + strip->startdisp = timeline_frame; /* Only to make files usable in older versions. */ - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -void SEQ_time_right_handle_frame_set(const Scene *scene, Strip *seq, int timeline_frame) +void SEQ_time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame) { - const float left_handle_orig_frame = SEQ_time_left_handle_frame_get(scene, seq); + const float left_handle_orig_frame = SEQ_time_left_handle_frame_get(scene, strip); if (timeline_frame <= left_handle_orig_frame) { timeline_frame = left_handle_orig_frame + 1; } - seq->endofs = SEQ_time_content_end_frame_get(scene, seq) - timeline_frame; - seq->enddisp = timeline_frame; /* Only to make files usable in older versions. */ + strip->endofs = SEQ_time_content_end_frame_get(scene, strip) - timeline_frame; + strip->enddisp = timeline_frame; /* Only to make files usable in older versions. */ - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -void seq_time_translate_handles(const Scene *scene, Strip *seq, const int offset) +void strip_time_translate_handles(const Scene *scene, Strip *strip, const int offset) { - seq->startofs += offset; - seq->endofs -= offset; - seq->startdisp += offset; /* Only to make files usable in older versions. */ - seq->enddisp -= offset; /* Only to make files usable in older versions. */ + strip->startofs += offset; + strip->endofs -= offset; + strip->startdisp += offset; /* Only to make files usable in older versions. */ + strip->enddisp -= offset; /* Only to make files usable in older versions. */ - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); - SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq)); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); + SEQ_time_update_meta_strip_range(scene, SEQ_lookup_meta_by_strip(scene, strip)); } -static void seq_time_slip_strip_ex( - const Scene *scene, Strip *seq, int delta, float subframe_delta, bool recursed) +static void strip_time_slip_strip_ex( + const Scene *scene, Strip *strip, int delta, float subframe_delta, bool recursed) { - if (seq->type == SEQ_TYPE_SOUND_RAM && subframe_delta != 0.0f) { - seq->sound_offset += subframe_delta / FPS; + if (strip->type == STRIP_TYPE_SOUND_RAM && subframe_delta != 0.0f) { + strip->sound_offset += subframe_delta / FPS; } if (delta == 0) { @@ -579,52 +579,52 @@ static void seq_time_slip_strip_ex( } /* Skip effect strips where the length is dependent on another strip, - * as they are calculated with #seq_time_update_effects_strip_range. */ - if (seq->seq1 != nullptr || seq->seq2 != nullptr) { + * as they are calculated with #strip_time_update_effects_strip_range. */ + if (strip->seq1 != nullptr || strip->seq2 != nullptr) { return; } /* Effects only have a start frame and a length, so unless we're inside * a meta strip, there's no need to do anything. */ - if (!recursed && (seq->type & SEQ_TYPE_EFFECT)) { + if (!recursed && (strip->type & STRIP_TYPE_EFFECT)) { return; } /* Move strips inside meta strip. */ - if (seq->type == SEQ_TYPE_META) { + if (strip->type == STRIP_TYPE_META) { /* If the meta strip has no contents, don't do anything. */ - if (BLI_listbase_is_empty(&seq->seqbase)) { + if (BLI_listbase_is_empty(&strip->seqbase)) { return; } - LISTBASE_FOREACH (Strip *, seq_child, &seq->seqbase) { - seq_time_slip_strip_ex(scene, seq_child, delta, subframe_delta, true); + LISTBASE_FOREACH (Strip *, strip_child, &strip->seqbase) { + strip_time_slip_strip_ex(scene, strip_child, delta, subframe_delta, true); } } - seq->start = seq->start + delta; + strip->start = strip->start + delta; if (!recursed) { - seq->startofs = seq->startofs - delta; - seq->endofs = seq->endofs + delta; + strip->startofs = strip->startofs - delta; + strip->endofs = strip->endofs + delta; } /* Only to make files usable in older versions. */ - seq->startdisp = SEQ_time_left_handle_frame_get(scene, seq); - seq->enddisp = SEQ_time_right_handle_frame_get(scene, seq); + strip->startdisp = SEQ_time_left_handle_frame_get(scene, strip); + strip->enddisp = SEQ_time_right_handle_frame_get(scene, strip); - blender::Span effects = seq_sequence_lookup_effects_by_seq(scene, seq); - seq_time_update_effects_strip_range(scene, effects); + blender::Span effects = SEQ_lookup_effects_by_strip(scene, strip); + strip_time_update_effects_strip_range(scene, effects); } -void SEQ_time_slip_strip(const Scene *scene, Strip *seq, int delta, float subframe_delta) +void SEQ_time_slip_strip(const Scene *scene, Strip *strip, int delta, float subframe_delta) { - seq_time_slip_strip_ex(scene, seq, delta, subframe_delta, false); + strip_time_slip_strip_ex(scene, strip, delta, subframe_delta, false); } -int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Strip *seq) +int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Strip *strip) { int sound_offset = 0; - if (seq->type == SEQ_TYPE_SOUND_RAM && seq->sound != nullptr) { - sound_offset = round_fl_to_int((seq->sound->offset_time + seq->sound_offset) * FPS); + if (strip->type == STRIP_TYPE_SOUND_RAM && strip->sound != nullptr) { + sound_offset = round_fl_to_int((strip->sound->offset_time + strip->sound_offset) * FPS); } return sound_offset; } diff --git a/source/blender/sequencer/intern/strip_time.hh b/source/blender/sequencer/intern/strip_time.hh index 8134efa7910d..0100a8250235 100644 --- a/source/blender/sequencer/intern/strip_time.hh +++ b/source/blender/sequencer/intern/strip_time.hh @@ -14,7 +14,7 @@ struct ListBase; struct Scene; struct Strip; -void seq_update_sound_bounds_recursive(const Scene *scene, Strip *metaseq); +void strip_update_sound_bounds_recursive(const Scene *scene, Strip *metaseq); /* Describes gap between strips in timeline. */ struct GapInfo { @@ -35,12 +35,12 @@ void seq_time_gap_info_get(const Scene *scene, ListBase *seqbase, int initial_frame, GapInfo *r_gap_info); -void seq_time_effect_range_set(const Scene *scene, Strip *seq); +void strip_time_effect_range_set(const Scene *scene, Strip *strip); /** * Update strip `startdisp` and `enddisp` (n-input effects have no length to calculate these). */ -void seq_time_update_effects_strip_range(const Scene *scene, blender::Span effects); -void seq_time_translate_handles(const Scene *scene, Strip *seq, const int offset); -float seq_time_media_playback_rate_factor_get(const Scene *scene, const Strip *seq); -int seq_time_strip_original_content_length_get(const Scene *scene, const Strip *seq); -float seq_retiming_evaluate(const Strip *seq, const float frame_index); +void strip_time_update_effects_strip_range(const Scene *scene, blender::Span effects); +void strip_time_translate_handles(const Scene *scene, Strip *strip, const int offset); +float strip_time_media_playback_rate_factor_get(const Scene *scene, const Strip *strip); +int seq_time_strip_original_content_length_get(const Scene *scene, const Strip *strip); +float strip_retiming_evaluate(const Strip *strip, const float frame_index); diff --git a/source/blender/sequencer/intern/strip_transform.cc b/source/blender/sequencer/intern/strip_transform.cc index 14a34f4117fb..5abd6a9b6ed0 100644 --- a/source/blender/sequencer/intern/strip_transform.cc +++ b/source/blender/sequencer/intern/strip_transform.cc @@ -8,7 +8,6 @@ * \ingroup bke */ -#include "BLI_math_matrix_types.hh" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -17,7 +16,6 @@ #include "BLI_math_rotation.h" #include "BLI_math_vector.h" #include "BLI_math_vector_types.hh" -#include "BLI_rect.h" #include "SEQ_animation.hh" #include "SEQ_channels.hh" @@ -32,9 +30,9 @@ #include "sequencer.hh" #include "strip_time.hh" -bool SEQ_transform_single_image_check(const Strip *seq) +bool SEQ_transform_single_image_check(const Strip *strip) { - return (seq->flag & SEQ_SINGLE_FRAME_CONTENT) != 0; + return (strip->flag & SEQ_SINGLE_FRAME_CONTENT) != 0; } bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) @@ -42,8 +40,8 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) /* is there more than 1 select */ bool ok = false; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (seq->flag & SELECT) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (strip->flag & SELECT) { ok = true; break; } @@ -54,20 +52,22 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) } /* test relationships */ - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if ((seq->type & SEQ_TYPE_EFFECT) == 0) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if ((strip->type & STRIP_TYPE_EFFECT) == 0) { continue; } - if (seq->flag & SELECT) { - if ((seq->seq1 && (seq->seq1->flag & SELECT) == 0) || - (seq->seq2 && (seq->seq2->flag & SELECT) == 0)) + if (strip->flag & SELECT) { + if ((strip->seq1 && (strip->seq1->flag & SELECT) == 0) || + (strip->seq2 && (strip->seq2->flag & SELECT) == 0)) { return false; } } else { - if ((seq->seq1 && (seq->seq1->flag & SELECT)) || (seq->seq2 && (seq->seq2->flag & SELECT))) { + if ((strip->seq1 && (strip->seq1->flag & SELECT)) || + (strip->seq2 && (strip->seq2->flag & SELECT))) + { return false; } } @@ -76,9 +76,9 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) return true; } -bool SEQ_transform_sequence_can_be_translated(const Strip *seq) +bool SEQ_transform_sequence_can_be_translated(const Strip *strip) { - return !(seq->type & SEQ_TYPE_EFFECT) || (SEQ_effect_get_num_inputs(seq->type) == 0); + return !(strip->type & STRIP_TYPE_EFFECT) || (SEQ_effect_get_num_inputs(strip->type) == 0); } bool SEQ_transform_test_overlap_seq_seq(const Scene *scene, Strip *seq1, Strip *seq2) @@ -92,20 +92,20 @@ bool SEQ_transform_test_overlap_seq_seq(const Scene *scene, Strip *seq1, Strip * bool SEQ_transform_test_overlap(const Scene *scene, ListBase *seqbasep, Strip *test) { - Strip *seq; + Strip *strip; - seq = static_cast(seqbasep->first); - while (seq) { - if (SEQ_transform_test_overlap_seq_seq(scene, test, seq)) { + strip = static_cast(seqbasep->first); + while (strip) { + if (SEQ_transform_test_overlap_seq_seq(scene, test, strip)) { return true; } - seq = seq->next; + strip = strip->next; } return false; } -void SEQ_transform_translate_sequence(Scene *evil_scene, Strip *seq, int delta) +void SEQ_transform_translate_sequence(Scene *evil_scene, Strip *strip, int delta) { if (delta == 0) { return; @@ -114,24 +114,24 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Strip *seq, int delta) /* Meta strips requires their content is to be translated, and then frame range of the meta is * updated based on nested strips. This won't work for empty meta-strips, * so they can be treated as normal strip. */ - if (seq->type == SEQ_TYPE_META && !BLI_listbase_is_empty(&seq->seqbase)) { - LISTBASE_FOREACH (Strip *, seq_child, &seq->seqbase) { - SEQ_transform_translate_sequence(evil_scene, seq_child, delta); + if (strip->type == STRIP_TYPE_META && !BLI_listbase_is_empty(&strip->seqbase)) { + LISTBASE_FOREACH (Strip *, strip_child, &strip->seqbase) { + SEQ_transform_translate_sequence(evil_scene, strip_child, delta); } /* Move meta start/end points. */ - seq_time_translate_handles(evil_scene, seq, delta); + strip_time_translate_handles(evil_scene, strip, delta); } - else if (seq->seq1 == nullptr && seq->seq2 == nullptr) { /* All other strip types. */ - seq->start += delta; + else if (strip->seq1 == nullptr && strip->seq2 == nullptr) { /* All other strip types. */ + strip->start += delta; /* Only to make files usable in older versions. */ - seq->startdisp = SEQ_time_left_handle_frame_get(evil_scene, seq); - seq->enddisp = SEQ_time_right_handle_frame_get(evil_scene, seq); + strip->startdisp = SEQ_time_left_handle_frame_get(evil_scene, strip); + strip->enddisp = SEQ_time_right_handle_frame_get(evil_scene, strip); } - SEQ_offset_animdata(evil_scene, seq, delta); - blender::Span effects = seq_sequence_lookup_effects_by_seq(evil_scene, seq); - seq_time_update_effects_strip_range(evil_scene, effects); - SEQ_time_update_meta_strip_range(evil_scene, seq_sequence_lookup_meta_by_seq(evil_scene, seq)); + SEQ_offset_animdata(evil_scene, strip, delta); + blender::Span effects = SEQ_lookup_effects_by_strip(evil_scene, strip); + strip_time_update_effects_strip_range(evil_scene, effects); + SEQ_time_update_meta_strip_range(evil_scene, SEQ_lookup_meta_by_strip(evil_scene, strip)); } bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, @@ -157,9 +157,9 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep, int new_frame = SEQ_time_right_handle_frame_get(evil_scene, test); - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - if (seq->machine == orig_machine) { - new_frame = max_ii(new_frame, SEQ_time_right_handle_frame_get(evil_scene, seq)); + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + if (strip->machine == orig_machine) { + new_frame = max_ii(new_frame, SEQ_time_right_handle_frame_get(evil_scene, strip)); } } @@ -201,15 +201,15 @@ static int shuffle_seq_time_offset_get(const Scene *scene, while (!all_conflicts_resolved) { all_conflicts_resolved = true; - for (Strip *seq : strips_to_shuffle) { - LISTBASE_FOREACH (Strip *, seq_other, seqbasep) { - if (strips_to_shuffle.contains(seq_other)) { + for (Strip *strip : strips_to_shuffle) { + LISTBASE_FOREACH (Strip *, strip_other, seqbasep) { + if (strips_to_shuffle.contains(strip_other)) { continue; } - if (SEQ_relation_is_effect_of_strip(seq_other, seq)) { + if (SEQ_relation_is_effect_of_strip(strip_other, strip)) { continue; } - if (!shuffle_seq_test_overlap(scene, seq, seq_other, offset)) { + if (!shuffle_seq_test_overlap(scene, strip, strip_other, offset)) { continue; } @@ -217,13 +217,13 @@ static int shuffle_seq_time_offset_get(const Scene *scene, if (dir == 'L') { offset = min_ii(offset, - SEQ_time_left_handle_frame_get(scene, seq_other) - - SEQ_time_right_handle_frame_get(scene, seq)); + SEQ_time_left_handle_frame_get(scene, strip_other) - + SEQ_time_right_handle_frame_get(scene, strip)); } else { offset = max_ii(offset, - SEQ_time_right_handle_frame_get(scene, seq_other) - - SEQ_time_left_handle_frame_get(scene, seq)); + SEQ_time_right_handle_frame_get(scene, strip_other) - + SEQ_time_left_handle_frame_get(scene, strip)); } } } @@ -255,14 +255,14 @@ bool SEQ_transform_seqbase_shuffle_time(blender::Span strips_to_shuffle int offset = (-offset_l < offset_r) ? offset_l : offset_r; if (offset) { - for (Strip *seq : strips_to_shuffle) { - SEQ_transform_translate_sequence(evil_scene, seq, offset); - seq->flag &= ~SEQ_OVERLAP; + for (Strip *strip : strips_to_shuffle) { + SEQ_transform_translate_sequence(evil_scene, strip, offset); + strip->flag &= ~SEQ_OVERLAP; } if (!time_dependent_strips.is_empty()) { - for (Strip *seq : time_dependent_strips) { - SEQ_offset_animdata(evil_scene, seq, offset); + for (Strip *strip : time_dependent_strips) { + SEQ_offset_animdata(evil_scene, strip, offset); } } @@ -284,9 +284,9 @@ static blender::VectorSet extract_standalone_strips( { blender::VectorSet standalone_strips; - for (Strip *seq : transformed_strips) { - if ((seq->type & SEQ_TYPE_EFFECT) == 0 || seq->seq1 == nullptr) { - standalone_strips.add(seq); + for (Strip *strip : transformed_strips) { + if ((strip->type & STRIP_TYPE_EFFECT) == 0 || strip->seq1 == nullptr) { + standalone_strips.add(strip); } } return standalone_strips; @@ -301,22 +301,22 @@ static blender::VectorSet query_right_side_strips( { int minframe = MAXFRAME; { - for (Strip *seq : transformed_strips) { - minframe = min_ii(minframe, SEQ_time_left_handle_frame_get(scene, seq)); + for (Strip *strip : transformed_strips) { + minframe = min_ii(minframe, SEQ_time_left_handle_frame_get(scene, strip)); } } blender::VectorSet right_side_strips; - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (!time_dependent_strips.is_empty() && time_dependent_strips.contains(seq)) { + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (!time_dependent_strips.is_empty() && time_dependent_strips.contains(strip)) { continue; } - if (transformed_strips.contains(seq)) { + if (transformed_strips.contains(strip)) { continue; } - if ((seq->flag & SELECT) == 0 && SEQ_time_left_handle_frame_get(scene, seq) >= minframe) { - right_side_strips.add(seq); + if ((strip->flag & SELECT) == 0 && SEQ_time_left_handle_frame_get(scene, strip) >= minframe) { + right_side_strips.add(strip); } } return right_side_strips; @@ -324,11 +324,11 @@ static blender::VectorSet query_right_side_strips( /* Offset all strips positioned after left edge of transformed strips bound-box by amount equal * to overlap of transformed strips. */ -static void seq_transform_handle_expand_to_fit(Scene *scene, - ListBase *seqbasep, - blender::Span transformed_strips, - blender::Span time_dependent_strips, - bool use_sync_markers) +static void strip_transform_handle_expand_to_fit(Scene *scene, + ListBase *seqbasep, + blender::Span transformed_strips, + blender::Span time_dependent_strips, + bool use_sync_markers) { ListBase *markers = &scene->markers; @@ -336,8 +336,8 @@ static void seq_transform_handle_expand_to_fit(Scene *scene, scene, seqbasep, transformed_strips, time_dependent_strips); /* Temporarily move right side strips beyond timeline boundary. */ - for (Strip *seq : right_side_strips) { - seq->machine += SEQ_MAX_CHANNELS * 2; + for (Strip *strip : right_side_strips) { + strip->machine += SEQ_MAX_CHANNELS * 2; } /* Shuffle transformed standalone strips. This is because transformed strips can overlap with @@ -347,8 +347,8 @@ static void seq_transform_handle_expand_to_fit(Scene *scene, standalone_strips, time_dependent_strips, seqbasep, scene, markers, use_sync_markers); /* Move temporarily moved strips back to their original place and tag for shuffling. */ - for (Strip *seq : right_side_strips) { - seq->machine -= SEQ_MAX_CHANNELS * 2; + for (Strip *strip : right_side_strips) { + strip->machine -= SEQ_MAX_CHANNELS * 2; } /* Shuffle again to displace strips on right side. Final effect shuffling is done in * SEQ_transform_handle_overlap. */ @@ -362,11 +362,11 @@ static blender::VectorSet query_overwrite_targets( blender::VectorSet overwrite_targets = SEQ_query_unselected_strips(seqbasep); /* Effects of transformed strips can be unselected. These must not be included. */ - overwrite_targets.remove_if([&](Strip *seq) { return transformed_strips.contains(seq); }); - overwrite_targets.remove_if([&](Strip *seq) { + overwrite_targets.remove_if([&](Strip *strip) { return transformed_strips.contains(strip); }); + overwrite_targets.remove_if([&](Strip *strip) { bool does_overlap = false; - for (Strip *seq_transformed : transformed_strips) { - if (SEQ_transform_test_overlap_seq_seq(scene, seq, seq_transformed)) { + for (Strip *strip_transformed : transformed_strips) { + if (SEQ_transform_test_overlap_seq_seq(scene, strip, strip_transformed)) { does_overlap = true; } } @@ -425,10 +425,10 @@ static eOvelapDescrition overlap_description_get(const Scene *scene, } /* Split strip in 3 parts, remove middle part and fit transformed inside. */ -static void seq_transform_handle_overwrite_split(Scene *scene, - ListBase *seqbasep, - const Strip *transformed, - Strip *target) +static void strip_transform_handle_overwrite_split(Scene *scene, + ListBase *seqbasep, + const Strip *transformed, + Strip *target) { /* Because we are doing a soft split, bmain is not used in SEQ_edit_strip_split, so we can * pass nullptr here. */ @@ -454,40 +454,40 @@ static void seq_transform_handle_overwrite_split(Scene *scene, /* Trim strips by adjusting handle position. * This is bit more complicated in case overlap happens on effect. */ -static void seq_transform_handle_overwrite_trim(Scene *scene, - ListBase *seqbasep, - const Strip *transformed, - Strip *target, - const eOvelapDescrition overlap) +static void strip_transform_handle_overwrite_trim(Scene *scene, + ListBase *seqbasep, + const Strip *transformed, + Strip *target, + const eOvelapDescrition overlap) { blender::VectorSet targets = SEQ_query_by_reference( target, scene, seqbasep, SEQ_query_strip_effect_chain); /* Expand collection by adding all target's children, effects and their children. */ - if ((target->type & SEQ_TYPE_EFFECT) != 0) { + if ((target->type & STRIP_TYPE_EFFECT) != 0) { SEQ_iterator_set_expand(scene, seqbasep, targets, SEQ_query_strip_effect_chain); } /* Trim all non effects, that have influence on effect length which is overlapping. */ - for (Strip *seq : targets) { - if ((seq->type & SEQ_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(seq->type) > 0) { + for (Strip *strip : targets) { + if ((strip->type & STRIP_TYPE_EFFECT) != 0 && SEQ_effect_get_num_inputs(strip->type) > 0) { continue; } if (overlap == STRIP_OVERLAP_LEFT_SIDE) { SEQ_time_left_handle_frame_set( - scene, seq, SEQ_time_right_handle_frame_get(scene, transformed)); + scene, strip, SEQ_time_right_handle_frame_get(scene, transformed)); } else { BLI_assert(overlap == STRIP_OVERLAP_RIGHT_SIDE); SEQ_time_right_handle_frame_set( - scene, seq, SEQ_time_left_handle_frame_get(scene, transformed)); + scene, strip, SEQ_time_left_handle_frame_get(scene, transformed)); } } } -static void seq_transform_handle_overwrite(Scene *scene, - ListBase *seqbasep, - blender::Span transformed_strips) +static void strip_transform_handle_overwrite(Scene *scene, + ListBase *seqbasep, + blender::Span transformed_strips) { blender::VectorSet targets = query_overwrite_targets(scene, seqbasep, transformed_strips); blender::VectorSet strips_to_delete; @@ -504,10 +504,10 @@ static void seq_transform_handle_overwrite(Scene *scene, strips_to_delete.add(target); } else if (overlap == STRIP_OVERLAP_IS_INSIDE) { - seq_transform_handle_overwrite_split(scene, seqbasep, transformed, target); + strip_transform_handle_overwrite_split(scene, seqbasep, transformed, target); } else if (ELEM(overlap, STRIP_OVERLAP_LEFT_SIDE, STRIP_OVERLAP_RIGHT_SIDE)) { - seq_transform_handle_overwrite_trim(scene, seqbasep, transformed, target, overlap); + strip_transform_handle_overwrite_trim(scene, seqbasep, transformed, target, overlap); } } } @@ -515,18 +515,18 @@ static void seq_transform_handle_overwrite(Scene *scene, /* Remove covered strips. This must be done in separate loop, because * `SEQ_edit_strip_split()` also uses `SEQ_edit_remove_flagged_sequences()`. See #91096. */ if (!strips_to_delete.is_empty()) { - for (Strip *seq : strips_to_delete) { - SEQ_edit_flag_for_removal(scene, seqbasep, seq); + for (Strip *strip : strips_to_delete) { + SEQ_edit_flag_for_removal(scene, seqbasep, strip); } SEQ_edit_remove_flagged_sequences(scene, seqbasep); } } -static void seq_transform_handle_overlap_shuffle(Scene *scene, - ListBase *seqbasep, - blender::Span transformed_strips, - blender::Span time_dependent_strips, - bool use_sync_markers) +static void strip_transform_handle_overlap_shuffle(Scene *scene, + ListBase *seqbasep, + blender::Span transformed_strips, + blender::Span time_dependent_strips, + bool use_sync_markers) { ListBase *markers = &scene->markers; @@ -555,25 +555,25 @@ void SEQ_transform_handle_overlap(Scene *scene, switch (overlap_mode) { case SEQ_OVERLAP_EXPAND: - seq_transform_handle_expand_to_fit( + strip_transform_handle_expand_to_fit( scene, seqbasep, transformed_strips, time_dependent_strips, use_sync_markers); break; case SEQ_OVERLAP_OVERWRITE: - seq_transform_handle_overwrite(scene, seqbasep, transformed_strips); + strip_transform_handle_overwrite(scene, seqbasep, transformed_strips); break; case SEQ_OVERLAP_SHUFFLE: - seq_transform_handle_overlap_shuffle( + strip_transform_handle_overlap_shuffle( scene, seqbasep, transformed_strips, time_dependent_strips, use_sync_markers); break; } /* If any effects still overlap, we need to move them up. * In some cases other strips can be overlapping still, see #90646. */ - for (Strip *seq : transformed_strips) { - if (SEQ_transform_test_overlap(scene, seqbasep, seq)) { - SEQ_transform_seqbase_shuffle(seqbasep, seq, scene); + for (Strip *strip : transformed_strips) { + if (SEQ_transform_test_overlap(scene, seqbasep, strip)) { + SEQ_transform_seqbase_shuffle(seqbasep, strip, scene); } - seq->flag &= ~SEQ_OVERLAP; + strip->flag &= ~SEQ_OVERLAP; } } @@ -582,10 +582,10 @@ void SEQ_transform_offset_after_frame(Scene *scene, const int delta, const int timeline_frame) { - LISTBASE_FOREACH (Strip *, seq, seqbase) { - if (SEQ_time_left_handle_frame_get(scene, seq) >= timeline_frame) { - SEQ_transform_translate_sequence(scene, seq, delta); - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + LISTBASE_FOREACH (Strip *, strip, seqbase) { + if (SEQ_time_left_handle_frame_get(scene, strip) >= timeline_frame) { + SEQ_transform_translate_sequence(scene, strip, delta); + SEQ_relations_invalidate_cache_preprocessed(scene, strip); } } @@ -598,32 +598,32 @@ void SEQ_transform_offset_after_frame(Scene *scene, } } -bool SEQ_transform_is_locked(ListBase *channels, const Strip *seq) +bool SEQ_transform_is_locked(ListBase *channels, const Strip *strip) { - const SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, seq->machine); - return seq->flag & SEQ_LOCK || - (SEQ_channel_is_locked(channel) && ((seq->flag & SEQ_IGNORE_CHANNEL_LOCK) == 0)); + const SeqTimelineChannel *channel = SEQ_channel_get_by_index(channels, strip->machine); + return strip->flag & SEQ_LOCK || + (SEQ_channel_is_locked(channel) && ((strip->flag & SEQ_IGNORE_CHANNEL_LOCK) == 0)); } -void SEQ_image_transform_mirror_factor_get(const Strip *seq, float r_mirror[2]) +void SEQ_image_transform_mirror_factor_get(const Strip *strip, float r_mirror[2]) { r_mirror[0] = 1.0f; r_mirror[1] = 1.0f; - if ((seq->flag & SEQ_FLIPX) != 0) { + if ((strip->flag & SEQ_FLIPX) != 0) { r_mirror[0] = -1.0f; } - if ((seq->flag & SEQ_FLIPY) != 0) { + if ((strip->flag & SEQ_FLIPY) != 0) { r_mirror[1] = -1.0f; } } void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, - const Strip *seq, + const Strip *strip, float r_origin[2]) { float image_size[2]; - const StripElem *strip_elem = seq->data->stripdata; + const StripElem *strip_elem = strip->data->stripdata; if (strip_elem == nullptr) { image_size[0] = scene->r.xsch; image_size[1] = scene->r.ysch; @@ -633,28 +633,28 @@ void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, image_size[1] = strip_elem->orig_height; } - const StripTransform *transform = seq->data->transform; + const StripTransform *transform = strip->data->transform; r_origin[0] = (image_size[0] * transform->origin[0]) - (image_size[0] * 0.5f) + transform->xofs; r_origin[1] = (image_size[1] * transform->origin[1]) - (image_size[1] * 0.5f) + transform->yofs; const float viewport_pixel_aspect[2] = {scene->r.xasp / scene->r.yasp, 1.0f}; float mirror[2]; - SEQ_image_transform_mirror_factor_get(seq, mirror); + SEQ_image_transform_mirror_factor_get(strip, mirror); mul_v2_v2(r_origin, mirror); mul_v2_v2(r_origin, viewport_pixel_aspect); } void SEQ_image_transform_matrix_get(const Scene *scene, - const Strip *seq, + const Strip *strip, float r_transform_matrix[4][4]) { float image_size[2] = {float(scene->r.xsch), float(scene->r.ysch)}; - if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { - image_size[0] = seq->data->stripdata->orig_width; - image_size[1] = seq->data->stripdata->orig_height; + if (ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { + image_size[0] = strip->data->stripdata->orig_width; + image_size[1] = strip->data->stripdata->orig_height; } - StripTransform *transform = seq->data->transform; + StripTransform *transform = strip->data->transform; float rotation_matrix[3][3]; axis_angle_to_mat3_single(rotation_matrix, 'Z', transform->rotation); loc_rot_size_to_mat4(r_transform_matrix, @@ -667,18 +667,18 @@ void SEQ_image_transform_matrix_get(const Scene *scene, transform_pivot_set_m4(r_transform_matrix, pivot); } -static void seq_image_transform_quad_get_ex(const Scene *scene, - const Strip *seq, - bool apply_rotation, - float r_quad[4][2]) +static void strip_image_transform_quad_get_ex(const Scene *scene, + const Strip *strip, + bool apply_rotation, + float r_quad[4][2]) { - StripTransform *transform = seq->data->transform; - const StripCrop *crop = seq->data->crop; + StripTransform *transform = strip->data->transform; + const StripCrop *crop = strip->data->crop; float image_size[2] = {float(scene->r.xsch), float(scene->r.ysch)}; - if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { - image_size[0] = seq->data->stripdata->orig_width; - image_size[1] = seq->data->stripdata->orig_height; + if (ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { + image_size[0] = strip->data->stripdata->orig_width; + image_size[1] = strip->data->stripdata->orig_height; } float transform_matrix[4][4]; @@ -708,7 +708,7 @@ static void seq_image_transform_quad_get_ex(const Scene *scene, quad_temp[3][1] = (image_size[1] / 2) - crop->top; float mirror[2]; - SEQ_image_transform_mirror_factor_get(seq, mirror); + SEQ_image_transform_mirror_factor_get(strip, mirror); const float viewport_pixel_aspect[2] = {scene->r.xasp / scene->r.yasp, 1.0f}; @@ -721,16 +721,16 @@ static void seq_image_transform_quad_get_ex(const Scene *scene, } void SEQ_image_transform_quad_get(const Scene *scene, - const Strip *seq, + const Strip *strip, bool apply_rotation, float r_quad[4][2]) { - seq_image_transform_quad_get_ex(scene, seq, apply_rotation, r_quad); + strip_image_transform_quad_get_ex(scene, strip, apply_rotation, r_quad); } -void SEQ_image_transform_final_quad_get(const Scene *scene, const Strip *seq, float r_quad[4][2]) +void SEQ_image_transform_final_quad_get(const Scene *scene, const Strip *strip, float r_quad[4][2]) { - seq_image_transform_quad_get_ex(scene, seq, true, r_quad); + strip_image_transform_quad_get_ex(scene, strip, true, r_quad); } void SEQ_image_preview_unit_to_px(const Scene *scene, const float co_src[2], float co_dst[2]) @@ -752,9 +752,9 @@ void SEQ_image_transform_bounding_box_from_collection(Scene *scene, float r_max[2]) { INIT_MINMAX2(r_min, r_max); - for (Strip *seq : strips) { + for (Strip *strip : strips) { float quad[4][2]; - SEQ_image_transform_quad_get(scene, seq, apply_rotation, quad); + SEQ_image_transform_quad_get(scene, strip, apply_rotation, quad); for (int i = 0; i < 4; i++) { minmax_v2v2_v2(r_min, r_max, quad[i]); } diff --git a/source/blender/sequencer/intern/thumbnail_cache.cc b/source/blender/sequencer/intern/thumbnail_cache.cc index 2d93728b47c0..ba994446962a 100644 --- a/source/blender/sequencer/intern/thumbnail_cache.cc +++ b/source/blender/sequencer/intern/thumbnail_cache.cc @@ -65,7 +65,7 @@ struct ThumbnailCache { explicit Request(const std::string &path, int frame, int stream, - SequenceType type, + StripType type, int64_t logical_time, float time_frame, int ch, @@ -74,7 +74,7 @@ struct ThumbnailCache { : file_path(path), frame_index(frame), stream_index(stream), - seq_type(type), + strip_type(type), requested_at(logical_time), timeline_frame(time_frame), channel(ch), @@ -86,7 +86,7 @@ struct ThumbnailCache { std::string file_path; int frame_index = 0; /* Frame index (for movies) or image index (for image sequences). */ int stream_index = 0; /* Stream index (only for multi-stream movies). */ - SequenceType seq_type = SEQ_TYPE_IMAGE; + StripType strip_type = STRIP_TYPE_IMAGE; /* The following members are payload and do not contribute to uniqueness. */ int64_t requested_at = 0; @@ -97,12 +97,12 @@ struct ThumbnailCache { uint64_t hash() const { - return get_default_hash(file_path, frame_index, stream_index, seq_type); + return get_default_hash(file_path, frame_index, stream_index, strip_type); } bool operator==(const Request &o) const { return frame_index == o.frame_index && stream_index == o.stream_index && - seq_type == o.seq_type && file_path == o.file_path; + strip_type == o.strip_type && file_path == o.file_path; } }; @@ -157,36 +157,36 @@ static ThumbnailCache *query_thumbnail_cache(Scene *scene) return scene->ed->runtime.thumbnail_cache; } -bool strip_can_have_thumbnail(const Scene *scene, const Strip *seq) +bool strip_can_have_thumbnail(const Scene *scene, const Strip *strip) { - if (scene == nullptr || scene->ed == nullptr || seq == nullptr) { + if (scene == nullptr || scene->ed == nullptr || strip == nullptr) { return false; } - if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { + if (!ELEM(strip->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { return false; } - const StripElem *se = seq->data->stripdata; + const StripElem *se = strip->data->stripdata; if (se->orig_height == 0 || se->orig_width == 0) { return false; } return true; } -static std::string get_path_from_seq(Scene *scene, const Strip *seq, float timeline_frame) +static std::string get_path_from_seq(Scene *scene, const Strip *strip, float timeline_frame) { char filepath[FILE_MAX]; filepath[0] = 0; - switch (seq->type) { - case SEQ_TYPE_IMAGE: { - const StripElem *s_elem = SEQ_render_give_stripelem(scene, seq, timeline_frame); + switch (strip->type) { + case STRIP_TYPE_IMAGE: { + const StripElem *s_elem = SEQ_render_give_stripelem(scene, strip, timeline_frame); if (s_elem != nullptr) { - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, s_elem->filename); + BLI_path_join(filepath, sizeof(filepath), strip->data->dirpath, s_elem->filename); BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&scene->id)); } } break; - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: BLI_path_join( - filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&scene->id)); break; } @@ -335,14 +335,14 @@ void ThumbGenerationJob::run_fn(void *customdata, wmJobWorkerStatus *worker_stat ++total_thumbs; #endif ImBuf *thumb = nullptr; - if (request.seq_type == SEQ_TYPE_IMAGE) { + if (request.strip_type == STRIP_TYPE_IMAGE) { /* Load thumbnail for an image. */ #ifdef DEBUG_PRINT_THUMB_JOB_TIMES ++total_images; #endif thumb = make_thumb_for_image(job->scene_, request); } - else if (request.seq_type == SEQ_TYPE_MOVIE) { + else if (request.strip_type == STRIP_TYPE_MOVIE) { /* Load thumbnail for an movie. */ #ifdef DEBUG_PRINT_THUMB_JOB_TIMES ++total_movies; @@ -422,7 +422,7 @@ static ImBuf *query_thumbnail(ThumbnailCache &cache, int frame_index, float timeline_frame, const bContext *C, - const Strip *seq) + const Strip *strip) { int64_t cur_time = cache.logical_time_; ThumbnailCache::FileEntry *val = cache.map_.lookup_ptr(key); @@ -440,7 +440,7 @@ static ImBuf *query_thumbnail(ThumbnailCache &cache, int64_t best_index = -1; int best_score = INT_MAX; for (int64_t index = 0; index < val->frames.size(); index++) { - if (seq->streamindex != val->frames[index].stream_index) { + if (strip->streamindex != val->frames[index].stream_index) { continue; /* Different video stream than what we need, ignore. */ } int score = math::abs(frame_index - val->frames[index].frame_index); @@ -455,16 +455,16 @@ static ImBuf *query_thumbnail(ThumbnailCache &cache, if (best_score > 0) { /* We do not have an exact frame match, add a thumb generation request. */ - const StripElem *se = seq->data->stripdata; + const StripElem *se = strip->data->stripdata; int img_width = se->orig_width; int img_height = se->orig_height; ThumbnailCache::Request request(key, frame_index, - seq->streamindex, - SequenceType(seq->type), + strip->streamindex, + StripType(strip->type), cur_time, timeline_frame, - seq->machine, + strip->machine, img_width, img_height); cache.requests_.add(request); @@ -481,25 +481,28 @@ static ImBuf *query_thumbnail(ThumbnailCache &cache, return val->frames[best_index].thumb; } -ImBuf *thumbnail_cache_get(const bContext *C, Scene *scene, const Strip *seq, float timeline_frame) +ImBuf *thumbnail_cache_get(const bContext *C, + Scene *scene, + const Strip *strip, + float timeline_frame) { - if (!strip_can_have_thumbnail(scene, seq)) { + if (!strip_can_have_thumbnail(scene, strip)) { return nullptr; } timeline_frame = math::round(timeline_frame); - const std::string key = get_path_from_seq(scene, seq, timeline_frame); - int frame_index = SEQ_give_frame_index(scene, seq, timeline_frame); - if (seq->type == SEQ_TYPE_MOVIE) { - frame_index += seq->anim_startofs; + const std::string key = get_path_from_seq(scene, strip, timeline_frame); + int frame_index = SEQ_give_frame_index(scene, strip, timeline_frame); + if (strip->type == STRIP_TYPE_MOVIE) { + frame_index += strip->anim_startofs; } ImBuf *res = nullptr; { std::scoped_lock lock(thumb_cache_mutex); ThumbnailCache *cache = ensure_thumbnail_cache(scene); - res = query_thumbnail(*cache, key, frame_index, timeline_frame, C, seq); + res = query_thumbnail(*cache, key, frame_index, timeline_frame, C, strip); } if (res) { @@ -508,28 +511,28 @@ ImBuf *thumbnail_cache_get(const bContext *C, Scene *scene, const Strip *seq, fl return res; } -void thumbnail_cache_invalidate_strip(Scene *scene, const Strip *seq) +void thumbnail_cache_invalidate_strip(Scene *scene, const Strip *strip) { - if (!strip_can_have_thumbnail(scene, seq)) { + if (!strip_can_have_thumbnail(scene, strip)) { return; } std::scoped_lock lock(thumb_cache_mutex); ThumbnailCache *cache = query_thumbnail_cache(scene); if (cache != nullptr) { - if (ELEM((seq)->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { - const StripElem *elem = seq->data->stripdata; + if (ELEM((strip)->type, STRIP_TYPE_MOVIE, STRIP_TYPE_IMAGE)) { + const StripElem *elem = strip->data->stripdata; if (elem != nullptr) { int paths_count = 1; - if (seq->type == SEQ_TYPE_IMAGE) { + if (strip->type == STRIP_TYPE_IMAGE) { /* Image strip has array of file names. */ paths_count = int(MEM_allocN_len(elem) / sizeof(*elem)); } char filepath[FILE_MAX]; - const char *basepath = seq->scene ? ID_BLEND_PATH_FROM_GLOBAL(&seq->scene->id) : - BKE_main_blendfile_path_from_global(); + const char *basepath = strip->scene ? ID_BLEND_PATH_FROM_GLOBAL(&strip->scene->id) : + BKE_main_blendfile_path_from_global(); for (int i = 0; i < paths_count; i++, elem++) { - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, elem->filename); + BLI_path_join(filepath, sizeof(filepath), strip->data->dirpath, elem->filename); BLI_path_abs(filepath, basepath); cache->remove_entry(filepath); } diff --git a/source/blender/sequencer/intern/utils.cc b/source/blender/sequencer/intern/utils.cc index 82f3dded9a98..3efaf1b08438 100644 --- a/source/blender/sequencer/intern/utils.cc +++ b/source/blender/sequencer/intern/utils.cc @@ -17,8 +17,9 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" -#include "BLI_blenlib.h" -#include "BLI_vector_set.hh" +#include "BLI_path_utils.hh" +#include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLT_translation.hh" @@ -37,7 +38,6 @@ #include "SEQ_time.hh" #include "SEQ_utils.hh" -#include "IMB_imbuf.hh" #include "IMB_imbuf_types.hh" #include "MOV_read.hh" @@ -48,40 +48,40 @@ #include "utils.hh" struct SeqUniqueInfo { - Strip *seq; - char name_src[SEQ_NAME_MAXSTR]; - char name_dest[SEQ_NAME_MAXSTR]; + Strip *strip; + char name_src[STRIP_NAME_MAXSTR]; + char name_dest[STRIP_NAME_MAXSTR]; int count; int match; }; static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui) { - LISTBASE_FOREACH (Strip *, seq, seqbasep) { - if ((sui->seq != seq) && STREQ(sui->name_dest, seq->name + 2)) { - /* SEQ_NAME_MAXSTR -4 for the number, -1 for \0, - 2 for r_prefix */ + LISTBASE_FOREACH (Strip *, strip, seqbasep) { + if ((sui->strip != strip) && STREQ(sui->name_dest, strip->name + 2)) { + /* STRIP_NAME_MAXSTR -4 for the number, -1 for \0, - 2 for r_prefix */ SNPRINTF( - sui->name_dest, "%.*s.%03d", SEQ_NAME_MAXSTR - 4 - 1 - 2, sui->name_src, sui->count++); + sui->name_dest, "%.*s.%03d", STRIP_NAME_MAXSTR - 4 - 1 - 2, sui->name_src, sui->count++); sui->match = 1; /* be sure to re-scan */ } } } -static bool seqbase_unique_name_recursive_fn(Strip *seq, void *arg_pt) +static bool seqbase_unique_name_recursive_fn(Strip *strip, void *arg_pt) { - if (seq->seqbase.first) { - seqbase_unique_name(&seq->seqbase, (SeqUniqueInfo *)arg_pt); + if (strip->seqbase.first) { + seqbase_unique_name(&strip->seqbase, (SeqUniqueInfo *)arg_pt); } return true; } -void SEQ_sequence_base_unique_name_recursive(Scene *scene, ListBase *seqbasep, Strip *seq) +void SEQ_sequence_base_unique_name_recursive(Scene *scene, ListBase *seqbasep, Strip *strip) { SeqUniqueInfo sui; char *dot; - sui.seq = seq; - STRNCPY(sui.name_src, seq->name + 2); - STRNCPY(sui.name_dest, seq->name + 2); + sui.strip = strip; + STRNCPY(sui.name_src, strip->name + 2); + STRNCPY(sui.name_dest, strip->name + 2); sui.count = 1; sui.match = 1; /* assume the worst to start the loop */ @@ -102,74 +102,74 @@ void SEQ_sequence_base_unique_name_recursive(Scene *scene, ListBase *seqbasep, S SEQ_for_each_callback(seqbasep, seqbase_unique_name_recursive_fn, &sui); } - SEQ_edit_sequence_name_set(scene, seq, sui.name_dest); + SEQ_edit_sequence_name_set(scene, strip, sui.name_dest); } static const char *give_seqname_by_type(int type) { switch (type) { - case SEQ_TYPE_META: + case STRIP_TYPE_META: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Meta"); - case SEQ_TYPE_IMAGE: + case STRIP_TYPE_IMAGE: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Image"); - case SEQ_TYPE_SCENE: + case STRIP_TYPE_SCENE: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Scene"); - case SEQ_TYPE_MOVIE: + case STRIP_TYPE_MOVIE: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Movie"); - case SEQ_TYPE_MOVIECLIP: + case STRIP_TYPE_MOVIECLIP: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Clip"); - case SEQ_TYPE_MASK: + case STRIP_TYPE_MASK: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Mask"); - case SEQ_TYPE_SOUND_RAM: + case STRIP_TYPE_SOUND_RAM: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Audio"); - case SEQ_TYPE_CROSS: + case STRIP_TYPE_CROSS: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Cross"); - case SEQ_TYPE_GAMCROSS: + case STRIP_TYPE_GAMCROSS: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Gamma Cross"); - case SEQ_TYPE_ADD: + case STRIP_TYPE_ADD: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Add"); - case SEQ_TYPE_SUB: + case STRIP_TYPE_SUB: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Subtract"); - case SEQ_TYPE_MUL: + case STRIP_TYPE_MUL: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Multiply"); - case SEQ_TYPE_ALPHAOVER: + case STRIP_TYPE_ALPHAOVER: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Alpha Over"); - case SEQ_TYPE_ALPHAUNDER: + case STRIP_TYPE_ALPHAUNDER: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Alpha Under"); - case SEQ_TYPE_OVERDROP: + case STRIP_TYPE_OVERDROP: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Over Drop"); - case SEQ_TYPE_COLORMIX: + case STRIP_TYPE_COLORMIX: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Color Mix"); - case SEQ_TYPE_WIPE: + case STRIP_TYPE_WIPE: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Wipe"); - case SEQ_TYPE_GLOW: + case STRIP_TYPE_GLOW: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Glow"); - case SEQ_TYPE_TRANSFORM: + case STRIP_TYPE_TRANSFORM: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Transform"); - case SEQ_TYPE_COLOR: + case STRIP_TYPE_COLOR: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Color"); - case SEQ_TYPE_MULTICAM: + case STRIP_TYPE_MULTICAM: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Multicam"); - case SEQ_TYPE_ADJUSTMENT: + case STRIP_TYPE_ADJUSTMENT: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Adjustment"); - case SEQ_TYPE_SPEED: + case STRIP_TYPE_SPEED: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Speed"); - case SEQ_TYPE_GAUSSIAN_BLUR: + case STRIP_TYPE_GAUSSIAN_BLUR: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Gaussian Blur"); - case SEQ_TYPE_TEXT: + case STRIP_TYPE_TEXT: return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Text"); default: return nullptr; } } -const char *SEQ_sequence_give_name(const Strip *seq) +const char *SEQ_sequence_give_name(const Strip *strip) { - const char *name = give_seqname_by_type(seq->type); + const char *name = give_seqname_by_type(strip->type); if (!name) { - if (!(seq->type & SEQ_TYPE_EFFECT)) { - return seq->data->dirpath; + if (!(strip->type & STRIP_TYPE_EFFECT)) { + return strip->data->dirpath; } return DATA_("Effect"); @@ -177,24 +177,24 @@ const char *SEQ_sequence_give_name(const Strip *seq) return name; } -ListBase *SEQ_get_seqbase_from_sequence(Strip *seq, ListBase **r_channels, int *r_offset) +ListBase *SEQ_get_seqbase_from_sequence(Strip *strip, ListBase **r_channels, int *r_offset) { ListBase *seqbase = nullptr; - switch (seq->type) { - case SEQ_TYPE_META: { - seqbase = &seq->seqbase; - *r_channels = &seq->channels; - *r_offset = SEQ_time_start_frame_get(seq); + switch (strip->type) { + case STRIP_TYPE_META: { + seqbase = &strip->seqbase; + *r_channels = &strip->channels; + *r_offset = SEQ_time_start_frame_get(strip); break; } - case SEQ_TYPE_SCENE: { - if (seq->flag & SEQ_SCENE_STRIPS && seq->scene) { - Editing *ed = SEQ_editing_get(seq->scene); + case STRIP_TYPE_SCENE: { + if (strip->flag & SEQ_SCENE_STRIPS && strip->scene) { + Editing *ed = SEQ_editing_get(strip->scene); if (ed) { seqbase = &ed->seqbase; *r_channels = &ed->channels; - *r_offset = seq->scene->r.sfra; + *r_offset = strip->scene->r.sfra; } } break; @@ -204,32 +204,32 @@ ListBase *SEQ_get_seqbase_from_sequence(Strip *seq, ListBase **r_channels, int * return seqbase; } -static void open_anim_filepath(Strip *seq, StripAnim *sanim, const char *filepath, bool openfile) +static void open_anim_filepath(Strip *strip, StripAnim *sanim, const char *filepath, bool openfile) { if (openfile) { sanim->anim = openanim(filepath, - IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), - seq->streamindex, - seq->data->colorspace_settings.name); + IB_rect | ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), + strip->streamindex, + strip->data->colorspace_settings.name); } else { sanim->anim = openanim_noload(filepath, - IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), - seq->streamindex, - seq->data->colorspace_settings.name); + IB_rect | ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), + strip->streamindex, + strip->data->colorspace_settings.name); } } -static bool use_proxy(Editing *ed, Strip *seq) +static bool use_proxy(Editing *ed, Strip *strip) { - StripProxy *proxy = seq->data->proxy; + StripProxy *proxy = strip->data->proxy; return proxy && ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) != 0 || (ed->proxy_storage == SEQ_EDIT_PROXY_DIR_STORAGE)); } -static void proxy_dir_get(Editing *ed, Strip *seq, size_t str_len, char *r_proxy_dirpath) +static void proxy_dir_get(Editing *ed, Strip *strip, size_t str_len, char *r_proxy_dirpath) { - if (use_proxy(ed, seq)) { + if (use_proxy(ed, strip)) { if (ed->proxy_storage == SEQ_EDIT_PROXY_DIR_STORAGE) { if (ed->proxy_dir[0] == 0) { BLI_strncpy(r_proxy_dirpath, "//BL_proxy", str_len); @@ -239,36 +239,36 @@ static void proxy_dir_get(Editing *ed, Strip *seq, size_t str_len, char *r_proxy } } else { - BLI_strncpy(r_proxy_dirpath, seq->data->proxy->dirpath, str_len); + BLI_strncpy(r_proxy_dirpath, strip->data->proxy->dirpath, str_len); } BLI_path_abs(r_proxy_dirpath, BKE_main_blendfile_path_from_global()); } } -static void index_dir_set(Editing *ed, Strip *seq, StripAnim *sanim) +static void index_dir_set(Editing *ed, Strip *strip, StripAnim *sanim) { - if (sanim->anim == nullptr || !use_proxy(ed, seq)) { + if (sanim->anim == nullptr || !use_proxy(ed, strip)) { return; } char proxy_dirpath[FILE_MAX]; - proxy_dir_get(ed, seq, sizeof(proxy_dirpath), proxy_dirpath); + proxy_dir_get(ed, strip, sizeof(proxy_dirpath), proxy_dirpath); seq_proxy_index_dir_set(sanim->anim, proxy_dirpath); } -static bool open_anim_file_multiview(Scene *scene, Strip *seq, const char *filepath) +static bool open_anim_file_multiview(Scene *scene, Strip *strip, const char *filepath) { char prefix[FILE_MAX]; const char *ext = nullptr; BKE_scene_multiview_view_prefix_get(scene, filepath, prefix, &ext); - if (seq->views_format != R_IMF_VIEWS_INDIVIDUAL || prefix[0] == '\0') { + if (strip->views_format != R_IMF_VIEWS_INDIVIDUAL || prefix[0] == '\0') { return false; } Editing *ed = scene->ed; bool is_multiview_loaded = false; - int totfiles = seq_num_files(scene, seq->views_format, true); + int totfiles = seq_num_files(scene, strip->views_format, true); for (int i = 0; i < totfiles; i++) { const char *suffix = BKE_scene_multiview_view_id_suffix_get(&scene->r, i); @@ -277,15 +277,15 @@ static bool open_anim_file_multiview(Scene *scene, Strip *seq, const char *filep StripAnim *sanim = static_cast(MEM_mallocN(sizeof(StripAnim), "Strip Anim")); /* Multiview files must be loaded, otherwise it is not possible to detect failure. */ - open_anim_filepath(seq, sanim, filepath_view, true); + open_anim_filepath(strip, sanim, filepath_view, true); if (sanim->anim == nullptr) { - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); return false; /* Multiview render failed. */ } - index_dir_set(ed, seq, sanim); - BLI_addtail(&seq->anims, sanim); + index_dir_set(ed, strip, sanim); + BLI_addtail(&strip->anims, sanim); MOV_set_multiview_suffix(sanim->anim, suffix); is_multiview_loaded = true; } @@ -293,34 +293,35 @@ static bool open_anim_file_multiview(Scene *scene, Strip *seq, const char *filep return is_multiview_loaded; } -void seq_open_anim_file(Scene *scene, Strip *seq, bool openfile) +void strip_open_anim_file(Scene *scene, Strip *strip, bool openfile) { - if ((seq->anims.first != nullptr) && (((StripAnim *)seq->anims.first)->anim != nullptr) && + if ((strip->anims.first != nullptr) && (((StripAnim *)strip->anims.first)->anim != nullptr) && !openfile) { return; } /* Reset all the previously created anims. */ - SEQ_relations_sequence_free_anim(seq); + SEQ_relations_sequence_free_anim(strip); Editing *ed = scene->ed; char filepath[FILE_MAX]; - BLI_path_join(filepath, sizeof(filepath), seq->data->dirpath, seq->data->stripdata->filename); + BLI_path_join( + filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename); BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&scene->id)); - bool is_multiview = (seq->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; + bool is_multiview = (strip->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; bool multiview_is_loaded = false; if (is_multiview) { - multiview_is_loaded = open_anim_file_multiview(scene, seq, filepath); + multiview_is_loaded = open_anim_file_multiview(scene, strip, filepath); } if (!is_multiview || !multiview_is_loaded) { StripAnim *sanim = static_cast(MEM_mallocN(sizeof(StripAnim), "Strip Anim")); - BLI_addtail(&seq->anims, sanim); - open_anim_filepath(seq, sanim, filepath, openfile); - index_dir_set(ed, seq, sanim); + BLI_addtail(&strip->anims, sanim); + open_anim_filepath(strip, sanim, filepath, openfile); + index_dir_set(ed, strip, sanim); } } @@ -336,40 +337,41 @@ const Strip *SEQ_get_topmost_sequence(const Scene *scene, int frame) const Strip *best_seq = nullptr; int best_machine = -1; - LISTBASE_FOREACH (const Strip *, seq, ed->seqbasep) { - if (SEQ_render_is_muted(channels, seq) || !SEQ_time_strip_intersects_frame(scene, seq, frame)) + LISTBASE_FOREACH (const Strip *, strip, ed->seqbasep) { + if (SEQ_render_is_muted(channels, strip) || + !SEQ_time_strip_intersects_frame(scene, strip, frame)) { continue; } /* Only use strips that generate an image, not ones that combine * other strips or apply some effect. */ - if (ELEM(seq->type, - SEQ_TYPE_IMAGE, - SEQ_TYPE_META, - SEQ_TYPE_SCENE, - SEQ_TYPE_MOVIE, - SEQ_TYPE_COLOR, - SEQ_TYPE_TEXT)) + if (ELEM(strip->type, + STRIP_TYPE_IMAGE, + STRIP_TYPE_META, + STRIP_TYPE_SCENE, + STRIP_TYPE_MOVIE, + STRIP_TYPE_COLOR, + STRIP_TYPE_TEXT)) { - if (seq->machine > best_machine) { - best_seq = seq; - best_machine = seq->machine; + if (strip->machine > best_machine) { + best_seq = strip; + best_machine = strip->machine; } } } return best_seq; } -ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Strip *seq) +ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Strip *strip) { Editing *ed = SEQ_editing_get(scene); ListBase *main_seqbase = &ed->seqbase; - Strip *seq_meta = seq_sequence_lookup_meta_by_seq(scene, seq); + Strip *strip_meta = SEQ_lookup_meta_by_strip(scene, strip); - if (seq_meta != nullptr) { - return &seq_meta->seqbase; + if (strip_meta != nullptr) { + return &strip_meta->seqbase; } - if (BLI_findindex(main_seqbase, seq) != -1) { + if (BLI_findindex(main_seqbase, strip) != -1) { return main_seqbase; } return nullptr; @@ -380,14 +382,14 @@ Strip *SEQ_sequence_from_strip_elem(ListBase *seqbase, StripElem *se) Strip *iseq; for (iseq = static_cast(seqbase->first); iseq; iseq = iseq->next) { - Strip *seq_found; + Strip *strip_found; if ((iseq->data && iseq->data->stripdata) && ARRAY_HAS_ITEM(se, iseq->data->stripdata, iseq->len)) { break; } - if ((seq_found = SEQ_sequence_from_strip_elem(&iseq->seqbase, se))) { - iseq = seq_found; + if ((strip_found = SEQ_sequence_from_strip_elem(&iseq->seqbase, se))) { + iseq = strip_found; break; } } @@ -414,62 +416,62 @@ Strip *SEQ_get_sequence_by_name(ListBase *seqbase, const char *name, bool recurs Mask *SEQ_active_mask_get(Scene *scene) { - Strip *seq_act = SEQ_select_active_get(scene); + Strip *strip_act = SEQ_select_active_get(scene); - if (seq_act && seq_act->type == SEQ_TYPE_MASK) { - return seq_act->mask; + if (strip_act && strip_act->type == STRIP_TYPE_MASK) { + return strip_act->mask; } return nullptr; } -void SEQ_alpha_mode_from_file_extension(Strip *seq) +void SEQ_alpha_mode_from_file_extension(Strip *strip) { - if (seq->data && seq->data->stripdata) { - const char *filename = seq->data->stripdata->filename; - seq->alpha_mode = BKE_image_alpha_mode_from_extension_ex(filename); + if (strip->data && strip->data->stripdata) { + const char *filename = strip->data->stripdata->filename; + strip->alpha_mode = BKE_image_alpha_mode_from_extension_ex(filename); } } -bool SEQ_sequence_has_valid_data(const Strip *seq) +bool SEQ_sequence_has_valid_data(const Strip *strip) { - switch (seq->type) { - case SEQ_TYPE_MASK: - return (seq->mask != nullptr); - case SEQ_TYPE_MOVIECLIP: - return (seq->clip != nullptr); - case SEQ_TYPE_SCENE: - return (seq->scene != nullptr); - case SEQ_TYPE_SOUND_RAM: - return (seq->sound != nullptr); + switch (strip->type) { + case STRIP_TYPE_MASK: + return (strip->mask != nullptr); + case STRIP_TYPE_MOVIECLIP: + return (strip->clip != nullptr); + case STRIP_TYPE_SCENE: + return (strip->scene != nullptr); + case STRIP_TYPE_SOUND_RAM: + return (strip->sound != nullptr); } return true; } -bool sequencer_seq_generates_image(Strip *seq) +bool sequencer_seq_generates_image(Strip *strip) { - switch (seq->type) { - case SEQ_TYPE_IMAGE: - case SEQ_TYPE_SCENE: - case SEQ_TYPE_MOVIE: - case SEQ_TYPE_MOVIECLIP: - case SEQ_TYPE_MASK: - case SEQ_TYPE_COLOR: - case SEQ_TYPE_TEXT: + switch (strip->type) { + case STRIP_TYPE_IMAGE: + case STRIP_TYPE_SCENE: + case STRIP_TYPE_MOVIE: + case STRIP_TYPE_MOVIECLIP: + case STRIP_TYPE_MASK: + case STRIP_TYPE_COLOR: + case STRIP_TYPE_TEXT: return true; } return false; } -void SEQ_set_scale_to_fit(const Strip *seq, +void SEQ_set_scale_to_fit(const Strip *strip, const int image_width, const int image_height, const int preview_width, const int preview_height, const eSeqImageFitMethod fit_method) { - StripTransform *transform = seq->data->transform; + StripTransform *transform = strip->data->transform; switch (fit_method) { case SEQ_SCALE_TO_FIT: @@ -493,25 +495,25 @@ void SEQ_set_scale_to_fit(const Strip *seq, } } -void SEQ_ensure_unique_name(Strip *seq, Scene *scene) +void SEQ_ensure_unique_name(Strip *strip, Scene *scene) { - char name[SEQ_NAME_MAXSTR]; + char name[STRIP_NAME_MAXSTR]; - STRNCPY_UTF8(name, seq->name + 2); - SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq); + STRNCPY_UTF8(name, strip->name + 2); + SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, strip); BKE_animdata_fix_paths_rename(&scene->id, scene->adt, nullptr, "sequence_editor.sequences_all", name, - seq->name + 2, + strip->name + 2, 0, 0, false); - if (seq->type == SEQ_TYPE_META) { - LISTBASE_FOREACH (Strip *, seq_child, &seq->seqbase) { - SEQ_ensure_unique_name(seq_child, scene); + if (strip->type == STRIP_TYPE_META) { + LISTBASE_FOREACH (Strip *, strip_child, &strip->seqbase) { + SEQ_ensure_unique_name(strip_child, scene); } } } diff --git a/source/blender/sequencer/intern/utils.hh b/source/blender/sequencer/intern/utils.hh index 1278f991be46..ebed7733802b 100644 --- a/source/blender/sequencer/intern/utils.hh +++ b/source/blender/sequencer/intern/utils.hh @@ -8,8 +8,8 @@ * \ingroup sequencer */ -struct ListBase; struct Scene; +struct Strip; -bool sequencer_seq_generates_image(Strip *seq); -void seq_open_anim_file(Scene *scene, Strip *seq, bool openfile); +bool sequencer_seq_generates_image(Strip *strip); +void strip_open_anim_file(Scene *scene, Strip *strip, bool openfile); diff --git a/source/blender/shader_fx/intern/FX_shader_blur.cc b/source/blender/shader_fx/intern/FX_shader_blur.cc index a65020ee51f6..32a9eb93d680 100644 --- a/source/blender/shader_fx/intern/FX_shader_blur.cc +++ b/source/blender/shader_fx/intern/FX_shader_blur.cc @@ -6,10 +6,7 @@ * \ingroup shader_fx */ -#include - #include "BLI_math_vector.h" -#include "BLI_utildefines.h" #include "BLT_translation.hh" diff --git a/source/blender/shader_fx/intern/FX_shader_colorize.cc b/source/blender/shader_fx/intern/FX_shader_colorize.cc index 6bee4b489815..7fc7b5c17f0f 100644 --- a/source/blender/shader_fx/intern/FX_shader_colorize.cc +++ b/source/blender/shader_fx/intern/FX_shader_colorize.cc @@ -6,8 +6,6 @@ * \ingroup shader_fx */ -#include - #include "BKE_context.hh" #include "BKE_screen.hh" diff --git a/source/blender/shader_fx/intern/FX_shader_flip.cc b/source/blender/shader_fx/intern/FX_shader_flip.cc index 421c27a04b60..bdd2a968c470 100644 --- a/source/blender/shader_fx/intern/FX_shader_flip.cc +++ b/source/blender/shader_fx/intern/FX_shader_flip.cc @@ -6,15 +6,8 @@ * \ingroup shader_fx */ -#include - -#include "DNA_gpencil_legacy_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "BLI_utildefines.h" - #include "BLT_translation.hh" #include "BKE_context.hh" diff --git a/source/blender/shader_fx/intern/FX_shader_glow.cc b/source/blender/shader_fx/intern/FX_shader_glow.cc index e298777aa422..68db2f0d7c51 100644 --- a/source/blender/shader_fx/intern/FX_shader_glow.cc +++ b/source/blender/shader_fx/intern/FX_shader_glow.cc @@ -6,11 +6,6 @@ * \ingroup shader_fx */ -#include - -#include "DNA_gpencil_legacy_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "BLI_math_vector.h" diff --git a/source/blender/shader_fx/intern/FX_shader_pixel.cc b/source/blender/shader_fx/intern/FX_shader_pixel.cc index ff65b33ec8a3..89006c8d858d 100644 --- a/source/blender/shader_fx/intern/FX_shader_pixel.cc +++ b/source/blender/shader_fx/intern/FX_shader_pixel.cc @@ -6,8 +6,6 @@ * \ingroup shader_fx */ -#include - #include "BLI_utildefines.h" #include "BLT_translation.hh" diff --git a/source/blender/shader_fx/intern/FX_shader_rim.cc b/source/blender/shader_fx/intern/FX_shader_rim.cc index ddcdf9d6c157..9e445348d240 100644 --- a/source/blender/shader_fx/intern/FX_shader_rim.cc +++ b/source/blender/shader_fx/intern/FX_shader_rim.cc @@ -6,8 +6,6 @@ * \ingroup shader_fx */ -#include - #include "DNA_screen_types.h" #include "DNA_shader_fx_types.h" diff --git a/source/blender/shader_fx/intern/FX_shader_shadow.cc b/source/blender/shader_fx/intern/FX_shader_shadow.cc index 69605275d6fc..44de4e1ea436 100644 --- a/source/blender/shader_fx/intern/FX_shader_shadow.cc +++ b/source/blender/shader_fx/intern/FX_shader_shadow.cc @@ -6,11 +6,6 @@ * \ingroup shader_fx */ -#include - -#include "DNA_gpencil_legacy_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "BLI_utildefines.h" @@ -31,7 +26,6 @@ #include "FX_shader_types.h" #include "FX_ui_common.h" -#include "DEG_depsgraph.hh" #include "DEG_depsgraph_build.hh" static void init_data(ShaderFxData *md) diff --git a/source/blender/shader_fx/intern/FX_shader_swirl.cc b/source/blender/shader_fx/intern/FX_shader_swirl.cc index 8ceb3c08b432..1589882aa7ec 100644 --- a/source/blender/shader_fx/intern/FX_shader_swirl.cc +++ b/source/blender/shader_fx/intern/FX_shader_swirl.cc @@ -6,15 +6,7 @@ * \ingroup shader_fx */ -#include - -#include "DNA_gpencil_legacy_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" - #include "BLI_math_base.h" -#include "BLI_utildefines.h" #include "BLT_translation.hh" @@ -32,7 +24,6 @@ #include "FX_shader_types.h" #include "FX_ui_common.h" -#include "DEG_depsgraph.hh" #include "DEG_depsgraph_build.hh" static void init_data(ShaderFxData *md) diff --git a/source/blender/shader_fx/intern/FX_shader_util.cc b/source/blender/shader_fx/intern/FX_shader_util.cc index 04c20bb12c0b..64513df01cff 100644 --- a/source/blender/shader_fx/intern/FX_shader_util.cc +++ b/source/blender/shader_fx/intern/FX_shader_util.cc @@ -6,16 +6,9 @@ * \ingroup shader_fx */ -#include - -#include "MEM_guardedalloc.h" - -#include "BLI_utildefines.h" - #include "BKE_shader_fx.h" #include "FX_shader_types.h" -#include "FX_shader_util.h" void shaderfx_type_init(ShaderFxTypeInfo *types[]) { diff --git a/source/blender/shader_fx/intern/FX_shader_wave.cc b/source/blender/shader_fx/intern/FX_shader_wave.cc index 8c857823d2c1..2da235dfe38e 100644 --- a/source/blender/shader_fx/intern/FX_shader_wave.cc +++ b/source/blender/shader_fx/intern/FX_shader_wave.cc @@ -6,18 +6,11 @@ * \ingroup shader_fx */ -#include - -#include "DNA_gpencil_legacy_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "BKE_context.hh" #include "BKE_screen.hh" -#include "BLI_utildefines.h" - #include "BLT_translation.hh" #include "UI_interface.hh" diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index 0e0d22385691..0c4bfaf02a47 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -12,12 +12,10 @@ #include "MEM_guardedalloc.h" #include "BKE_context.hh" -#include "BKE_object.hh" #include "BKE_screen.hh" #include "BKE_shader_fx.h" #include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_shader_fx_types.h" diff --git a/source/blender/shader_fx/intern/FX_ui_common.h b/source/blender/shader_fx/intern/FX_ui_common.h index d702866b0b8d..c441e32094a1 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.h +++ b/source/blender/shader_fx/intern/FX_ui_common.h @@ -8,17 +8,19 @@ #pragma once -#include "FX_shader_types.h" +#include "FX_shader_types.h" // IWYU pragma: export #ifdef __cplusplus extern "C" { #endif +struct PointerRNA; +struct Panel; struct ARegionType; struct PanelType; struct bContext; struct uiLayout; -typedef void (*PanelDrawFn)(const bContext *, Panel *); +using PanelDrawFn = void (*)(const bContext *, Panel *); /** * Draw shaderfx error message. diff --git a/source/blender/simulation/intern/ConstrainedConjugateGradient.h b/source/blender/simulation/intern/ConstrainedConjugateGradient.h index 465e8fe6cfa8..38656a23e6a0 100644 --- a/source/blender/simulation/intern/ConstrainedConjugateGradient.h +++ b/source/blender/simulation/intern/ConstrainedConjugateGradient.h @@ -9,6 +9,7 @@ */ #include +#include namespace Eigen { diff --git a/source/blender/simulation/intern/SIM_mass_spring.cc b/source/blender/simulation/intern/SIM_mass_spring.cc index 16b84e204f18..165559dbee58 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cc +++ b/source/blender/simulation/intern/SIM_mass_spring.cc @@ -6,8 +6,6 @@ * \ingroup sim */ -#include - #include "MEM_guardedalloc.h" #include "DNA_cloth_types.h" diff --git a/source/blender/simulation/intern/hair_volume.cc b/source/blender/simulation/intern/hair_volume.cc index 64fd7786ad78..b9b42865d206 100644 --- a/source/blender/simulation/intern/hair_volume.cc +++ b/source/blender/simulation/intern/hair_volume.cc @@ -6,17 +6,10 @@ * \ingroup sim */ -#include - #include "MEM_guardedalloc.h" #include "BLI_math_matrix.h" #include "BLI_math_vector.h" -#include "BLI_utildefines.h" - -#include "DNA_texture_types.h" - -#include "BKE_effect.h" #include "eigen_utils.h" #include "implicit.h" diff --git a/source/blender/simulation/intern/implicit_blender.cc b/source/blender/simulation/intern/implicit_blender.cc index a53a15676bf8..c88fcea782a4 100644 --- a/source/blender/simulation/intern/implicit_blender.cc +++ b/source/blender/simulation/intern/implicit_blender.cc @@ -12,19 +12,11 @@ # include "MEM_guardedalloc.h" -# include "DNA_object_force_types.h" -# include "DNA_object_types.h" -# include "DNA_scene_types.h" -# include "DNA_texture_types.h" - # include "BLI_math_geom.h" # include "BLI_math_matrix.h" # include "BLI_math_vector.h" -# include "BLI_utildefines.h" # include "BKE_cloth.hh" -# include "BKE_collision.h" -# include "BKE_effect.h" # include "SIM_mass_spring.h" diff --git a/source/blender/windowmanager/WM_message.hh b/source/blender/windowmanager/WM_message.hh index 3a70d21f573e..8d075ab7df9b 100644 --- a/source/blender/windowmanager/WM_message.hh +++ b/source/blender/windowmanager/WM_message.hh @@ -8,4 +8,4 @@ #pragma once -#include "message_bus/wm_message_bus.hh" +#include "message_bus/wm_message_bus.hh" // IWYU pragma: export diff --git a/source/blender/windowmanager/WM_types.hh b/source/blender/windowmanager/WM_types.hh index 310562cc8287..3d6ad3986c5d 100644 --- a/source/blender/windowmanager/WM_types.hh +++ b/source/blender/windowmanager/WM_types.hh @@ -123,12 +123,12 @@ struct wmWindowManager; #include "RNA_types.hh" /* Exported types for WM. */ -#include "gizmo/WM_gizmo_types.hh" -#include "wm_cursors.hh" -#include "wm_event_types.hh" +#include "gizmo/WM_gizmo_types.hh" // IWYU pragma: export +#include "wm_cursors.hh" // IWYU pragma: export +#include "wm_event_types.hh" // IWYU pragma: export /* Include external gizmo API's. */ -#include "gizmo/WM_gizmo_api.hh" +#include "gizmo/WM_gizmo_api.hh" // IWYU pragma: export namespace blender::asset_system { class AssetRepresentation; diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.hh b/source/blender/windowmanager/gizmo/WM_gizmo_api.hh index 5a46fcc32a28..8e77e58ae97f 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.hh +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.hh @@ -14,24 +14,31 @@ #pragma once struct ARegion; +struct bContext; struct GHashIterator; struct IDProperty; +struct ListBase; struct Main; +struct PointerRNA; struct PropertyRNA; struct ScrArea; struct bToolRef; struct wmGizmo; struct wmGizmoGroup; struct wmGizmoGroupType; +struct wmGizmoGroupTypeRef; struct wmGizmoMap; struct wmGizmoMapType; struct wmGizmoMapType_Params; +struct wmGizmoOpElem; struct wmGizmoProperty; struct wmGizmoPropertyType; struct wmGizmoType; struct wmKeyConfig; struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; +struct wmOperatorType; +struct wmWindow; struct wmWindowManager; #include "wm_gizmo_fn.hh" diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.hh b/source/blender/windowmanager/gizmo/WM_gizmo_types.hh index 39f77ac98fc6..f13cb8679c4a 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.hh +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.hh @@ -13,12 +13,14 @@ #pragma once -#include "BLI_compiler_attrs.h" #include "BLI_utildefines.h" #include "BLI_vector.hh" #include "DNA_listBase.h" +#include "RNA_types.hh" + +struct IDProperty; struct wmGizmo; struct wmGizmoType; struct wmGizmoGroup; diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc index d7069a0ce0a0..d3d80eed40cf 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.cc @@ -6,8 +6,6 @@ * \ingroup wm */ -#include - #include "MEM_guardedalloc.h" #include "BLI_listbase.h" diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc index a3d1d40a9c9a..b077cf9a04ef 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc @@ -23,12 +23,10 @@ #include "BKE_context.hh" #include "BKE_main.hh" -#include "BKE_report.hh" #include "BKE_screen.hh" #include "BKE_workspace.hh" #include "RNA_access.hh" -#include "RNA_define.hh" #include "WM_api.hh" #include "WM_types.hh" diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc index d04b90134b5b..ec50937c02af 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.cc @@ -9,7 +9,6 @@ #include #include "BLI_ghash.h" -#include "BLI_utildefines.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.hh b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.hh index 951186021409..57a2a9a1f262 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.hh +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.hh @@ -8,9 +8,16 @@ #pragma once +#include "DNA_listBase.h" +#include "WM_gizmo_types.hh" + struct BLI_Buffer; struct wmGizmoMap; +struct wmGizmoGroupType; +struct wmGizmoMapType; +struct wmGizmoType; struct wmKeyConfig; +struct wmWindowManager; #include "wm_gizmo_fn.hh" diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc index 2445f2a02315..3b7d0172bce7 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.cc @@ -11,7 +11,6 @@ #include "BLI_buffer.h" #include "BLI_ghash.h" #include "BLI_listbase.h" -#include "BLI_math_bits.h" #include "BLI_math_vector.h" #include "BLI_math_vector_types.hh" #include "BLI_rect.h" @@ -27,7 +26,6 @@ #include "GPU_framebuffer.hh" #include "GPU_matrix.hh" -#include "GPU_platform.hh" #include "GPU_select.hh" #include "GPU_state.hh" #include "GPU_viewport.hh" @@ -967,7 +965,6 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler) if (area == nullptr) { /* When changing screen layouts with running modal handlers (like render display), * this is not an error to print. */ - printf("internal error: modal gizmo-map handler has invalid area\n"); } else { ARegion *region; diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc index 6a47de635048..22e2b4f7725d 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.cc @@ -10,7 +10,6 @@ #include "BLI_ghash.h" #include "BLI_listbase.h" -#include "BLI_utildefines.h" #include "BKE_main.hh" #include "BKE_screen.hh" diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.hh b/source/blender/windowmanager/gizmo/wm_gizmo_fn.hh index f7a5fd324d7b..b74539ea9c22 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.hh +++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.hh @@ -10,8 +10,14 @@ #pragma once -#include "BLI_compiler_attrs.h" - +struct bContext; +struct rcti; +struct wmEvent; +struct wmGizmo; +struct wmGizmoGroup; +struct wmGizmoGroupType; +struct wmGizmoProperty; +struct wmKeyConfig; struct wmKeyMap; struct wmMsgBus; diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.hh b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.hh index a4b5fd9e0ef7..83f3d4701317 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.hh +++ b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.hh @@ -15,10 +15,16 @@ #pragma once +struct bContext; +struct wmEvent; struct wmEventHandler_Gizmo; struct wmEventHandler_Op; +struct wmGizmo; +struct wmGizmoGroup; struct wmGizmoMap; +struct wmKeyConfig; struct wmOperatorType; +struct ListBase; /* -------------------------------------------------------------------- */ /** \name #wmGizmo diff --git a/source/blender/windowmanager/intern/wm.cc b/source/blender/windowmanager/intern/wm.cc index ebe544d45c23..d082a65a13ab 100644 --- a/source/blender/windowmanager/intern/wm.cc +++ b/source/blender/windowmanager/intern/wm.cc @@ -16,14 +16,12 @@ #include #include -#include "BLI_ghash.h" -#include "BLI_sys_types.h" - #include "DNA_windowmanager_types.h" #include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" +#include "BLI_ghash.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLT_translation.hh" diff --git a/source/blender/windowmanager/intern/wm_cursors.cc b/source/blender/windowmanager/intern/wm_cursors.cc index 709549ed61ff..38c90ae553c9 100644 --- a/source/blender/windowmanager/intern/wm_cursors.cc +++ b/source/blender/windowmanager/intern/wm_cursors.cc @@ -8,7 +8,6 @@ * Cursor pixmap and cursor utility functions to change the cursor. */ -#include #include #include "GHOST_C-api.h" @@ -16,7 +15,6 @@ #include "BLI_utildefines.h" #include "DNA_listBase.h" -#include "DNA_userdef_types.h" #include "DNA_workspace_types.h" #include "BKE_global.hh" diff --git a/source/blender/windowmanager/intern/wm_dragdrop.cc b/source/blender/windowmanager/intern/wm_dragdrop.cc index 8b49b81b14cd..e74e03e1de04 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.cc +++ b/source/blender/windowmanager/intern/wm_dragdrop.cc @@ -21,7 +21,6 @@ #include "BLT_translation.hh" -#include "BLI_bitmap.h" #include "BLI_blenlib.h" #include "BLI_math_color.h" @@ -39,13 +38,11 @@ #include "BLO_readfile.hh" -#include "ED_asset.hh" #include "ED_fileselect.hh" #include "ED_screen.hh" #include "GPU_shader.hh" #include "GPU_state.hh" -#include "GPU_viewport.hh" #include "IMB_imbuf_types.hh" diff --git a/source/blender/windowmanager/intern/wm_draw.cc b/source/blender/windowmanager/intern/wm_draw.cc index 14303351a49a..dab1880a4d96 100644 --- a/source/blender/windowmanager/intern/wm_draw.cc +++ b/source/blender/windowmanager/intern/wm_draw.cc @@ -23,6 +23,7 @@ #include "BLI_math_matrix.h" #include "BLI_math_vector_types.hh" +#include "BLI_rect.h" #include "BLI_utildefines.h" #include "BKE_context.hh" diff --git a/source/blender/windowmanager/intern/wm_event_query.cc b/source/blender/windowmanager/intern/wm_event_query.cc index 6829fa534cbc..52317caea013 100644 --- a/source/blender/windowmanager/intern/wm_event_query.cc +++ b/source/blender/windowmanager/intern/wm_event_query.cc @@ -11,7 +11,6 @@ #include #include -#include "DNA_listBase.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 5dfeaa40f577..9609ef8d5622 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -10,7 +10,6 @@ * Also some operator reports utility functions. */ -#include #include #include #include @@ -1180,7 +1179,9 @@ static void wm_operator_reports(bContext *C, } /* Refresh Info Editor with reports immediately, even if op returned #OPERATOR_CANCELLED. */ - if ((retval & OPERATOR_CANCELLED) && !BLI_listbase_is_empty(&op->reports->list)) { + if ((retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) && + !BLI_listbase_is_empty(&op->reports->list)) + { WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO_REPORT, nullptr); } /* If the caller owns them, handle this. */ @@ -3412,7 +3413,7 @@ static eHandlerActionFlag wm_handlers_do_intern(bContext *C, /* Clear the tool-tip whenever a key binding is handled, without this tool-tips * are kept when a modal operators starts (annoying but otherwise harmless). */ - if (action & WM_HANDLER_BREAK) { + if (action & WM_HANDLER_BREAK && !ISTIMER(event->type)) { /* Window may be gone after file read. */ if (CTX_wm_window(C) != nullptr) { WM_tooltip_clear(C, CTX_wm_window(C)); @@ -3781,23 +3782,29 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event) wmWindowManager *wm = CTX_wm_manager(C); if (wm->paintcursors.first) { - ARegion *region = CTX_wm_region(C); + const bScreen *screen = CTX_wm_screen(C); + ARegion *region = screen ? screen->active_region : nullptr; if (region) { + ARegion *prev_region = CTX_wm_region(C); + + CTX_wm_region_set(C, region); wm_paintcursor_tag(C, wm, region); + CTX_wm_region_set(C, prev_region); } /* If previous position was not in current region, we have to set a temp new context. */ if (region == nullptr || !BLI_rcti_isect_pt_v(®ion->winrct, event->prev_xy)) { - ScrArea *area = CTX_wm_area(C); + ScrArea *prev_area = CTX_wm_area(C); + ARegion *prev_region = CTX_wm_region(C); CTX_wm_area_set(C, area_event_inside(C, event->prev_xy)); CTX_wm_region_set(C, region_event_inside(C, event->prev_xy)); wm_paintcursor_tag(C, wm, CTX_wm_region(C)); - CTX_wm_area_set(C, area); - CTX_wm_region_set(C, region); + CTX_wm_area_set(C, prev_area); + CTX_wm_region_set(C, prev_region); } } } diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 110490c88a11..e396f3bef44e 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -51,10 +51,8 @@ #include "BLF_api.hh" -#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "DNA_sequence_types.h" #include "DNA_space_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" @@ -62,7 +60,9 @@ #include "AS_asset_library.hh" -#include "BKE_addon.h" +#ifndef WITH_CYCLES +# include "BKE_addon.h" +#endif #include "BKE_appdir.hh" #include "BKE_autoexec.hh" #include "BKE_blender.hh" diff --git a/source/blender/windowmanager/intern/wm_files_link.cc b/source/blender/windowmanager/intern/wm_files_link.cc index d309b5a2c4f0..1678f854d13f 100644 --- a/source/blender/windowmanager/intern/wm_files_link.cc +++ b/source/blender/windowmanager/intern/wm_files_link.cc @@ -12,27 +12,17 @@ #include #include #include -#include #include #include "CLG_log.h" -#include "MEM_guardedalloc.h" - #include "DNA_ID.h" -#include "DNA_collection_types.h" -#include "DNA_key_types.h" -#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" -#include "BLI_bitmap.h" #include "BLI_blenlib.h" -#include "BLI_linklist.h" #include "BLI_map.hh" -#include "BLI_memarena.h" -#include "BLI_utildefines.h" #include "BLO_readfile.hh" diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.cc b/source/blender/windowmanager/intern/wm_gesture_ops.cc index f7b9afbd6180..799fdf7a99d2 100644 --- a/source/blender/windowmanager/intern/wm_gesture_ops.cc +++ b/source/blender/windowmanager/intern/wm_gesture_ops.cc @@ -17,15 +17,12 @@ #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" -#include "BLI_math_base.hh" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" #include "BLI_math_vector.hh" #include "BLI_math_vector_types.hh" #include "BLI_rect.h" -#include "BLT_translation.hh" - #include "BKE_context.hh" #include "WM_api.hh" diff --git a/source/blender/windowmanager/intern/wm_init_exit.cc b/source/blender/windowmanager/intern/wm_init_exit.cc index 86b44b659b3d..7ae093d0ee8f 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.cc +++ b/source/blender/windowmanager/intern/wm_init_exit.cc @@ -21,7 +21,6 @@ #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" -#include "BLI_fileops.h" #include "BLI_listbase.h" #include "BLI_path_utils.hh" #include "BLI_string.h" diff --git a/source/blender/windowmanager/intern/wm_keymap.cc b/source/blender/windowmanager/intern/wm_keymap.cc index 3f97ab84ba7c..023593b8c166 100644 --- a/source/blender/windowmanager/intern/wm_keymap.cc +++ b/source/blender/windowmanager/intern/wm_keymap.cc @@ -11,7 +11,6 @@ #include #include -#include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_userdef_types.h" @@ -22,7 +21,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_string_utils.hh" #include "BLI_utildefines.h" #include "BLF_api.hh" diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.cc b/source/blender/windowmanager/intern/wm_keymap_utils.cc index 33fe2d20c5ac..50611aa334d9 100644 --- a/source/blender/windowmanager/intern/wm_keymap_utils.cc +++ b/source/blender/windowmanager/intern/wm_keymap_utils.cc @@ -10,9 +10,7 @@ #include -#include "DNA_object_types.h" #include "DNA_space_types.h" -#include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" #include "BLI_listbase.h" diff --git a/source/blender/windowmanager/intern/wm_operator_type.cc b/source/blender/windowmanager/intern/wm_operator_type.cc index 542eec4b44cf..c0b9068baeb4 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.cc +++ b/source/blender/windowmanager/intern/wm_operator_type.cc @@ -12,17 +12,12 @@ #include "CLG_log.h" -#include "DNA_ID.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" -#include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" #include "BLT_translation.hh" #include "BLI_blenlib.h" -#include "BLI_map.hh" -#include "BLI_utildefines.h" #include "BKE_context.hh" #include "BKE_idprop.hh" diff --git a/source/blender/windowmanager/intern/wm_operator_utils.cc b/source/blender/windowmanager/intern/wm_operator_utils.cc index a1954ec01586..09cd123923c0 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.cc +++ b/source/blender/windowmanager/intern/wm_operator_utils.cc @@ -12,7 +12,6 @@ #include "BLI_array.hh" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BKE_context.hh" #include "BKE_global.hh" diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index cd8c8f767da6..051154672705 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -42,10 +41,8 @@ #include "BLI_blenlib.h" #include "BLI_dial_2d.h" -#include "BLI_math_matrix.hh" #include "BLI_math_rotation.h" #include "BLI_math_vector_types.hh" -#include "BLI_string_utils.hh" #include "BLI_time.h" #include "BLI_utildefines.h" @@ -65,7 +62,6 @@ #include "BKE_report.hh" #include "BKE_scene.hh" #include "BKE_screen.hh" /* #BKE_ST_MAXNAME. */ -#include "BKE_unit.hh" #include "BKE_idtype.hh" @@ -2543,7 +2539,7 @@ static void radial_control_update_header(wmOperator *op, bContext *C) if (hasNumInput(&rc->num_input)) { char num_str[NUM_STR_REP_LEN]; - outputNumInput(&rc->num_input, num_str, &scene->unit); + outputNumInput(&rc->num_input, num_str, scene->unit); SNPRINTF(msg, "%s: %s", RNA_property_ui_name(rc->prop), num_str); } else { diff --git a/source/blender/windowmanager/intern/wm_panel_type.cc b/source/blender/windowmanager/intern/wm_panel_type.cc index 32e73466bf11..2cfef43689d6 100644 --- a/source/blender/windowmanager/intern/wm_panel_type.cc +++ b/source/blender/windowmanager/intern/wm_panel_type.cc @@ -14,8 +14,6 @@ #include -#include "BLI_sys_types.h" - #include "DNA_windowmanager_types.h" #include "BLI_ghash.h" diff --git a/source/blender/windowmanager/intern/wm_platform.cc b/source/blender/windowmanager/intern/wm_platform.cc index 83a088a7cb4a..94034464ee64 100644 --- a/source/blender/windowmanager/intern/wm_platform.cc +++ b/source/blender/windowmanager/intern/wm_platform.cc @@ -8,8 +8,6 @@ * Interactions with the underlying platform. */ -#include "BLI_string.h" - #include "WM_api.hh" /* Own include. */ #ifdef WIN32 @@ -17,6 +15,8 @@ #elif defined(__APPLE__) /* Pass. */ #else +# include "BLI_string.h" + # include "BKE_context.hh" # include "BPY_extern_run.hh" diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index 2a5e0d6ce1be..c7fcc1bb1527 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -13,7 +13,6 @@ */ #include -#include #include #include #include diff --git a/source/blender/windowmanager/intern/wm_splash_screen.cc b/source/blender/windowmanager/intern/wm_splash_screen.cc index fb26f7a85cc2..c2e820ba0d99 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.cc +++ b/source/blender/windowmanager/intern/wm_splash_screen.cc @@ -14,17 +14,12 @@ * - Links to web sites. */ -#include #include -#include "DNA_ID.h" -#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" -#include "BLF_api.hh" - #include "BLI_blenlib.h" #include "BLI_utildefines.h" diff --git a/source/blender/windowmanager/intern/wm_stereo.cc b/source/blender/windowmanager/intern/wm_stereo.cc index 3a9ce1592af3..40772cfd0ed0 100644 --- a/source/blender/windowmanager/intern/wm_stereo.cc +++ b/source/blender/windowmanager/intern/wm_stereo.cc @@ -9,8 +9,6 @@ #include #include -#include "DNA_listBase.h" - #include "RNA_access.hh" #include "RNA_prototypes.hh" @@ -30,7 +28,6 @@ #include "GPU_capabilities.hh" #include "GPU_immediate.hh" -#include "GPU_texture.hh" #include "GPU_viewport.hh" #include "WM_api.hh" diff --git a/source/blender/windowmanager/intern/wm_tooltip.cc b/source/blender/windowmanager/intern/wm_tooltip.cc index e19a58c64d48..a2f8b774de6a 100644 --- a/source/blender/windowmanager/intern/wm_tooltip.cc +++ b/source/blender/windowmanager/intern/wm_tooltip.cc @@ -12,7 +12,6 @@ #include "BLI_math_vector.h" #include "BLI_time.h" -#include "BLI_utildefines.h" #include "BKE_context.hh" diff --git a/source/blender/windowmanager/intern/wm_uilist_type.cc b/source/blender/windowmanager/intern/wm_uilist_type.cc index 78283a362514..22a907141156 100644 --- a/source/blender/windowmanager/intern/wm_uilist_type.cc +++ b/source/blender/windowmanager/intern/wm_uilist_type.cc @@ -12,7 +12,6 @@ #include #include "BLI_listbase.h" -#include "BLI_sys_types.h" #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" diff --git a/source/blender/windowmanager/intern/wm_window.cc b/source/blender/windowmanager/intern/wm_window.cc index b6dd1a6219a9..ac6660d3c60d 100644 --- a/source/blender/windowmanager/intern/wm_window.cc +++ b/source/blender/windowmanager/intern/wm_window.cc @@ -44,9 +44,7 @@ #include "BKE_workspace.hh" #include "RNA_access.hh" -#include "RNA_define.hh" #include "RNA_enum_types.hh" -#include "RNA_prototypes.hh" #include "WM_api.hh" #include "WM_types.hh" @@ -54,7 +52,6 @@ #include "wm_draw.hh" #include "wm_event_system.hh" #include "wm_files.hh" -#include "wm_platform_support.hh" #include "wm_window.hh" #include "wm_window_private.hh" #ifdef WITH_XR_OPENXR @@ -74,15 +71,9 @@ #include "UI_interface_icons.hh" #include "BLF_api.hh" -#include "GPU_batch.hh" -#include "GPU_batch_presets.hh" #include "GPU_context.hh" #include "GPU_framebuffer.hh" -#include "GPU_immediate.hh" #include "GPU_init_exit.hh" -#include "GPU_platform.hh" -#include "GPU_state.hh" -#include "GPU_texture.hh" #include "UI_resources.hh" diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.hh b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.hh index 5914552c85ec..7eeb78695c2a 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.hh +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_intern.hh @@ -10,6 +10,8 @@ #include "../wm_message_bus.hh" +struct GSet; + struct wmMsgBus { GSet *messages_gset[WM_MSG_TYPE_NUM]; /** Messages in order of being added. */ diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc index 44032a039731..f8a7a47b0a28 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.cc @@ -16,7 +16,6 @@ #include "BLI_ghash.h" #include "BLI_listbase.h" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "WM_message.hh" #include "WM_types.hh" diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc index a60d458494b0..c988544cd811 100644 --- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc +++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.cc @@ -14,7 +14,6 @@ #include "BLI_ghash.h" #include "BLI_listbase.h" -#include "BLI_utildefines.h" #include "WM_message.hh" #include "WM_types.hh" diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.hh b/source/blender/windowmanager/message_bus/wm_message_bus.hh index 6a60cd106c81..4b47ecb16b29 100644 --- a/source/blender/windowmanager/message_bus/wm_message_bus.hh +++ b/source/blender/windowmanager/message_bus/wm_message_bus.hh @@ -8,9 +8,11 @@ #pragma once +#include "DNA_listBase.h" + #include "RNA_prototypes.hh" #include "RNA_types.hh" -#include +#include struct ID; struct bContext; diff --git a/source/blender/windowmanager/wm.hh b/source/blender/windowmanager/wm.hh index 42e6f5b5b10b..db554a4dc34e 100644 --- a/source/blender/windowmanager/wm.hh +++ b/source/blender/windowmanager/wm.hh @@ -8,7 +8,11 @@ #pragma once +struct wmOperator; +struct wmTimer; struct wmWindow; +struct wmWindowManager; +struct Main; #include "gizmo/wm_gizmo_wmapi.hh" diff --git a/source/blender/windowmanager/wm_surface.hh b/source/blender/windowmanager/wm_surface.hh index f291f7001c4a..611fd99b8898 100644 --- a/source/blender/windowmanager/wm_surface.hh +++ b/source/blender/windowmanager/wm_surface.hh @@ -12,6 +12,8 @@ #pragma once +#include "GHOST_Types.h" + struct bContext; struct GPUContext; diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.hh b/source/blender/windowmanager/xr/intern/wm_xr_intern.hh index 6570c968a5c8..d2391e2cd5e7 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_intern.hh +++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.hh @@ -17,8 +17,13 @@ #include "wm_xr.hh" +struct bContext; +struct ARegion; struct Object; +struct wmWindow; +struct wmWindowManager; struct wmXrActionSet; +struct wmXrData; struct wmXrSessionState { bool is_started; diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 13458073b198..b7521bc02c15 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -1939,7 +1939,7 @@ if(WIN32) endif() endif() -# `vcpkg` substitutes our libraries with theirs, which will cause issues when you you run +# `vcpkg` substitutes our libraries with theirs, which will cause issues when you run # these builds on other systems due to missing DLL's. So we opt out the use of `vcpkg`. if(WIN32) set_target_properties(blender PROPERTIES VS_GLOBAL_VcpkgEnabled "false") diff --git a/tests/data b/tests/data index 2c95be0c53b6..8f02ead1ce8c 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 2c95be0c53b68352817ddd02c23f2c388fd2639a +Subproject commit 8f02ead1ce8c4da5838da12e2824631f889828c0 diff --git a/tests/python/bl_animation_action.py b/tests/python/bl_animation_action.py index efe85cb36148..0ba4d556131e 100644 --- a/tests/python/bl_animation_action.py +++ b/tests/python/bl_animation_action.py @@ -513,8 +513,8 @@ def test_multi_use_action(self): self.assertEqual(len(strip.channelbags[0].groups), 1) self.assertEqual(len(strip.channelbags[0].groups[0].channels), 9) - # Multi user slots do not get named after their users. - self.assertEqual(action.slots[0].identifier, "OBSlot") + # Slots created from legacy Actions are always called "Legacy SLot". + self.assertEqual(action.slots[0].identifier, "OBLegacy Slot") def test_action_constraint(self): constrained_object = bpy.data.objects["action_constraint_constrained"] @@ -546,8 +546,8 @@ def test_armature_action_conversion(self): self.assertEqual(len(strip.channelbags[0].groups[0].channels), 10) self.assertEqual(len(strip.channelbags[0].groups[1].channels), 10) - # Slots with a single user are named after their user. - self.assertEqual(action.slots[0].identifier, "OBarmature_object") + # Slots on converted Actions are always called "Legacy Slot" + self.assertEqual(action.slots[0].identifier, "OBLegacy Slot") for fcurve in strip.channelbags[0].groups[0].channels: self.assertEqual(fcurve.group.name, "Bone") diff --git a/tools/check_source/check_spelling.py b/tools/check_source/check_spelling.py index 7896216a413e..3abed59d247c 100755 --- a/tools/check_source/check_spelling.py +++ b/tools/check_source/check_spelling.py @@ -712,9 +712,10 @@ def spell_check_file_with_cache_support( def argparse_create() -> argparse.ArgumentParser: - # When --help or no args are given, print this help - description = __doc__ - parser = argparse.ArgumentParser(description=description) + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawTextHelpFormatter, + ) parser.add_argument( "--match", @@ -750,10 +751,10 @@ def argparse_create() -> argparse.ArgumentParser: required=False, metavar='CHECK_TYPE', help=( - 'Text to extract for checking.\n' + 'The check to perform.\n' '\n' - '- ``COMMENTS`` extracts comments from source code.\n' - '- ``STRINGS`` extracts text.' + '- ``SPELLING`` check spelling.\n' + '- ``DUPLICATES`` report repeated words.' ), ) diff --git a/tools/utils/gitea_inactive_developers.py b/tools/utils/gitea_inactive_developers.py index 7e4d234c43bf..473edae60334 100755 --- a/tools/utils/gitea_inactive_developers.py +++ b/tools/utils/gitea_inactive_developers.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -# Script to get all the inactive gitea developers +# Script to get all the inactive GITEA developers # Usage: GITEA_API_TOKEN= python3 gitea_inactive_developers.py # # The API Token have the "read:org" or "admin:org" scope.