~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/BKE_modifier.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 *  \ingroup bke
32
32
 */
33
33
 
34
 
#include "DNA_modifier_types.h"         /* needed for all enum typdefs */
 
34
#include "DNA_modifier_types.h"     /* needed for all enum typdefs */
35
35
#include "BKE_customdata.h"
36
36
 
37
37
struct ID;
73
73
} ModifierTypeType;
74
74
 
75
75
typedef enum {
76
 
        eModifierTypeFlag_AcceptsMesh          = (1<<0),
77
 
        eModifierTypeFlag_AcceptsCVs           = (1<<1),
78
 
        eModifierTypeFlag_SupportsMapping      = (1<<2),
79
 
        eModifierTypeFlag_SupportsEditmode     = (1<<3),
 
76
        eModifierTypeFlag_AcceptsMesh          = (1 << 0),
 
77
        eModifierTypeFlag_AcceptsCVs           = (1 << 1),
 
78
        eModifierTypeFlag_SupportsMapping      = (1 << 2),
 
79
        eModifierTypeFlag_SupportsEditmode     = (1 << 3),
80
80
 
81
81
        /* For modifiers that support editmode this determines if the
82
82
         * modifier should be enabled by default in editmode. This should
84
84
         * also generally used in editmode, otherwise let the user enable
85
85
         * it by hand.
86
86
         */
87
 
        eModifierTypeFlag_EnableInEditmode     = (1<<4),
 
87
        eModifierTypeFlag_EnableInEditmode     = (1 << 4),
88
88
 
89
89
        /* For modifiers that require original data and so cannot
90
90
         * be placed after any non-deformative modifier.
91
91
         */
92
 
        eModifierTypeFlag_RequiresOriginalData = (1<<5),
 
92
        eModifierTypeFlag_RequiresOriginalData = (1 << 5),
93
93
 
94
94
        /* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
95
95
         */
96
 
        eModifierTypeFlag_UsesPointCache = (1<<6),
 
96
        eModifierTypeFlag_UsesPointCache = (1 << 6),
97
97
 
98
98
        /* For physics modifiers, max one per type */
99
 
        eModifierTypeFlag_Single = (1<<7),
 
99
        eModifierTypeFlag_Single = (1 << 7),
100
100
 
101
101
        /* Some modifier can't be added manually by user */
102
 
        eModifierTypeFlag_NoUserAdd = (1<<8),
 
102
        eModifierTypeFlag_NoUserAdd = (1 << 8),
103
103
 
104
104
        /* For modifiers that use CD_PREVIEW_MCOL for preview. */
105
 
        eModifierTypeFlag_UsesPreview = (1<<9)
 
105
        eModifierTypeFlag_UsesPreview = (1 << 9)
106
106
} ModifierTypeFlag;
107
107
 
108
108
typedef void (*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object **obpoin);
109
109
typedef void (*IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin);
110
110
typedef void (*TexWalkFunc)(void *userData, struct Object *ob, struct ModifierData *md, const char *propname);
111
111
 
 
112
typedef enum ModifierApplyFlag {
 
113
        MOD_APPLY_RENDER = 1 << 0,       /* Render time. */
 
114
        MOD_APPLY_USECACHE = 1 << 1,     /* Last modifier in stack. */
 
115
} ModifierApplyFlag;
 
116
 
 
117
 
112
118
typedef struct ModifierTypeInfo {
113
119
        /* The user visible name for this modifier */
114
120
        char name[32];
140
146
         * and otherwise the ob argument.
141
147
         */
142
148
        void (*deformVerts)(struct ModifierData *md, struct Object *ob,
143
 
                                                struct DerivedMesh *derivedData,
144
 
                                                float (*vertexCos)[3], int numVerts,
145
 
                                                int useRenderParams, int isFinalCalc);
 
149
                            struct DerivedMesh *derivedData,
 
150
                            float (*vertexCos)[3], int numVerts,
 
151
                            ModifierApplyFlag flag);
146
152
 
147
153
        /* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
148
 
        void (*deformMatrices)(
149
 
                                struct ModifierData *md, struct Object *ob,
150
 
                                struct DerivedMesh *derivedData,
151
 
                                float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
 
154
        void (*deformMatrices)(struct ModifierData *md, struct Object *ob,
 
155
                               struct DerivedMesh *derivedData,
 
156
                               float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
152
157
 
153
158
        /* Like deformVerts but called during editmode (for supporting modifiers)
154
159
         */
