Files
test/source/blender/blenkernel/BKE_viewer_path.h
Bastien Montagne a9193a9ad2 Refactor ID liblinking on readfile to take ID pointer.
The usage of the lib pointer was cryptic to say the least, it was
essentialy used to allow or not local IDs results in the mapping
old_id_pointer -> new_id_pointer lookup result.

Now:
- Explicitely pass a boolean to allow or not local ID as result in
  lower-level code.
- Pass the 'self ID' pointer instead of its library to the whole
  liblinking code (that was already the case in a few places).

Note that naming of the 'self id' pointer is currently very inconsistent
throughout the readfile liblink code, this will have to be cleaned up in
a separate step later. For now, `self_id` has been chosen for new code
as it matches the terminology in lib_query code.

The later change can also allow finer handling of lookup on undo, based
on how it was re-read (or not), should the need for this arise.
2023-05-17 16:38:56 +02:00

59 lines
2.3 KiB
C

/* 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);
NodeViewerPathElem *BKE_viewer_path_elem_new_node(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