tornavis/source/blender/blenkernel/BKE_lattice.h

96 lines
4.1 KiB
C
Raw Normal View History

/*
* ***** BEGIN GPL LICENSE BLOCK *****
2002-10-12 13:37:38 +02: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.
2002-10-12 13:37:38 +02: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 14:34:04 +01:00
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2002-10-12 13:37:38 +02:00
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
2002-10-12 13:37:38 +02:00
*/
#ifndef __BKE_LATTICE_H__
#define __BKE_LATTICE_H__
2002-10-12 13:37:38 +02:00
/** \file BKE_lattice.h
* \ingroup bke
* \author Ton Roosendaal
* \since June 2001
*/
2014-02-05 16:18:46 +01:00
#include "BLI_compiler_attrs.h"
2002-10-12 13:37:38 +02:00
struct Lattice;
struct Main;
2002-10-12 13:37:38 +02:00
struct Object;
struct Scene;
struct DerivedMesh;
2002-10-12 13:37:38 +02:00
struct BPoint;
2008-11-04 02:05:44 +01:00
struct MDeformVert;
2002-10-12 13:37:38 +02:00
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
struct Lattice *BKE_lattice_copy(struct Lattice *lt);
void BKE_lattice_free(struct Lattice *lt);
void BKE_lattice_make_local(struct Lattice *lt);
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
struct LatticeDeformData;
struct LatticeDeformData *init_latt_deform(struct Object *oblatt, struct Object *ob) ATTR_WARN_UNUSED_RESULT;
void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float co[3], float weight);
void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
bool object_deform_mball(struct Object *ob, struct ListBase *dispbase);
2002-10-12 13:37:38 +02:00
void outside_lattice(struct Lattice *lt);
void curve_deform_verts(struct Scene *scene, struct Object *cuOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
int numVerts, const char *vgroup, short defaxis);
void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object *target,
float orco[3], float vec[3], float mat[3][3], int no_rot_axis);
Two wonderful new NLA & Armature editing features! - FORWARD CYCLING & MATCHING Up to no now, adding multiple actions in NLA with walkcycles required to animate them standing still, as if walking on a conveyor belt. The stride option then makes the object itself move forward, trying to keep the foot stuck on the floor (with poor results!). This option now allows to make walk cycles moving forward. By indicating a reference Offset Bone, the NLA system will use that bone to detect the correct offset for the Armature Pose to make it seamlessly going forward. Best of all, this option works as for cyclic Action Strips as well as for individual Action Strips. Note that for individual strips, you have to set the strip on "Hold". (Might become automatic detected later). Here's an example edit image for NLA: http://www.blender.org/bf/nla_match-cycle.jpg And the animation for it: http://download.blender.org/demo/test/2.43/0001_0150_match.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_matching.blend Using this kind of cycling works pretty straightforward, and is a lot easier to setup than Stride Bones. To be further tested: - Blending cycles - matching rotation for the bones as well. - ACTION MODIFIERS (motion deformors) The above option was actually required for this feature. Typically walk cycles are constructed with certain Bones to be the handles, controlling for example the torso or feet. An Action Modifier allows you to use a Curve Path to deform the motion of these controlling bones. This uses the existing Curve Deformation option. Modifiers can be added per Action Strip, each controlling a channel (bone) by choice, and even allows to layer multiple modifiers on top of each other (several paths deforming motion). This option is using the dependency graph, so editing the Curve will give realtime changes in the Armature. The previous walkcycle, controlled by two curves: http://download.blender.org/demo/test/2.43/0001_0150_deform.avi Blender file: http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend Action Modifiers can be added in the NLA Properties Panel. Per Modifier you have to indicate the channel and a Curve Object. You can copy modifiers from one strip to another using CTRL+C (only copies to active Object strips). Setting up a correct Curve Path has to be carefully done: - Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated. - make sure the center point of the Curve Object is at the center of the Armature (or above) - move the first point of the curve to the center point as well. - check if the path starts from this first point, you can change it using (in Curve EditMode) the option Wkey -> "Switch Direction" - Make sure alignment uses the correct axis; if the Armature walks into the negative Y direction, you have to set in Object Buttons, "Anim settings" Panel, the correct Track option. (Note; option will probably move to the Modifier later). This is a good reason to make such paths automatic (on a command). Is on the todo list. Also note this: - the Curve Path extends in beginning and ending, that's (for now) the default, and allows to use multiple paths. Make sure paths begin and end horizontal. - Moving the Curve in Object Mode will change the "mapping" (as if the landscape a character walks over moves). Moving the Curve in Edit Mode will change the actual position of the deformation. - Speed (Ipos) on paths is not supported yet, will be done. - The Curve "Stretch" deform option doesn't work. - Modifiers are executed *after* all actions in NLA are evaluated, there's no support yet for blending multiple strips with Modifiers. - This doesn't work yet for time-mapping... This commit is mostly for review by character animators... some details or working methods might change. This feature can also be used for other modifiers, such as noise (Perlin) or the mythical "Oomph" (frequency control) and of course Python. Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 16:51:57 +01:00
void lattice_deform_verts(struct Object *laOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
int numVerts, const char *vgroup, float influence);
void armature_deform_verts(struct Object *armOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts, int deformflag,
float (*prevCos)[3], const char *defgrp_name);
float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3];
void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]);
void BKE_lattice_modifiers_calc(struct Scene *scene, struct Object *ob);
2002-10-12 13:37:38 +02:00
struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice);
struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
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 08:55:59 +01:00
void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys);
int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w);
void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w);
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);
#endif /* __BKE_LATTICE_H__ */