2011-02-18 14:05:18 +01:00
|
|
|
/*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2005-07-19 22:14:17 +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
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2005-07-19 22:14:17 +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.
|
2005-07-19 22:14:17 +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.
|
|
|
|
*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2005-07-19 22:14:17 +02:00
|
|
|
*/
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __BKE_MODIFIER_H__
|
|
|
|
#define __BKE_MODIFIER_H__
|
2005-07-19 22:14:17 +02:00
|
|
|
|
2011-02-18 14:05:18 +01:00
|
|
|
/** \file BKE_modifier.h
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
2006-12-23 12:56:22 +01:00
|
|
|
#include "DNA_modifier_types.h" /* needed for all enum typdefs */
|
2006-12-05 18:42:03 +01:00
|
|
|
#include "BKE_customdata.h"
|
|
|
|
|
2009-07-31 03:40:15 +02:00
|
|
|
struct ID;
|
2005-07-19 22:14:17 +02:00
|
|
|
struct DerivedMesh;
|
2005-07-20 01:04:34 +02:00
|
|
|
struct DagForest;
|
|
|
|
struct DagNode;
|
2005-07-19 22:14:17 +02:00
|
|
|
struct Object;
|
2009-01-04 15:14:06 +01:00
|
|
|
struct Scene;
|
2005-08-11 05:31:33 +02:00
|
|
|
struct ListBase;
|
2006-12-05 18:42:03 +01:00
|
|
|
struct LinkNode;
|
2006-06-21 17:14:44 +02:00
|
|
|
struct bArmature;
|
2006-12-23 12:56:22 +01:00
|
|
|
struct ModifierData;
|
2009-05-18 10:46:04 +02:00
|
|
|
struct BMEditMesh;
|
2005-07-19 22:14:17 +02:00
|
|
|
|
|
|
|
typedef enum {
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Should not be used, only for None modifier type */
|
2005-07-19 22:14:17 +02:00
|
|
|
eModifierTypeType_None,
|
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Modifier only does deformation, implies that modifier
|
|
|
|
* type should have a valid deformVerts function. OnlyDeform
|
|
|
|
* style modifiers implicitly accept either mesh or CV
|
|
|
|
* input but should still declare flags appropriately.
|
|
|
|
*/
|
2005-07-19 22:14:17 +02:00
|
|
|
eModifierTypeType_OnlyDeform,
|
|
|
|
|
|
|
|
eModifierTypeType_Constructive,
|
|
|
|
eModifierTypeType_Nonconstructive,
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
|
|
|
|
/* both deformVerts & applyModifier are valid calls
|
|
|
|
* used for particles modifier that doesn't actually modify the object
|
|
|
|
* unless it's a mesh and can be exploded -> curve can also emit particles
|
|
|
|
*/
|
2009-07-02 21:41:31 +02:00
|
|
|
eModifierTypeType_DeformOrConstruct,
|
2011-12-20 15:15:59 +01:00
|
|
|
|
|
|
|
/* Like eModifierTypeType_Nonconstructive, but does not affect the geometry
|
|
|
|
* of the object, rather some of its CustomData layers.
|
|
|
|
* E.g. UVProject and WeightVG modifiers. */
|
|
|
|
eModifierTypeType_NonGeometrical,
|
2005-07-19 22:14:17 +02:00
|
|
|
} ModifierTypeType;
|
|
|
|
|
|
|
|
typedef enum {
|
2006-08-28 03:12:36 +02:00
|
|
|
eModifierTypeFlag_AcceptsMesh = (1<<0),
|
|
|
|
eModifierTypeFlag_AcceptsCVs = (1<<1),
|
|
|
|
eModifierTypeFlag_SupportsMapping = (1<<2),
|
|
|
|
eModifierTypeFlag_SupportsEditmode = (1<<3),
|
|
|
|
|
|
|
|
/* For modifiers that support editmode this determines if the
|
|
|
|
* modifier should be enabled by default in editmode. This should
|
|
|
|
* only be used by modifiers that are relatively speedy and
|
|
|
|
* also generally used in editmode, otherwise let the user enable
|
|
|
|
* it by hand.
|
|
|
|
*/
|
|
|
|
eModifierTypeFlag_EnableInEditmode = (1<<4),
|
|
|
|
|
|
|
|
/* For modifiers that require original data and so cannot
|
|
|
|
* be placed after any non-deformative modifier.
|
|
|
|
*/
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-11 00:05:52 +02:00
|
|
|
eModifierTypeFlag_RequiresOriginalData = (1<<5),
|
2007-11-30 11:38:59 +01:00
|
|
|
|
|
|
|
/* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
|
2012-03-03 21:19:11 +01:00
|
|
|
*/
|
2007-11-30 11:38:59 +01:00
|
|
|
eModifierTypeFlag_UsesPointCache = (1<<6),
|
2009-07-02 21:41:31 +02:00
|
|
|
|
|
|
|
/* For physics modifiers, max one per type */
|
2009-08-21 04:51:56 +02:00
|
|
|
eModifierTypeFlag_Single = (1<<7),
|
|
|
|
|
|
|
|
/* Some modifier can't be added manually by user */
|
Add weight preview to WeightVG modifiers, and first, simple/basic refactor of how modifiers can generate preview.
User side:
* Preview for DynamicPaint should keep the same behavior (for now). Weight preview should be somawhat quicker, though.
* Preview for WeightVG modifiers is only active in WeightPaint mode, and if the affected vgroup is the active one.
* Last active preview modifier in stack wins!
Note: that modifier preview topic is yet to be further refined, quite raw/incomplete for now.
Dev side:
* In draw code, renamed DRAW_DYNAMIC_PAINT_PREVIEW flag to DRAW_MODIFIERS_PREVIEW
* Removed use of MOD_DPAINT_PREVIEW_READY in DynamicPaint code (seems unecessary, and if it was, should be of more general scope).
* Added eModifierTypeFlag_UsesPreview to ModifierTypeFlag, for modifiers that can generate some preview data.
* Added three new modifier funcs, to handle preview modifiers in draw code / mod stack.
* For weights preview: added the generic DM_update_weight_mcol func, which can update WEIGHT_MCOL layer with either a given array of weights (currently used by DynamicPaint only), or from current active vgroup(s).
So now, draw code is fully generic (i.e. no more modifier-type checking in it). Mod stack code is generic to some extent, but will need more work.
2012-01-22 18:54:23 +01:00
|
|
|
eModifierTypeFlag_NoUserAdd = (1<<8),
|
|
|
|
|
|
|
|
/* For modifiers that use CD_WEIGHT_MCOL for preview. */
|
|
|
|
eModifierTypeFlag_UsesPreview = (1<<9)
|
2005-07-19 22:14:17 +02:00
|
|
|
} ModifierTypeFlag;
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin);
|
|
|
|
typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin);
|
2011-08-12 20:11:22 +02:00
|
|
|
typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
2005-07-19 22:14:17 +02:00
|
|
|
typedef struct ModifierTypeInfo {
|
2006-08-28 03:12:36 +02:00
|
|
|
/* The user visible name for this modifier */
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 22:30:33 +02:00
|
|
|
char name[32];
|
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* The DNA struct name for the modifier data type, used to
|
|
|
|
* write the DNA data out.
|
|
|
|
*/
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 22:30:33 +02:00
|
|
|
char structName[32];
|
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* The size of the modifier data type, used by allocation. */
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 22:30:33 +02:00
|
|
|
int structSize;
|
|
|
|
|
2005-07-19 22:14:17 +02:00
|
|
|
ModifierTypeType type;
|
|
|
|
ModifierTypeFlag flags;
|
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 22:30:33 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/********************* Non-optional functions *********************/
|
|
|
|
|
|
|
|
/* Copy instance data for this modifier type. Should copy all user
|
|
|
|
* level settings to the target modifier.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*copyData)(struct ModifierData *md, struct ModifierData *target);
|
2005-07-27 22:16:41 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/********************* Deform modifier functions *********************/
|
|
|
|
|
|
|
|
/* Only for deform types, should apply the deformation
|
|
|
|
* to the given vertex array. If the deformer requires information from
|
|
|
|
* the object it can obtain it from the derivedData argument if non-NULL,
|
|
|
|
* and otherwise the ob argument.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*deformVerts)(struct ModifierData *md, struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
struct DerivedMesh *derivedData,
|
|
|
|
float (*vertexCos)[3], int numVerts,
|
|
|
|
int useRenderParams, int isFinalCalc);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
2011-01-31 21:02:51 +01:00
|
|
|
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
|
|
|
void (*deformMatrices)(
|
|
|
|
struct ModifierData *md, struct Object *ob,
|
|
|
|
struct DerivedMesh *derivedData,
|
|
|
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Like deformVerts but called during editmode (for supporting modifiers)
|
|
|
|
*/
|
|
|
|
void (*deformVertsEM)(
|
2010-03-22 10:30:00 +01:00
|
|
|
struct ModifierData *md, struct Object *ob,
|
2010-07-19 06:44:37 +02:00
|
|
|
struct BMEditMesh *editData, struct DerivedMesh *derivedData,
|
2010-03-22 10:30:00 +01:00
|
|
|
float (*vertexCos)[3], int numVerts);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
2007-07-28 23:04:30 +02:00
|
|
|
/* Set deform matrix per vertex for crazyspace correction */
|
|
|
|
void (*deformMatricesEM)(
|
2010-03-22 10:30:00 +01:00
|
|
|
struct ModifierData *md, struct Object *ob,
|
2010-07-19 06:44:37 +02:00
|
|
|
struct BMEditMesh *editData, struct DerivedMesh *derivedData,
|
2010-03-22 10:30:00 +01:00
|
|
|
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
|
|
|
/********************* Non-deform modifier functions *********************/
|
|
|
|
|
|
|
|
/* For non-deform types: apply the modifier and return a derived
|
|
|
|
* data object (type is dependent on object type).
|
|
|
|
*
|
|
|
|
* The derivedData argument should always be non-NULL; the modifier
|
|
|
|
* should read the object data from the derived object instead of the
|
|
|
|
* actual object data.
|
|
|
|
*
|
|
|
|
* The useRenderParams argument indicates if the modifier is being
|
|
|
|
* applied in the service of the renderer which may alter quality
|
|
|
|
* settings.
|
|
|
|
*
|
|
|
|
* The isFinalCalc parameter indicates if the modifier is being
|
|
|
|
* calculated for a final result or for something temporary
|
|
|
|
* (like orcos). This is a hack at the moment, it is meant so subsurf
|
|
|
|
* can know if it is safe to reuse its internal cache.
|
|
|
|
*
|
|
|
|
* The modifier may reuse the derivedData argument (i.e. return it in
|
|
|
|
* modified form), but must not release it.
|
|
|
|
*/
|
|
|
|
struct DerivedMesh *(*applyModifier)(
|
2010-03-22 10:30:00 +01:00
|
|
|
struct ModifierData *md, struct Object *ob,
|
|
|
|
struct DerivedMesh *derivedData,
|
|
|
|
int useRenderParams, int isFinalCalc);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
|
|
|
/* Like applyModifier but called during editmode (for supporting
|
|
|
|
* modifiers).
|
|
|
|
*
|
|
|
|
* The derived object that is returned must support the operations that
|
|
|
|
* are expected from editmode objects. The same qualifications regarding
|
|
|
|
* derivedData apply as for applyModifier.
|
|
|
|
*/
|
|
|
|
struct DerivedMesh *(*applyModifierEM)(
|
2010-03-22 10:30:00 +01:00
|
|
|
struct ModifierData *md, struct Object *ob,
|
2010-07-19 06:44:37 +02:00
|
|
|
struct BMEditMesh *editData,
|
2010-03-22 10:30:00 +01:00
|
|
|
struct DerivedMesh *derivedData);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
/********************* Optional functions *********************/
|
|
|
|
|
|
|
|
/* Initialize new instance data for this modifier type, this function
|
|
|
|
* should set modifier variables to their default values.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*initData)(struct ModifierData *md);
|
2006-08-28 03:12:36 +02:00
|
|
|
|
2006-12-05 18:42:03 +01:00
|
|
|
/* Should return a CustomDataMask indicating what data this
|
|
|
|
* modifier needs. If (mask & (1 << (layer type))) != 0, this modifier
|
|
|
|
* needs that custom data layer. This function's return value can change
|
|
|
|
* depending on the modifier's settings.
|
|
|
|
*
|
|
|
|
* Note that this means extra data (e.g. vertex groups) - it is assumed
|
|
|
|
* that all modifiers need mesh data and deform modifiers need vertex
|
|
|
|
* coordinates.
|
|
|
|
*
|
|
|
|
* Note that this limits the number of custom data layer types to 32.
|
|
|
|
*
|
|
|
|
* If this function is not present or it returns 0, it is assumed that
|
|
|
|
* no extra data is needed.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2009-06-15 13:48:42 +02:00
|
|
|
CustomDataMask (*requiredDataMask)(struct Object *ob, struct ModifierData *md);
|
2006-12-05 18:42:03 +01:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Free internal modifier data variables, this function should
|
|
|
|
* not free the md variable itself.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*freeData)(struct ModifierData *md);
|
2005-07-19 22:14:17 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Return a boolean value indicating if this modifier is able to be
|
|
|
|
* calculated based on the modifier data. This is *not* regarding the
|
|
|
|
* md->flag, that is tested by the system, this is just if the data
|
|
|
|
* validates (for example, a lattice will return false if the lattice
|
|
|
|
* object is not defined).
|
|
|
|
*
|
|
|
|
* This function is optional (assumes never disabled if not present).
|
|
|
|
*/
|
2009-11-25 15:07:12 +01:00
|
|
|
int (*isDisabled)(struct ModifierData *md, int userRenderParams);
|
2005-07-19 22:14:17 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Add the appropriate relations to the DEP graph depending on the
|
|
|
|
* modifier data.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2009-01-04 15:14:06 +01:00
|
|
|
void (*updateDepgraph)(struct ModifierData *md, struct DagForest *forest, struct Scene *scene,
|
2010-03-22 10:30:00 +01:00
|
|
|
struct Object *ob, struct DagNode *obNode);
|
2005-07-20 06:14:21 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Should return true if the modifier needs to be recalculated on time
|
|
|
|
* changes.
|
|
|
|
*
|
|
|
|
* This function is optional (assumes false if not present).
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
int (*dependsOnTime)(struct ModifierData *md);
|
2005-07-19 22:14:17 +02:00
|
|
|
|
2010-09-30 12:51:36 +02:00
|
|
|
|
|
|
|
/* True when a deform modifier uses normals, the requiredDataMask
|
|
|
|
* cant be used here because that refers to a normal layer where as
|
|
|
|
* in this case we need to know if the deform modifier uses normals.
|
|
|
|
*
|
|
|
|
* this is needed because applying 2 deform modifiers will give the
|
|
|
|
* second modifier bogus normals.
|
|
|
|
* */
|
|
|
|
int (*dependsOnNormals)(struct ModifierData *md);
|
|
|
|
|
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Should call the given walk function on with a pointer to each Object
|
|
|
|
* pointer that the modifier data stores. This is used for linking on file
|
|
|
|
* load and for unlinking objects or forwarding object references.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*foreachObjectLink)(struct ModifierData *md, struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
ObjectWalkFunc walk, void *userData);
|
2005-07-19 22:14:17 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Should call the given walk function with a pointer to each ID
|
|
|
|
* pointer (i.e. each datablock pointer) that the modifier data
|
|
|
|
* stores. This is used for linking on file load and for
|
|
|
|
* unlinking datablocks or forwarding datablock references.
|
|
|
|
*
|
|
|
|
* This function is optional. If it is not present, foreachObjectLink
|
|
|
|
* will be used.
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 22:30:33 +02:00
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
void (*foreachIDLink)(struct ModifierData *md, struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
IDWalkFunc walk, void *userData);
|
2011-08-12 20:11:22 +02:00
|
|
|
|
|
|
|
/* Should call the given walk function for each texture that the
|
|
|
|
* modifier data stores. This is used for finding all textures in
|
|
|
|
* the context for the UI.
|
|
|
|
*
|
|
|
|
* This function is optional. If it is not present, it will be
|
|
|
|
* assumed the modifier has no textures.
|
|
|
|
*/
|
|
|
|
void (*foreachTexLink)(struct ModifierData *md, struct Object *ob,
|
|
|
|
TexWalkFunc walk, void *userData);
|
2006-08-28 03:12:36 +02:00
|
|
|
} ModifierTypeInfo;
|
2005-08-11 04:23:52 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
ModifierTypeInfo *modifierType_getInfo (ModifierType type);
|
2005-08-11 04:23:52 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
/* Modifier utility calls, do call through type pointer and return
|
|
|
|
* default values if pointer is optional.
|
|
|
|
*/
|
2006-12-23 12:56:22 +01:00
|
|
|
struct ModifierData *modifier_new(int type);
|
|
|
|
void modifier_free(struct ModifierData *md);
|
2005-08-11 04:23:52 +02:00
|
|
|
|
2009-10-23 01:22:05 +02:00
|
|
|
void modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md);
|
|
|
|
|
2006-12-23 12:56:22 +01:00
|
|
|
void modifier_copyData(struct ModifierData *md, struct ModifierData *target);
|
|
|
|
int modifier_dependsOnTime(struct ModifierData *md);
|
|
|
|
int modifier_supportsMapping(struct ModifierData *md);
|
2010-01-25 12:39:56 +01:00
|
|
|
int modifier_couldBeCage(struct Scene *scene, struct ModifierData *md);
|
2009-12-09 02:53:04 +01:00
|
|
|
int modifier_isCorrectableDeformed(struct ModifierData *md);
|
2009-11-22 14:44:09 +01:00
|
|
|
int modifier_sameTopology(ModifierData *md);
|
2011-12-20 15:15:59 +01:00
|
|
|
int modifier_nonGeometrical(ModifierData *md);
|
2010-01-25 12:39:56 +01:00
|
|
|
int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
|
2010-12-04 12:44:56 +01:00
|
|
|
void modifier_setError(struct ModifierData *md, const char *format, ...)
|
|
|
|
#ifdef __GNUC__
|
2011-02-27 09:31:10 +01:00
|
|
|
__attribute__ ((format (printf, 2, 3)))
|
2010-12-04 12:44:56 +01:00
|
|
|
#endif
|
|
|
|
;
|
Add weight preview to WeightVG modifiers, and first, simple/basic refactor of how modifiers can generate preview.
User side:
* Preview for DynamicPaint should keep the same behavior (for now). Weight preview should be somawhat quicker, though.
* Preview for WeightVG modifiers is only active in WeightPaint mode, and if the affected vgroup is the active one.
* Last active preview modifier in stack wins!
Note: that modifier preview topic is yet to be further refined, quite raw/incomplete for now.
Dev side:
* In draw code, renamed DRAW_DYNAMIC_PAINT_PREVIEW flag to DRAW_MODIFIERS_PREVIEW
* Removed use of MOD_DPAINT_PREVIEW_READY in DynamicPaint code (seems unecessary, and if it was, should be of more general scope).
* Added eModifierTypeFlag_UsesPreview to ModifierTypeFlag, for modifiers that can generate some preview data.
* Added three new modifier funcs, to handle preview modifiers in draw code / mod stack.
* For weights preview: added the generic DM_update_weight_mcol func, which can update WEIGHT_MCOL layer with either a given array of weights (currently used by DynamicPaint only), or from current active vgroup(s).
So now, draw code is fully generic (i.e. no more modifier-type checking in it). Mod stack code is generic to some extent, but will need more work.
2012-01-22 18:54:23 +01:00
|
|
|
int modifier_isPreview(struct ModifierData *md);
|
2005-07-27 22:16:41 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
void modifiers_foreachObjectLink(struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
ObjectWalkFunc walk,
|
|
|
|
void *userData);
|
2006-08-28 03:12:36 +02:00
|
|
|
void modifiers_foreachIDLink(struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
IDWalkFunc walk,
|
|
|
|
void *userData);
|
2011-08-12 20:11:22 +02:00
|
|
|
void modifiers_foreachTexLink(struct Object *ob,
|
|
|
|
TexWalkFunc walk,
|
|
|
|
void *userData);
|
|
|
|
|
2006-12-23 12:56:22 +01:00
|
|
|
struct ModifierData *modifiers_findByType(struct Object *ob, ModifierType type);
|
2010-04-22 03:55:10 +02:00
|
|
|
struct ModifierData *modifiers_findByName(struct Object *ob, const char *name);
|
2006-08-28 03:12:36 +02:00
|
|
|
void modifiers_clearErrors(struct Object *ob);
|
2010-01-25 12:39:56 +01:00
|
|
|
int modifiers_getCageIndex(struct Scene *scene, struct Object *ob,
|
2010-03-22 10:30:00 +01:00
|
|
|
int *lastPossibleCageIndex_r, int virtual_);
|
2005-08-11 05:31:33 +02:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
int modifiers_isSoftbodyEnabled(struct Object *ob);
|
2008-01-29 22:01:12 +01:00
|
|
|
int modifiers_isClothEnabled(struct Object *ob);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
int modifiers_isParticleEnabled(struct Object *ob);
|
2008-01-29 22:01:12 +01:00
|
|
|
|
2006-08-28 03:12:36 +02:00
|
|
|
struct Object *modifiers_isDeformedByArmature(struct Object *ob);
|
2006-12-23 12:56:22 +01:00
|
|
|
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
|
2006-08-28 03:12:36 +02:00
|
|
|
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
|
2010-10-14 08:29:17 +02:00
|
|
|
int modifiers_isCorrectableDeformed(struct Object *ob);
|
2007-12-17 12:47:24 +01:00
|
|
|
void modifier_freeTemporaryData(struct ModifierData *md);
|
Add weight preview to WeightVG modifiers, and first, simple/basic refactor of how modifiers can generate preview.
User side:
* Preview for DynamicPaint should keep the same behavior (for now). Weight preview should be somawhat quicker, though.
* Preview for WeightVG modifiers is only active in WeightPaint mode, and if the affected vgroup is the active one.
* Last active preview modifier in stack wins!
Note: that modifier preview topic is yet to be further refined, quite raw/incomplete for now.
Dev side:
* In draw code, renamed DRAW_DYNAMIC_PAINT_PREVIEW flag to DRAW_MODIFIERS_PREVIEW
* Removed use of MOD_DPAINT_PREVIEW_READY in DynamicPaint code (seems unecessary, and if it was, should be of more general scope).
* Added eModifierTypeFlag_UsesPreview to ModifierTypeFlag, for modifiers that can generate some preview data.
* Added three new modifier funcs, to handle preview modifiers in draw code / mod stack.
* For weights preview: added the generic DM_update_weight_mcol func, which can update WEIGHT_MCOL layer with either a given array of weights (currently used by DynamicPaint only), or from current active vgroup(s).
So now, draw code is fully generic (i.e. no more modifier-type checking in it). Mod stack code is generic to some extent, but will need more work.
2012-01-22 18:54:23 +01:00
|
|
|
int modifiers_isPreview(struct Object *ob);
|
2005-09-18 15:27:12 +02:00
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 23:09:57 +01:00
|
|
|
int modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
|
|
|
|
|
2006-12-05 18:42:03 +01:00
|
|
|
/* Calculates and returns a linked list of CustomDataMasks indicating the
|
|
|
|
* data required by each modifier in the stack pointed to by md for correct
|
|
|
|
* evaluation, assuming the data indicated by dataMask is required at the
|
|
|
|
* end of the stack.
|
|
|
|
*/
|
2010-01-25 12:39:56 +01:00
|
|
|
struct LinkNode *modifiers_calcDataMasks(struct Scene *scene,
|
2010-03-22 10:30:00 +01:00
|
|
|
struct Object *ob,
|
|
|
|
struct ModifierData *md,
|
|
|
|
CustomDataMask dataMask,
|
|
|
|
int required_mode);
|
Add weight preview to WeightVG modifiers, and first, simple/basic refactor of how modifiers can generate preview.
User side:
* Preview for DynamicPaint should keep the same behavior (for now). Weight preview should be somawhat quicker, though.
* Preview for WeightVG modifiers is only active in WeightPaint mode, and if the affected vgroup is the active one.
* Last active preview modifier in stack wins!
Note: that modifier preview topic is yet to be further refined, quite raw/incomplete for now.
Dev side:
* In draw code, renamed DRAW_DYNAMIC_PAINT_PREVIEW flag to DRAW_MODIFIERS_PREVIEW
* Removed use of MOD_DPAINT_PREVIEW_READY in DynamicPaint code (seems unecessary, and if it was, should be of more general scope).
* Added eModifierTypeFlag_UsesPreview to ModifierTypeFlag, for modifiers that can generate some preview data.
* Added three new modifier funcs, to handle preview modifiers in draw code / mod stack.
* For weights preview: added the generic DM_update_weight_mcol func, which can update WEIGHT_MCOL layer with either a given array of weights (currently used by DynamicPaint only), or from current active vgroup(s).
So now, draw code is fully generic (i.e. no more modifier-type checking in it). Mod stack code is generic to some extent, but will need more work.
2012-01-22 18:54:23 +01:00
|
|
|
struct ModifierData *modifiers_getLastPreview(struct Scene *scene,
|
|
|
|
struct ModifierData *md,
|
|
|
|
int required_mode);
|
2006-12-23 12:56:22 +01:00
|
|
|
struct ModifierData *modifiers_getVirtualModifierList(struct Object *ob);
|
2005-09-18 15:27:12 +02:00
|
|
|
|
2010-09-09 02:14:51 +02:00
|
|
|
/* ensure modifier correctness when changing ob->data */
|
|
|
|
void test_object_modifiers(struct Object *ob);
|
|
|
|
|
2010-04-23 13:19:06 +02:00
|
|
|
/* here for do_versions */
|
|
|
|
void modifier_mdef_compact_influences(struct ModifierData *md);
|
|
|
|
|
2011-11-20 15:38:11 +01:00
|
|
|
void modifier_path_init(char *path, int path_maxlen, const char *name);
|
|
|
|
const char *modifier_path_relbase(struct Object *ob);
|
|
|
|
|
2005-07-19 22:14:17 +02:00
|
|
|
#endif
|
|
|
|
|