2011-05-01 15:16:59 +00:00
|
|
|
/*
|
2011-10-23 17:52:20 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Campbell Barton
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
*/
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2011-09-22 12:00:24 +00:00
|
|
|
/** \file blender/modifiers/intern/MOD_warp.c
|
|
|
|
* \ingroup modifiers
|
|
|
|
*/
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2012-04-30 08:24:44 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
|
|
#include "BKE_cdderivedmesh.h"
|
|
|
|
#include "BKE_modifier.h"
|
|
|
|
#include "BKE_deform.h"
|
|
|
|
#include "BKE_texture.h"
|
|
|
|
#include "BKE_colortools.h"
|
|
|
|
|
|
|
|
#include "depsgraph_private.h"
|
|
|
|
|
|
|
|
#include "RE_shader_ext.h"
|
|
|
|
|
|
|
|
#include "MOD_util.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
wmd->texture = NULL;
|
|
|
|
wmd->strength = 1.0f;
|
|
|
|
wmd->falloff_radius = 1.0f;
|
|
|
|
wmd->falloff_type = eWarp_Falloff_Smooth;
|
|
|
|
wmd->flag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copyData(ModifierData *md, ModifierData *target)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
|
|
|
WarpModifierData *twmd = (WarpModifierData *) target;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2013-12-22 04:35:52 +11:00
|
|
|
modifier_copyData_generic(md, target);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
twmd->curfalloff = curvemapping_copy(wmd->curfalloff);
|
|
|
|
}
|
|
|
|
|
|
|
|
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
|
|
|
{
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
|
|
|
CustomDataMask dataMask = 0;
|
|
|
|
|
|
|
|
/* ask for vertexgroups if we need them */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
|
2011-07-11 09:15:20 +00:00
|
|
|
dataMask |= (CD_MASK_MDEFORMVERT);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
/* ask for UV coordinates if we need them */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
return dataMask;
|
|
|
|
}
|
|
|
|
|
2013-06-02 03:59:19 +00:00
|
|
|
static bool dependsOnTime(ModifierData *md)
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *)md;
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else {
|
2013-06-02 03:59:19 +00:00
|
|
|
return false;
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void freeData(ModifierData *md)
|
|
|
|
{
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
|
|
|
curvemapping_free(wmd->curfalloff);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-02 03:59:19 +00:00
|
|
|
static bool isDisabled(ModifierData *md, int 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 foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
walk(userData, ob, &wmd->object_from);
|
|
|
|
walk(userData, ob, &wmd->object_to);
|
|
|
|
walk(userData, ob, &wmd->map_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
walk(userData, ob, (ID **)&wmd->texture);
|
|
|
|
|
|
|
|
walk(userData, ob, (ID **)&wmd->object_from);
|
|
|
|
walk(userData, ob, (ID **)&wmd->object_to);
|
|
|
|
walk(userData, ob, (ID **)&wmd->map_object);
|
|
|
|
}
|
|
|
|
|
2011-08-12 18:11:22 +00:00
|
|
|
static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void *userData)
|
|
|
|
{
|
|
|
|
walk(userData, ob, md, "texture");
|
|
|
|
}
|
|
|
|
|
2015-03-13 11:48:04 +05:00
|
|
|
static void updateDepgraph(ModifierData *md, DagForest *forest,
|
|
|
|
struct Main *UNUSED(bmain),
|
|
|
|
struct Scene *UNUSED(scene),
|
2011-05-01 15:16:59 +00:00
|
|
|
Object *UNUSED(ob), DagNode *obNode)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wmd->object_from && wmd->object_to) {
|
2011-05-01 15:16:59 +00:00
|
|
|
DagNode *fromNode = dag_get_node(forest, wmd->object_from);
|
|
|
|
DagNode *toNode = dag_get_node(forest, wmd->object_to);
|
|
|
|
|
|
|
|
dag_add_relation(forest, fromNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier1");
|
|
|
|
dag_add_relation(forest, toNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier2");
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) {
|
2011-05-01 15:16:59 +00:00
|
|
|
DagNode *curNode = dag_get_node(forest, wmd->map_object);
|
|
|
|
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier3");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void updateDepsgraph(ModifierData *md,
|
|
|
|
struct Main *UNUSED(bmain),
|
|
|
|
struct Scene *UNUSED(scene),
|
|
|
|
Object *UNUSED(ob),
|
|
|
|
struct DepsNodeHandle *node)
|
|
|
|
{
|
|
|
|
WarpModifierData *wmd = (WarpModifierData *) md;
|
|
|
|
if (wmd->object_from != NULL && wmd->object_to != NULL) {
|
|
|
|
DEG_add_object_relation(node, wmd->object_from, DEG_OB_COMP_TRANSFORM, "Warp Modifier from");
|
|
|
|
DEG_add_object_relation(node, wmd->object_to, DEG_OB_COMP_TRANSFORM, "Warp Modifier to");
|
|
|
|
}
|
|
|
|
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
|
|
|
|
DEG_add_object_relation(node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Warp Modifier map");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
static void warpModifier_do(WarpModifierData *wmd, Object *ob,
|
|
|
|
DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
|
|
|
|
{
|
|
|
|
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];
|
|
|
|
|
|
|
|
float tmat[4][4];
|
|
|
|
|
2015-02-03 04:35:02 +11:00
|
|
|
const float falloff_radius_sq = SQUARE(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;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-05-06 13:38:33 +00:00
|
|
|
float (*tex_co)[3] = NULL;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (!(wmd->object_from && wmd->object_to))
|
2011-05-01 15:16:59 +00:00
|
|
|
return;
|
|
|
|
|
2011-07-11 09:15:20 +00:00
|
|
|
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
|
2015-02-03 04:38:59 +11:00
|
|
|
if (dvert == NULL) {
|
|
|
|
defgrp_index = -1;
|
|
|
|
}
|
2011-07-11 09:15:20 +00:00
|
|
|
|
2012-05-03 21:35:04 +00:00
|
|
|
if (wmd->curfalloff == NULL) /* should never happen, but bad lib linking could cause it */
|
2011-05-01 15:16:59 +00:00
|
|
|
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
2012-08-21 14:43:51 +00:00
|
|
|
if (wmd->curfalloff) {
|
|
|
|
curvemapping_initialize(wmd->curfalloff);
|
|
|
|
}
|
|
|
|
|
2011-05-01 15:16:59 +00:00
|
|
|
invert_m4_m4(obinv, ob->obmat);
|
|
|
|
|
2013-05-26 18:36:25 +00:00
|
|
|
mul_m4_m4m4(mat_from, obinv, wmd->object_from->obmat);
|
|
|
|
mul_m4_m4m4(mat_to, obinv, wmd->object_to->obmat);
|
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);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
|
|
|
invert_m4_m4(mat_from_inv, mat_from);
|
|
|
|
|
|
|
|
unit_m4(mat_unit);
|
|
|
|
|
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;
|
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;
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wmd->texture) {
|
2011-05-01 15:16:59 +00:00
|
|
|
tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co");
|
|
|
|
get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
|
2012-04-10 14:11:45 +00:00
|
|
|
|
|
|
|
modifier_init_texture(wmd->modifier.scene, wmd->texture);
|
2011-05-01 15:16:59 +00: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];
|
|
|
|
|
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)))
|
2012-05-03 21:35:04 +00:00
|
|
|
{
|
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];
|
2015-02-03 04:38:59 +11:00
|
|
|
weight = defvert_find_weight(dv, defgrp_index) * strength;
|
|
|
|
if (weight <= 0.0f) {
|
|
|
|
continue;
|
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:
|
|
|
|
fac = curvemapping_evaluateF(wmd->curfalloff, 0, fac);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
fac *= weight;
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (tex_co) {
|
2011-05-01 15:16:59 +00:00
|
|
|
TexResult texres;
|
|
|
|
texres.nor = NULL;
|
2013-10-20 13:01:07 +00:00
|
|
|
BKE_texture_get_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
fac *= texres.tin;
|
|
|
|
}
|
|
|
|
|
2015-02-03 04:26:31 +11:00
|
|
|
if (fac != 0.0f) {
|
|
|
|
/* into the 'from' objects space */
|
|
|
|
mul_m4_v3(mat_from_inv, co);
|
2011-05-01 15:16:59 +00: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
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (tex_co)
|
2011-05-01 15:16:59 +00:00
|
|
|
MEM_freeN(tex_co);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int warp_needs_dm(WarpModifierData *wmd)
|
|
|
|
{
|
|
|
|
return wmd->texture || wmd->defgrp_name[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
|
2012-05-09 15:00:26 +00:00
|
|
|
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
|
2011-05-01 15:16:59 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DerivedMesh *dm = NULL;
|
|
|
|
int use_dm = warp_needs_dm((WarpModifierData *)md);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (use_dm) {
|
2013-07-16 08:24:53 +00:00
|
|
|
dm = get_cddm(ob, NULL, derivedData, vertexCos, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts);
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (use_dm) {
|
|
|
|
if (dm != derivedData) dm->release(dm);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-24 07:24:11 +00:00
|
|
|
static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *em,
|
2011-05-01 15:16:59 +00:00
|
|
|
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
|
|
|
|
{
|
|
|
|
DerivedMesh *dm = derivedData;
|
2012-05-06 13:38:33 +00:00
|
|
|
int use_dm = warp_needs_dm((WarpModifierData *)md);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (use_dm) {
|
|
|
|
if (!derivedData)
|
2014-01-23 14:50:50 +01:00
|
|
|
dm = CDDM_from_editbmesh(em, false, false);
|
2011-05-01 15:16:59 +00:00
|
|
|
}
|
|
|
|
|
2012-05-09 15:00:26 +00:00
|
|
|
deformVerts(md, ob, dm, vertexCos, numVerts, 0);
|
2011-05-01 15:16:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (use_dm) {
|
|
|
|
if (!derivedData) dm->release(dm);
|
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),
|
|
|
|
/* type */ eModifierTypeType_OnlyDeform,
|
|
|
|
/* flags */ eModifierTypeFlag_AcceptsCVs |
|
|
|
|
eModifierTypeFlag_SupportsEditmode,
|
|
|
|
/* copyData */ copyData,
|
|
|
|
/* deformVerts */ deformVerts,
|
|
|
|
/* deformMatrices */ NULL,
|
|
|
|
/* deformVertsEM */ deformVertsEM,
|
|
|
|
/* deformMatricesEM */ NULL,
|
2013-08-07 03:36:05 +00:00
|
|
|
/* applyModifier */ NULL,
|
|
|
|
/* applyModifierEM */ NULL,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* initData */ initData,
|
|
|
|
/* requiredDataMask */ requiredDataMask,
|
|
|
|
/* freeData */ freeData,
|
|
|
|
/* isDisabled */ isDisabled,
|
|
|
|
/* updateDepgraph */ updateDepgraph,
|
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,
|
2011-05-01 15:16:59 +00:00
|
|
|
/* foreachObjectLink */ foreachObjectLink,
|
2012-10-24 05:45:54 +00:00
|
|
|
/* foreachIDLink */ foreachIDLink,
|
|
|
|
/* foreachTexLink */ foreachTexLink,
|
2011-05-01 15:16:59 +00:00
|
|
|
};
|