2012-12-14 04:07:30 +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,
|
2012-12-14 04:07:30 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup modifiers
|
2012-12-14 04:07:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2019-02-25 11:39:14 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2012-12-14 04:07:30 +00:00
|
|
|
|
|
|
|
#include "BLI_math.h"
|
2015-12-25 15:52:14 +01:00
|
|
|
#include "BLI_task.h"
|
2019-02-25 11:39:14 +01:00
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BLT_translation.h"
|
|
|
|
|
2020-10-01 09:38:00 -05:00
|
|
|
#include "DNA_defaults.h"
|
2019-02-25 11:39:14 +01:00
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "DNA_screen_types.h"
|
2012-12-14 04:07:30 +00:00
|
|
|
|
|
|
|
#include "BKE_action.h" /* BKE_pose_channel_find_name */
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "BKE_context.h"
|
2012-12-14 04:07:30 +00:00
|
|
|
#include "BKE_deform.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_query.h"
|
2012-12-14 04:07:30 +00:00
|
|
|
#include "BKE_modifier.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"
|
2012-12-14 04:07:30 +00:00
|
|
|
|
2018-12-07 15:45:53 +01:00
|
|
|
#include "DEG_depsgraph_query.h"
|
|
|
|
|
2020-06-05 10:41:03 -04:00
|
|
|
#include "MOD_ui_common.h"
|
2012-12-14 04:07:30 +00:00
|
|
|
#include "MOD_util.h"
|
|
|
|
|
2020-08-07 22:56:13 +10:00
|
|
|
static void uv_warp_from_mat4_pair(float uv_dst[2],
|
|
|
|
const float uv_src[2],
|
|
|
|
const float warp_mat[4][4])
|
2012-12-14 04:07:30 +00:00
|
|
|
{
|
|
|
|
float tuv[3] = {0.0f};
|
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
copy_v2_v2(tuv, uv_src);
|
2012-12-14 04:07:30 +00:00
|
|
|
mul_m4_v3(warp_mat, tuv);
|
2020-02-15 01:49:50 +01:00
|
|
|
copy_v2_v2(uv_dst, tuv);
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
{
|
|
|
|
UVWarpModifierData *umd = (UVWarpModifierData *)md;
|
2020-10-01 09:38:00 -05:00
|
|
|
|
|
|
|
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(umd, modifier));
|
|
|
|
|
|
|
|
MEMCPY_STRUCT_AFTER(umd, DNA_struct_default_get(UVWarpModifierData), modifier);
|
2012-12-14 04:07:30 +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)
|
2012-12-14 04:07:30 +00:00
|
|
|
{
|
|
|
|
UVWarpModifierData *umd = (UVWarpModifierData *)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 (umd->vgroup_name[0] != '\0') {
|
|
|
|
r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT;
|
|
|
|
}
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void matrix_from_obj_pchan(float mat[4][4], Object *ob, const char *bonename)
|
|
|
|
{
|
|
|
|
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bonename);
|
|
|
|
if (pchan) {
|
2013-05-26 18:36:25 +00:00
|
|
|
mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat);
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
copy_m4_m4(mat, ob->obmat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
typedef struct UVWarpData {
|
|
|
|
MPoly *mpoly;
|
|
|
|
MLoop *mloop;
|
|
|
|
MLoopUV *mloopuv;
|
|
|
|
|
|
|
|
MDeformVert *dvert;
|
|
|
|
int defgrp_index;
|
|
|
|
|
|
|
|
float (*warp_mat)[4];
|
2020-02-18 18:12:06 +01:00
|
|
|
bool invert_vgroup;
|
2015-12-25 15:52:14 +01:00
|
|
|
} UVWarpData;
|
|
|
|
|
2018-01-10 12:49:51 +01:00
|
|
|
static void uv_warp_compute(void *__restrict userdata,
|
|
|
|
const int i,
|
2019-07-30 14:56:47 +02:00
|
|
|
const TaskParallelTLS *__restrict UNUSED(tls))
|
2015-12-25 15:52:14 +01:00
|
|
|
{
|
|
|
|
const UVWarpData *data = userdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
const MPoly *mp = &data->mpoly[i];
|
|
|
|
const MLoop *ml = &data->mloop[mp->loopstart];
|
|
|
|
MLoopUV *mluv = &data->mloopuv[mp->loopstart];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
const MDeformVert *dvert = data->dvert;
|
|
|
|
const int defgrp_index = data->defgrp_index;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
float(*warp_mat)[4] = data->warp_mat;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
int l;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-25 15:52:14 +01:00
|
|
|
if (dvert) {
|
|
|
|
for (l = 0; l < mp->totloop; l++, ml++, mluv++) {
|
|
|
|
float uv[2];
|
2020-02-18 18:12:06 +01:00
|
|
|
const float weight = data->invert_vgroup ?
|
2020-03-06 12:50:56 +11:00
|
|
|
1.0f - BKE_defvert_find_weight(&dvert[ml->v], defgrp_index) :
|
|
|
|
BKE_defvert_find_weight(&dvert[ml->v], defgrp_index);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
uv_warp_from_mat4_pair(uv, mluv->uv, warp_mat);
|
2015-12-25 15:52:14 +01:00
|
|
|
interp_v2_v2v2(mluv->uv, mluv->uv, uv, weight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (l = 0; l < mp->totloop; l++, ml++, mluv++) {
|
2020-02-15 01:49:50 +01:00
|
|
|
uv_warp_from_mat4_pair(mluv->uv, mluv->uv, warp_mat);
|
2015-12-25 15:52:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-05 03:10:29 +00:00
|
|
|
|
2020-04-21 13:09:41 +02:00
|
|
|
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
|
2012-12-14 04:07:30 +00:00
|
|
|
{
|
|
|
|
UVWarpModifierData *umd = (UVWarpModifierData *)md;
|
2015-12-26 15:32:37 +11:00
|
|
|
int numPolys, numLoops;
|
2012-12-14 04:07:30 +00:00
|
|
|
MPoly *mpoly;
|
|
|
|
MLoop *mloop;
|
|
|
|
MLoopUV *mloopuv;
|
|
|
|
MDeformVert *dvert;
|
|
|
|
int defgrp_index;
|
|
|
|
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
|
|
|
|
float warp_mat[4][4];
|
|
|
|
const int axis_u = umd->axis_u;
|
|
|
|
const int axis_v = umd->axis_v;
|
2020-02-18 18:12:06 +01:00
|
|
|
const bool invert_vgroup = (umd->flag & MOD_UVWARP_INVERT_VGROUP) != 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-14 04:07:30 +00:00
|
|
|
/* make sure there are UV Maps available */
|
2018-06-22 15:45:46 +02:00
|
|
|
if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
|
|
|
|
return mesh;
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
if (!ELEM(NULL, umd->object_src, umd->object_dst)) {
|
|
|
|
float mat_src[4][4];
|
|
|
|
float mat_dst[4][4];
|
|
|
|
float imat_dst[4][4];
|
|
|
|
float shuf_mat[4][4];
|
|
|
|
|
|
|
|
/* make sure anything moving UVs is available */
|
|
|
|
matrix_from_obj_pchan(mat_src, umd->object_src, umd->bone_src);
|
|
|
|
matrix_from_obj_pchan(mat_dst, umd->object_dst, umd->bone_dst);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
invert_m4_m4(imat_dst, mat_dst);
|
|
|
|
mul_m4_m4m4(warp_mat, imat_dst, mat_src);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
/* apply warp */
|
|
|
|
if (!is_zero_v2(umd->center)) {
|
|
|
|
float mat_cent[4][4];
|
|
|
|
float imat_cent[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
unit_m4(mat_cent);
|
|
|
|
mat_cent[3][axis_u] = umd->center[0];
|
|
|
|
mat_cent[3][axis_v] = umd->center[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
invert_m4_m4(imat_cent, mat_cent);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-15 01:49:50 +01:00
|
|
|
mul_m4_m4m4(warp_mat, warp_mat, imat_cent);
|
|
|
|
mul_m4_m4m4(warp_mat, mat_cent, warp_mat);
|
|
|
|
}
|
|
|
|
|
2020-08-07 22:36:11 +10:00
|
|
|
const int shuf_indices[4] = {axis_u, axis_v, -1, 3};
|
2020-02-15 01:49:50 +01:00
|
|
|
shuffle_m4(shuf_mat, shuf_indices);
|
|
|
|
mul_m4_m4m4(warp_mat, shuf_mat, warp_mat);
|
|
|
|
transpose_m4(shuf_mat);
|
|
|
|
mul_m4_m4m4(warp_mat, warp_mat, shuf_mat);
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
2020-02-15 01:49:50 +01:00
|
|
|
else {
|
|
|
|
unit_m4(warp_mat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Apply direct 2d transform. */
|
|
|
|
translate_m4(warp_mat, umd->center[0], umd->center[1], 0.0f);
|
|
|
|
const float scale[3] = {umd->scale[0], umd->scale[1], 1.0f};
|
|
|
|
rescale_m4(warp_mat, scale);
|
|
|
|
rotate_m4(warp_mat, 'Z', umd->rotation);
|
|
|
|
translate_m4(warp_mat, umd->offset[0], umd->offset[1], 0.0f);
|
|
|
|
translate_m4(warp_mat, -umd->center[0], -umd->center[1], 0.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-14 04:07:30 +00:00
|
|
|
/* make sure we're using an existing layer */
|
2018-06-22 15:45:46 +02:00
|
|
|
CustomData_validate_layer_name(&mesh->ldata, CD_MLOOPUV, umd->uvlayer_name, uvname);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-22 15:45:46 +02:00
|
|
|
numPolys = mesh->totpoly;
|
|
|
|
numLoops = mesh->totloop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-22 15:45:46 +02:00
|
|
|
mpoly = mesh->mpoly;
|
|
|
|
mloop = mesh->mloop;
|
2012-12-14 04:07:30 +00:00
|
|
|
/* make sure we are not modifying the original UV map */
|
2018-06-22 15:45:46 +02:00
|
|
|
mloopuv = CustomData_duplicate_referenced_layer_named(
|
|
|
|
&mesh->ldata, CD_MLOOPUV, uvname, numLoops);
|
2018-06-29 19:02:19 +02:00
|
|
|
MOD_get_vgroup(ctx->object, mesh, umd->vgroup_name, &dvert, &defgrp_index);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-07 00:06:58 +11:00
|
|
|
UVWarpData data = {
|
|
|
|
.mpoly = mpoly,
|
|
|
|
.mloop = mloop,
|
|
|
|
.mloopuv = mloopuv,
|
|
|
|
.dvert = dvert,
|
|
|
|
.defgrp_index = defgrp_index,
|
|
|
|
.warp_mat = warp_mat,
|
2020-02-18 18:12:06 +01:00
|
|
|
.invert_vgroup = invert_vgroup,
|
2019-01-07 00:06:58 +11:00
|
|
|
};
|
2019-07-30 14:56:47 +02:00
|
|
|
TaskParallelSettings settings;
|
2018-01-08 11:35:48 +01:00
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
|
|
|
settings.use_threading = (numPolys > 1000);
|
|
|
|
BLI_task_parallel_range(0, numPolys, &data, uv_warp_compute, &settings);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-22 15:27:50 +02:00
|
|
|
/* XXX TODO is this still needed? */
|
|
|
|
// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-11 21:46:06 +10:00
|
|
|
mesh->runtime.is_original = false;
|
|
|
|
|
2018-06-22 15:45:46 +02:00
|
|
|
return mesh;
|
2012-12-14 04:07:30 +00:00
|
|
|
}
|
|
|
|
|
2020-10-01 18:05:23 +02:00
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
|
2012-12-14 04:07:30 +00:00
|
|
|
{
|
|
|
|
UVWarpModifierData *umd = (UVWarpModifierData *)md;
|
|
|
|
|
2020-10-01 18:05:23 +02:00
|
|
|
walk(userData, ob, (ID **)&umd->object_dst, IDWALK_CB_NOP);
|
|
|
|
walk(userData, ob, (ID **)&umd->object_src, IDWALK_CB_NOP);
|
2012-12-14 04:07:30 +00: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
|
|
|
{
|
|
|
|
UVWarpModifierData *umd = (UVWarpModifierData *)md;
|
|
|
|
|
2020-04-10 22:00:21 +02:00
|
|
|
MOD_depsgraph_update_object_bone_relation(
|
|
|
|
ctx->node, umd->object_src, umd->bone_src, "UVWarp Modifier");
|
|
|
|
MOD_depsgraph_update_object_bone_relation(
|
|
|
|
ctx->node, umd->object_dst, umd->bone_dst, "UVWarp Modifier");
|
2018-11-27 21:14:35 +01:00
|
|
|
|
2019-02-12 12:01:17 +01:00
|
|
|
DEG_add_modifier_to_transform_relation(ctx->node, "UVWarp Modifier");
|
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-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
|
|
|
|
|
|
|
PointerRNA warp_obj_ptr;
|
|
|
|
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(layout, ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "center", 0, NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "axis_u", 0, IFACE_("Axis U"), ICON_NONE);
|
|
|
|
uiItemR(col, ptr, "axis_v", 0, IFACE_("V"), ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "object_from", 0, NULL, ICON_NONE);
|
|
|
|
warp_obj_ptr = RNA_pointer_get(ptr, "object_from");
|
2020-06-05 10:41:03 -04:00
|
|
|
if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) {
|
|
|
|
PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data");
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(col, ptr, "bone_from", &warp_obj_data_ptr, "bones", NULL, ICON_NONE);
|
2020-06-05 10:41:03 -04:00
|
|
|
}
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(col, ptr, "object_to", 0, IFACE_("To"), ICON_NONE);
|
|
|
|
warp_obj_ptr = RNA_pointer_get(ptr, "object_to");
|
2020-06-05 10:41:03 -04:00
|
|
|
if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) {
|
|
|
|
PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data");
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemPointerR(col, ptr, "bone_to", &warp_obj_data_ptr, "bones", 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 transform_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
|
|
|
|
|
|
|
uiLayoutSetPropSep(layout, true);
|
|
|
|
|
2020-09-02 14:13:26 -05:00
|
|
|
uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
|
|
|
|
uiItemR(layout, ptr, "scale", 0, NULL, ICON_NONE);
|
|
|
|
uiItemR(layout, ptr, "rotation", 0, 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_UVWarp, panel_draw);
|
|
|
|
modifier_subpanel_register(
|
|
|
|
region_type, "offset", "Transform", NULL, transform_panel_draw, panel_type);
|
|
|
|
}
|
|
|
|
|
2012-12-14 04:07:30 +00:00
|
|
|
ModifierTypeInfo modifierType_UVWarp = {
|
|
|
|
/* name */ "UVWarp",
|
|
|
|
/* structName */ "UVWarpModifierData",
|
|
|
|
/* structSize */ sizeof(UVWarpModifierData),
|
2020-09-25 12:49:18 +02:00
|
|
|
/* srna */ &RNA_UVWarpModifier,
|
2012-12-14 04:07:30 +00:00
|
|
|
/* type */ eModifierTypeType_NonGeometrical,
|
|
|
|
/* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode |
|
|
|
|
eModifierTypeFlag_EnableInEditmode,
|
2020-09-25 12:45:30 +02:00
|
|
|
/* icon */ ICON_MOD_UVPROJECT, /* TODO: Use correct icon. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-08 10:14:02 +02:00
|
|
|
/* copyData */ BKE_modifier_copydata_generic,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-14 04:07:30 +00:00
|
|
|
/* deformVerts */ NULL,
|
|
|
|
/* deformMatrices */ NULL,
|
|
|
|
/* deformVertsEM */ NULL,
|
|
|
|
/* deformMatricesEM */ NULL,
|
2020-04-21 13:09:41 +02:00
|
|
|
/* modifyMesh */ modifyMesh,
|
|
|
|
/* modifyHair */ NULL,
|
2020-12-10 14:35:02 +01:00
|
|
|
/* modifyGeometrySet */ NULL,
|
2020-04-21 13:09:41 +02:00
|
|
|
/* modifyVolume */ NULL,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-14 04:07:30 +00:00
|
|
|
/* initData */ initData,
|
|
|
|
/* requiredDataMask */ requiredDataMask,
|
|
|
|
/* freeData */ NULL,
|
|
|
|
/* isDisabled */ NULL,
|
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-12-14 04:07:30 +00:00
|
|
|
/* dependsOnTime */ NULL,
|
|
|
|
/* dependsOnNormals */ NULL,
|
2020-10-01 18:05:23 +02:00
|
|
|
/* foreachIDLink */ foreachIDLink,
|
2012-12-14 04:07:30 +00:00
|
|
|
/* foreachTexLink */ NULL,
|
2019-03-18 15:56:16 +01:00
|
|
|
/* freeRuntimeData */ NULL,
|
2020-06-05 10:41:03 -04:00
|
|
|
/* panelRegister */ panelRegister,
|
2020-06-15 17:37:07 +02:00
|
|
|
/* blendWrite */ NULL,
|
|
|
|
/* blendRead */ NULL,
|
2012-12-14 04:07:30 +00:00
|
|
|
};
|