2011-05-01 15:16:59 +00:00
|
|
|
/*
|
2011-10-23 17:52:20 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-05-09 17:14:35 +10:00
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2011-10-23 17:52:20 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup modifiers
|
2011-09-22 12:00:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2019-02-25 11:39:14 +01:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_math.h"
|
|
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BLT_translation.h"
|
|
|
|
|
|
2020-10-01 09:38:00 -05:00
|
|
|
#include "DNA_defaults.h"
|
2018-05-08 18:41:43 +02:00
|
|
|
#include "DNA_mesh_types.h"
|
2012-04-30 08:24:44 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2018-05-08 18:41:43 +02:00
|
|
|
#include "DNA_object_types.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "DNA_screen_types.h"
|
2012-04-30 08:24:44 +00:00
|
|
|
|
2020-04-01 18:54:34 +11:00
|
|
|
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_colortools.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BKE_context.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_deform.h"
|
2018-05-08 18:41:43 +02:00
|
|
|
#include "BKE_editmesh.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
|
|
|
|
#include "BKE_lib_query.h"
|
2018-05-08 18:41:43 +02:00
|
|
|
#include "BKE_mesh.h"
|
2020-06-10 22:32:06 +10:00
|
|
|
#include "BKE_mesh_wrapper.h"
|
2011-05-01 15:16:59 +00:00
|
|
|
#include "BKE_modifier.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BKE_screen.h"
|
2011-05-01 15:16:59 +00:00
|
|
|
#include "BKE_texture.h"
|
|
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
|
2020-06-23 16:42:00 +02:00
|
|
|
#include "BLO_read_write.h"
|
|
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
2018-05-23 15:52:35 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
2018-06-22 15:03:42 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
2018-05-23 15:52:35 +02:00
|
|
|
|
2020-11-09 15:42:38 +01:00
|
|
|
#include "RE_texture.h"
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "MOD_ui_common.h"
|
2011-05-01 15:16:59 +00:00
|
|
|
#include "MOD_util.h"
|
|
|
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-01 09:38:00 -05:00
|
|
|
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(wmd, modifier));
|
|
|
|
|
|
|
|
|
|
MEMCPY_STRUCT_AFTER(wmd, DNA_struct_default_get(WarpModifierData), modifier);
|
|
|
|
|
|
2019-08-07 03:21:55 +10:00
|
|
|
wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-04 12:45:30 +02:00
|
|
|
static void copyData(const ModifierData *md, ModifierData *target, const int flag)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2018-05-08 15:04:10 +02:00
|
|
|
const WarpModifierData *wmd = (const WarpModifierData *)md;
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *twmd = (WarpModifierData *)target;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2020-05-08 10:14:02 +02:00
|
|
|
BKE_modifier_copydata_generic(md, target, flag);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2019-08-07 03:21:55 +10:00
|
|
|
twmd->curfalloff = BKE_curvemapping_copy(wmd->curfalloff);
|
2011-05-01 15:16:59 +00: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
|
|
|
static void requiredDataMask(Object *UNUSED(ob),
|
|
|
|
|
ModifierData *md,
|
|
|
|
|
CustomData_MeshMasks *r_cddata_masks)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
|
|
|
|
|
|
|
|
|
/* ask for vertexgroups if we need them */
|
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 (wmd->defgrp_name[0] != '\0') {
|
|
|
|
|
r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
|
|
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
|
/* ask for UV coordinates if we need them */
|
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 (wmd->texmapping == MOD_DISP_MAP_UV) {
|
|
|
|
|
r_cddata_masks->fmask |= CD_MASK_MTFACE;
|
|
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-01 18:54:34 +11:00
|
|
|
static void matrix_from_obj_pchan(float mat[4][4],
|
|
|
|
|
const float obinv[4][4],
|
|
|
|
|
Object *ob,
|
|
|
|
|
const char *bonename)
|
2020-03-27 10:27:00 +01:00
|
|
|
{
|
|
|
|
|
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename);
|
|
|
|
|
if (pchan) {
|
2020-03-29 18:56:59 +11:00
|
|
|
float mat_bone_world[4][4];
|
|
|
|
|
mul_m4_m4m4(mat_bone_world, ob->obmat, pchan->pose_mat);
|
|
|
|
|
mul_m4_m4m4(mat, obinv, mat_bone_world);
|
2020-03-27 10:27:00 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mul_m4_m4m4(mat, obinv, ob->obmat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-19 14:34:01 +02:00
|
|
|
static bool dependsOnTime(struct Scene *UNUSED(scene),
|
|
|
|
|
ModifierData *md,
|
|
|
|
|
const int UNUSED(dag_eval_mode))
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wmd->texture) {
|
2011-05-01 15:16:59 +00:00
|
|
|
return BKE_texture_dependsOnTime(wmd->texture);
|
|
|
|
|
}
|
2020-08-07 12:40:29 +02:00
|
|
|
|
|
|
|
|
return false;
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void freeData(ModifierData *md)
|
|
|
|
|
{
|
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_free(wmd->curfalloff);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-10 12:14:08 +02:00
|
|
|
static bool isDisabled(const struct Scene *UNUSED(scene),
|
|
|
|
|
ModifierData *md,
|
|
|
|
|
bool UNUSED(userRenderParams))
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
|
return !(wmd->object_from && wmd->object_to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
|
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2017-01-31 09:47:59 +01:00
|
|
|
walk(userData, ob, (ID **)&wmd->texture, IDWALK_CB_USER);
|
2020-10-01 18:05:23 +02:00
|
|
|
walk(userData, ob, (ID **)&wmd->object_from, IDWALK_CB_NOP);
|
|
|
|
|
walk(userData, ob, (ID **)&wmd->object_to, IDWALK_CB_NOP);
|
|
|
|
|
walk(userData, ob, (ID **)&wmd->map_object, IDWALK_CB_NOP);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2011-08-12 18:11:22 +00:00
|
|
|
static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData)
|
|
|
|
|
{
|
|
|
|
|
walk(userData, ob, md, "texture");
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2020-04-11 17:12:56 +02:00
|
|
|
bool need_transform_relation = false;
|
2020-03-27 10:27:00 +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
|
|
|
if (wmd->object_from != NULL && wmd->object_to != NULL) {
|
2020-04-10 22:00:21 +02:00
|
|
|
MOD_depsgraph_update_object_bone_relation(
|
|
|
|
|
ctx->node, wmd->object_from, wmd->bone_from, "Warp Modifier");
|
|
|
|
|
MOD_depsgraph_update_object_bone_relation(
|
|
|
|
|
ctx->node, wmd->object_to, wmd->bone_to, "Warp Modifier");
|
2020-04-11 17:12:56 +02:00
|
|
|
need_transform_relation = true;
|
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
|
|
|
}
|
2020-03-27 10:27:00 +01:00
|
|
|
|
2018-12-05 17:35:13 +01:00
|
|
|
if (wmd->texture != NULL) {
|
|
|
|
|
DEG_add_generic_id_relation(ctx->node, &wmd->texture->id, "Warp Modifier");
|
2020-04-11 17:12:56 +02:00
|
|
|
|
|
|
|
|
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
|
|
|
|
MOD_depsgraph_update_object_bone_relation(
|
|
|
|
|
ctx->node, wmd->map_object, wmd->map_bone, "Warp Modifier");
|
|
|
|
|
need_transform_relation = true;
|
|
|
|
|
}
|
|
|
|
|
else if (wmd->texmapping == MOD_DISP_MAP_GLOBAL) {
|
|
|
|
|
need_transform_relation = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (need_transform_relation) {
|
|
|
|
|
DEG_add_modifier_to_transform_relation(ctx->node, "Warp Modifier");
|
2018-12-05 17:35:13 +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
|
|
|
}
|
|
|
|
|
|
2018-05-12 08:04:56 +02:00
|
|
|
static void warpModifier_do(WarpModifierData *wmd,
|
2018-05-23 15:52:35 +02:00
|
|
|
const ModifierEvalContext *ctx,
|
2018-05-12 08:21:07 +02:00
|
|
|
Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2018-05-23 15:52:35 +02:00
|
|
|
Object *ob = ctx->object;
|
2011-05-01 15:16:59 +00:00
|
|
|
float obinv[4][4];
|
|
|
|
|
float mat_from[4][4];
|
|
|
|
|
float mat_from_inv[4][4];
|
|
|
|
|
float mat_to[4][4];
|
|
|
|
|
float mat_unit[4][4];
|
|
|
|
|
float mat_final[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
float tmat[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 17:18:10 +01:00
|
|
|
const float falloff_radius_sq = square_f(wmd->falloff_radius);
|
2011-05-01 15:16:59 +00:00
|
|
|
float strength = wmd->strength;
|
|
|
|
|
float fac = 1.0f, weight;
|
|
|
|
|
int i;
|
2011-07-11 09:15:20 +00:00
|
|
|
int defgrp_index;
|
2012-05-06 13:38:33 +00:00
|
|
|
MDeformVert *dvert, *dv = NULL;
|
2020-02-03 12:01:13 +01:00
|
|
|
const bool invert_vgroup = (wmd->flag & MOD_WARP_INVERT_VGROUP) != 0;
|
2012-05-06 13:38:33 +00:00
|
|
|
float(*tex_co)[3] = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:15:10 +10:00
|
|
|
if (!(wmd->object_from && wmd->object_to)) {
|
2011-05-01 15:16:59 +00:00
|
|
|
return;
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-29 19:02:19 +02:00
|
|
|
MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
|
2015-02-03 04:38:59 +11:00
|
|
|
if (dvert == NULL) {
|
|
|
|
|
defgrp_index = -1;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:15:10 +10:00
|
|
|
if (wmd->curfalloff == NULL) { /* should never happen, but bad lib linking could cause it */
|
2019-08-07 03:21:55 +10:00
|
|
|
wmd->curfalloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
2019-04-22 09:15:10 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-21 14:43:51 +00:00
|
|
|
if (wmd->curfalloff) {
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(wmd->curfalloff);
|
2012-08-21 14:43:51 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
invert_m4_m4(obinv, ob->obmat);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-27 10:27:00 +01:00
|
|
|
/* Checks that the objects/bones are available. */
|
|
|
|
|
matrix_from_obj_pchan(mat_from, obinv, wmd->object_from, wmd->bone_from);
|
|
|
|
|
matrix_from_obj_pchan(mat_to, obinv, wmd->object_to, wmd->bone_to);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
invert_m4_m4(tmat, mat_from); // swap?
|
2013-05-26 18:36:25 +00:00
|
|
|
mul_m4_m4m4(mat_final, tmat, mat_to);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
invert_m4_m4(mat_from_inv, mat_from);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
unit_m4(mat_unit);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (strength < 0.0f) {
|
2011-05-01 16:07:18 +00:00
|
|
|
float loc[3];
|
2011-05-01 15:16:59 +00:00
|
|
|
strength = -strength;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 16:07:18 +00:00
|
|
|
/* inverted location is not useful, just use the negative */
|
|
|
|
|
copy_v3_v3(loc, mat_final[3]);
|
2011-05-01 15:16:59 +00:00
|
|
|
invert_m4(mat_final);
|
2011-05-01 16:07:18 +00:00
|
|
|
negate_v3_v3(mat_final[3], loc);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
2012-05-06 13:38:33 +00:00
|
|
|
weight = strength;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 11:25:07 +01:00
|
|
|
Tex *tex_target = wmd->texture;
|
2018-12-07 15:45:53 +01:00
|
|
|
if (mesh != NULL && tex_target != NULL) {
|
2018-01-14 22:14:20 +01:00
|
|
|
tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co");
|
2018-12-07 15:45:53 +01:00
|
|
|
MOD_get_texture_coords((MappingInfoModifierData *)wmd, ctx, ob, mesh, vertexCos, tex_co);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-07 15:45:53 +01:00
|
|
|
MOD_init_texture((MappingInfoModifierData *)wmd, ctx);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
for (i = 0; i < numVerts; i++) {
|
2011-05-01 15:16:59 +00:00
|
|
|
float *co = vertexCos[i];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-03 21:35:04 +00:00
|
|
|
if (wmd->falloff_type == eWarp_Falloff_None ||
|
2015-02-03 04:35:02 +11:00
|
|
|
((fac = len_squared_v3v3(co, mat_from[3])) < falloff_radius_sq &&
|
|
|
|
|
(fac = (wmd->falloff_radius - sqrtf(fac)) / wmd->falloff_radius))) {
|
2011-05-01 15:16:59 +00:00
|
|
|
/* skip if no vert group found */
|
2015-02-03 04:38:59 +11:00
|
|
|
if (defgrp_index != -1) {
|
2011-07-11 09:15:20 +00:00
|
|
|
dv = &dvert[i];
|
2020-09-19 14:08:38 +10:00
|
|
|
weight = (invert_vgroup ? (1.0f - BKE_defvert_find_weight(dv, defgrp_index)) :
|
|
|
|
|
BKE_defvert_find_weight(dv, defgrp_index)) *
|
|
|
|
|
strength;
|
2015-02-03 04:38:59 +11:00
|
|
|
if (weight <= 0.0f) {
|
|
|
|
|
continue;
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
/* closely match PROP_SMOOTH and similar */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (wmd->falloff_type) {
|
2012-05-06 13:38:33 +00:00
|
|
|
case eWarp_Falloff_None:
|
|
|
|
|
fac = 1.0f;
|
|
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Curve:
|
2019-08-07 03:21:55 +10:00
|
|
|
fac = BKE_curvemapping_evaluateF(wmd->curfalloff, 0, fac);
|
2012-05-06 13:38:33 +00:00
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Sharp:
|
|
|
|
|
fac = fac * fac;
|
|
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Smooth:
|
|
|
|
|
fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
|
|
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Root:
|
2014-03-28 14:53:37 +11:00
|
|
|
fac = sqrtf(fac);
|
2012-05-06 13:38:33 +00:00
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Linear:
|
|
|
|
|
/* pass */
|
|
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Const:
|
|
|
|
|
fac = 1.0f;
|
|
|
|
|
break;
|
|
|
|
|
case eWarp_Falloff_Sphere:
|
2014-03-28 14:53:37 +11:00
|
|
|
fac = sqrtf(2 * fac - fac * fac);
|
2012-05-06 13:38:33 +00:00
|
|
|
break;
|
2015-02-04 05:35:09 +11:00
|
|
|
case eWarp_Falloff_InvSquare:
|
|
|
|
|
fac = fac * (2.0f - fac);
|
|
|
|
|
break;
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
fac *= weight;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (tex_co) {
|
2018-06-22 15:03:42 +02:00
|
|
|
struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
|
2011-05-01 15:16:59 +00:00
|
|
|
TexResult texres;
|
|
|
|
|
texres.nor = NULL;
|
2018-12-07 15:45:53 +01:00
|
|
|
BKE_texture_get_value(scene, tex_target, tex_co[i], &texres, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
fac *= texres.tin;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-03 04:26:31 +11:00
|
|
|
if (fac != 0.0f) {
|
|
|
|
|
/* into the 'from' objects space */
|
|
|
|
|
mul_m4_v3(mat_from_inv, co);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-03 04:26:31 +11:00
|
|
|
if (fac == 1.0f) {
|
|
|
|
|
mul_m4_v3(mat_final, co);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-02-03 04:26:31 +11:00
|
|
|
if (wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
|
|
|
|
|
/* interpolate the matrix for nicer locations */
|
|
|
|
|
blend_m4_m4m4(tmat, mat_unit, mat_final, fac);
|
|
|
|
|
mul_m4_v3(tmat, co);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
float tvec[3];
|
|
|
|
|
mul_v3_m4v3(tvec, mat_final, co);
|
|
|
|
|
interp_v3_v3v3(co, co, tvec, fac);
|
|
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-03 04:26:31 +11:00
|
|
|
/* out of the 'from' objects space */
|
|
|
|
|
mul_m4_v3(mat_from, co);
|
|
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-08 18:41:43 +02:00
|
|
|
if (tex_co) {
|
2011-05-01 15:16:59 +00:00
|
|
|
MEM_freeN(tex_co);
|
2018-05-08 18:41:43 +02:00
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-05-12 08:04:56 +02:00
|
|
|
static void deformVerts(ModifierData *md,
|
2018-05-12 08:21:07 +02:00
|
|
|
const ModifierEvalContext *ctx,
|
|
|
|
|
Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2018-11-27 15:11:13 +01:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
|
|
|
|
Mesh *mesh_src = NULL;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2018-11-27 20:10:41 +01:00
|
|
|
if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) {
|
|
|
|
|
/* mesh_src is only needed for vgroups and textures. */
|
2018-11-27 17:21:16 +01:00
|
|
|
mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-27 15:11:13 +01:00
|
|
|
warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2018-11-27 15:11:13 +01:00
|
|
|
if (!ELEM(mesh_src, NULL, mesh)) {
|
|
|
|
|
BKE_id_free(NULL, mesh_src);
|
|
|
|
|
}
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-05-12 08:04:56 +02:00
|
|
|
static void deformVertsEM(ModifierData *md,
|
2018-05-12 08:21:07 +02:00
|
|
|
const ModifierEvalContext *ctx,
|
|
|
|
|
struct BMEditMesh *em,
|
|
|
|
|
Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2018-11-27 15:11:13 +01:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
2018-11-27 20:10:41 +01:00
|
|
|
Mesh *mesh_src = NULL;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2018-11-27 20:10:41 +01:00
|
|
|
if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) {
|
|
|
|
|
/* mesh_src is only needed for vgroups and textures. */
|
|
|
|
|
mesh_src = MOD_deform_mesh_eval_get(ctx->object, em, mesh, NULL, numVerts, false, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
2020-05-25 20:16:42 +10:00
|
|
|
/* TODO(Campbell): use edit-mode data only (remove this line). */
|
|
|
|
|
if (mesh_src != NULL) {
|
|
|
|
|
BKE_mesh_wrapper_ensure_mdata(mesh_src);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 15:11:13 +01:00
|
|
|
warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2018-11-27 15:11:13 +01:00
|
|
|
if (!ELEM(mesh_src, NULL, mesh)) {
|
2018-05-08 18:41:43 +02:00
|
|
|
BKE_id_free(NULL, mesh_src);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *col;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, true);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "object_from", 0, NULL, ICON_NONE);
|
|
|
|
|
PointerRNA from_obj_ptr = RNA_pointer_get(ptr, "object_from");
|
2020-06-05 10:41:03 -04:00
|
|
|
if (!RNA_pointer_is_null(&from_obj_ptr) && RNA_enum_get(&from_obj_ptr, "type") == OB_ARMATURE) {
|
|
|
|
|
|
|
|
|
|
PointerRNA from_obj_data_ptr = RNA_pointer_get(&from_obj_ptr, "data");
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(col, ptr, "bone_from", &from_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, true);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "object_to", 0, NULL, ICON_NONE);
|
|
|
|
|
PointerRNA to_obj_ptr = RNA_pointer_get(ptr, "object_to");
|
2020-06-05 10:41:03 -04:00
|
|
|
if (!RNA_pointer_is_null(&to_obj_ptr) && RNA_enum_get(&to_obj_ptr, "type") == OB_ARMATURE) {
|
|
|
|
|
PointerRNA to_obj_data_ptr = RNA_pointer_get(&to_obj_ptr, "data");
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(col, ptr, "bone_to", &to_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "use_volume_preserve", 0, NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "strength", 0, NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL);
|
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
|
|
|
}
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
static void falloff_panel_draw(const bContext *UNUSED(C), Panel *panel)
|
2020-06-05 10:41:03 -04:00
|
|
|
{
|
|
|
|
|
uiLayout *layout = panel->layout;
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
bool use_falloff = (RNA_enum_get(ptr, "falloff_type") != eWarp_Falloff_None);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "falloff_type", 0, NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
if (use_falloff) {
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "falloff_radius", 0, NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
if (use_falloff && RNA_enum_get(ptr, "falloff_type") == eWarp_Falloff_Curve) {
|
|
|
|
|
uiTemplateCurveMapping(layout, ptr, "falloff_curve", 0, false, false, false, false);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void texture_panel_draw(const bContext *C, Panel *panel)
|
|
|
|
|
{
|
UI: Small Tweaks to Modifier Layouts for Consistency
These changes are smaller, made based on feedback and a pass on all
the layouts for clarity and consistency. The Multires modifier UI will
be addressed in a separate patch. Here is an overview of the changes:
Renaming Options:
- Build: "Start" -> "Start Frame"
- Curve: "From Radius" -> "Size from Radius"
- Screw: "Calc Order" -> "Calculate Order"
- Displace, Warp, Wave: "Texture Coordinates Object" -> "Object"
Move Mode Toggle to Top & Expand:
- Bevel, Boolean, Normal Edit, Subdivision
Use Columns for Tighter Spacing:
- Displace, Explode, Ocean, Particle Instance, Remesh, Shrinkwrap,
Solidify, Warp, Weighted Normal, Wave
Misc:
- Bevel: Set inactive properties for vertex bevel
- Mesh Sequence Cache: Remove box for cache file
- Skin: Don't align "Mark Loose" and "Clear Loose"
- Array: Expand relative offset subpanel by default
- Array: Move start cap, end cap to a new subpanel
- Bevel: Move width type above width
Differential Revision: https://developer.blender.org/D8115
2020-07-02 10:47:02 -04:00
|
|
|
uiLayout *col;
|
2020-06-05 10:41:03 -04:00
|
|
|
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
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
int texture_coords = RNA_enum_get(ptr, "texture_coords");
|
2020-06-05 10:41:03 -04:00
|
|
|
|
2021-01-13 15:08:09 +01:00
|
|
|
uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
|
UI: Small Tweaks to Modifier Layouts for Consistency
These changes are smaller, made based on feedback and a pass on all
the layouts for clarity and consistency. The Multires modifier UI will
be addressed in a separate patch. Here is an overview of the changes:
Renaming Options:
- Build: "Start" -> "Start Frame"
- Curve: "From Radius" -> "Size from Radius"
- Screw: "Calc Order" -> "Calculate Order"
- Displace, Warp, Wave: "Texture Coordinates Object" -> "Object"
Move Mode Toggle to Top & Expand:
- Bevel, Boolean, Normal Edit, Subdivision
Use Columns for Tighter Spacing:
- Displace, Explode, Ocean, Particle Instance, Remesh, Shrinkwrap,
Solidify, Warp, Weighted Normal, Wave
Misc:
- Bevel: Set inactive properties for vertex bevel
- Mesh Sequence Cache: Remove box for cache file
- Skin: Don't align "Mark Loose" and "Clear Loose"
- Array: Expand relative offset subpanel by default
- Array: Move start cap, end cap to a new subpanel
- Bevel: Move width type above width
Differential Revision: https://developer.blender.org/D8115
2020-07-02 10:47:02 -04:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
if (texture_coords == MOD_DISP_MAP_OBJECT) {
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "texture_coords_object", 0, IFACE_("Object"), ICON_NONE);
|
|
|
|
|
PointerRNA texture_coords_obj_ptr = RNA_pointer_get(ptr, "texture_coords_object");
|
2020-06-05 10:41:03 -04:00
|
|
|
if (!RNA_pointer_is_null(&texture_coords_obj_ptr) &&
|
|
|
|
|
(RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) {
|
|
|
|
|
PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data");
|
UI: Small Tweaks to Modifier Layouts for Consistency
These changes are smaller, made based on feedback and a pass on all
the layouts for clarity and consistency. The Multires modifier UI will
be addressed in a separate patch. Here is an overview of the changes:
Renaming Options:
- Build: "Start" -> "Start Frame"
- Curve: "From Radius" -> "Size from Radius"
- Screw: "Calc Order" -> "Calculate Order"
- Displace, Warp, Wave: "Texture Coordinates Object" -> "Object"
Move Mode Toggle to Top & Expand:
- Bevel, Boolean, Normal Edit, Subdivision
Use Columns for Tighter Spacing:
- Displace, Explode, Ocean, Particle Instance, Remesh, Shrinkwrap,
Solidify, Warp, Weighted Normal, Wave
Misc:
- Bevel: Set inactive properties for vertex bevel
- Mesh Sequence Cache: Remove box for cache file
- Skin: Don't align "Mark Loose" and "Clear Loose"
- Array: Expand relative offset subpanel by default
- Array: Move start cap, end cap to a new subpanel
- Bevel: Move width type above width
Differential Revision: https://developer.blender.org/D8115
2020-07-02 10:47:02 -04:00
|
|
|
uiItemPointerR(col,
|
2020-09-02 14:13:26 -05:00
|
|
|
ptr,
|
2020-06-05 10:41:03 -04:00
|
|
|
"texture_coords_bone",
|
|
|
|
|
&texture_coords_obj_data_ptr,
|
|
|
|
|
"bones",
|
|
|
|
|
IFACE_("Bone"),
|
|
|
|
|
ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) {
|
|
|
|
|
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(col, ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, 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_Warp, panel_draw);
|
|
|
|
|
modifier_subpanel_register(
|
|
|
|
|
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
|
|
|
|
|
modifier_subpanel_register(
|
|
|
|
|
region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 16:42:00 +02:00
|
|
|
static void blendWrite(BlendWriter *writer, const ModifierData *md)
|
|
|
|
|
{
|
|
|
|
|
const WarpModifierData *tmd = (const WarpModifierData *)md;
|
|
|
|
|
|
|
|
|
|
if (tmd->curfalloff) {
|
|
|
|
|
BKE_curvemapping_blend_write(writer, tmd->curfalloff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void blendRead(BlendDataReader *reader, ModifierData *md)
|
|
|
|
|
{
|
|
|
|
|
WarpModifierData *tmd = (WarpModifierData *)md;
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &tmd->curfalloff);
|
|
|
|
|
if (tmd->curfalloff) {
|
|
|
|
|
BKE_curvemapping_blend_read(reader, tmd->curfalloff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
ModifierTypeInfo modifierType_Warp = {
|
2012-10-24 05:45:54 +00:00
|
|
|
/* name */ "Warp",
|
|
|
|
|
/* structName */ "WarpModifierData",
|
|
|
|
|
/* structSize */ sizeof(WarpModifierData),
|
2020-09-25 12:49:18 +02:00
|
|
|
/* srna */ &RNA_WarpModifier,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* type */ eModifierTypeType_OnlyDeform,
|
2020-04-21 13:09:41 +02:00
|
|
|
/* flags */ eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_AcceptsVertexCosOnly |
|
2012-10-24 05:45:54 +00:00
|
|
|
eModifierTypeFlag_SupportsEditmode,
|
2020-09-25 12:45:30 +02:00
|
|
|
/* icon */ ICON_MOD_WARP,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* copyData */ copyData,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-08 18:41:43 +02:00
|
|
|
/* deformVerts */ deformVerts,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* deformMatrices */ NULL,
|
2018-05-08 18:41:43 +02:00
|
|
|
/* deformVertsEM */ deformVertsEM,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* deformMatricesEM */ NULL,
|
2020-04-21 13:09:41 +02:00
|
|
|
/* modifyMesh */ NULL,
|
|
|
|
|
/* modifyHair */ NULL,
|
2020-12-10 14:35:02 +01:00
|
|
|
/* modifyGeometrySet */ NULL,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-24 05:45:54 +00:00
|
|
|
/* initData */ initData,
|
|
|
|
|
/* requiredDataMask */ requiredDataMask,
|
|
|
|
|
/* freeData */ freeData,
|
|
|
|
|
/* isDisabled */ isDisabled,
|
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
|
|
|
/* updateDepsgraph */ updateDepsgraph,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* dependsOnTime */ dependsOnTime,
|
|
|
|
|
/* dependsOnNormals */ NULL,
|
|
|
|
|
/* foreachIDLink */ foreachIDLink,
|
|
|
|
|
/* foreachTexLink */ foreachTexLink,
|
2019-03-18 15:56:16 +01:00
|
|
|
/* freeRuntimeData */ NULL,
|
2020-06-05 10:41:03 -04:00
|
|
|
/* panelRegister */ panelRegister,
|
2020-06-23 16:42:00 +02:00
|
|
|
/* blendWrite */ blendWrite,
|
|
|
|
|
/* blendRead */ blendRead,
|
2011-05-01 15:16:59 +00:00
|
|
|
};
|