2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2014 Blender Foundation. All rights reserved. */
|
2015-01-09 21:19:12 +01:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup modifiers
|
2015-01-09 21:19:12 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "BLI_utildefines.h"
|
2019-02-25 11:56:24 +01:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BLT_translation.h"
|
|
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
|
#include "DNA_meshdata_types.h"
|
|
|
|
|
#include "DNA_modifier_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "DNA_screen_types.h"
|
2015-01-09 21:19:12 +01:00
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BKE_context.h"
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "BKE_customdata.h"
|
2015-01-12 12:03:28 +01:00
|
|
|
#include "BKE_data_transfer.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
|
|
|
|
#include "BKE_lib_query.h"
|
2023-03-12 22:29:15 +01:00
|
|
|
#include "BKE_mesh.hh"
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "BKE_mesh_mapping.h"
|
|
|
|
|
#include "BKE_mesh_remap.h"
|
|
|
|
|
#include "BKE_modifier.h"
|
|
|
|
|
#include "BKE_report.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BKE_screen.h"
|
|
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
2022-03-14 16:54:46 +01:00
|
|
|
#include "RNA_prototypes.h"
|
2015-01-09 21:19:12 +01:00
|
|
|
|
2018-06-22 15:03:42 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
|
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "MEM_guardedalloc.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
#include "MOD_ui_common.h"
|
2015-01-09 21:19:12 +01:00
|
|
|
#include "MOD_util.h"
|
|
|
|
|
|
|
|
|
|
/**************************************
|
|
|
|
|
* Modifiers functions. *
|
|
|
|
|
**************************************/
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
|
|
|
|
int i;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
dtmd->ob_source = nullptr;
|
2015-01-09 21:19:12 +01:00
|
|
|
dtmd->data_types = 0;
|
|
|
|
|
|
|
|
|
|
dtmd->vmap_mode = MREMAP_MODE_VERT_NEAREST;
|
|
|
|
|
dtmd->emap_mode = MREMAP_MODE_EDGE_NEAREST;
|
|
|
|
|
dtmd->lmap_mode = MREMAP_MODE_LOOP_NEAREST_POLYNOR;
|
|
|
|
|
dtmd->pmap_mode = MREMAP_MODE_POLY_NEAREST;
|
|
|
|
|
|
|
|
|
|
dtmd->map_max_distance = 1.0f;
|
|
|
|
|
dtmd->map_ray_radius = 0.0f;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < DT_MULTILAYER_INDEX_MAX; i++) {
|
|
|
|
|
dtmd->layers_select_src[i] = DT_LAYERS_ALL_SRC;
|
|
|
|
|
dtmd->layers_select_dst[i] = DT_LAYERS_NAME_DST;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dtmd->mix_mode = CDT_MIX_TRANSFER;
|
|
|
|
|
dtmd->mix_factor = 1.0f;
|
|
|
|
|
dtmd->defgrp_name[0] = '\0';
|
|
|
|
|
|
|
|
|
|
dtmd->flags = MOD_DATATRANSFER_OBSRC_TRANSFORM;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-14 14:49:40 -05:00
|
|
|
static void requiredDataMask(ModifierData *md, CustomData_MeshMasks *r_cddata_masks)
|
2015-01-09 21:19:12 +01:00
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
|
|
|
|
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
if (dtmd->defgrp_name[0] != '\0') {
|
2015-01-09 21:19:12 +01:00
|
|
|
/* We need vertex groups! */
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
|
|
|
|
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types, r_cddata_masks);
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool dependsOnNormals(ModifierData *md)
|
|
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
|
|
|
|
int item_types = BKE_object_data_transfer_get_dttypes_item_types(dtmd->data_types);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
if ((item_types & ME_VERT) && (dtmd->vmap_mode & (MREMAP_USE_NORPROJ | MREMAP_USE_NORMAL))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if ((item_types & ME_EDGE) && (dtmd->emap_mode & (MREMAP_USE_NORPROJ | MREMAP_USE_NORMAL))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if ((item_types & ME_LOOP) && (dtmd->lmap_mode & (MREMAP_USE_NORPROJ | MREMAP_USE_NORMAL))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if ((item_types & ME_POLY) && (dtmd->pmap_mode & (MREMAP_USE_NORPROJ | MREMAP_USE_NORMAL))) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 18:05:23 +02:00
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
|
2015-01-09 21:19:12 +01:00
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
2020-10-01 18:05:23 +02:00
|
|
|
walk(userData, ob, (ID **)&dtmd->ob_source, IDWALK_CB_NOP);
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
|
|
|
|
|
2018-02-22 12:54:06 +01:00
|
|
|
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
2022-10-02 11:16:14 -05:00
|
|
|
if (dtmd->ob_source != nullptr) {
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
CustomData_MeshMasks cddata_masks = {0};
|
|
|
|
|
BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types, &cddata_masks);
|
2019-03-14 09:46:46 +01:00
|
|
|
BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(
|
|
|
|
|
dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode, &cddata_masks);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-03 18:09:45 +03:00
|
|
|
DEG_add_object_relation(
|
|
|
|
|
ctx->node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, "DataTransfer Modifier");
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
DEG_add_customdata_mask(ctx->node, dtmd->ob_source, &cddata_masks);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-27 21:14:35 +01:00
|
|
|
if (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) {
|
|
|
|
|
DEG_add_object_relation(
|
|
|
|
|
ctx->node, dtmd->ob_source, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
|
2022-08-04 12:11:31 +02:00
|
|
|
DEG_add_depends_on_transform_relation(ctx->node, "DataTransfer Modifier");
|
2018-11-27 21:14:35 +01:00
|
|
|
}
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static bool isDisabled(const struct Scene * /*scene*/, ModifierData *md, bool /*useRenderParams*/)
|
2015-01-09 21:19:12 +01:00
|
|
|
{
|
|
|
|
|
/* If no source object, bypass. */
|
2019-08-23 15:50:53 +02:00
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
|
|
|
|
/* The object type check is only needed here in case we have a placeholder
|
|
|
|
|
* object assigned (because the library containing the mesh is missing).
|
|
|
|
|
*
|
2019-08-31 01:19:22 +10:00
|
|
|
* In other cases it should be impossible to have a type mismatch.
|
2019-08-23 15:50:53 +02:00
|
|
|
*/
|
|
|
|
|
return !dtmd->ob_source || dtmd->ob_source->type != OB_MESH;
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
|
|
|
|
|
2015-02-15 18:46:46 +01:00
|
|
|
#define DT_TYPES_AFFECT_MESH \
|
|
|
|
|
(DT_TYPE_BWEIGHT_VERT | DT_TYPE_BWEIGHT_EDGE | DT_TYPE_CREASE | DT_TYPE_SHARP_EDGE | \
|
|
|
|
|
DT_TYPE_LNOR | DT_TYPE_SHARP_FACE)
|
2015-01-09 21:19:12 +01:00
|
|
|
|
2020-04-21 13:09:41 +02:00
|
|
|
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *me_mod)
|
2015-01-09 21:19:12 +01:00
|
|
|
{
|
|
|
|
|
DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
|
2018-06-22 15:03:42 +02:00
|
|
|
struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
|
2018-06-21 14:39:28 +02:00
|
|
|
Mesh *result = me_mod;
|
2015-01-09 21:19:12 +01:00
|
|
|
ReportList reports;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-01 13:53:25 +10:00
|
|
|
/* Only used to check whether we are operating on org data or not... */
|
2022-10-02 11:16:14 -05:00
|
|
|
const Mesh *me = static_cast<const Mesh *>(ctx->object->data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 11:25:07 +01:00
|
|
|
Object *ob_source = dtmd->ob_source;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
const bool invert_vgroup = (dtmd->flags & MOD_DATATRANSFER_INVERT_VGROUP) != 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
const float max_dist = (dtmd->flags & MOD_DATATRANSFER_MAP_MAXDIST) ? dtmd->map_max_distance :
|
|
|
|
|
FLT_MAX;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
SpaceTransform space_transform_data;
|
|
|
|
|
SpaceTransform *space_transform = (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) ?
|
|
|
|
|
&space_transform_data :
|
2022-10-02 11:16:14 -05:00
|
|
|
nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
if (space_transform) {
|
2018-12-07 15:45:53 +01:00
|
|
|
BLI_SPACE_TRANSFORM_SETUP(space_transform, ctx->object, ob_source);
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Mesh: Move positions to a generic attribute
**Changes**
As described in T93602, this patch removes all use of the `MVert`
struct, replacing it with a generic named attribute with the name
`"position"`, consistent with other geometry types.
Variable names have been changed from `verts` to `positions`, to align
with the attribute name and the more generic design (positions are not
vertices, they are just an attribute stored on the point domain).
This change is made possible by previous commits that moved all other
data out of `MVert` to runtime data or other generic attributes. What
remains is mostly a simple type change. Though, the type still shows up
859 times, so the patch is quite large.
One compromise is that now `CD_MASK_BAREMESH` now contains
`CD_PROP_FLOAT3`. With the general move towards generic attributes
over custom data types, we are removing use of these type masks anyway.
**Benefits**
The most obvious benefit is reduced memory usage and the benefits
that brings in memory-bound situations. `float3` is only 3 bytes, in
comparison to `MVert` which was 4. When there are millions of vertices
this starts to matter more.
The other benefits come from using a more generic type. Instead of
writing algorithms specifically for `MVert`, code can just use arrays
of vectors. This will allow eliminating many temporary arrays or
wrappers used to extract positions.
Many possible improvements aren't implemented in this patch, though
I did switch simplify or remove the process of creating temporary
position arrays in a few places.
The design clarity that "positions are just another attribute" brings
allows removing explicit copying of vertices in some procedural
operations-- they are just processed like most other attributes.
**Performance**
This touches so many areas that it's hard to benchmark exhaustively,
but I observed some areas as examples.
* The mesh line node with 4 million count was 1.5x (8ms to 12ms) faster.
* The Spring splash screen went from ~4.3 to ~4.5 fps.
* The subdivision surface modifier/node was slightly faster
RNA access through Python may be slightly slower, since now we need
a name lookup instead of just a custom data type lookup for each index.
**Future Improvements**
* Remove uses of "vert_coords" functions:
* `BKE_mesh_vert_coords_alloc`
* `BKE_mesh_vert_coords_get`
* `BKE_mesh_vert_coords_apply{_with_mat4}`
* Remove more hidden copying of positions
* General simplification now possible in many areas
* Convert more code to C++ to use `float3` instead of `float[3]`
* Currently `reinterpret_cast` is used for those C-API functions
Differential Revision: https://developer.blender.org/D15982
2023-01-10 00:10:43 -05:00
|
|
|
const float(*me_positions)[3] = BKE_mesh_vert_positions(me);
|
2023-02-23 10:39:51 -05:00
|
|
|
const blender::Span<MEdge> me_edges = me->edges();
|
Mesh: Move positions to a generic attribute
**Changes**
As described in T93602, this patch removes all use of the `MVert`
struct, replacing it with a generic named attribute with the name
`"position"`, consistent with other geometry types.
Variable names have been changed from `verts` to `positions`, to align
with the attribute name and the more generic design (positions are not
vertices, they are just an attribute stored on the point domain).
This change is made possible by previous commits that moved all other
data out of `MVert` to runtime data or other generic attributes. What
remains is mostly a simple type change. Though, the type still shows up
859 times, so the patch is quite large.
One compromise is that now `CD_MASK_BAREMESH` now contains
`CD_PROP_FLOAT3`. With the general move towards generic attributes
over custom data types, we are removing use of these type masks anyway.
**Benefits**
The most obvious benefit is reduced memory usage and the benefits
that brings in memory-bound situations. `float3` is only 3 bytes, in
comparison to `MVert` which was 4. When there are millions of vertices
this starts to matter more.
The other benefits come from using a more generic type. Instead of
writing algorithms specifically for `MVert`, code can just use arrays
of vectors. This will allow eliminating many temporary arrays or
wrappers used to extract positions.
Many possible improvements aren't implemented in this patch, though
I did switch simplify or remove the process of creating temporary
position arrays in a few places.
The design clarity that "positions are just another attribute" brings
allows removing explicit copying of vertices in some procedural
operations-- they are just processed like most other attributes.
**Performance**
This touches so many areas that it's hard to benchmark exhaustively,
but I observed some areas as examples.
* The mesh line node with 4 million count was 1.5x (8ms to 12ms) faster.
* The Spring splash screen went from ~4.3 to ~4.5 fps.
* The subdivision surface modifier/node was slightly faster
RNA access through Python may be slightly slower, since now we need
a name lookup instead of just a custom data type lookup for each index.
**Future Improvements**
* Remove uses of "vert_coords" functions:
* `BKE_mesh_vert_coords_alloc`
* `BKE_mesh_vert_coords_get`
* `BKE_mesh_vert_coords_apply{_with_mat4}`
* Remove more hidden copying of positions
* General simplification now possible in many areas
* Convert more code to C++ to use `float3` instead of `float[3]`
* Currently `reinterpret_cast` is used for those C-API functions
Differential Revision: https://developer.blender.org/D15982
2023-01-10 00:10:43 -05:00
|
|
|
const float(*result_positions)[3] = BKE_mesh_vert_positions(result);
|
2023-02-23 10:39:51 -05:00
|
|
|
const blender::Span<MEdge> result_edges = result->edges();
|
Mesh: Remove redundant custom data pointers
For copy-on-write, we want to share attribute arrays between meshes
where possible. Mutable pointers like `Mesh.mvert` make that difficult
by making ownership vague. They also make code more complex by adding
redundancy.
The simplest solution is just removing them and retrieving layers from
`CustomData` as needed. Similar changes have already been applied to
curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of
the pointers generally makes code more obvious and more reusable.
Mesh data is now accessed with a C++ API (`Mesh::edges()` or
`Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`).
The CoW changes this commit makes possible are described in T95845
and T95842, and started in D14139 and D14140. The change also simplifies
the ongoing mesh struct-of-array refactors from T95965.
**RNA/Python Access Performance**
Theoretically, accessing mesh elements with the RNA API may become
slower, since the layer needs to be found on every random access.
However, overhead is already high enough that this doesn't make a
noticible differenc, and performance is actually improved in some
cases. Random access can be up to 10% faster, but other situations
might be a bit slower. Generally using `foreach_get/set` are the best
way to improve performance. See the differential revision for more
discussion about Python performance.
Cycles has been updated to use raw pointers and the internal Blender
mesh types, mostly because there is no sense in having this overhead
when it's already compiled with Blender. In my tests this roughly
halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million
face grid).
Differential Revision: https://developer.blender.org/D15488
2022-09-05 11:56:34 -05:00
|
|
|
|
2023-02-23 10:39:51 -05:00
|
|
|
if (((result == me) || (me_positions == result_positions) ||
|
|
|
|
|
(me_edges.data() == result_edges.data())) &&
|
2018-06-21 14:39:28 +02:00
|
|
|
(dtmd->data_types & DT_TYPES_AFFECT_MESH)) {
|
2020-02-13 14:01:52 +11:00
|
|
|
/* We need to duplicate data here, otherwise setting custom normals, edges' sharpness, etc.,
|
2023-02-12 14:37:16 +11:00
|
|
|
* could modify org mesh, see #43671. */
|
2022-10-02 11:16:14 -05:00
|
|
|
result = (Mesh *)BKE_id_copy_ex(nullptr, &me_mod->id, nullptr, LIB_ID_COPY_LOCALIZE);
|
2015-02-15 18:46:46 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
BKE_reports_init(&reports, RPT_STORE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: no islands precision for now here. */
|
2020-08-11 21:46:06 +10:00
|
|
|
if (BKE_object_data_transfer_ex(ctx->depsgraph,
|
|
|
|
|
scene,
|
|
|
|
|
ob_source,
|
|
|
|
|
ctx->object,
|
|
|
|
|
result,
|
|
|
|
|
dtmd->data_types,
|
|
|
|
|
false,
|
|
|
|
|
dtmd->vmap_mode,
|
|
|
|
|
dtmd->emap_mode,
|
|
|
|
|
dtmd->lmap_mode,
|
|
|
|
|
dtmd->pmap_mode,
|
|
|
|
|
space_transform,
|
|
|
|
|
false,
|
|
|
|
|
max_dist,
|
|
|
|
|
dtmd->map_ray_radius,
|
|
|
|
|
0.0f,
|
|
|
|
|
dtmd->layers_select_src,
|
|
|
|
|
dtmd->layers_select_dst,
|
|
|
|
|
dtmd->mix_mode,
|
|
|
|
|
dtmd->mix_factor,
|
|
|
|
|
dtmd->defgrp_name,
|
|
|
|
|
invert_vgroup,
|
|
|
|
|
&reports)) {
|
2022-10-12 20:55:26 -05:00
|
|
|
result->runtime->is_original_bmesh = false;
|
2020-08-11 21:46:06 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-09 21:19:12 +01:00
|
|
|
if (BKE_reports_contain(&reports, RPT_ERROR)) {
|
2020-08-11 17:07:15 +10:00
|
|
|
const char *report_str = BKE_reports_string(&reports, RPT_ERROR);
|
2020-10-26 17:07:58 +11:00
|
|
|
BKE_modifier_set_error(ctx->object, md, "%s", report_str);
|
2020-08-11 17:07:15 +10:00
|
|
|
MEM_freeN((void *)report_str);
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
2017-01-27 19:06:10 +01:00
|
|
|
else if ((dtmd->data_types & DT_TYPE_LNOR) && !(me->flag & ME_AUTOSMOOTH)) {
|
2020-10-26 17:07:58 +11:00
|
|
|
BKE_modifier_set_error(
|
|
|
|
|
ctx->object, (ModifierData *)dtmd, "Enable 'Auto Smooth' in Object Data Properties");
|
2017-01-27 19:06:10 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-21 14:39:28 +02:00
|
|
|
return result;
|
2015-01-09 21:19:12 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *sub, *row;
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
|
|
|
|
PointerRNA ob_ptr;
|
2020-09-02 14:13:26 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
|
|
|
|
row = uiLayoutRow(layout, true);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(row, ptr, "object", 0, IFACE_("Source"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
sub = uiLayoutRow(row, true);
|
|
|
|
|
uiLayoutSetPropDecorate(sub, false);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(sub, ptr, "use_object_transform", 0, "", ICON_ORIENTATION_GLOBAL);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "mix_mode", 0, nullptr, ICON_NONE);
|
2020-10-23 14:36:57 +02:00
|
|
|
|
|
|
|
|
row = uiLayoutRow(layout, false);
|
|
|
|
|
uiLayoutSetActive(row,
|
|
|
|
|
!ELEM(RNA_enum_get(ptr, "mix_mode"),
|
|
|
|
|
CDT_MIX_NOMIX,
|
|
|
|
|
CDT_MIX_REPLACE_ABOVE_THRESHOLD,
|
|
|
|
|
CDT_MIX_REPLACE_BELOW_THRESHOLD));
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(row, ptr, "mix_factor", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-10-22 10:25:08 -05:00
|
|
|
uiItemO(layout, IFACE_("Generate Data Layers"), ICON_NONE, "OBJECT_OT_datalayout_transfer");
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
modifier_panel_end(layout, ptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void vertex_panel_draw_header(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "use_vert_data", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void vertex_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
bool use_vert_data = RNA_boolean_get(ptr, "use_vert_data");
|
2020-06-05 10:41:03 -04:00
|
|
|
uiLayoutSetActive(layout, use_vert_data);
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "data_types_verts", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "vert_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void vertex_vgroup_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(layout, RNA_enum_get(ptr, "data_types_verts") & DT_TYPE_MDEFORMVERT);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "layers_vgroup_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "layers_vgroup_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void edge_panel_draw_header(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "use_edge_data", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void edge_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_edge_data"));
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "data_types_edges", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "edge_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_corner_panel_draw_header(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "use_loop_data", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_corner_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_loop_data"));
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "data_types_loops", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "loop_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void vert_vcol_panel_draw(const bContext * /*C*/, Panel *panel)
|
2022-04-05 11:42:55 -07:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2022-04-05 11:42:55 -07:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
|
|
|
|
uiLayoutSetActive(layout,
|
|
|
|
|
RNA_enum_get(ptr, "data_types_verts") &
|
|
|
|
|
(DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT));
|
|
|
|
|
|
|
|
|
|
uiItemR(layout, ptr, "layers_vcol_vert_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "layers_vcol_vert_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_corner_vcol_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2022-04-05 11:42:55 -07:00
|
|
|
uiLayoutSetActive(layout,
|
|
|
|
|
RNA_enum_get(ptr, "data_types_loops") &
|
|
|
|
|
(DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP));
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-04-05 11:42:55 -07:00
|
|
|
uiItemR(layout, ptr, "layers_vcol_loop_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "layers_vcol_loop_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_corner_uv_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(layout, RNA_enum_get(ptr, "data_types_loops") & DT_TYPE_UV);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "layers_uv_select_src", 0, IFACE_("Layer Selection"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "layers_uv_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE);
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "islands_precision", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_panel_draw_header(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "use_poly_data", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void face_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_poly_data"));
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "data_types_polys", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "poly_mapping", 0, IFACE_("Mapping"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void advanced_panel_draw(const bContext * /*C*/, Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *row, *sub;
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
|
|
|
|
row = uiLayoutRowWithHeading(layout, true, IFACE_("Max Distance"));
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(row, ptr, "use_max_distance", 0, "", ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
sub = uiLayoutRow(row, true);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max_distance"));
|
|
|
|
|
uiItemR(sub, ptr, "max_distance", 0, "", ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-10-02 11:16:14 -05:00
|
|
|
uiItemR(layout, ptr, "ray_radius", 0, nullptr, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void panelRegister(ARegionType *region_type)
|
|
|
|
|
{
|
|
|
|
|
PanelType *panel_type = modifier_panel_register(
|
|
|
|
|
region_type, eModifierType_DataTransfer, panel_draw);
|
|
|
|
|
PanelType *vertex_panel = modifier_subpanel_register(
|
|
|
|
|
region_type, "vertex", "", vertex_panel_draw_header, vertex_panel_draw, panel_type);
|
2022-10-02 11:16:14 -05:00
|
|
|
modifier_subpanel_register(region_type,
|
|
|
|
|
"vertex_vgroup",
|
|
|
|
|
"Vertex Groups",
|
|
|
|
|
nullptr,
|
|
|
|
|
vertex_vgroup_panel_draw,
|
|
|
|
|
vertex_panel);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2022-04-05 11:42:55 -07:00
|
|
|
modifier_subpanel_register(
|
2022-10-02 11:16:14 -05:00
|
|
|
region_type, "vert_vcol", "Colors", nullptr, vert_vcol_panel_draw, vertex_panel);
|
2022-04-05 11:42:55 -07:00
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
modifier_subpanel_register(
|
|
|
|
|
region_type, "edge", "", edge_panel_draw_header, edge_panel_draw, panel_type);
|
|
|
|
|
|
|
|
|
|
PanelType *face_corner_panel = modifier_subpanel_register(region_type,
|
|
|
|
|
"face_corner",
|
|
|
|
|
"",
|
|
|
|
|
face_corner_panel_draw_header,
|
|
|
|
|
face_corner_panel_draw,
|
|
|
|
|
panel_type);
|
|
|
|
|
modifier_subpanel_register(region_type,
|
|
|
|
|
"face_corner_vcol",
|
2022-04-05 11:42:55 -07:00
|
|
|
"Colors",
|
2022-10-02 11:16:14 -05:00
|
|
|
nullptr,
|
2020-06-05 10:41:03 -04:00
|
|
|
face_corner_vcol_panel_draw,
|
|
|
|
|
face_corner_panel);
|
|
|
|
|
modifier_subpanel_register(
|
2022-10-02 11:16:14 -05:00
|
|
|
region_type, "face_corner_uv", "UVs", nullptr, face_corner_uv_panel_draw, face_corner_panel);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
modifier_subpanel_register(
|
|
|
|
|
region_type, "face", "", face_panel_draw_header, face_panel_draw, panel_type);
|
|
|
|
|
modifier_subpanel_register(
|
2022-10-02 11:16:14 -05:00
|
|
|
region_type, "advanced", "Topology Mapping", nullptr, advanced_panel_draw, panel_type);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2015-02-15 18:46:46 +01:00
|
|
|
#undef DT_TYPES_AFFECT_MESH
|
2015-01-09 21:19:12 +01:00
|
|
|
|
|
|
|
|
ModifierTypeInfo modifierType_DataTransfer = {
|
2023-01-16 12:41:11 +11:00
|
|
|
/*name*/ N_("DataTransfer"),
|
|
|
|
|
/*structName*/ "DataTransferModifierData",
|
|
|
|
|
/*structSize*/ sizeof(DataTransferModifierData),
|
|
|
|
|
/*srna*/ &RNA_DataTransferModifier,
|
|
|
|
|
/*type*/ eModifierTypeType_NonGeometrical,
|
|
|
|
|
/*flags*/ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping |
|
2015-01-09 21:19:12 +01:00
|
|
|
eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_UsesPreview,
|
2023-01-16 12:41:11 +11:00
|
|
|
/*icon*/ ICON_MOD_DATA_TRANSFER,
|
|
|
|
|
|
|
|
|
|
/*copyData*/ BKE_modifier_copydata_generic,
|
|
|
|
|
|
|
|
|
|
/*deformVerts*/ nullptr,
|
|
|
|
|
/*deformMatrices*/ nullptr,
|
|
|
|
|
/*deformVertsEM*/ nullptr,
|
|
|
|
|
/*deformMatricesEM*/ nullptr,
|
|
|
|
|
/*modifyMesh*/ modifyMesh,
|
|
|
|
|
/*modifyGeometrySet*/ nullptr,
|
|
|
|
|
|
|
|
|
|
/*initData*/ initData,
|
|
|
|
|
/*requiredDataMask*/ requiredDataMask,
|
|
|
|
|
/*freeData*/ nullptr,
|
|
|
|
|
/*isDisabled*/ isDisabled,
|
|
|
|
|
/*updateDepsgraph*/ updateDepsgraph,
|
|
|
|
|
/*dependsOnTime*/ nullptr,
|
|
|
|
|
/*dependsOnNormals*/ dependsOnNormals,
|
|
|
|
|
/*foreachIDLink*/ foreachIDLink,
|
|
|
|
|
/*foreachTexLink*/ nullptr,
|
|
|
|
|
/*freeRuntimeData*/ nullptr,
|
|
|
|
|
/*panelRegister*/ panelRegister,
|
|
|
|
|
/*blendWrite*/ nullptr,
|
|
|
|
|
/*blendRead*/ nullptr,
|
2015-01-09 21:19:12 +01:00
|
|
|
};
|