This adds support for running a set of nodes repeatedly. The number of iterations can be controlled dynamically as an input of the repeat zone. The repeat zone can be added in via the search or from the Add > Utilities menu. The main use case is to replace long repetitive node chains with a more flexible alternative. Technically, repeat zones can also be used for many other use cases. However, due to their serial nature, performance is very sub-optimal when they are used to solve problems that could be processed in parallel. Better solutions for such use cases will be worked on separately. Repeat zones are similar to simulation zones. The major difference is that they have no concept of time and are always evaluated entirely in the current frame, while in simulations only a single iteration is evaluated per frame. Stopping the repetition early using a dynamic condition is not yet supported. "Break" functionality can be implemented manually using Switch nodes in the loop for now. It's likely that this functionality will be built into the repeat zone in the future. For now, things are kept more simple. Remaining Todos after this first version: * Improve socket inspection and viewer node support. Currently, only the first iteration is taken into account for socket inspection and the viewer. * Make loop evaluation more lazy. Currently, the evaluation is eager, meaning that it evaluates some nodes even though their output may not be required. Pull Request: https://projects.blender.org/blender/blender/pulls/109164
64 lines
2.6 KiB
C
64 lines
2.6 KiB
C
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/**
|
|
* A #ViewerPath is a path to data that is viewed/debugged by the user. It is a list of
|
|
* #ViewerPathElem.
|
|
*
|
|
* This is only used for geometry nodes currently. When the user activates a viewer node the
|
|
* corresponding path contains the following elements:
|
|
* - Object the viewer is activated on.
|
|
* - Modifier that contains the corresponding geometry node group.
|
|
* - Node tree path in case the viewer node is in a nested node group.
|
|
* - Viewer node name.
|
|
*
|
|
* The entire path is necessary (instead of just the combination of node group and viewer name),
|
|
* because the same node group may be used in many different places.
|
|
*
|
|
* This file contains basic functions for creating/deleting a #ViewerPath. For more use-case
|
|
* specific functions look in `ED_viewer_path.hh`.
|
|
*/
|
|
|
|
#include "DNA_viewer_path_types.h"
|
|
|
|
struct BlendWriter;
|
|
struct BlendDataReader;
|
|
struct BlendLibReader;
|
|
struct LibraryForeachIDData;
|
|
struct Library;
|
|
struct IDRemapper;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void BKE_viewer_path_init(ViewerPath *viewer_path);
|
|
void BKE_viewer_path_clear(ViewerPath *viewer_path);
|
|
void BKE_viewer_path_copy(ViewerPath *dst, const ViewerPath *src);
|
|
bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b);
|
|
void BKE_viewer_path_blend_write(struct BlendWriter *writer, const ViewerPath *viewer_path);
|
|
void BKE_viewer_path_blend_read_data(struct BlendDataReader *reader, ViewerPath *viewer_path);
|
|
void BKE_viewer_path_blend_read_lib(struct BlendLibReader *reader,
|
|
struct ID *self_id,
|
|
ViewerPath *viewer_path);
|
|
void BKE_viewer_path_foreach_id(struct LibraryForeachIDData *data, ViewerPath *viewer_path);
|
|
void BKE_viewer_path_id_remap(ViewerPath *viewer_path, const struct IDRemapper *mappings);
|
|
|
|
ViewerPathElem *BKE_viewer_path_elem_new(ViewerPathElemType type);
|
|
IDViewerPathElem *BKE_viewer_path_elem_new_id(void);
|
|
ModifierViewerPathElem *BKE_viewer_path_elem_new_modifier(void);
|
|
GroupNodeViewerPathElem *BKE_viewer_path_elem_new_group_node(void);
|
|
SimulationZoneViewerPathElem *BKE_viewer_path_elem_new_simulation_zone(void);
|
|
ViewerNodeViewerPathElem *BKE_viewer_path_elem_new_viewer_node(void);
|
|
RepeatZoneViewerPathElem *BKE_viewer_path_elem_new_repeat_zone(void);
|
|
ViewerPathElem *BKE_viewer_path_elem_copy(const ViewerPathElem *src);
|
|
bool BKE_viewer_path_elem_equal(const ViewerPathElem *a, const ViewerPathElem *b);
|
|
void BKE_viewer_path_elem_free(ViewerPathElem *elem);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|