2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_LATTICE_H__
|
|
|
|
|
#define __BKE_LATTICE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-02-05 16:18:46 +01:00
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct BPoint;
|
|
|
|
|
struct Depsgraph;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Lattice;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct MDeformVert;
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Main;
|
2018-04-25 11:04:40 +02:00
|
|
|
struct Mesh;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Object;
|
2009-01-04 14:14:06 +00:00
|
|
|
struct Scene;
|
2018-08-30 12:22:55 +02:00
|
|
|
struct bGPDstroke;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-05 16:03:57 +00:00
|
|
|
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void BKE_lattice_init(struct Lattice *lt);
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_lattice_copy_data(struct Main *bmain,
|
|
|
|
|
struct Lattice *lt_dst,
|
|
|
|
|
const struct Lattice *lt_src,
|
|
|
|
|
const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Lattice *BKE_lattice_copy(struct Main *bmain, const struct Lattice *lt);
|
2012-05-05 14:03:12 +00:00
|
|
|
void BKE_lattice_free(struct Lattice *lt);
|
2016-07-20 19:49:45 +02:00
|
|
|
void BKE_lattice_make_local(struct Main *bmain, struct Lattice *lt, const bool lib_local);
|
2012-10-15 09:11:17 +00:00
|
|
|
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
|
2009-01-07 16:05:55 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct LatticeDeformData *init_latt_deform(struct Object *oblatt,
|
|
|
|
|
struct Object *ob) ATTR_WARN_UNUSED_RESULT;
|
2013-08-19 10:11:48 +00:00
|
|
|
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
|
|
|
|
|
void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
|
2009-01-07 16:05:55 +00:00
|
|
|
|
2014-02-05 22:36:15 +11:00
|
|
|
bool object_deform_mball(struct Object *ob, struct ListBase *dispbase);
|
2002-10-12 11:37:38 +00:00
|
|
|
void outside_lattice(struct Lattice *lt);
|
2009-01-04 14:14:06 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void curve_deform_verts(struct Object *cuOb,
|
|
|
|
|
struct Object *target,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts,
|
|
|
|
|
struct MDeformVert *dvert,
|
|
|
|
|
const int defgrp_index,
|
|
|
|
|
short defaxis);
|
|
|
|
|
void curve_deform_vector(struct Object *cuOb,
|
|
|
|
|
struct Object *target,
|
|
|
|
|
float orco[3],
|
|
|
|
|
float vec[3],
|
|
|
|
|
float mat[3][3],
|
|
|
|
|
int no_rot_axis);
|
|
|
|
|
|
|
|
|
|
void lattice_deform_verts(struct Object *laOb,
|
|
|
|
|
struct Object *target,
|
|
|
|
|
struct Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts,
|
|
|
|
|
const char *vgroup,
|
|
|
|
|
float influence);
|
|
|
|
|
void armature_deform_verts(struct Object *armOb,
|
|
|
|
|
struct Object *target,
|
|
|
|
|
const struct Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
float (*defMats)[3][3],
|
|
|
|
|
int numVerts,
|
|
|
|
|
int deformflag,
|
|
|
|
|
float (*prevCos)[3],
|
|
|
|
|
const char *defgrp_name,
|
|
|
|
|
struct bGPDstroke *gps);
|
2009-01-04 14:14:06 +00:00
|
|
|
|
2014-03-16 03:24:05 +11:00
|
|
|
float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]);
|
|
|
|
|
void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct Object *ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice);
|
2013-06-09 20:28:08 +00:00
|
|
|
struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
|
2008-11-03 23:17:36 +00:00
|
|
|
|
2015-08-13 18:12:08 +02:00
|
|
|
struct BoundBox *BKE_lattice_boundbox_get(struct Object *ob);
|
2015-08-17 16:59:32 +02:00
|
|
|
void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], float max[3]);
|
2013-02-01 15:17:39 +00:00
|
|
|
void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
|
|
|
|
|
void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
|
|
|
|
|
void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
|
2014-02-03 18:55:59 +11:00
|
|
|
void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys);
|
2014-09-01 20:09:31 +10:00
|
|
|
void BKE_lattice_transform(struct Lattice *lt, float mat[4][4], bool do_keys);
|
2013-02-01 15:17:39 +00:00
|
|
|
|
2018-05-22 08:11:13 +02:00
|
|
|
bool BKE_lattice_is_any_selected(const struct Lattice *lt);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w);
|
2013-06-24 13:45:35 +00:00
|
|
|
void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w);
|
2019-04-17 06:17:24 +02:00
|
|
|
int BKE_lattice_index_flip(
|
|
|
|
|
struct Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w);
|
|
|
|
|
void BKE_lattice_bitmap_from_flag(struct Lattice *lt,
|
|
|
|
|
unsigned int *bitmap,
|
|
|
|
|
const short flag,
|
|
|
|
|
const bool clear,
|
|
|
|
|
const bool respecthide);
|
2013-06-24 13:45:35 +00:00
|
|
|
|
2015-05-12 13:57:11 +05:00
|
|
|
/* **** Depsgraph evaluation **** */
|
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2015-05-12 13:57:11 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_lattice_eval_geometry(struct Depsgraph *depsgraph, struct Lattice *latt);
|
2015-05-12 13:57:11 +05:00
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
/* Draw Cache */
|
|
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
BKE_LATTICE_BATCH_DIRTY_ALL = 0,
|
|
|
|
|
BKE_LATTICE_BATCH_DIRTY_SELECT,
|
2017-04-21 21:14:11 +10:00
|
|
|
};
|
2018-08-23 10:14:29 -03:00
|
|
|
void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
|
2017-04-21 21:14:11 +10:00
|
|
|
void BKE_lattice_batch_cache_free(struct Lattice *lt);
|
|
|
|
|
|
2019-02-23 12:58:39 +11:00
|
|
|
extern void (*BKE_lattice_batch_cache_dirty_tag_cb)(struct Lattice *lt, int mode);
|
|
|
|
|
extern void (*BKE_lattice_batch_cache_free_cb)(struct Lattice *lt);
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#endif /* __BKE_LATTICE_H__ */
|