Blender V4.3
BKE_data_transfer.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "BLI_compiler_compat.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17struct Depsgraph;
18struct Object;
19struct ReportList;
20struct SpaceTransform;
21
22/* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */
23enum {
26 DT_TYPE_SKIN = 1 << 2,
28
30 DT_TYPE_SEAM = 1 << 9,
31 DT_TYPE_CREASE = 1 << 10,
34
36 DT_TYPE_LNOR = 1 << 17,
37
38 DT_TYPE_UV = 1 << 24,
44 DT_TYPE_VCOL_ALL = (1 << 16) | (1 << 27) | (1 << 28) | (1 << 29),
45#define DT_TYPE_MAX 30
46
53};
54
56 struct CustomData_MeshMasks *r_data_masks);
62 bool *r_advanced_mixing,
63 bool *r_threshold);
65
68
69#define DT_DATATYPE_IS_VERT(_dt) \
70 ELEM(_dt, \
71 DT_TYPE_MDEFORMVERT, \
72 DT_TYPE_SHAPEKEY, \
73 DT_TYPE_SKIN, \
74 DT_TYPE_BWEIGHT_VERT, \
75 DT_TYPE_MLOOPCOL_VERT, \
76 DT_TYPE_MPROPCOL_VERT)
77#define DT_DATATYPE_IS_EDGE(_dt) \
78 ELEM(_dt, \
79 DT_TYPE_CREASE, \
80 DT_TYPE_SHARP_EDGE, \
81 DT_TYPE_SEAM, \
82 DT_TYPE_BWEIGHT_EDGE, \
83 DT_TYPE_FREESTYLE_EDGE)
84#define DT_DATATYPE_IS_LOOP(_dt) \
85 ELEM(_dt, DT_TYPE_UV, DT_TYPE_LNOR, DT_TYPE_MLOOPCOL_LOOP, DT_TYPE_MPROPCOL_LOOP)
86#define DT_DATATYPE_IS_FACE(_dt) ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE)
87
88#define DT_DATATYPE_IS_MULTILAYERS(_dt) \
89 ELEM(_dt, \
90 DT_TYPE_MDEFORMVERT, \
91 DT_TYPE_SHAPEKEY, \
92 DT_TYPE_MPROPCOL_VERT, \
93 DT_TYPE_MLOOPCOL_VERT, \
94 DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT, \
95 DT_TYPE_MPROPCOL_LOOP, \
96 DT_TYPE_MLOOPCOL_LOOP, \
97 DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP, \
98 DT_TYPE_UV)
99
100enum {
108};
109
110/* Below we keep positive values for real layers idx (generated dynamically). */
111
112/* How to select data layers, for types supporting multi-layers.
113 * Here too, some options are highly dependent on type of transferred data! */
114enum {
117 /* Datatype-specific. */
121 /* Other types-related modes... */
122};
123
124/* How to map a source layer to a destination layer, for types supporting multi-layers.
125 * NOTE: if no matching layer can be found, it will be created. */
126enum {
127 DT_LAYERS_ACTIVE_DST = -1, /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
130#if 0 /* TODO */
131 DT_LAYERS_CREATE_DST = -4, /* Never replace existing data in dst, always create new layers. */
132#endif
133};
134
141void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph,
142 struct Object *ob_src,
143 struct Object *ob_dst,
144 int data_types,
145 bool use_delete,
146 const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
147 const int tolayers_select[DT_MULTILAYER_INDEX_MAX]);
148
149bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph,
150 struct Object *ob_src,
151 struct Object *ob_dst,
152 int data_types,
153 bool use_create,
154 int map_vert_mode,
155 int map_edge_mode,
156 int map_loop_mode,
157 int map_face_mode,
158 struct SpaceTransform *space_transform,
159 bool auto_transform,
160 float max_distance,
161 float ray_radius,
162 float islands_handling_precision,
163 const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
164 const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
165 int mix_mode,
166 float mix_factor,
167 const char *vgroup_name,
168 bool invert_vgroup,
169 struct ReportList *reports);
170bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
171 struct Object *ob_src,
172 struct Object *ob_dst,
173 struct Mesh *me_dst,
174 int data_types,
175 bool use_create,
176 int map_vert_mode,
177 int map_edge_mode,
178 int map_loop_mode,
179 int map_face_mode,
180 struct SpaceTransform *space_transform,
181 bool auto_transform,
182 float max_distance,
183 float ray_radius,
184 float islands_handling_precision,
185 const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
186 const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
187 int mix_mode,
188 float mix_factor,
189 const char *vgroup_name,
190 bool invert_vgroup,
191 struct ReportList *reports);
192
193#ifdef __cplusplus
194}
195#endif
int BKE_object_data_transfer_dttype_to_srcdst_index(int dtdata_type)
bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph, struct Object *ob_src, struct Object *ob_dst, int data_types, bool use_create, int map_vert_mode, int map_edge_mode, int map_loop_mode, int map_face_mode, struct SpaceTransform *space_transform, bool auto_transform, float max_distance, float ray_radius, float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], int mix_mode, float mix_factor, const char *vgroup_name, bool invert_vgroup, struct ReportList *reports)
bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, struct Object *ob_src, struct Object *ob_dst, struct Mesh *me_dst, int data_types, bool use_create, int map_vert_mode, int map_edge_mode, int map_loop_mode, int map_face_mode, struct SpaceTransform *space_transform, bool auto_transform, float max_distance, float ray_radius, float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], int mix_mode, float mix_factor, const char *vgroup_name, bool invert_vgroup, struct ReportList *reports)
void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph, struct Object *ob_src, struct Object *ob_dst, int data_types, bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX])
@ DT_LAYERS_ACTIVE_DST
@ DT_LAYERS_INDEX_DST
@ DT_LAYERS_NAME_DST
int BKE_object_data_transfer_dttype_to_cdtype(int dtdata_type)
@ DT_LAYERS_VGROUP_SRC_BONE_SELECT
@ DT_LAYERS_VGROUP_SRC_BONE_DEFORM
@ DT_LAYERS_VGROUP_SRC
@ DT_LAYERS_ALL_SRC
@ DT_LAYERS_ACTIVE_SRC
int BKE_object_data_transfer_get_dttypes_item_types(int dtdata_types)
bool BKE_object_data_transfer_get_dttypes_capacity(int dtdata_types, bool *r_advanced_mixing, bool *r_threshold)
@ DT_MULTILAYER_INDEX_MAX
@ DT_MULTILAYER_INDEX_MDEFORMVERT
@ DT_MULTILAYER_INDEX_INVALID
@ DT_MULTILAYER_INDEX_SHAPEKEY
@ DT_MULTILAYER_INDEX_UV
@ DT_MULTILAYER_INDEX_VCOL_VERT
@ DT_MULTILAYER_INDEX_VCOL_LOOP
@ DT_TYPE_VCOL_ALL
@ DT_TYPE_MLOOPCOL_LOOP
@ DT_TYPE_SKIN
@ DT_TYPE_UV
@ DT_TYPE_MPROPCOL_VERT
@ DT_TYPE_VERT_ALL
@ DT_TYPE_BWEIGHT_VERT
@ DT_TYPE_FREESTYLE_FACE
@ DT_TYPE_SHAPEKEY
@ DT_TYPE_CREASE
@ DT_TYPE_LOOP_ALL
@ DT_TYPE_SEAM
@ DT_TYPE_POLY_ALL
@ DT_TYPE_MLOOPCOL_VERT
@ DT_TYPE_LNOR
@ DT_TYPE_MPROPCOL_LOOP
@ DT_TYPE_EDGE_ALL
@ DT_TYPE_SHARP_FACE
@ DT_TYPE_MDEFORMVERT
@ DT_TYPE_BWEIGHT_EDGE
@ DT_TYPE_FREESTYLE_EDGE
@ DT_TYPE_SHARP_EDGE
void BKE_object_data_transfer_dttypes_to_cdmask(int dtdata_types, struct CustomData_MeshMasks *r_data_masks)
const Depsgraph * depsgraph