Blender  V3.3
BKE_data_transfer.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2014 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "BKE_customdata.h"
11 #include "BLI_compiler_compat.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 struct Depsgraph;
18 struct Object;
19 struct ReportList;
20 struct Scene;
21 struct SpaceTransform;
22 
23 /* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */
24 enum {
26  DT_TYPE_SHAPEKEY = 1 << 1,
27  DT_TYPE_SKIN = 1 << 2,
29 
31  DT_TYPE_SEAM = 1 << 9,
32  DT_TYPE_CREASE = 1 << 10,
35 
37  DT_TYPE_LNOR = 1 << 17,
38 
39  DT_TYPE_UV = 1 << 24,
40  DT_TYPE_SHARP_FACE = 1 << 25,
45  DT_TYPE_VCOL_ALL = (1 << 16) | (1 << 27) | (1 << 28) | (1 << 29),
46 #define DT_TYPE_MAX 30
47 
54 };
55 
56 void BKE_object_data_transfer_dttypes_to_cdmask(int dtdata_types,
57  struct CustomData_MeshMasks *r_data_masks);
63  bool *r_advanced_mixing,
64  bool *r_threshold);
66 
69 
70 #define DT_DATATYPE_IS_VERT(_dt) \
71  ELEM(_dt, \
72  DT_TYPE_MDEFORMVERT, \
73  DT_TYPE_SHAPEKEY, \
74  DT_TYPE_SKIN, \
75  DT_TYPE_BWEIGHT_VERT, \
76  DT_TYPE_MLOOPCOL_VERT, \
77  DT_TYPE_MPROPCOL_VERT)
78 #define DT_DATATYPE_IS_EDGE(_dt) \
79  ELEM(_dt, \
80  DT_TYPE_CREASE, \
81  DT_TYPE_SHARP_EDGE, \
82  DT_TYPE_SEAM, \
83  DT_TYPE_BWEIGHT_EDGE, \
84  DT_TYPE_FREESTYLE_EDGE)
85 #define DT_DATATYPE_IS_LOOP(_dt) \
86  ELEM(_dt, DT_TYPE_UV, DT_TYPE_LNOR, DT_TYPE_MLOOPCOL_LOOP, DT_TYPE_MPROPCOL_LOOP)
87 #define DT_DATATYPE_IS_POLY(_dt) ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE)
88 
89 #define DT_DATATYPE_IS_MULTILAYERS(_dt) \
90  ELEM(_dt, \
91  DT_TYPE_MDEFORMVERT, \
92  DT_TYPE_SHAPEKEY, \
93  DT_TYPE_MPROPCOL_VERT, \
94  DT_TYPE_MLOOPCOL_VERT, \
95  DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT, \
96  DT_TYPE_MPROPCOL_LOOP, \
97  DT_TYPE_MLOOPCOL_LOOP, \
98  DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP, \
99  DT_TYPE_UV)
100 
101 enum {
109 };
110 
111 /* Below we keep positive values for real layers idx (generated dynamically). */
112 
113 /* How to select data layers, for types supporting multi-layers.
114  * Here too, some options are highly dependent on type of transferred data! */
115 enum {
118  /* Datatype-specific. */
122  /* Other types-related modes... */
123 };
124 
125 /* How to map a source layer to a destination layer, for types supporting multi-layers.
126  * NOTE: if no matching layer can be found, it will be created. */
127 enum {
128  DT_LAYERS_ACTIVE_DST = -1, /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
131 #if 0 /* TODO */
132  DT_LAYERS_CREATE_DST = -4, /* Never replace existing data in dst, always create new layers. */
133 #endif
134 };
135 
143  struct Scene *scene,
144  struct Object *ob_src,
145  struct Object *ob_dst,
146  int data_types,
147  bool use_delete,
148  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
149  const int tolayers_select[DT_MULTILAYER_INDEX_MAX]);
150 
152  struct Scene *scene,
153  struct Object *ob_src,
154  struct Object *ob_dst,
155  int data_types,
156  bool use_create,
157  int map_vert_mode,
158  int map_edge_mode,
159  int map_loop_mode,
160  int map_poly_mode,
161  struct SpaceTransform *space_transform,
162  bool auto_transform,
163  float max_distance,
164  float ray_radius,
165  float islands_handling_precision,
166  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
167  const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
168  int mix_mode,
169  float mix_factor,
170  const char *vgroup_name,
171  bool invert_vgroup,
172  struct ReportList *reports);
174  struct Scene *scene,
175  struct Object *ob_src,
176  struct Object *ob_dst,
177  struct Mesh *me_dst,
178  int data_types,
179  bool use_create,
180  int map_vert_mode,
181  int map_edge_mode,
182  int map_loop_mode,
183  int map_poly_mode,
184  struct SpaceTransform *space_transform,
185  bool auto_transform,
186  float max_distance,
187  float ray_radius,
188  float islands_handling_precision,
189  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
190  const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
191  int mix_mode,
192  float mix_factor,
193  const char *vgroup_name,
194  bool invert_vgroup,
195  struct ReportList *reports);
196 
197 #ifdef __cplusplus
198 }
199 #endif
CustomData interface, see also DNA_customdata_types.h.
@ 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_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_dttype_to_srcdst_index(int dtdata_type)
void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph, struct Scene *scene, 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])
int BKE_object_data_transfer_dttype_to_cdtype(int dtdata_type)
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)
Definition: data_transfer.c:80
bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph, struct Scene *scene, 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_poly_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)
@ DT_LAYERS_ACTIVE_DST
@ DT_LAYERS_INDEX_DST
@ DT_LAYERS_NAME_DST
@ 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)
Definition: data_transfer.c:40
bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, struct Scene *scene, 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_poly_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)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
Scene scene
const Depsgraph * depsgraph