|
|
|
|
@@ -48,25 +48,28 @@ typedef enum {
|
|
|
|
|
/* Should not be used, only for None modifier type */
|
|
|
|
|
eModifierTypeType_None,
|
|
|
|
|
|
|
|
|
|
/* Modifier only does deformation, implies that modifier
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
eModifierTypeType_OnlyDeform,
|
|
|
|
|
|
|
|
|
|
/* Modifier adds geometry. */
|
|
|
|
|
/** Modifier adds geometry. */
|
|
|
|
|
eModifierTypeType_Constructive,
|
|
|
|
|
/* Modifier can add and remove geometry. */
|
|
|
|
|
eModifierTypeType_Nonconstructive,
|
|
|
|
|
|
|
|
|
|
/* both deformVerts & applyModifier are valid calls
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
eModifierTypeType_DeformOrConstruct,
|
|
|
|
|
|
|
|
|
|
/* Like eModifierTypeType_Nonconstructive, but does not affect the geometry
|
|
|
|
|
/**
|
|
|
|
|
* 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,
|
|
|
|
|
@@ -78,7 +81,8 @@ typedef enum {
|
|
|
|
|
eModifierTypeFlag_SupportsMapping = (1 << 2),
|
|
|
|
|
eModifierTypeFlag_SupportsEditmode = (1 << 3),
|
|
|
|
|
|
|
|
|
|
/* For modifiers that support editmode this determines if the
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
@@ -86,22 +90,25 @@ typedef enum {
|
|
|
|
|
*/
|
|
|
|
|
eModifierTypeFlag_EnableInEditmode = (1 << 4),
|
|
|
|
|
|
|
|
|
|
/* For modifiers that require original data and so cannot
|
|
|
|
|
/**
|
|
|
|
|
* For modifiers that require original data and so cannot
|
|
|
|
|
* be placed after any non-deformative modifier.
|
|
|
|
|
*/
|
|
|
|
|
eModifierTypeFlag_RequiresOriginalData = (1 << 5),
|
|
|
|
|
|
|
|
|
|
/* For modifiers that support pointcache,
|
|
|
|
|
* so we can check to see if it has files we need to deal with. */
|
|
|
|
|
/**
|
|
|
|
|
* For modifiers that support pointcache,
|
|
|
|
|
* so we can check to see if it has files we need to deal with.
|
|
|
|
|
*/
|
|
|
|
|
eModifierTypeFlag_UsesPointCache = (1 << 6),
|
|
|
|
|
|
|
|
|
|
/* For physics modifiers, max one per type */
|
|
|
|
|
/** For physics modifiers, max one per type */
|
|
|
|
|
eModifierTypeFlag_Single = (1 << 7),
|
|
|
|
|
|
|
|
|
|
/* Some modifier can't be added manually by user */
|
|
|
|
|
/** Some modifier can't be added manually by user */
|
|
|
|
|
eModifierTypeFlag_NoUserAdd = (1 << 8),
|
|
|
|
|
|
|
|
|
|
/* For modifiers that use CD_PREVIEW_MCOL for preview. */
|
|
|
|
|
/** For modifiers that use CD_PREVIEW_MCOL for preview. */
|
|
|
|
|
eModifierTypeFlag_UsesPreview = (1 << 9),
|
|
|
|
|
eModifierTypeFlag_AcceptsVertexCosOnly = (1 << 10),
|
|
|
|
|
|
|
|
|
|
@@ -169,7 +176,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
|
|
|
|
|
/********************* Non-optional functions *********************/
|
|
|
|
|
|
|
|
|
|
/* Copy instance data for this modifier type. Should copy all user
|
|
|
|
|
/**
|
|
|
|
|
* Copy instance data for this modifier type. Should copy all user
|
|
|
|
|
* level settings to the target modifier.
|
|
|
|
|
*
|
|
|
|
|
* \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).
|
|
|
|
|
@@ -178,7 +186,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
|
|
|
|
|
/********************* Deform modifier functions *********************/
|
|
|
|
|
|
|
|
|
|
/* Only for deform types, should apply the deformation
|
|
|
|
|
/**
|
|
|
|
|
* 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 mesh argument if non-NULL,
|
|
|
|
|
* and otherwise the ob argument.
|
|
|
|
|
@@ -189,15 +198,17 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
int numVerts);
|
|
|
|
|
|
|
|
|
|
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
|
|
|
|
/**
|
|
|
|
|
* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode).
|
|
|
|
|
*/
|
|
|
|
|
void (*deformMatrices)(struct ModifierData *md,
|
|
|
|
|
const struct ModifierEvalContext *ctx,
|
|
|
|
|
struct Mesh *mesh,
|
|
|
|
|
float (*vertexCos)[3],
|
|
|
|
|
float (*defMats)[3][3],
|
|
|
|
|
int numVerts);
|
|
|
|
|
|
|
|
|
|
/* Like deformVerts but called during editmode (for supporting modifiers)
|
|
|
|
|
/**
|
|
|
|
|
* Like deformVerts but called during editmode (for supporting modifiers)
|
|
|
|
|
*/
|
|
|
|
|
void (*deformVertsEM)(struct ModifierData *md,
|
|
|
|
|
const struct ModifierEvalContext *ctx,
|
|
|
|
|
@@ -217,7 +228,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
|
|
|
|
|
/********************* Non-deform modifier functions *********************/
|
|
|
|
|
|
|
|
|
|
/* For non-deform types: apply the modifier and return a mesh data-block.
|
|
|
|
|
/**
|
|
|
|
|
* For non-deform types: apply the modifier and return a mesh data-block.
|
|
|
|
|
*
|
|
|
|
|
* The mesh argument should always be non-NULL; the modifier should use the
|
|
|
|
|
* passed in mesh data-block rather than object->data, as it contains the mesh
|
|
|
|
|
@@ -242,14 +254,16 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
|
|
|
|
|
/********************* Optional functions *********************/
|
|
|
|
|
|
|
|
|
|
/* Initialize new instance data for this modifier type, this function
|
|
|
|
|
/**
|
|
|
|
|
* Initialize new instance data for this modifier type, this function
|
|
|
|
|
* should set modifier variables to their default values.
|
|
|
|
|
*
|
|
|
|
|
* This function is optional.
|
|
|
|
|
*/
|
|
|
|
|
void (*initData)(struct ModifierData *md);
|
|
|
|
|
|
|
|
|
|
/* Should add to passed \a r_cddata_masks the data types that this
|
|
|
|
|
/**
|
|
|
|
|
* Should add to passed \a r_cddata_masks the data types that this
|
|
|
|
|
* modifier needs. If (mask & (1 << (layer type))) != 0, this modifier
|
|
|
|
|
* needs that custom data layer. It can change required layers
|
|
|
|
|
* depending on the modifier's settings.
|
|
|
|
|
@@ -266,7 +280,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
struct ModifierData *md,
|
|
|
|
|
struct CustomData_MeshMasks *r_cddata_masks);
|
|
|
|
|
|
|
|
|
|
/* Free internal modifier data variables, this function should
|
|
|
|
|
/**
|
|
|
|
|
* Free internal modifier data variables, this function should
|
|
|
|
|
* not free the md variable itself.
|
|
|
|
|
*
|
|
|
|
|
* This function is responsible for freeing the runtime data as well.
|
|
|
|
|
@@ -275,7 +290,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
*/
|
|
|
|
|
void (*freeData)(struct ModifierData *md);
|
|
|
|
|
|
|
|
|
|
/* Return a boolean value indicating if this modifier is able to be
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
@@ -285,29 +301,33 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
*/
|
|
|
|
|
bool (*isDisabled)(const struct Scene *scene, struct ModifierData *md, bool userRenderParams);
|
|
|
|
|
|
|
|
|
|
/* Add the appropriate relations to the dependency graph.
|
|
|
|
|
/**
|
|
|
|
|
* Add the appropriate relations to the dependency graph.
|
|
|
|
|
*
|
|
|
|
|
* This function is optional.
|
|
|
|
|
*/
|
|
|
|
|
void (*updateDepsgraph)(struct ModifierData *md, const ModifierUpdateDepsgraphContext *ctx);
|
|
|
|
|
|
|
|
|
|
/* Should return true if the modifier needs to be recalculated on time
|
|
|
|
|
/**
|
|
|
|
|
* Should return true if the modifier needs to be recalculated on time
|
|
|
|
|
* changes.
|
|
|
|
|
*
|
|
|
|
|
* This function is optional (assumes false if not present).
|
|
|
|
|
*/
|
|
|
|
|
bool (*dependsOnTime)(struct ModifierData *md);
|
|
|
|
|
|
|
|
|
|
/* True when a deform modifier uses normals, the requiredDataMask
|
|
|
|
|
/**
|
|
|
|
|
* True when a deform modifier uses normals, the requiredDataMask
|
|
|
|
|
* cant be used here because that refers to a normal layer whereas
|
|
|
|
|
* 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.
|
|
|
|
|
* */
|
|
|
|
|
*/
|
|
|
|
|
bool (*dependsOnNormals)(struct ModifierData *md);
|
|
|
|
|
|
|
|
|
|
/* Should call the given walk function on with a pointer to each Object
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
@@ -318,7 +338,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
ObjectWalkFunc walk,
|
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
|
|
/* Should call the given walk function with a pointer to each ID
|
|
|
|
|
/**
|
|
|
|
|
* Should call the given walk function with a pointer to each ID
|
|
|
|
|
* pointer (i.e. each data-block pointer) that the modifier data
|
|
|
|
|
* stores. This is used for linking on file load and for
|
|
|
|
|
* unlinking data-blocks or forwarding data-block references.
|
|
|
|
|
@@ -331,7 +352,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
IDWalkFunc walk,
|
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
|
|
/* Should call the given walk function for each texture that the
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
@@ -343,7 +365,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
TexWalkFunc walk,
|
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
|
|
/* Free given run-time data.
|
|
|
|
|
/**
|
|
|
|
|
* Free given run-time data.
|
|
|
|
|
*
|
|
|
|
|
* This data is coming from a modifier of the corresponding type, but actual
|
|
|
|
|
* modifier data is not known here.
|
|
|
|
|
@@ -355,10 +378,11 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
*/
|
|
|
|
|
void (*freeRuntimeData)(void *runtime_data);
|
|
|
|
|
|
|
|
|
|
/* Register the panel types for the modifier's UI. */
|
|
|
|
|
/** Register the panel types for the modifier's UI. */
|
|
|
|
|
void (*panelRegister)(struct ARegionType *region_type);
|
|
|
|
|
|
|
|
|
|
/* Is called when the modifier is written to a file. The modifier data struct itself is written
|
|
|
|
|
/**
|
|
|
|
|
* Is called when the modifier is written to a file. The modifier data struct itself is written
|
|
|
|
|
* already.
|
|
|
|
|
*
|
|
|
|
|
* This method should write any additional arrays and referenced structs that should be
|
|
|
|
|
@@ -366,7 +390,8 @@ typedef struct ModifierTypeInfo {
|
|
|
|
|
*/
|
|
|
|
|
void (*blendWrite)(struct BlendWriter *writer, const struct ModifierData *md);
|
|
|
|
|
|
|
|
|
|
/* Is called when the modifier is read from a file.
|
|
|
|
|
/**
|
|
|
|
|
* Is called when the modifier is read from a file.
|
|
|
|
|
*
|
|
|
|
|
* It can be used to update pointers to arrays and other structs. Furthermore, fields that have
|
|
|
|
|
* not been written (e.g. runtime data) can be reset.
|
|
|
|
|
@@ -447,7 +472,8 @@ typedef struct CDMaskLink {
|
|
|
|
|
struct CustomData_MeshMasks mask;
|
|
|
|
|
} CDMaskLink;
|
|
|
|
|
|
|
|
|
|
/* Calculates and returns a linked list of CustomData_MeshMasks and modified
|
|
|
|
|
/**
|
|
|
|
|
* Calculates and returns a linked list of CustomData_MeshMasks and modified
|
|
|
|
|
* final datamask, indicating the data required by each modifier in the stack
|
|
|
|
|
* pointed to by md for correct evaluation, assuming the data indicated by
|
|
|
|
|
* final_datamask is required at the end of the stack.
|
|
|
|
|
@@ -473,7 +499,7 @@ typedef struct VirtualModifierData {
|
|
|
|
|
struct ModifierData *BKE_modifiers_get_virtual_modifierlist(const struct Object *ob,
|
|
|
|
|
struct VirtualModifierData *data);
|
|
|
|
|
|
|
|
|
|
/* ensure modifier correctness when changing ob->data */
|
|
|
|
|
/** Ensure modifier correctness when changing ob->data. */
|
|
|
|
|
void BKE_modifiers_test_object(struct Object *ob);
|
|
|
|
|
|
|
|
|
|
/* here for do_versions */
|
|
|
|
|
|