2010-04-11 22:12:30 +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.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Daniel Dunbar
|
|
|
|
* Ton Roosendaal,
|
|
|
|
* Ben Batt,
|
|
|
|
* Brecht Van Lommel,
|
|
|
|
* Campbell Barton
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
*/
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2011-02-25 13:57:17 +00:00
|
|
|
/** \file blender/modifiers/intern/MOD_uvproject.c
|
|
|
|
* \ingroup modifiers
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-04-12 22:33:43 +00:00
|
|
|
/* UV Project modifier: Generates UVs projected from an object */
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2010-04-12 00:36:50 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2010-04-12 22:33:43 +00:00
|
|
|
#include "DNA_camera_types.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_object_types.h"
|
2011-11-04 14:36:06 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2010-04-12 01:09:59 +00:00
|
|
|
#include "BLI_math.h"
|
2011-08-01 05:25:30 +00:00
|
|
|
#include "BLI_string.h"
|
2010-04-12 01:09:59 +00:00
|
|
|
#include "BLI_uvproject.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2011-11-19 20:40:46 +00:00
|
|
|
#include "BKE_camera.h"
|
2010-04-12 00:36:50 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
#include "MOD_modifiertypes.h"
|
|
|
|
#include "MOD_util.h"
|
|
|
|
|
2010-04-12 01:09:59 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
2010-04-12 22:33:43 +00:00
|
|
|
#include "depsgraph_private.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
{
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
|
|
|
|
umd->projectors[i] = NULL;
|
|
|
|
umd->image = NULL;
|
|
|
|
umd->flags = 0;
|
|
|
|
umd->num_projectors = 1;
|
|
|
|
umd->aspectx = umd->aspecty = 1.0f;
|
|
|
|
umd->scalex = umd->scaley = 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copyData(ModifierData *md, ModifierData *target)
|
|
|
|
{
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
UVProjectModifierData *tumd = (UVProjectModifierData*) target;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
|
|
|
|
tumd->projectors[i] = umd->projectors[i];
|
|
|
|
tumd->image = umd->image;
|
|
|
|
tumd->flags = umd->flags;
|
|
|
|
tumd->num_projectors = umd->num_projectors;
|
|
|
|
tumd->aspectx = umd->aspectx;
|
|
|
|
tumd->aspecty = umd->aspecty;
|
|
|
|
tumd->scalex = umd->scalex;
|
|
|
|
tumd->scaley = umd->scaley;
|
2011-08-01 05:25:30 +00:00
|
|
|
BLI_strncpy(tumd->uvlayer_name, umd->uvlayer_name, sizeof(umd->uvlayer_name));
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
2010-10-14 06:29:17 +00:00
|
|
|
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
|
|
|
CustomDataMask dataMask = 0;
|
|
|
|
|
|
|
|
/* ask for UV coordinates */
|
2010-10-21 01:55:39 +00:00
|
|
|
dataMask |= CD_MASK_MTFACE;
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
return dataMask;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void foreachObjectLink(ModifierData *md, Object *ob,
|
|
|
|
ObjectWalkFunc walk, void *userData)
|
|
|
|
{
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
|
|
|
|
walk(userData, ob, &umd->projectors[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob,
|
|
|
|
IDWalkFunc walk, void *userData)
|
|
|
|
{
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
|
|
|
|
walk(userData, ob, (ID **)&umd->image);
|
|
|
|
|
|
|
|
foreachObjectLink(md, ob, (ObjectWalkFunc)walk,
|
|
|
|
userData);
|
|
|
|
}
|
|
|
|
|
2010-10-14 06:29:17 +00:00
|
|
|
static void updateDepgraph(ModifierData *md, DagForest *forest,
|
|
|
|
struct Scene *UNUSED(scene),
|
|
|
|
Object *UNUSED(ob),
|
|
|
|
DagNode *obNode)
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < umd->num_projectors; ++i) {
|
|
|
|
if(umd->projectors[i]) {
|
|
|
|
DagNode *curNode = dag_get_node(forest, umd->projectors[i]);
|
|
|
|
|
|
|
|
dag_add_relation(forest, curNode, obNode,
|
|
|
|
DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "UV Project Modifier");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct Projector {
|
|
|
|
Object *ob; /* object this projector is derived from */
|
|
|
|
float projmat[4][4]; /* projection matrix */
|
|
|
|
float normal[3]; /* projector normal in world space */
|
|
|
|
void *uci; /* optional uv-project info (panorama projection) */
|
|
|
|
} Projector;
|
|
|
|
|
|
|
|
static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
|
|
|
Object *ob, DerivedMesh *dm)
|
|
|
|
{
|
|
|
|
float (*coords)[3], (*co)[3];
|
|
|
|
MTFace *tface;
|
|
|
|
int i, numVerts, numFaces;
|
|
|
|
Image *image = umd->image;
|
|
|
|
MFace *mface, *mf;
|
|
|
|
int override_image = ((umd->flags & MOD_UVPROJECT_OVERRIDEIMAGE) != 0);
|
|
|
|
Projector projectors[MOD_UVPROJECT_MAXPROJECTORS];
|
|
|
|
int num_projectors = 0;
|
|
|
|
float aspect;
|
|
|
|
char uvname[32];
|
|
|
|
float aspx= umd->aspectx ? umd->aspectx : 1.0f;
|
|
|
|
float aspy= umd->aspecty ? umd->aspecty : 1.0f;
|
|
|
|
float scax= umd->scalex ? umd->scalex : 1.0f;
|
|
|
|
float scay= umd->scaley ? umd->scaley : 1.0f;
|
|
|
|
int free_uci= 0;
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
aspect = aspx / aspy;
|
|
|
|
|
|
|
|
for(i = 0; i < umd->num_projectors; ++i)
|
|
|
|
if(umd->projectors[i])
|
|
|
|
projectors[num_projectors++].ob = umd->projectors[i];
|
|
|
|
|
|
|
|
if(num_projectors == 0) return dm;
|
|
|
|
|
2011-11-23 17:25:25 +00:00
|
|
|
/* make sure there are UV Maps available */
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
if(!CustomData_has_layer(&dm->faceData, CD_MTFACE)) return dm;
|
|
|
|
|
|
|
|
/* make sure we're using an existing layer */
|
2011-10-13 20:00:22 +00:00
|
|
|
CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, umd->uvlayer_name, uvname);
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
/* calculate a projection matrix and normal for each projector */
|
|
|
|
for(i = 0; i < num_projectors; ++i) {
|
|
|
|
float tmpmat[4][4];
|
|
|
|
float offsetmat[4][4];
|
|
|
|
Camera *cam = NULL;
|
|
|
|
/* calculate projection matrix */
|
|
|
|
invert_m4_m4(projectors[i].projmat, projectors[i].ob->obmat);
|
|
|
|
|
|
|
|
projectors[i].uci= NULL;
|
|
|
|
|
|
|
|
if(projectors[i].ob->type == OB_CAMERA) {
|
2010-06-15 21:46:02 +00:00
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
cam = (Camera *)projectors[i].ob->data;
|
|
|
|
if(cam->flag & CAM_PANORAMA) {
|
|
|
|
projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy);
|
2010-06-15 21:46:02 +00:00
|
|
|
project_camera_info_scale(projectors[i].uci, scax, scay);
|
2010-04-11 22:12:30 +00:00
|
|
|
free_uci= 1;
|
|
|
|
}
|
2010-06-15 21:46:02 +00:00
|
|
|
else {
|
2011-11-19 18:35:42 +00:00
|
|
|
float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
|
|
|
|
int sensor_fit= camera_sensor_fit(cam->sensor_fit, aspx, aspy);
|
2011-11-04 14:36:06 +00:00
|
|
|
float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale;
|
2010-06-15 21:46:02 +00:00
|
|
|
float xmax, xmin, ymax, ymin;
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2011-11-19 18:35:42 +00:00
|
|
|
if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
|
2010-06-15 21:46:02 +00:00
|
|
|
xmax = 0.5f * scale;
|
2010-04-11 22:12:30 +00:00
|
|
|
ymax = xmax / aspect;
|
2011-11-04 14:36:06 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-06-15 21:46:02 +00:00
|
|
|
ymax = 0.5f * scale;
|
|
|
|
xmax = ymax * aspect;
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
2011-11-04 14:36:06 +00:00
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
xmin = -xmax;
|
|
|
|
ymin = -ymax;
|
|
|
|
|
2010-06-15 21:46:02 +00:00
|
|
|
/* scale the matrix */
|
|
|
|
xmin *= scax;
|
|
|
|
xmax *= scax;
|
|
|
|
ymin *= scay;
|
|
|
|
ymax *= scay;
|
|
|
|
|
|
|
|
if(cam->type == CAM_PERSP) {
|
|
|
|
float perspmat[4][4];
|
|
|
|
perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
|
Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:
mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)
For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
2011-12-16 19:53:12 +00:00
|
|
|
mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat);
|
2010-06-15 21:46:02 +00:00
|
|
|
} else { /* if(cam->type == CAM_ORTHO) */
|
|
|
|
float orthomat[4][4];
|
|
|
|
orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
|
Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:
mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)
For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
2011-12-16 19:53:12 +00:00
|
|
|
mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
copy_m4_m4(tmpmat, projectors[i].projmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
unit_m4(offsetmat);
|
|
|
|
mul_mat3_m4_fl(offsetmat, 0.5);
|
|
|
|
offsetmat[3][0] = offsetmat[3][1] = offsetmat[3][2] = 0.5;
|
|
|
|
|
|
|
|
if (cam) {
|
|
|
|
if (aspx == aspy) {
|
|
|
|
offsetmat[3][0] -= cam->shiftx;
|
|
|
|
offsetmat[3][1] -= cam->shifty;
|
|
|
|
} else if (aspx < aspy) {
|
|
|
|
offsetmat[3][0] -=(cam->shiftx * aspy/aspx);
|
|
|
|
offsetmat[3][1] -= cam->shifty;
|
|
|
|
} else {
|
|
|
|
offsetmat[3][0] -= cam->shiftx;
|
|
|
|
offsetmat[3][1] -=(cam->shifty * aspx/aspy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:
mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)
For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
2011-12-16 19:53:12 +00:00
|
|
|
mult_m4_m4m4(projectors[i].projmat, offsetmat, tmpmat);
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
/* calculate worldspace projector normal (for best projector test) */
|
|
|
|
projectors[i].normal[0] = 0;
|
|
|
|
projectors[i].normal[1] = 0;
|
|
|
|
projectors[i].normal[2] = 1;
|
|
|
|
mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
|
|
|
|
}
|
|
|
|
|
2011-12-19 08:26:53 +00:00
|
|
|
numFaces = dm->getNumFaces(dm);
|
|
|
|
|
2011-11-23 17:25:25 +00:00
|
|
|
/* make sure we are not modifying the original UV map */
|
2010-04-11 22:12:30 +00:00
|
|
|
tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
|
2011-12-19 08:26:53 +00:00
|
|
|
CD_MTFACE, uvname, numFaces);
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
numVerts = dm->getNumVerts(dm);
|
|
|
|
|
|
|
|
coords = MEM_callocN(sizeof(*coords) * numVerts,
|
|
|
|
"uvprojectModifier_do coords");
|
|
|
|
dm->getVertCos(dm, coords);
|
|
|
|
|
|
|
|
/* convert coords to world space */
|
|
|
|
for(i = 0, co = coords; i < numVerts; ++i, ++co)
|
|
|
|
mul_m4_v3(ob->obmat, *co);
|
|
|
|
|
|
|
|
/* if only one projector, project coords to UVs */
|
|
|
|
if(num_projectors == 1 && projectors[0].uci==NULL)
|
|
|
|
for(i = 0, co = coords; i < numVerts; ++i, ++co)
|
2011-05-20 10:09:03 +00:00
|
|
|
mul_project_m4_v3(projectors[0].projmat, *co);
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
mface = dm->getFaceArray(dm);
|
|
|
|
|
|
|
|
/* apply coords as UVs, and apply image if tfaces are new */
|
|
|
|
for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tface) {
|
|
|
|
if(override_image || !image || tface->tpage == image) {
|
2010-06-15 21:46:02 +00:00
|
|
|
if(num_projectors == 1) {
|
|
|
|
if(projectors[0].uci) {
|
2012-01-04 05:13:29 +00:00
|
|
|
unsigned int fidx= mf->v4 ? 3:2;
|
|
|
|
do {
|
|
|
|
unsigned int vidx= *(&mf->v1 + fidx);
|
|
|
|
project_from_camera(tface->uv[fidx], coords[vidx], projectors[0].uci);
|
|
|
|
} while (fidx--);
|
2010-06-15 21:46:02 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* apply transformed coords as UVs */
|
2012-01-04 05:13:29 +00:00
|
|
|
unsigned int fidx= mf->v4 ? 3:2;
|
|
|
|
do {
|
|
|
|
unsigned int vidx= *(&mf->v1 + fidx);
|
|
|
|
copy_v2_v2(tface->uv[fidx], coords[vidx]);
|
|
|
|
} while (fidx--);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* multiple projectors, select the closest to face normal
|
|
|
|
* direction
|
|
|
|
*/
|
|
|
|
float face_no[3];
|
|
|
|
int j;
|
|
|
|
Projector *best_projector;
|
|
|
|
float best_dot;
|
|
|
|
|
|
|
|
/* get the untransformed face normal */
|
|
|
|
if(mf->v4) {
|
2012-01-04 05:13:29 +00:00
|
|
|
normal_quad_v3(face_no, coords[mf->v1], coords[mf->v2], coords[mf->v3], coords[mf->v4]);
|
2010-04-11 22:12:30 +00:00
|
|
|
} else {
|
2012-01-04 05:13:29 +00:00
|
|
|
normal_tri_v3(face_no, coords[mf->v1], coords[mf->v2], coords[mf->v3]);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* find the projector which the face points at most directly
|
|
|
|
* (projector normal with largest dot product is best)
|
|
|
|
*/
|
|
|
|
best_dot = dot_v3v3(projectors[0].normal, face_no);
|
|
|
|
best_projector = &projectors[0];
|
|
|
|
|
|
|
|
for(j = 1; j < num_projectors; ++j) {
|
|
|
|
float tmp_dot = dot_v3v3(projectors[j].normal,
|
|
|
|
face_no);
|
|
|
|
if(tmp_dot > best_dot) {
|
|
|
|
best_dot = tmp_dot;
|
|
|
|
best_projector = &projectors[j];
|
|
|
|
}
|
|
|
|
}
|
2010-06-15 21:46:02 +00:00
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
if(best_projector->uci) {
|
2012-01-04 05:13:29 +00:00
|
|
|
unsigned int fidx= mf->v4 ? 3:2;
|
|
|
|
do {
|
|
|
|
unsigned int vidx= *(&mf->v1 + fidx);
|
|
|
|
project_from_camera(tface->uv[fidx], coords[vidx], best_projector->uci);
|
|
|
|
} while (fidx--);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-01-04 05:13:29 +00:00
|
|
|
unsigned int fidx= mf->v4 ? 3:2;
|
|
|
|
do {
|
|
|
|
unsigned int vidx= *(&mf->v1 + fidx);
|
|
|
|
float tco[3];
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2012-01-04 05:13:29 +00:00
|
|
|
copy_v3_v3(tco, coords[vidx]);
|
|
|
|
mul_project_m4_v3(best_projector->projmat, tco);
|
|
|
|
copy_v2_v2(tface->uv[fidx], tco);
|
|
|
|
|
|
|
|
} while (fidx--);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(override_image) {
|
|
|
|
tface->tpage = image;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MEM_freeN(coords);
|
|
|
|
|
|
|
|
if(free_uci) {
|
|
|
|
int j;
|
|
|
|
for(j = 0; j < num_projectors; ++j) {
|
|
|
|
if(projectors[j].uci) {
|
|
|
|
MEM_freeN(projectors[j].uci);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dm;
|
|
|
|
}
|
|
|
|
|
2010-10-14 06:29:17 +00:00
|
|
|
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|
|
|
DerivedMesh *derivedData,
|
|
|
|
int UNUSED(useRenderParams),
|
|
|
|
int UNUSED(isFinalCalc))
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
|
|
|
DerivedMesh *result;
|
|
|
|
UVProjectModifierData *umd = (UVProjectModifierData*) md;
|
|
|
|
|
|
|
|
result = uvprojectModifier_do(umd, ob, derivedData);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-10-14 06:29:17 +00:00
|
|
|
static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
|
|
|
|
struct EditMesh *UNUSED(editData),
|
|
|
|
DerivedMesh *derivedData)
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
|
|
|
return applyModifier(md, ob, derivedData, 0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ModifierTypeInfo modifierType_UVProject = {
|
|
|
|
/* name */ "UVProject",
|
|
|
|
/* structName */ "UVProjectModifierData",
|
|
|
|
/* structSize */ sizeof(UVProjectModifierData),
|
2011-12-20 14:15:59 +00:00
|
|
|
/* type */ eModifierTypeType_NonGeometrical,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* flags */ eModifierTypeFlag_AcceptsMesh
|
|
|
|
| eModifierTypeFlag_SupportsMapping
|
|
|
|
| eModifierTypeFlag_SupportsEditmode
|
|
|
|
| eModifierTypeFlag_EnableInEditmode,
|
|
|
|
|
|
|
|
/* copyData */ copyData,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* deformVerts */ NULL,
|
|
|
|
/* deformMatrices */ NULL,
|
|
|
|
/* deformVertsEM */ NULL,
|
|
|
|
/* deformMatricesEM */ NULL,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* applyModifier */ applyModifier,
|
|
|
|
/* applyModifierEM */ applyModifierEM,
|
|
|
|
/* initData */ initData,
|
|
|
|
/* requiredDataMask */ requiredDataMask,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* freeData */ NULL,
|
|
|
|
/* isDisabled */ NULL,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* updateDepgraph */ updateDepgraph,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* dependsOnTime */ NULL,
|
|
|
|
/* dependsOnNormals */ NULL,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* foreachObjectLink */ foreachObjectLink,
|
|
|
|
/* foreachIDLink */ foreachIDLink,
|
2011-08-12 18:11:22 +00:00
|
|
|
/* foreachTexLink */ NULL,
|
2010-04-11 22:12:30 +00:00
|
|
|
};
|