Blender  V2.93
BKE_data_transfer.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2014 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "BKE_customdata.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct Depsgraph;
33 struct Object;
34 struct ReportList;
35 struct Scene;
36 struct SpaceTransform;
37 
38 /* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */
39 enum {
41  DT_TYPE_SHAPEKEY = 1 << 1,
42  DT_TYPE_SKIN = 1 << 2,
44 
46  DT_TYPE_SEAM = 1 << 9,
47  DT_TYPE_CREASE = 1 << 10,
50 
51  DT_TYPE_VCOL = 1 << 16,
52  DT_TYPE_LNOR = 1 << 17,
53 
54  DT_TYPE_UV = 1 << 24,
55  DT_TYPE_SHARP_FACE = 1 << 25,
57 #define DT_TYPE_MAX 27
58 
64 };
65 
66 void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types,
67  struct CustomData_MeshMasks *r_data_masks);
68 bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types,
69  bool *r_advanced_mixing,
70  bool *r_threshold);
71 int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types);
72 
73 int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type);
74 int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type);
75 
76 #define DT_DATATYPE_IS_VERT(_dt) \
77  ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_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) ELEM(_dt, DT_TYPE_UV, DT_TYPE_VCOL, DT_TYPE_LNOR)
86 #define DT_DATATYPE_IS_POLY(_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, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_VCOL, DT_TYPE_UV)
90 
91 enum {
98 };
99 
100 /* Below we keep positive values for real layers idx (generated dynamically). */
101 
102 /* How to select data layers, for types supporting multi-layers.
103  * Here too, some options are highly dependent on type of transferred data! */
104 enum {
107  /* Datatype-specific. */
111  /* Other types-related modes... */
112 };
113 
114 /* How to map a source layer to a destination layer, for types supporting multi-layers.
115  * Note: if no matching layer can be found, it will be created. */
116 enum {
117  DT_LAYERS_ACTIVE_DST = -1, /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
120 #if 0 /* TODO */
121  DT_LAYERS_CREATE_DST = -4, /* Never replace existing data in dst, always create new layers. */
122 #endif
123 };
124 
126  struct Scene *scene,
127  struct Object *ob_src,
128  struct Object *ob_dst,
129  const int data_types,
130  const bool use_delete,
131  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
132  const int tolayers_select[DT_MULTILAYER_INDEX_MAX]);
133 
135  struct Scene *scene,
136  struct Object *ob_src,
137  struct Object *ob_dst,
138  const int data_types,
139  const bool use_create,
140  const int map_vert_mode,
141  const int map_edge_mode,
142  const int map_loop_mode,
143  const int map_poly_mode,
144  struct SpaceTransform *space_transform,
145  const bool auto_transform,
146  const float max_distance,
147  const float ray_radius,
148  const float islands_handling_precision,
149  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
150  const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
151  const int mix_mode,
152  const float mix_factor,
153  const char *vgroup_name,
154  const bool invert_vgroup,
155  struct ReportList *reports);
157  struct Scene *scene,
158  struct Object *ob_src,
159  struct Object *ob_dst,
160  struct Mesh *me_dst,
161  const int data_types,
162  bool use_create,
163  const int map_vert_mode,
164  const int map_edge_mode,
165  const int map_loop_mode,
166  const int map_poly_mode,
167  struct SpaceTransform *space_transform,
168  const bool auto_transform,
169  const float max_distance,
170  const float ray_radius,
171  const float islands_handling_precision,
172  const int fromlayers_select[DT_MULTILAYER_INDEX_MAX],
173  const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
174  const int mix_mode,
175  const float mix_factor,
176  const char *vgroup_name,
177  const bool invert_vgroup,
178  struct ReportList *reports);
179 
180 #ifdef __cplusplus
181 }
182 #endif
CustomData interface, see also DNA_customdata_types.h.
@ DT_LAYERS_VGROUP_SRC_BONE_SELECT
@ DT_LAYERS_VGROUP_SRC_BONE_DEFORM
@ DT_LAYERS_VGROUP_SRC
@ DT_LAYERS_ALL_SRC
@ DT_LAYERS_ACTIVE_SRC
@ DT_LAYERS_ACTIVE_DST
@ DT_LAYERS_INDEX_DST
@ DT_LAYERS_NAME_DST
bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct Mesh *me_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports)
int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types)
void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX])
bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types, bool *r_advanced_mixing, bool *r_threshold)
bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports)
int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type)
@ DT_TYPE_SKIN
@ DT_TYPE_UV
@ 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_LNOR
@ DT_TYPE_EDGE_ALL
@ DT_TYPE_VCOL
@ DT_TYPE_SHARP_FACE
@ DT_TYPE_MDEFORMVERT
@ DT_TYPE_BWEIGHT_EDGE
@ DT_TYPE_FREESTYLE_EDGE
@ DT_TYPE_SHARP_EDGE
@ DT_MULTILAYER_INDEX_MAX
@ DT_MULTILAYER_INDEX_MDEFORMVERT
@ DT_MULTILAYER_INDEX_INVALID
@ DT_MULTILAYER_INDEX_SHAPEKEY
@ DT_MULTILAYER_INDEX_UV
@ DT_MULTILAYER_INDEX_VCOL
void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types, struct CustomData_MeshMasks *r_data_masks)
Definition: data_transfer.c:56
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
Scene scene
const Depsgraph * depsgraph