155
 
        void (*deformVertsEM)(
156
 
                                struct ModifierData *md, struct Object *ob,
157
 
                                struct BMEditMesh *editData, struct DerivedMesh *derivedData,
158
 
                                float (*vertexCos)[3], int numVerts);
 
160
        void (*deformVertsEM)(struct ModifierData *md, struct Object *ob,
 
161
                              struct BMEditMesh *editData, struct DerivedMesh *derivedData,
 
162
                              float (*vertexCos)[3], int numVerts);
159
163
 
160
164
        /* Set deform matrix per vertex for crazyspace correction */
161
 
        void (*deformMatricesEM)(
162
 
                                struct ModifierData *md, struct Object *ob,
163
 
                                struct BMEditMesh *editData, struct DerivedMesh *derivedData,
164
 
                                float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
 
165
        void (*deformMatricesEM)(struct ModifierData *md, struct Object *ob,
 
166
                                 struct BMEditMesh *editData, struct DerivedMesh *derivedData,
 
167
                                 float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
165
168
 
166
169
        /********************* Non-deform modifier functions *********************/
167
170
 
184
187
         * The modifier may reuse the derivedData argument (i.e. return it in
185
188
         * modified form), but must not release it.
186
189
         */
187
 
        struct DerivedMesh *(*applyModifier)(
188
 
                                                                struct ModifierData *md, struct Object *ob,
189
 
                                                                struct DerivedMesh *derivedData,
190
 
                                                                int useRenderParams, int isFinalCalc);
 
190
        struct DerivedMesh *(*applyModifier)(struct ModifierData *md, struct Object *ob,
 
191
                                             struct DerivedMesh *derivedData,
 
192
                                             ModifierApplyFlag flag);
191
193
 
192
194
        /* Like applyModifier but called during editmode (for supporting
193
195
         * modifiers).
196
198
         * are expected from editmode objects. The same qualifications regarding
197
199
         * derivedData apply as for applyModifier.
198
200
         */
199
 
        struct DerivedMesh *(*applyModifierEM)(
200
 
                                                                struct ModifierData *md, struct Object *ob,
201
 
                                                                struct BMEditMesh *editData,
202
 
                                                                struct DerivedMesh *derivedData);
 
201
        struct DerivedMesh *(*applyModifierEM)(struct ModifierData *md, struct Object *ob,
 
202
                                               struct BMEditMesh *editData,
 
203
                                               struct DerivedMesh *derivedData);
203
204
 
204
205
 
205
206
        /********************* Optional functions *********************/
252
253
         * This function is optional.
253
254
         */
254
255
        void (*updateDepgraph)(struct ModifierData *md, struct DagForest *forest, struct Scene *scene,
255
 
                                                   struct Object *ob, struct DagNode *obNode);
 
256
                               struct Object *ob, struct DagNode *obNode);
256
257
 
257
258
        /* Should return true if the modifier needs to be recalculated on time
258
259
         * changes.
279
280
         * This function is optional.
280
281
         */
281
282
        void (*foreachObjectLink)(struct ModifierData *md, struct Object *ob,
282
 
                                                          ObjectWalkFunc walk, void *userData);
 
283
                                  ObjectWalkFunc walk, void *userData);
283
284
 
284
285
        /* Should call the given walk function with a pointer to each ID
285
286
         * pointer (i.e. each datablock pointer) that the modifier data
290
291
         * will be used.
291
292
         */
292
293
        void (*foreachIDLink)(struct ModifierData *md, struct Object *ob,
293
 
                                                  IDWalkFunc walk, void *userData);
 
294
                              IDWalkFunc walk, void *userData);
294
295
 
295
296
        /* Should call the given walk function for each texture that the
296
297
         * modifier data stores. This is used for finding all textures in
300
301
         * assumed the modifier has no textures.
301
302
         */
302
303
        void (*foreachTexLink)(struct ModifierData *md, struct Object *ob,
303
 
                                                  TexWalkFunc walk, void *userData);
 
304
                               TexWalkFunc walk, void *userData);
304
305
} ModifierTypeInfo;
305
306
 
306
 
ModifierTypeInfo *modifierType_getInfo (ModifierType type);
 
