2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2005 Blender Foundation. All rights reserved. */
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup modifiers
|
2011-02-25 13:57:17 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-10-06 16:05:56 -05:00
|
|
|
#include <cstring>
|
2010-04-12 22:33:43 +00:00
|
|
|
|
2019-02-25 11:39:14 +01:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_bitmap.h"
|
|
|
|
|
#include "BLI_math_matrix.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_math_vector.h"
|
2019-02-25 11:39:14 +01:00
|
|
|
|
2012-04-10 14:11:45 +00:00
|
|
|
#include "DNA_image_types.h"
|
2018-04-19 11:03:58 +02:00
|
|
|
#include "DNA_mesh_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_meshdata_types.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
2012-04-10 14:11:45 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2020-04-10 14:03:36 +02:00
|
|
|
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
2011-07-11 09:15:20 +00:00
|
|
|
#include "BKE_deform.h"
|
2018-05-08 11:33:31 +02:00
|
|
|
#include "BKE_editmesh.h"
|
2012-04-10 14:11:45 +00:00
|
|
|
#include "BKE_image.h"
|
2011-07-11 09:15:20 +00:00
|
|
|
#include "BKE_lattice.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
#include "BKE_mesh.h"
|
2020-06-10 22:32:06 +10:00
|
|
|
#include "BKE_mesh_wrapper.h"
|
2018-12-14 16:07:29 +01:00
|
|
|
#include "BKE_object.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2010-04-25 01:10:03 +00:00
|
|
|
#include "BKE_modifier.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2018-05-23 15:52:35 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
#include "DEG_depsgraph_query.h"
|
|
|
|
|
|
2010-04-25 01:10:03 +00:00
|
|
|
#include "MOD_modifiertypes.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "MOD_util.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2010-04-12 22:33:43 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2018-05-08 11:33:31 +02:00
|
|
|
#include "bmesh.h"
|
|
|
|
|
|
2018-12-07 15:45:53 +01:00
|
|
|
void MOD_init_texture(MappingInfoModifierData *dmd, const ModifierEvalContext *ctx)
|
2012-04-10 14:11:45 +00:00
|
|
|
{
|
2019-03-26 11:25:07 +01:00
|
|
|
Tex *tex = dmd->texture;
|
2018-12-07 15:45:53 +01:00
|
|
|
|
2022-10-06 16:05:56 -05:00
|
|
|
if (tex == nullptr) {
|
2012-04-10 14:11:45 +00:00
|
|
|
return;
|
2018-12-07 15:45:53 +01:00
|
|
|
}
|
2012-04-10 14:11:45 +00:00
|
|
|
|
2014-01-14 04:59:58 +11:00
|
|
|
if (tex->ima && BKE_image_is_animated(tex->ima)) {
|
2019-06-17 11:39:52 +02:00
|
|
|
BKE_image_user_frame_calc(tex->ima, &tex->iuser, DEG_get_ctime(ctx->depsgraph));
|
2014-01-14 04:59:58 +11:00
|
|
|
}
|
2012-04-10 14:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* TODO: to be renamed to get_texture_coords once we are done with moving modifiers to Mesh. */
|
2018-05-07 18:14:15 +02:00
|
|
|
void MOD_get_texture_coords(MappingInfoModifierData *dmd,
|
2019-03-26 11:25:07 +01:00
|
|
|
const ModifierEvalContext *UNUSED(ctx),
|
2018-05-07 18:14:15 +02:00
|
|
|
Object *ob,
|
|
|
|
|
Mesh *mesh,
|
2018-05-08 11:57:34 +02:00
|
|
|
float (*cos)[3],
|
2018-05-07 18:14:15 +02:00
|
|
|
float (*r_texco)[3])
|
|
|
|
|
{
|
2022-03-28 12:29:47 +11:00
|
|
|
const int verts_num = mesh->totvert;
|
2018-05-07 18:14:15 +02:00
|
|
|
int i;
|
|
|
|
|
int texmapping = dmd->texmapping;
|
2020-04-10 14:03:36 +02:00
|
|
|
float mapref_imat[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
if (texmapping == MOD_DISP_MAP_OBJECT) {
|
2022-10-06 16:05:56 -05:00
|
|
|
if (dmd->map_object != nullptr) {
|
2019-03-26 11:25:07 +01:00
|
|
|
Object *map_object = dmd->map_object;
|
2020-04-10 14:03:36 +02:00
|
|
|
if (dmd->map_bone[0] != '\0') {
|
|
|
|
|
bPoseChannel *pchan = BKE_pose_channel_find_name(map_object->pose, dmd->map_bone);
|
|
|
|
|
if (pchan) {
|
|
|
|
|
float mat_bone_world[4][4];
|
|
|
|
|
mul_m4_m4m4(mat_bone_world, map_object->obmat, pchan->pose_mat);
|
|
|
|
|
invert_m4_m4(mapref_imat, mat_bone_world);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
invert_m4_m4(mapref_imat, map_object->obmat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
invert_m4_m4(mapref_imat, map_object->obmat);
|
|
|
|
|
}
|
2018-12-07 15:45:53 +01:00
|
|
|
}
|
|
|
|
|
else { /* if there is no map object, default to local */
|
2018-05-07 18:14:15 +02:00
|
|
|
texmapping = MOD_DISP_MAP_LOCAL;
|
2018-12-07 15:45:53 +01:00
|
|
|
}
|
2018-05-07 18:14:15 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
/* UVs need special handling, since they come from faces */
|
|
|
|
|
if (texmapping == MOD_DISP_MAP_UV) {
|
|
|
|
|
if (CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
|
2022-09-07 00:06:31 -05:00
|
|
|
const MPoly *mpoly = BKE_mesh_polys(mesh);
|
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
|
|
|
const MPoly *mp;
|
|
|
|
|
const MLoop *mloop = BKE_mesh_loops(mesh);
|
2022-03-28 12:29:47 +11:00
|
|
|
BLI_bitmap *done = BLI_BITMAP_NEW(verts_num, __func__);
|
|
|
|
|
const int polys_num = mesh->totpoly;
|
2018-05-07 18:14:15 +02:00
|
|
|
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
CustomData_validate_layer_name(&mesh->ldata, CD_MLOOPUV, dmd->uvlayer_name, uvname);
|
2022-10-06 16:05:56 -05:00
|
|
|
const MLoopUV *mloop_uv = static_cast<const MLoopUV *>(
|
|
|
|
|
CustomData_get_layer_named(&mesh->ldata, CD_MLOOPUV, uvname));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
/* verts are given the UV from the first face that uses them */
|
2022-03-28 12:29:47 +11:00
|
|
|
for (i = 0, mp = mpoly; i < polys_num; i++, mp++) {
|
2019-09-19 13:32:36 +10:00
|
|
|
uint fidx = mp->totloop - 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
do {
|
2019-09-19 13:32:36 +10:00
|
|
|
uint lidx = mp->loopstart + fidx;
|
|
|
|
|
uint vidx = mloop[lidx].v;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
if (!BLI_BITMAP_TEST(done, vidx)) {
|
|
|
|
|
/* remap UVs from [0, 1] to [-1, 1] */
|
|
|
|
|
r_texco[vidx][0] = (mloop_uv[lidx].uv[0] * 2.0f) - 1.0f;
|
|
|
|
|
r_texco[vidx][1] = (mloop_uv[lidx].uv[1] * 2.0f) - 1.0f;
|
|
|
|
|
BLI_BITMAP_ENABLE(done, vidx);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
} while (fidx--);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-07 18:14:15 +02:00
|
|
|
MEM_freeN(done);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-08-07 12:40:29 +02:00
|
|
|
|
|
|
|
|
/* if there are no UVs, default to local */
|
|
|
|
|
texmapping = MOD_DISP_MAP_LOCAL;
|
2018-05-07 18:14:15 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-07 00:06:31 -05:00
|
|
|
const MVert *mv = BKE_mesh_verts(mesh);
|
2022-03-28 12:29:47 +11:00
|
|
|
for (i = 0; i < verts_num; i++, mv++, r_texco++) {
|
2018-05-07 18:14:15 +02:00
|
|
|
switch (texmapping) {
|
|
|
|
|
case MOD_DISP_MAP_LOCAL:
|
2022-10-06 16:05:56 -05:00
|
|
|
copy_v3_v3(*r_texco, cos != nullptr ? *cos : mv->co);
|
2018-05-07 18:14:15 +02:00
|
|
|
break;
|
|
|
|
|
case MOD_DISP_MAP_GLOBAL:
|
2022-10-06 16:05:56 -05:00
|
|
|
mul_v3_m4v3(*r_texco, ob->obmat, cos != nullptr ? *cos : mv->co);
|
2018-05-07 18:14:15 +02:00
|
|
|
break;
|
|
|
|
|
case MOD_DISP_MAP_OBJECT:
|
2022-10-06 16:05:56 -05:00
|
|
|
mul_v3_m4v3(*r_texco, ob->obmat, cos != nullptr ? *cos : mv->co);
|
2020-04-10 14:03:36 +02:00
|
|
|
mul_m4_v3(mapref_imat, *r_texco);
|
2018-05-07 18:14:15 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2022-10-06 16:05:56 -05:00
|
|
|
if (cos != nullptr) {
|
2018-05-08 11:57:34 +02:00
|
|
|
cos++;
|
|
|
|
|
}
|
2018-05-07 18:14:15 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-12 14:29:59 +10:00
|
|
|
void MOD_previous_vcos_store(ModifierData *md, const float (*vert_coords)[3])
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
while ((md = md->next) && md->type == eModifierType_Armature) {
|
|
|
|
|
ArmatureModifierData *amd = (ArmatureModifierData *)md;
|
2022-10-06 16:05:56 -05:00
|
|
|
if (amd->multi && amd->vert_coords_prev == nullptr) {
|
|
|
|
|
amd->vert_coords_prev = static_cast<float(*)[3]>(MEM_dupallocN(vert_coords));
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2010-04-11 22:12:30 +00:00
|
|
|
break;
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
/* lattice/mesh modifier too */
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 17:21:16 +01:00
|
|
|
Mesh *MOD_deform_mesh_eval_get(Object *ob,
|
2018-05-12 08:21:07 +02:00
|
|
|
struct BMEditMesh *em,
|
|
|
|
|
Mesh *mesh,
|
2020-06-12 14:29:59 +10:00
|
|
|
const float (*vertexCos)[3],
|
2022-03-28 12:29:47 +11:00
|
|
|
const int verts_num,
|
2018-11-27 17:21:16 +01:00
|
|
|
const bool use_orco)
|
2018-05-08 11:33:31 +02:00
|
|
|
{
|
2022-10-06 16:05:56 -05:00
|
|
|
if (mesh != nullptr) {
|
2018-05-08 11:33:31 +02:00
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (ob->type == OB_MESH) {
|
2018-05-14 14:34:00 +02:00
|
|
|
if (em) {
|
2022-10-06 16:05:56 -05:00
|
|
|
mesh = BKE_mesh_wrapper_from_editmesh_with_coords(
|
|
|
|
|
em, nullptr, vertexCos, static_cast<const Mesh *>(ob->data));
|
2018-05-14 14:34:00 +02:00
|
|
|
}
|
2018-05-08 11:33:31 +02:00
|
|
|
else {
|
2018-05-09 17:37:54 +02:00
|
|
|
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
|
|
|
|
|
* we really need a copy here. Maybe the CoW ob->data can be directly used. */
|
2018-12-14 16:07:29 +01:00
|
|
|
Mesh *mesh_prior_modifiers = BKE_object_get_pre_modified_mesh(ob);
|
2022-10-06 16:05:56 -05:00
|
|
|
mesh = (Mesh *)BKE_id_copy_ex(nullptr,
|
2020-10-07 14:27:33 +02:00
|
|
|
&mesh_prior_modifiers->id,
|
2022-10-06 16:05:56 -05:00
|
|
|
nullptr,
|
2020-10-07 14:27:33 +02:00
|
|
|
(LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_CD_REFERENCE));
|
2018-05-15 13:26:24 +02:00
|
|
|
mesh->runtime.deformed_only = 1;
|
2018-05-08 11:33:31 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-10-06 16:05:56 -05:00
|
|
|
if (em != nullptr) {
|
2020-05-25 20:16:42 +10:00
|
|
|
/* pass */
|
|
|
|
|
}
|
2018-05-09 17:37:54 +02:00
|
|
|
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
|
|
|
|
|
* we really need vertexCos here. */
|
2020-05-25 20:16:42 +10:00
|
|
|
else if (vertexCos) {
|
2019-08-22 06:28:35 +10:00
|
|
|
BKE_mesh_vert_coords_apply(mesh, vertexCos);
|
2018-05-08 11:33:31 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-08 11:33:31 +02:00
|
|
|
if (use_orco) {
|
2021-11-22 12:04:37 +01:00
|
|
|
BKE_mesh_orco_ensure(ob, mesh);
|
2018-05-08 11:33:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-02-18 09:50:29 -06:00
|
|
|
else if (ELEM(ob->type, OB_FONT, OB_CURVES_LEGACY, OB_SURF)) {
|
2019-05-01 07:40:07 +10:00
|
|
|
/* TODO(sybren): get evaluated mesh from depsgraph once
|
|
|
|
|
* that's properly generated for curves. */
|
2018-05-08 17:28:43 +02:00
|
|
|
mesh = BKE_mesh_new_nomain_from_curve(ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-10 09:45:25 +10:00
|
|
|
/* Currently, that may not be the case every time
|
2019-05-01 07:40:07 +10:00
|
|
|
* (texts e.g. tend to give issues,
|
|
|
|
|
* also when deforming curve points instead of generated curve geometry... ). */
|
2022-10-06 16:05:56 -05:00
|
|
|
if (mesh != nullptr && mesh->totvert != verts_num) {
|
|
|
|
|
BKE_id_free(nullptr, mesh);
|
|
|
|
|
mesh = nullptr;
|
2018-11-27 17:21:16 +01:00
|
|
|
}
|
2018-05-08 11:33:31 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-25 20:16:42 +10:00
|
|
|
if (mesh && mesh->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) {
|
2022-03-28 12:29:47 +11:00
|
|
|
BLI_assert(mesh->totvert == verts_num);
|
2020-05-25 20:16:42 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-08 11:33:31 +02:00
|
|
|
return mesh;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-29 19:02:19 +02:00
|
|
|
void MOD_get_vgroup(
|
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
|
|
|
Object *ob, struct Mesh *mesh, const char *name, const MDeformVert **dvert, int *defgrp_index)
|
2018-04-19 11:03:58 +02:00
|
|
|
{
|
2021-07-13 12:10:34 -04:00
|
|
|
if (mesh) {
|
|
|
|
|
*defgrp_index = BKE_id_defgroup_name_index(&mesh->id, name);
|
|
|
|
|
if (*defgrp_index != -1) {
|
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
|
|
|
*dvert = BKE_mesh_deform_verts(mesh);
|
2021-07-13 12:10:34 -04:00
|
|
|
}
|
|
|
|
|
else {
|
2022-10-06 16:05:56 -05:00
|
|
|
*dvert = nullptr;
|
2021-07-13 12:10:34 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*defgrp_index = BKE_object_defgroup_name_index(ob, name);
|
|
|
|
|
if (*defgrp_index != -1 && ob->type == OB_LATTICE) {
|
2018-04-19 11:03:58 +02:00
|
|
|
*dvert = BKE_lattice_deform_verts_get(ob);
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
2021-07-13 12:10:34 -04:00
|
|
|
else {
|
2022-10-06 16:05:56 -05:00
|
|
|
*dvert = nullptr;
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
2018-04-19 11:03:58 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 22:00:21 +02:00
|
|
|
void MOD_depsgraph_update_object_bone_relation(struct DepsNodeHandle *node,
|
|
|
|
|
Object *object,
|
|
|
|
|
const char *bonename,
|
|
|
|
|
const char *description)
|
|
|
|
|
{
|
2022-10-06 16:05:56 -05:00
|
|
|
if (object == nullptr) {
|
2020-04-10 22:00:21 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (bonename[0] != '\0' && object->type == OB_ARMATURE) {
|
|
|
|
|
DEG_add_object_relation(node, object, DEG_OB_COMP_EVAL_POSE, description);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, description);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-14 06:29:17 +00:00
|
|
|
void modifier_type_init(ModifierTypeInfo *types[])
|
2010-04-25 01:10:03 +00:00
|
|
|
{
|
|
|
|
|
#define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName)
|
|
|
|
|
INIT_TYPE(None);
|
|
|
|
|
INIT_TYPE(Curve);
|
|
|
|
|
INIT_TYPE(Lattice);
|
|
|
|
|
INIT_TYPE(Subsurf);
|
|
|
|
|
INIT_TYPE(Build);
|
|
|
|
|
INIT_TYPE(Array);
|
|
|
|
|
INIT_TYPE(Mirror);
|
|
|
|
|
INIT_TYPE(EdgeSplit);
|
|
|
|
|
INIT_TYPE(Bevel);
|
|
|
|
|
INIT_TYPE(Displace);
|
|
|
|
|
INIT_TYPE(UVProject);
|
|
|
|
|
INIT_TYPE(Decimate);
|
|
|
|
|
INIT_TYPE(Smooth);
|
|
|
|
|
INIT_TYPE(Cast);
|
|
|
|
|
INIT_TYPE(Wave);
|
|
|
|
|
INIT_TYPE(Armature);
|
|
|
|
|
INIT_TYPE(Hook);
|
|
|
|
|
INIT_TYPE(Softbody);
|
|
|
|
|
INIT_TYPE(Cloth);
|
|
|
|
|
INIT_TYPE(Collision);
|
|
|
|
|
INIT_TYPE(Boolean);
|
|
|
|
|
INIT_TYPE(MeshDeform);
|
2011-11-13 12:17:27 +00:00
|
|
|
INIT_TYPE(Ocean);
|
2010-04-25 01:10:03 +00:00
|
|
|
INIT_TYPE(ParticleSystem);
|
|
|
|
|
INIT_TYPE(ParticleInstance);
|
|
|
|
|
INIT_TYPE(Explode);
|
|
|
|
|
INIT_TYPE(Shrinkwrap);
|
|
|
|
|
INIT_TYPE(Mask);
|
|
|
|
|
INIT_TYPE(SimpleDeform);
|
|
|
|
|
INIT_TYPE(Multires);
|
|
|
|
|
INIT_TYPE(Surface);
|
2019-12-16 15:50:14 +01:00
|
|
|
INIT_TYPE(Fluid);
|
2010-04-25 01:10:03 +00:00
|
|
|
INIT_TYPE(ShapeKey);
|
|
|
|
|
INIT_TYPE(Solidify);
|
|
|
|
|
INIT_TYPE(Screw);
|
2011-05-01 15:16:59 +00:00
|
|
|
INIT_TYPE(Warp);
|
2011-07-25 15:27:01 +00:00
|
|
|
INIT_TYPE(WeightVGEdit);
|
|
|
|
|
INIT_TYPE(WeightVGMix);
|
|
|
|
|
INIT_TYPE(WeightVGProximity);
|
2011-05-24 07:08:58 +00:00
|
|
|
INIT_TYPE(DynamicPaint);
|
2011-12-30 21:11:40 +00:00
|
|
|
INIT_TYPE(Remesh);
|
2012-05-22 15:29:01 +00:00
|
|
|
INIT_TYPE(Skin);
|
2012-10-24 10:39:11 +00:00
|
|
|
INIT_TYPE(LaplacianSmooth);
|
2012-11-19 20:40:08 +00:00
|
|
|
INIT_TYPE(Triangulate);
|
2012-12-14 04:07:30 +00:00
|
|
|
INIT_TYPE(UVWarp);
|
2013-01-21 15:41:00 +00:00
|
|
|
INIT_TYPE(MeshCache);
|
2013-11-24 07:00:49 +11:00
|
|
|
INIT_TYPE(LaplacianDeform);
|
2013-12-22 07:08:35 +11:00
|
|
|
INIT_TYPE(Wireframe);
|
2019-12-11 22:31:20 -03:00
|
|
|
INIT_TYPE(Weld);
|
2015-01-09 21:19:12 +01:00
|
|
|
INIT_TYPE(DataTransfer);
|
2015-02-05 14:49:44 +01:00
|
|
|
INIT_TYPE(NormalEdit);
|
2015-03-29 04:44:05 +11:00
|
|
|
INIT_TYPE(CorrectiveSmooth);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
INIT_TYPE(MeshSequenceCache);
|
2017-02-27 12:39:14 -03:00
|
|
|
INIT_TYPE(SurfaceDeform);
|
2018-05-25 22:24:24 +05:30
|
|
|
INIT_TYPE(WeightedNormal);
|
2020-09-29 16:02:40 +02:00
|
|
|
INIT_TYPE(MeshToVolume);
|
2020-10-07 18:03:07 +02:00
|
|
|
INIT_TYPE(VolumeDisplace);
|
2020-10-19 12:11:38 +02:00
|
|
|
INIT_TYPE(VolumeToMesh);
|
2020-12-02 13:25:25 +01:00
|
|
|
INIT_TYPE(Nodes);
|
2010-04-25 01:10:03 +00:00
|
|
|
#undef INIT_TYPE
|
|
|
|
|
}
|