23 #define DNA_DEPRECATED_ALLOW
71 lattice_dst->
key->
from = &lattice_dst->
id;
76 if (lattice_src->
dvert) {
179 .struct_size =
sizeof(
Lattice),
181 .name_plural =
"lattices",
184 .asset_type_info =
NULL,
191 .foreach_cache =
NULL,
192 .foreach_path =
NULL,
200 .blend_read_undo_preserve =
NULL,
202 .lib_override_apply_post =
NULL,
207 const int totu = lt->
pntsu;
208 const int totv = lt->
pntsv;
210 return (
w * (totu * totv) + (
v * totu) + u);
215 const int totu = lt->
pntsu;
216 const int totv = lt->
pntsv;
218 *r_u = (index % totu);
219 *r_v = (index / totu) % totv;
220 *r_w = (index / (totu * totv));
224 Lattice *lt,
const int index,
const bool flip_u,
const bool flip_v,
const bool flip_w)
231 u = (lt->
pntsu - 1) - u;
252 for (
int i = 0; i < tot; i++, bp++) {
253 if ((bp->
f1 & flag) && (!respecthide || !bp->
hide)) {
271 *r_fu = -0.5f * (res - 1);
276 *r_du = 2.0f / (res - 1);
284 float fu, fv, fw, uc, vc, wc, du = 0.0, dv = 0.0, dw = 0.0;
285 float *co, (*vert_coords)[3] =
NULL;
293 while (uNew * vNew * wNew > 32000) {
294 if (uNew >= vNew && uNew >= wNew) {
297 else if (vNew >= uNew && vNew >= wNew) {
305 vert_coords =
MEM_mallocN(
sizeof(*vert_coords) * uNew * vNew * wNew,
"tmp_vcos");
317 const float default_size = 1.0;
320 fu = -default_size / 2.0;
321 du = default_size / (uNew - 1);
325 fv = -default_size / 2.0;
326 dv = default_size / (vNew - 1);
330 fw = -default_size / 2.0;
331 dw = default_size / (wNew - 1);
336 for (
w = 0, wc = fw;
w < wNew;
w++, wc += dw) {
337 for (
v = 0, vc = fv;
v < vNew;
v++, vc += dv) {
338 for (u = 0, uc = fu; u < uNew; u++, co += 3, uc += du) {
406 for (dl = dispbase->
first; dl; dl = dl->
next) {
425 float fac1, du = 0.0, dv = 0.0, dw = 0.0;
444 for (u = 0; u < lt->
pntsu; u++, bp++) {
445 if (u == 0 ||
v == 0 ||
w == 0 || u == lt->
pntsu - 1 ||
v == lt->
pntsv - 1 ||
458 bp->
vec[0] = (1.0f - fac1) * bp1->
vec[0] + fac1 * bp2->
vec[0];
459 bp->
vec[1] = (1.0f - fac1) * bp1->
vec[1] + fac1 * bp2->
vec[1];
460 bp->
vec[2] = (1.0f - fac1) * bp1->
vec[2] + fac1 * bp2->
vec[2];
467 bp->
vec[0] += (1.0f - fac1) * bp1->
vec[0] + fac1 * bp2->
vec[0];
468 bp->
vec[1] += (1.0f - fac1) * bp1->
vec[1] + fac1 * bp2->
vec[1];
469 bp->
vec[2] += (1.0f - fac1) * bp1->
vec[2] + fac1 * bp2->
vec[2];
476 bp->
vec[0] += (1.0f - fac1) * bp1->
vec[0] + fac1 * bp2->
vec[0];
477 bp->
vec[1] += (1.0f - fac1) * bp1->
vec[1] + fac1 * bp2->
vec[1];
478 bp->
vec[2] += (1.0f - fac1) * bp1->
vec[2] + fac1 * bp2->
vec[2];
491 for (u = 0; u < lt->
pntsu; u++, bp++) {
502 for (
int i = 0; i < vert_len; i++) {
510 float(*vert_coords)[3] =
MEM_mallocN(
sizeof(*vert_coords) * vert_len, __func__);
516 const float (*vert_coords)[3],
517 const float mat[4][4])
520 for (i = 0; i < numVerts; i++) {
528 for (
int i = 0; i < vert_len; i++) {
548 for (; md; md = md->
next) {
567 if (vert_coords ==
NULL) {
576 if (vert_coords ==
NULL) {
581 if (lt_eval ==
NULL) {
625 for (i = 0; i < numVerts; i++) {
676 for (i = 0; i < numVerts; i++) {
691 for (i = 0; i < numVerts; i++) {
716 if (do_keys && lt->
key) {
720 float *fp = kb->
data;
721 for (i = kb->
totelem; i--; fp += 3) {
735 for (i = 0; i < numVerts; i++) {
741 for (i = 0; i < numVerts; i++) {
746 if (do_keys && lt->
key) {
750 float *fp = kb->
data;
751 for (i = kb->
totelem; i--; fp += 3) {
typedef float(TangentPoint)[2]
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
display list (or rather multi purpose list) stuff.
void BKE_displist_free(struct ListBase *lb)
DispList * BKE_displist_find(struct ListBase *lb, int type)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void BKE_lattice_deform_coords(const struct Object *ob_lattice, const struct Object *ob_target, float(*vert_coords)[3], int vert_coords_len, short flag, const char *defgrp_name, float fac)
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag)
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
void * BKE_id_new(struct Main *bmain, short type, const char *name)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
@ eModifierTypeFlag_AcceptsVertexCosOnly
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
@ eModifierTypeType_OnlyDeform
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
struct Lattice * BKE_object_get_lattice(const struct Object *object)
void BKE_object_free_derived_caches(struct Object *ob)
struct Lattice * BKE_object_get_evaluated_lattice(const struct Object *object)
void BKE_object_eval_assign_data(struct Object *object, struct ID *data, bool is_owned)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_DISABLE(_bitmap, _index)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void unit_m4(float m[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
#define INIT_MINMAX(min, max)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
void BLO_read_list(BlendDataReader *reader, struct ListBase *list)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_expand(expander, id)
#define BLT_I18NCONTEXT_ID_LATTICE
struct Depsgraph Depsgraph
#define DNA_struct_default_get(struct_name)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static void init_data(ModifierData *md)
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void outside_lattice(Lattice *lt)
static void lattice_blend_read_lib(BlendLibReader *reader, ID *id)
static BPoint * latt_bp(Lattice *lt, int u, int v, int w)
void BKE_lattice_bitmap_from_flag(Lattice *lt, BLI_bitmap *bitmap, const uint8_t flag, const bool clear, const bool respecthide)
void BKE_lattice_transform(Lattice *lt, const float mat[4][4], bool do_keys)
static void lattice_blend_read_expand(BlendExpander *expander, ID *id)
void BKE_lattice_center_bounds(Lattice *lt, float cent[3])
void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
void BKE_lattice_batch_cache_dirty_tag(Lattice *lt, int mode)
static void lattice_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_lattice_vert_coords_apply(Lattice *lt, const float(*vert_coords)[3])
void(* BKE_lattice_batch_cache_dirty_tag_cb)(Lattice *lt, int mode)
float(* BKE_lattice_vert_coords_alloc(const Lattice *lt, int *r_vert_len))[3]
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3])
void BKE_lattice_center_median(Lattice *lt, float cent[3])
static void boundbox_lattice(Object *ob)
static void lattice_free_data(ID *id)
void(* BKE_lattice_batch_cache_free_cb)(Lattice *lt)
static void lattice_blend_read_data(BlendDataReader *reader, ID *id)
static void lattice_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
void BKE_lattice_index_to_uvw(Lattice *lt, const int index, int *r_u, int *r_v, int *r_w)
Lattice * BKE_lattice_add(Main *bmain, const char *name)
static void lattice_init_data(ID *id)
struct BPoint * BKE_lattice_active_point_get(Lattice *lt)
void BKE_lattice_translate(Lattice *lt, const float offset[3], bool do_keys)
bool BKE_lattice_is_any_selected(const Lattice *lt)
void BKE_lattice_eval_geometry(struct Depsgraph *UNUSED(depsgraph), Lattice *UNUSED(latt))
void BKE_lattice_vert_coords_apply_with_mat4(struct Lattice *lt, const float(*vert_coords)[3], const float mat[4][4])
bool object_deform_mball(Object *ob, ListBase *dispbase)
int BKE_lattice_index_flip(Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w)
void BKE_lattice_minmax(Lattice *lt, float min[3], float max[3])
int BKE_lattice_index_from_uvw(Lattice *lt, const int u, const int v, const int w)
void BKE_lattice_batch_cache_free(Lattice *lt)
void BKE_lattice_vert_coords_get(const Lattice *lt, float(*vert_coords)[3])
BoundBox * BKE_lattice_boundbox_get(Object *ob)
void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Object *ob)
struct MDeformVert * BKE_lattice_deform_verts_get(const struct Object *oblatt)
static void lattice_foreach_id(ID *id, LibraryForeachIDData *data)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void clear(Message *msg)
ListBase vertex_group_names
struct MDeformVert * dvert
struct EditLatt * editlatt
struct ModifierData * next
bool(* isDisabled)(const struct Scene *scene, struct ModifierData *md, bool userRenderParams)
void(* deformVerts)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct Mesh *mesh, float(*vertexCos)[3], int numVerts)
struct CurveCache * curve_cache