307
ModifierTypeInfo *modifierType_getInfo(ModifierType type);
307
308
 
308
309
/* Modifier utility calls, do call through type pointer and return
309
310
 * default values if pointer is optional.
311
312
struct ModifierData  *modifier_new(int type);
312
313
void          modifier_free(struct ModifierData *md);
313
314
 
314
 
void              modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md);
 
315
void          modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md);
315
316
 
316
317
void          modifier_copyData(struct ModifierData *md, struct ModifierData *target);
317
318
int           modifier_dependsOnTime(struct ModifierData *md);
318
319
int           modifier_supportsMapping(struct ModifierData *md);
319
320
int           modifier_couldBeCage(struct Scene *scene, struct ModifierData *md);
320
321
int           modifier_isCorrectableDeformed(struct ModifierData *md);
321
 
int                       modifier_sameTopology(ModifierData *md);
322
 
int           modifier_nonGeometrical(ModifierData *md);
 
322
int           modifier_isSameTopology(ModifierData *md);
 
323
int           modifier_isNonGeometrical(ModifierData *md);
323
324
int           modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
324
325
void          modifier_setError(struct ModifierData *md, const char *format, ...)
325
326
#ifdef __GNUC__
326
 
__attribute__ ((format (printf, 2, 3)))
 
327
__attribute__ ((format(printf, 2, 3)))
327
328
#endif
328
329
;
329
330
int           modifier_isPreview(struct ModifierData *md);
330
331
 
331
332
void          modifiers_foreachObjectLink(struct Object *ob,
332
 
                                                                                  ObjectWalkFunc walk,
333
 
                                                                                  void *userData);
 
333
                                          ObjectWalkFunc walk,
 
334
                                          void *userData);
334
335
void          modifiers_foreachIDLink(struct Object *ob,
335
 
                                                                          IDWalkFunc walk,
336
 
                                                                          void *userData);
 
336
                                      IDWalkFunc walk,
 
337
                                      void *userData);
337
338
void          modifiers_foreachTexLink(struct Object *ob,
338
 
                                                                          TexWalkFunc walk,
339
 
                                                                          void *userData);
 
339
                                       TexWalkFunc walk,
 
340
                                       void *userData);
340
341
 
341
342
struct ModifierData  *modifiers_findByType(struct Object *ob, ModifierType type);
342
343
struct ModifierData  *modifiers_findByName(struct Object *ob, const char *name);
343
344
void          modifiers_clearErrors(struct Object *ob);
344
345
int           modifiers_getCageIndex(struct Scene *scene, struct Object *ob,
345
 
                                                                         int *lastPossibleCageIndex_r, int virtual_);
 
346
                                     int *lastPossibleCageIndex_r, int virtual_);
346
347
 
 
348
int           modifiers_isModifierEnabled(struct Object *ob, int modifierType);
347
349
int           modifiers_isSoftbodyEnabled(struct Object *ob);
348
350
int           modifiers_isClothEnabled(struct Object *ob);
349
351
int           modifiers_isParticleEnabled(struct Object *ob);
350
352
 
351
353
struct Object *modifiers_isDeformedByArmature(struct Object *ob);
352
354
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
 
355
struct Object *modifiers_isDeformedByCurve(struct Object *ob);
353
356
int           modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
354
357
int           modifiers_isCorrectableDeformed(struct Object *ob);
355
358
void          modifier_freeTemporaryData(struct ModifierData *md);
356
359
int           modifiers_isPreview(struct Object *ob);
357
360
 
358
 
int           modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
359
 
 
360
361
typedef struct CDMaskLink {
361
362
        struct CDMaskLink *next;
362
363
        CustomDataMask mask;
368
369
 * end of the stack.
369
370
 */
370
371
struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, 
371
 
                                                                                   struct Object *ob,
372
 
                                                                                   struct ModifierData *md,
373
 
                                                                                   CustomDataMask dataMask,
374
 
                                                                                   int required_mode);
 
372
                                           struct Object *ob,
 
373
                                           struct ModifierData *md,
 
374
                                           CustomDataMask dataMask,
 
375
                                           int required_mode);
375
376
struct ModifierData *modifiers_getLastPreview(struct Scene *scene,
376
377
                                              struct ModifierData *md,
377
378
                                              int required_mode);