Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-03-26 00:40:08 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-03-26 00:40:08 +0300
commit048f357f416d8044a3acfb16f7cd27db194cd3e8 (patch)
tree65c5da02a9e39518550d89e72a4b5c69fa9089e8 /source/blender/blenkernel
parent29adfa7d649df33a3d756b02058b4c1b09740058 (diff)
parentaa3428e6abbf3ef453757b4909ad10bb52b9a418 (diff)
Merged changes in the trunk up to revision 27752.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h114
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_bmesh.h6
-rw-r--r--source/blender/blenkernel/BKE_booleanops.h2
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h2
-rw-r--r--source/blender/blenkernel/BKE_context.h2
-rw-r--r--source/blender/blenkernel/BKE_customdata.h42
-rw-r--r--source/blender/blenkernel/BKE_displist.h8
-rw-r--r--source/blender/blenkernel/BKE_idprop.h2
-rw-r--r--source/blender/blenkernel/BKE_lattice.h8
-rw-r--r--source/blender/blenkernel/BKE_modifier.h54
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_paint.h9
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h6
-rw-r--r--source/blender/blenkernel/BKE_softbody.h4
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h28
-rw-r--r--source/blender/blenkernel/intern/BME_Customdata.c4
-rw-r--r--source/blender/blenkernel/intern/BME_eulers.c2
-rw-r--r--source/blender/blenkernel/intern/BME_mesh.c2
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c116
-rw-r--r--source/blender/blenkernel/intern/action.c24
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c19
-rw-r--r--source/blender/blenkernel/intern/armature.c46
-rw-r--r--source/blender/blenkernel/intern/bmfont.c2
-rw-r--r--source/blender/blenkernel/intern/booleanops.c10
-rw-r--r--source/blender/blenkernel/intern/brush.c4
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c86
-rw-r--r--source/blender/blenkernel/intern/cloth.c57
-rw-r--r--source/blender/blenkernel/intern/colortools.c8
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c40
-rw-r--r--source/blender/blenkernel/intern/customdata.c150
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/displist.c10
-rw-r--r--source/blender/blenkernel/intern/effect.c10
-rw-r--r--source/blender/blenkernel/intern/exotic.c108
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c8
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c8
-rw-r--r--source/blender/blenkernel/intern/font.c18
-rw-r--r--source/blender/blenkernel/intern/idprop.c12
-rw-r--r--source/blender/blenkernel/intern/image.c20
-rw-r--r--source/blender/blenkernel/intern/image_gen.c82
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/key.c10
-rw-r--r--source/blender/blenkernel/intern/lattice.c10
-rw-r--r--source/blender/blenkernel/intern/library.c14
-rw-r--r--source/blender/blenkernel/intern/material.c90
-rw-r--r--source/blender/blenkernel/intern/mball.c14
-rw-r--r--source/blender/blenkernel/intern/mesh.c8
-rw-r--r--source/blender/blenkernel/intern/modifier.c1227
-rw-r--r--source/blender/blenkernel/intern/multires.c26
-rw-r--r--source/blender/blenkernel/intern/nla.c1
-rw-r--r--source/blender/blenkernel/intern/node.c53
-rw-r--r--source/blender/blenkernel/intern/object.c80
-rw-r--r--source/blender/blenkernel/intern/particle.c25
-rw-r--r--source/blender/blenkernel/intern/particle_system.c809
-rw-r--r--source/blender/blenkernel/intern/pointcache.c25
-rw-r--r--source/blender/blenkernel/intern/sca.c20
-rw-r--r--source/blender/blenkernel/intern/scene.c23
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c240
-rw-r--r--source/blender/blenkernel/intern/sequencer.c144
-rw-r--r--source/blender/blenkernel/intern/smoke.c172
-rw-r--r--source/blender/blenkernel/intern/softbody.c170
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c115
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c6
-rw-r--r--source/blender/blenkernel/intern/world.c6
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c10
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c4
72 files changed, 2674 insertions, 1781 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 154c6347f50..965bad31991 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -165,28 +165,28 @@ struct DerivedMesh {
* passed as a float or short array, only one should be non-NULL.
*/
void (*foreachMappedVert)(
- DerivedMesh *dm,
- void (*func)(void *userData, int index, float *co,
- float *no_f, short *no_s),
- void *userData);
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index, float *co,
+ float *no_f, short *no_s),
+ void *userData);
/* Iterate over each mapped edge in the derived mesh, calling the
* given function with the original edge and the mapped edge's new
* coordinates.
*/
void (*foreachMappedEdge)(DerivedMesh *dm,
- void (*func)(void *userData, int index,
- float *v0co, float *v1co),
- void *userData);
+ void (*func)(void *userData, int index,
+ float *v0co, float *v1co),
+ void *userData);
/* Iterate over each mapped face in the derived mesh, calling the
* given function with the original face and the mapped face's (or
* faces') center and normal.
*/
void (*foreachMappedFaceCenter)(DerivedMesh *dm,
- void (*func)(void *userData, int index,
- float *cent, float *no),
- void *userData);
+ void (*func)(void *userData, int index,
+ float *cent, float *no),
+ void *userData);
/* Iterate over all vertex points, calling DO_MINMAX with given args.
*
@@ -227,7 +227,7 @@ struct DerivedMesh {
*
* Also called for *final* editmode DerivedMeshes
*/
- void (*drawEdges)(DerivedMesh *dm, int drawLooseEdges);
+ void (*drawEdges)(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges);
/* Draw all loose edges (edges w/ no adjoining faces) */
void (*drawLooseEdges)(DerivedMesh *dm);
@@ -240,7 +240,7 @@ struct DerivedMesh {
* Also called for *final* editmode DerivedMeshes
*/
void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
- int fast, int (*setMaterial)(int, void *attribs));
+ int fast, int (*setMaterial)(int, void *attribs));
/* Draw all faces
* o If useTwoSided, draw front and back using col arrays
@@ -248,14 +248,14 @@ struct DerivedMesh {
* in ABGR format, and should be passed as per-face vertex color.
*/
void (*drawFacesColored)(DerivedMesh *dm, int useTwoSided,
- unsigned char *col1, unsigned char *col2);
+ unsigned char *col1, unsigned char *col2);
/* Draw all faces using MTFace
* o Drawing options too complicated to enumerate, look at code.
*/
void (*drawFacesTex)(DerivedMesh *dm,
- int (*setDrawOptions)(struct MTFace *tface,
- struct MCol *mcol, int matnr));
+ int (*setDrawOptions)(struct MTFace *tface,
+ struct MCol *mcol, int matnr));
/* Draw all faces with GLSL materials
* o setMaterial is called for every different material nr
@@ -278,17 +278,17 @@ struct DerivedMesh {
* smooth shaded.
*/
void (*drawMappedFaces)(DerivedMesh *dm,
- int (*setDrawOptions)(void *userData, int index,
- int *drawSmooth_r),
- void *userData, int useColors);
+ int (*setDrawOptions)(void *userData, int index,
+ int *drawSmooth_r),
+ void *userData, int useColors);
/* Draw mapped faces using MTFace
* o Drawing options too complicated to enumerate, look at code.
*/
void (*drawMappedFacesTex)(DerivedMesh *dm,
- int (*setDrawOptions)(void *userData,
- int index),
- void *userData);
+ int (*setDrawOptions)(void *userData,
+ int index),
+ void *userData);
/* Draw mapped faces with GLSL materials
* o setMaterial is called for every different material nr
@@ -304,8 +304,8 @@ struct DerivedMesh {
* returns true
*/
void (*drawMappedEdges)(DerivedMesh *dm,
- int (*setDrawOptions)(void *userData, int index),
- void *userData);
+ int (*setDrawOptions)(void *userData, int index),
+ void *userData);
/* Draw mapped edges as lines with interpolation values
* o Only if !setDrawOptions or
@@ -315,12 +315,12 @@ struct DerivedMesh {
* NOTE: This routine is optional!
*/
void (*drawMappedEdgesInterp)(DerivedMesh *dm,
- int (*setDrawOptions)(void *userData,
- int index),
- void (*setDrawInterpOptions)(void *userData,
- int index,
- float t),
- void *userData);
+ int (*setDrawOptions)(void *userData,
+ int index),
+ void (*setDrawInterpOptions)(void *userData,
+ int index,
+ float t),
+ void *userData);
/* Release reference to the DerivedMesh. This function decides internally
* if the DerivedMesh will be freed, or cached for later use. */
@@ -337,14 +337,14 @@ void DM_init_funcs(DerivedMesh *dm);
* sets up the custom data layers)
*/
void DM_init(DerivedMesh *dm, DerivedMeshType type,
- int numVerts, int numEdges, int numFaces);
+ int numVerts, int numEdges, int numFaces);
/* utility function to initialise a DerivedMesh for the desired number
* of vertices, edges and faces, with a layer setup copied from source
*/
void DM_from_template(DerivedMesh *dm, DerivedMesh *source,
- DerivedMeshType type,
- int numVerts, int numEdges, int numFaces);
+ DerivedMeshType type,
+ int numVerts, int numEdges, int numFaces);
/* utility function to release a DerivedMesh's layers
* returns 1 if DerivedMesh has to be released by the backend, 0 otherwise
@@ -371,11 +371,11 @@ void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
* freed, see BKE_customdata.h for the different options
*/
void DM_add_vert_layer(struct DerivedMesh *dm, int type, int alloctype,
- void *layer);
+ void *layer);
void DM_add_edge_layer(struct DerivedMesh *dm, int type, int alloctype,
- void *layer);
+ void *layer);
void DM_add_face_layer(struct DerivedMesh *dm, int type, int alloctype,
- void *layer);
+ void *layer);
/* custom data access functions
* return pointer to data from first layer which matches type
@@ -408,11 +408,11 @@ void DM_set_face_data(struct DerivedMesh *dm, int index, int type, void *data);
* these copy all layers for which the CD_FLAG_NOCOPY flag is not set
*/
void DM_copy_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int source_index, int dest_index, int count);
+ int source_index, int dest_index, int count);
void DM_copy_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int source_index, int dest_index, int count);
+ int source_index, int dest_index, int count);
void DM_copy_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int source_index, int dest_index, int count);
+ int source_index, int dest_index, int count);
/* custom data free functions
* free count elements, starting at index
@@ -427,8 +427,8 @@ void DM_free_face_data(struct DerivedMesh *dm, int index, int count);
* indexed by dest_index in the dest mesh
*/
void DM_interp_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int *src_indices, float *weights,
- int count, int dest_index);
+ int *src_indices, float *weights,
+ int count, int dest_index);
/* interpolates edge data from the edges indexed by src_indices in the
* source mesh using the given weights and stores the result in the edge indexed
@@ -439,9 +439,9 @@ void DM_interp_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
*/
typedef float EdgeVertWeight[SUB_ELEMS_EDGE][SUB_ELEMS_EDGE];
void DM_interp_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int *src_indices,
- float *weights, EdgeVertWeight *vert_weights,
- int count, int dest_index);
+ int *src_indices,
+ float *weights, EdgeVertWeight *vert_weights,
+ int count, int dest_index);
/* interpolates face data from the faces indexed by src_indices in the
* source mesh using the given weights and stores the result in the face indexed
@@ -452,9 +452,9 @@ void DM_interp_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
*/
typedef float FaceVertWeight[SUB_ELEMS_FACE][SUB_ELEMS_FACE];
void DM_interp_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
- int *src_indices,
- float *weights, FaceVertWeight *vert_weights,
- int count, int dest_index);
+ int *src_indices,
+ float *weights, FaceVertWeight *vert_weights,
+ int count, int dest_index);
void DM_swap_face_data(struct DerivedMesh *dm, int index, int *corner_indices);
@@ -468,42 +468,42 @@ float *mesh_get_mapped_verts_nors(struct Scene *scene, struct Object *ob);
/* */
DerivedMesh *mesh_get_derived_final(struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
DerivedMesh *mesh_get_derived_deform(struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_for_modifier(struct Scene *scene, struct Object *ob, struct ModifierData *md);
DerivedMesh *mesh_create_derived_render(struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_index_render(struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index);
/* same as above but wont use render settings */
DerivedMesh *mesh_create_derived_view(struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_no_deform(struct Scene *scene, struct Object *ob,
- float (*vertCos)[3],
- CustomDataMask dataMask);
+ float (*vertCos)[3],
+ CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_no_deform_render(struct Scene *scene, struct Object *ob,
- float (*vertCos)[3],
- CustomDataMask dataMask);
+ float (*vertCos)[3],
+ CustomDataMask dataMask);
/* for gameengine */
DerivedMesh *mesh_create_derived_no_virtual(struct Scene *scene, struct Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
DerivedMesh *editmesh_get_derived_base(struct Object *, struct EditMesh *em);
DerivedMesh *editmesh_get_derived_cage(struct Scene *scene, struct Object *,
struct EditMesh *em, CustomDataMask dataMask);
DerivedMesh *editmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *,
struct EditMesh *em, DerivedMesh **final_r,
- CustomDataMask dataMask);
+ CustomDataMask dataMask);
void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em, CustomDataMask dataMask);
/* returns an array of deform matrices for crazyspace correction, and the
number of modifiers left */
int editmesh_get_first_deform_matrices(struct Scene *, struct Object *, struct EditMesh *em,
- float (**deformmats)[3][3], float (**deformcos)[3]);
+ float (**deformmats)[3][3], float (**deformcos)[3]);
void weight_to_rgb(float input, float *fr, float *fg, float *fb);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index b9576c343db..6b656f1d12e 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -45,7 +45,7 @@ struct Scene;
struct Main;
#define BLENDER_VERSION 252
-#define BLENDER_SUBVERSION 0
+#define BLENDER_SUBVERSION 1
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 470db28cb72..aff102f2e09 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -218,11 +218,11 @@ typedef struct BME_TransData {
void *loc; /* a pointer to the data to transform (likely the vert's cos) */
float factor; /* primary scaling factor; also accumulates number of weighted edges for beveling tool */
float weight; /* another scaling factor; used primarily for propogating vertex weights to transforms; */
- /* weight is also used across recursive bevels to help with the math */
+ /* weight is also used across recursive bevels to help with the math */
float maxfactor; /* the unscaled, original factor (used only by "edge verts" in recursive beveling) */
float *max; /* the maximum distance this vert can be transformed; negative is infinite
- * it points to the "parent" maxfactor (where maxfactor makes little sense)
- * where the max limit is stored (limits are stored per-corner) */
+ * it points to the "parent" maxfactor (where maxfactor makes little sense)
+ * where the max limit is stored (limits are stored per-corner) */
} BME_TransData;
typedef struct BME_TransData_Head {
diff --git a/source/blender/blenkernel/BKE_booleanops.h b/source/blender/blenkernel/BKE_booleanops.h
index d323725ec19..dcf71645db3 100644
--- a/source/blender/blenkernel/BKE_booleanops.h
+++ b/source/blender/blenkernel/BKE_booleanops.h
@@ -44,6 +44,6 @@ int NewBooleanMesh(struct Scene *scene, struct Base *base, struct Base *base_sel
are in fact mesh object. On success returns a DerivedMesh. On failure
returns NULL and reports an error. */
struct DerivedMesh *NewBooleanDerivedMesh(struct DerivedMesh *dm, struct Object *ob, struct DerivedMesh *dm_select, struct Object *ob_select,
- int int_op_type);
+ int int_op_type);
#endif
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 33e8f930c9d..bff9f16b489 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -71,7 +71,7 @@ struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
* elements are initialised to all zeros
*/
struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source,
- int numVerts, int numEdges, int numFaces);
+ int numVerts, int numEdges, int numFaces);
/* applies vertex coordinates or normals to a CDDerivedMesh. if the MVert
* layer is a referenced layer, it will be duplicate to not overwrite the
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index ae3fdb91edf..48e2dbf4fec 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -167,7 +167,7 @@ void CTX_wm_menu_set(bContext *C, struct ARegion *menu);
/* Data Context
- listbases consist of CollectionPointerLink items and must be
- freed with BLI_freelistN!
+ freed with BLI_freelistN!
- the dir listbase consits of LinkData items */
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 2f65dab9b83..c07b26fd372 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -57,18 +57,18 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
#define CD_DEFAULT 2 /* allocate and set to default */
#define CD_REFERENCE 3 /* use data pointers, set layer flag NOFREE */
#define CD_DUPLICATE 4 /* do a full copy of all layers, only allowed if source
- has same number of elements */
+ has same number of elements */
/* initialises a CustomData object with the same layer setup as source.
* mask is a bitfield where (mask & (1 << (layer type))) indicates
* if a layer should be copied or not. alloctype must be one of the above. */
void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
- CustomDataMask mask, int alloctype, int totelem);
+ CustomDataMask mask, int alloctype, int totelem);
/* same as the above, except that this will preserve existing layers, and only
* add the layers that were not there yet */
void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
- CustomDataMask mask, int alloctype, int totelem);
+ CustomDataMask mask, int alloctype, int totelem);
/* frees data associated with a CustomData object (doesn't free the object
* itself, though)
@@ -85,10 +85,10 @@ void CustomData_free_temporary(struct CustomData *data, int totelem);
* in editmode, use EM_add_data_layer instead of this function
*/
void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
- void *layer, int totelem);
+ void *layer, int totelem);
/*same as above but accepts a name */
void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
- void *layer, int totelem, char *name);
+ void *layer, int totelem, char *name);
/* frees the active or first data layer with the give type.
* returns 1 on succes, 0 if no layer with the given type is found
@@ -117,14 +117,14 @@ int CustomData_number_of_layers(const struct CustomData *data, int type);
* returns the layer data */
void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type);
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
- int type, char *name);
+ int type, char *name);
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
* zero for the layer type, so only layer types specified by the mask
* will be copied
*/
void CustomData_set_only_copy(const struct CustomData *data,
- CustomDataMask mask);
+ CustomDataMask mask);
/* copies data from one CustomData object to another
* objects need not be compatible, each source layer is copied to the
@@ -132,11 +132,11 @@ void CustomData_set_only_copy(const struct CustomData *data,
* return 1 on success, 0 on failure
*/
void CustomData_copy_data(const struct CustomData *source,
- struct CustomData *dest, int source_index,
- int dest_index, int count);
+ struct CustomData *dest, int source_index,
+ int dest_index, int count);
void CustomData_em_copy_data(const struct CustomData *source,
- struct CustomData *dest, void *src_block,
- void **dest_block);
+ struct CustomData *dest, void *src_block,
+ void **dest_block);
void CustomData_bmesh_copy_data(const struct CustomData *source,
struct CustomData *dest,void *src_block,
void **dest_block);
@@ -161,11 +161,11 @@ void CustomData_free_elem(struct CustomData *data, int index, int count);
* returns 1 on success, 0 on failure
*/
void CustomData_interp(const struct CustomData *source, struct CustomData *dest,
- int *src_indices, float *weights, float *sub_weights,
- int count, int dest_index);
+ int *src_indices, float *weights, float *sub_weights,
+ int count, int dest_index);
void CustomData_em_interp(struct CustomData *data, void **src_blocks,
- float *weights, float *sub_weights, int count,
- void *dest_block);
+ float *weights, float *sub_weights, int count,
+ void *dest_block);
void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks,
float *weights, float *sub_weights, int count,
void *dest_block);
@@ -191,7 +191,7 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ
void *CustomData_get_layer(const struct CustomData *data, int type);
void *CustomData_get_layer_n(const struct CustomData *data, int type, int n);
void *CustomData_get_layer_named(const struct CustomData *data, int type,
- char *name);
+ char *name);
int CustomData_get_layer_index(const struct CustomData *data, int type);
int CustomData_get_named_layer_index(const struct CustomData *data, int type, char *name);
@@ -209,11 +209,11 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type);
* no effect if there is no layer of type
*/
void CustomData_set(const struct CustomData *data, int index, int type,
- void *source);
+ void *source);
void CustomData_em_set(struct CustomData *data, void *block, int type,
- void *source);
+ void *source);
void CustomData_em_set_n(struct CustomData *data, void *block, int type, int n,
- void *source);
+ void *source);
void CustomData_bmesh_set(const struct CustomData *data, void *block, int type,
void *source);
@@ -252,9 +252,9 @@ void CustomData_bmesh_free_block(struct CustomData *data, void **block);
/* copy custom data to/from layers as in mesh/derivedmesh, to editmesh
blocks of data. the CustomData's must not be compatible */
void CustomData_to_em_block(const struct CustomData *source,
- struct CustomData *dest, int index, void **block);
+ struct CustomData *dest, int index, void **block);
void CustomData_from_em_block(const struct CustomData *source,
- struct CustomData *dest, void *block, int index);
+ struct CustomData *dest, void *block, int index);
void CustomData_to_bmesh_block(const struct CustomData *source,
struct CustomData *dest, int src_index, void **dest_block);
void CustomData_from_bmesh_block(const struct CustomData *source,
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index 01a1126e464..febe0a11ae6 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -66,10 +66,10 @@ struct DerivedMesh;
/* used for curves, nurbs, mball, importing */
typedef struct DispList {
- struct DispList *next, *prev;
- short type, flag;
- int parts, nr;
- short col, rt; /* rt used by initrenderNurbs */
+ struct DispList *next, *prev;
+ short type, flag;
+ int parts, nr;
+ short col, rt; /* rt used by initrenderNurbs */
float *verts, *nors;
int *index;
unsigned int *col1, *col2;
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 6e364ef63b6..e33239293a8 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -114,7 +114,7 @@ int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop);
/*this is the same as IDP_AddToGroup, only you pass an item
in the group list to be inserted after.*/
int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous,
- struct IDProperty *pnew);
+ struct IDProperty *pnew);
/*NOTE: this does not free the property!!
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index d99296068d9..f35dff53cd5 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -59,11 +59,11 @@ void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object
float *orco, float *vec, float mat[][3], int no_rot_axis);
void lattice_deform_verts(struct Object *laOb, struct Object *target,
- struct DerivedMesh *dm, float (*vertexCos)[3],
- int numVerts, char *vgroup);
+ struct DerivedMesh *dm, float (*vertexCos)[3],
+ int numVerts, char *vgroup);
void armature_deform_verts(struct Object *armOb, struct Object *target,
- struct DerivedMesh *dm, float (*vertexCos)[3],
- float (*defMats)[3][3], int numVerts, int deformflag,
+ struct DerivedMesh *dm, float (*vertexCos)[3],
+ float (*defMats)[3][3], int numVerts, int deformflag,
float (*prevCos)[3], const char *defgrp_name);
float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3];
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index c9f56ef7e3e..6db610f4d8d 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -130,22 +130,22 @@ typedef struct ModifierTypeInfo {
* and otherwise the ob argument.
*/
void (*deformVerts)(struct ModifierData *md, struct Object *ob,
- struct DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts,
- int useRenderParams, int isFinalCalc);
+ struct DerivedMesh *derivedData,
+ float (*vertexCos)[3], int numVerts,
+ int useRenderParams, int isFinalCalc);
/* Like deformVerts but called during editmode (for supporting modifiers)
*/
void (*deformVertsEM)(
- struct ModifierData *md, struct Object *ob,
- struct EditMesh *editData, struct DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts);
+ struct ModifierData *md, struct Object *ob,
+ struct EditMesh *editData, struct DerivedMesh *derivedData,
+ float (*vertexCos)[3], int numVerts);
/* Set deform matrix per vertex for crazyspace correction */
void (*deformMatricesEM)(
- struct ModifierData *md, struct Object *ob,
- struct EditMesh *editData, struct DerivedMesh *derivedData,
- float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
+ struct ModifierData *md, struct Object *ob,
+ struct EditMesh *editData, struct DerivedMesh *derivedData,
+ float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
/********************* Non-deform modifier functions *********************/
@@ -169,9 +169,9 @@ typedef struct ModifierTypeInfo {
* modified form), but must not release it.
*/
struct DerivedMesh *(*applyModifier)(
- struct ModifierData *md, struct Object *ob,
- struct DerivedMesh *derivedData,
- int useRenderParams, int isFinalCalc);
+ struct ModifierData *md, struct Object *ob,
+ struct DerivedMesh *derivedData,
+ int useRenderParams, int isFinalCalc);
/* Like applyModifier but called during editmode (for supporting
* modifiers).
@@ -181,9 +181,9 @@ typedef struct ModifierTypeInfo {
* derivedData apply as for applyModifier.
*/
struct DerivedMesh *(*applyModifierEM)(
- struct ModifierData *md, struct Object *ob,
- struct EditMesh *editData,
- struct DerivedMesh *derivedData);
+ struct ModifierData *md, struct Object *ob,
+ struct EditMesh *editData,
+ struct DerivedMesh *derivedData);
/********************* Optional functions *********************/
@@ -236,7 +236,7 @@ typedef struct ModifierTypeInfo {
* This function is optional.
*/
void (*updateDepgraph)(struct ModifierData *md, struct DagForest *forest, struct Scene *scene,
- struct Object *ob, struct DagNode *obNode);
+ struct Object *ob, struct DagNode *obNode);
/* Should return true if the modifier needs to be recalculated on time
* changes.
@@ -252,7 +252,7 @@ typedef struct ModifierTypeInfo {
* This function is optional.
*/
void (*foreachObjectLink)(struct ModifierData *md, struct Object *ob,
- ObjectWalkFunc walk, void *userData);
+ ObjectWalkFunc walk, void *userData);
/* Should call the given walk function with a pointer to each ID
* pointer (i.e. each datablock pointer) that the modifier data
@@ -263,7 +263,7 @@ typedef struct ModifierTypeInfo {
* will be used.
*/
void (*foreachIDLink)(struct ModifierData *md, struct Object *ob,
- IDWalkFunc walk, void *userData);
+ IDWalkFunc walk, void *userData);
} ModifierTypeInfo;
ModifierTypeInfo *modifierType_getInfo (ModifierType type);
@@ -286,15 +286,15 @@ int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, i
void modifier_setError(struct ModifierData *md, char *format, ...);
void modifiers_foreachObjectLink(struct Object *ob,
- ObjectWalkFunc walk,
- void *userData);
+ ObjectWalkFunc walk,
+ void *userData);
void modifiers_foreachIDLink(struct Object *ob,
- IDWalkFunc walk,
- void *userData);
+ IDWalkFunc walk,
+ void *userData);
struct ModifierData *modifiers_findByType(struct Object *ob, ModifierType type);
void modifiers_clearErrors(struct Object *ob);
int modifiers_getCageIndex(struct Scene *scene, struct Object *ob,
- int *lastPossibleCageIndex_r, int virtual_);
+ int *lastPossibleCageIndex_r, int virtual_);
int modifiers_isSoftbodyEnabled(struct Object *ob);
int modifiers_isClothEnabled(struct Object *ob);
@@ -314,10 +314,10 @@ int modifiers_indexInObject(struct Object *ob, struct ModifierData *md
* end of the stack.
*/
struct LinkNode *modifiers_calcDataMasks(struct Scene *scene,
- struct Object *ob,
- struct ModifierData *md,
- CustomDataMask dataMask,
- int required_mode);
+ struct Object *ob,
+ struct ModifierData *md,
+ CustomDataMask dataMask,
+ int required_mode);
struct ModifierData *modifiers_getVirtualModifierList(struct Object *ob);
#endif
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 1362a191919..84995b60f4b 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -111,6 +111,8 @@ void where_is_object_simul(struct Scene *scene, struct Object *ob);
struct BoundBox *unit_boundbox(void);
void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]);
struct BoundBox *object_get_boundbox(struct Object *ob);
+void object_get_dimensions(struct Object *ob, float *value);
+void object_set_dimensions(struct Object *ob, const float *value);
void object_boundbox_flag(struct Object *ob, int flag, int set);
void minmax_object(struct Object *ob, float *min, float *max);
int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index e1c08e2cb3d..81fb724b3a5 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -69,13 +69,15 @@ typedef struct SculptSession {
struct MFace *mface;
int totvert, totface;
float *face_normals;
- struct PBVH *tree;
struct Object *ob;
struct KeyBlock *kb, *refkb;
/* Mesh connectivity */
struct ListBase *fmap;
+ /* PBVH acceleration structure */
+ struct PBVH *pbvh;
+
/* Used temporarily per-stroke */
float *vertexcosnos;
@@ -86,8 +88,7 @@ typedef struct SculptSession {
unsigned int texcache_side, *texcache, texcache_actual;
/* Layer brush persistence between strokes */
- float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
- float *layer_disps; /* Displacements for each vertex */
+ float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
struct SculptStroke *stroke;
struct StrokeCache *cache;
@@ -95,6 +96,6 @@ typedef struct SculptSession {
struct GPUDrawObject *drawobject;
} SculptSession;
-void free_sculptsession(SculptSession **);
+void free_sculptsession(struct Object *ob);
#endif
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 0268f2faf31..55f11e1066b 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -302,4 +302,10 @@ void BKE_ptcache_toggle_disk_cache(struct PTCacheID *pid);
/* Loads simulation from external (disk) cache files. */
void BKE_ptcache_load_external(struct PTCacheID *pid);
+/* Set correct flags after successful simulation step */
+void BKE_ptcache_validate(struct PointCache *cache, int framenr);
+
+/* Set correct flags after unsuccessful simulation step */
+void BKE_ptcache_invalidate(struct PointCache *cache);
+
#endif
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index 30b7e8cda53..ef7fa473ad0 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -39,8 +39,8 @@ typedef struct BodyPoint {
float origS[3], origE[3], origT[3], pos[3], vec[3], force[3];
float goal;
float prevpos[3], prevvec[3], prevdx[3], prevdv[3]; /* used for Heun integration */
- float impdv[3],impdx[3];
- int nofsprings; int *springs;
+ float impdv[3],impdx[3];
+ int nofsprings; int *springs;
float choke,choke2,frozen;
float colball;
short flag;
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index 62ad86635c0..853fd99aa86 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -28,27 +28,29 @@
#ifndef BKE_SUBSURF_H
#define BKE_SUBSURF_H
-struct Mesh;
-struct Object;
+struct DMGridAdjacency;
+struct DMGridData;
struct DerivedMesh;
struct EditMesh;
+struct IndexNode;
+struct ListBase;
+struct Mesh;
struct MultiresSubsurf;
+struct Object;
+struct PBVH;
struct SubsurfModifierData;
-struct _CCGSubsurf;
-struct _CCGVert;
struct _CCGEdge;
struct _CCGFace;
-struct PBVH;
-struct DMGridData;
-struct DMGridAdjacency;
+struct _CCGSubsurf;
+struct _CCGVert;
/**************************** External *****************************/
struct DerivedMesh *subsurf_make_derived_from_derived(
- struct DerivedMesh *dm,
- struct SubsurfModifierData *smd,
- int useRenderParams, float (*vertCos)[3],
- int isFinalCalc, int editMode);
+ struct DerivedMesh *dm,
+ struct SubsurfModifierData *smd,
+ int useRenderParams, float (*vertCos)[3],
+ int isFinalCalc, int editMode);
void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]);
@@ -64,12 +66,14 @@ typedef struct CCGDerivedMesh {
struct {int startVert; struct _CCGVert *vert;} *vertMap;
struct {int startVert; int startEdge; struct _CCGEdge *edge;} *edgeMap;
struct {int startVert; int startEdge;
- int startFace; struct _CCGFace *face;} *faceMap;
+ int startFace; struct _CCGFace *face;} *faceMap;
short *edgeFlags;
char *faceFlags;
struct PBVH *pbvh;
+ struct ListBase *fmap;
+ struct IndexNode *fmap_mem;
struct DMGridData **gridData;
struct DMGridAdjacency *gridAdjacency;
diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c
index 736b5e05798..d8a6b66d5bb 100644
--- a/source/blender/blenkernel/intern/BME_Customdata.c
+++ b/source/blender/blenkernel/intern/BME_Customdata.c
@@ -135,7 +135,7 @@ static void BME_CD_alloc_block(BME_CustomData *data, void **block)
}
void BME_CD_copy_data(const BME_CustomData *source, BME_CustomData *dest,
- void *src_block, void **dest_block)
+ void *src_block, void **dest_block)
{
const BME_LayerTypeInfo *typeInfo;
int dest_i, src_i;
@@ -151,7 +151,7 @@ void BME_CD_copy_data(const BME_CustomData *source, BME_CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c
index 9c9c71292c2..036cd4a23e2 100644
--- a/source/blender/blenkernel/intern/BME_eulers.c
+++ b/source/blender/blenkernel/intern/BME_eulers.c
@@ -71,7 +71,7 @@
code.
*The term "Euler Operator" is actually a misnomer when referring to a non-manifold
- data structure. Its use is in keeping with the convention established by others.
+ data structure. Its use is in keeping with the convention established by others.
TODO:
-Finish inserting 'strict' validation in all Eulers
diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c
index f616d21c6fd..1bb419937b0 100644
--- a/source/blender/blenkernel/intern/BME_mesh.c
+++ b/source/blender/blenkernel/intern/BME_mesh.c
@@ -87,7 +87,7 @@ void BME_free_mesh(BME_Mesh *bm)
if(bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
if(bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
- /*free custom data*/
+ /*free custom data*/
CustomData_free(&bm->vdata,0);
CustomData_free(&bm->edata,0);
CustomData_free(&bm->ldata,0);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index eb316c64af4..6778c9eb8ad 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -170,7 +170,7 @@ static void *_ehashIterator_getCurrent(EHashIterator *ehi) {
static void _ehashIterator_next(EHashIterator *ehi) {
if (ehi->curEntry) {
- ehi->curEntry = ehi->curEntry->next;
+ ehi->curEntry = ehi->curEntry->next;
while (!ehi->curEntry) {
ehi->curBucket++;
if (ehi->curBucket==ehi->eh->curSize)
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index e69686eeb00..9d15ac3f348 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -41,10 +41,11 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h" // N_T
-#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_math.h"
#include "BLI_memarena.h"
+#include "BLI_pbvh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
@@ -113,7 +114,7 @@ static MFace *dm_getFaceArray(DerivedMesh *dm)
static MVert *dm_dupVertArray(DerivedMesh *dm)
{
MVert *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumVerts(dm),
- "dm_dupVertArray tmp");
+ "dm_dupVertArray tmp");
if(tmp) dm->copyVertArray(dm, tmp);
@@ -123,7 +124,7 @@ static MVert *dm_dupVertArray(DerivedMesh *dm)
static MEdge *dm_dupEdgeArray(DerivedMesh *dm)
{
MEdge *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumEdges(dm),
- "dm_dupEdgeArray tmp");
+ "dm_dupEdgeArray tmp");
if(tmp) dm->copyEdgeArray(dm, tmp);
@@ -133,7 +134,7 @@ static MEdge *dm_dupEdgeArray(DerivedMesh *dm)
static MFace *dm_dupFaceArray(DerivedMesh *dm)
{
MFace *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumFaces(dm),
- "dm_dupFaceArray tmp");
+ "dm_dupFaceArray tmp");
if(tmp) dm->copyFaceArray(dm, tmp);
@@ -161,7 +162,7 @@ void DM_init_funcs(DerivedMesh *dm)
}
void DM_init(DerivedMesh *dm, DerivedMeshType type,
- int numVerts, int numEdges, int numFaces)
+ int numVerts, int numEdges, int numFaces)
{
dm->type = type;
dm->numVertData = numVerts;
@@ -174,14 +175,14 @@ void DM_init(DerivedMesh *dm, DerivedMeshType type,
}
void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
- int numVerts, int numEdges, int numFaces)
+ int numVerts, int numEdges, int numFaces)
{
CustomData_copy(&source->vertData, &dm->vertData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numVerts);
+ CD_CALLOC, numVerts);
CustomData_copy(&source->edgeData, &dm->edgeData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numEdges);
+ CD_CALLOC, numEdges);
CustomData_copy(&source->faceData, &dm->faceData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numFaces);
+ CD_CALLOC, numFaces);
dm->type = type;
dm->numVertData = numVerts;
@@ -352,24 +353,24 @@ void DM_set_face_data(DerivedMesh *dm, int index, int type, void *data)
}
void DM_copy_vert_data(DerivedMesh *source, DerivedMesh *dest,
- int source_index, int dest_index, int count)
+ int source_index, int dest_index, int count)
{
CustomData_copy_data(&source->vertData, &dest->vertData,
- source_index, dest_index, count);
+ source_index, dest_index, count);
}
void DM_copy_edge_data(DerivedMesh *source, DerivedMesh *dest,
- int source_index, int dest_index, int count)
+ int source_index, int dest_index, int count)
{
CustomData_copy_data(&source->edgeData, &dest->edgeData,
- source_index, dest_index, count);
+ source_index, dest_index, count);
}
void DM_copy_face_data(DerivedMesh *source, DerivedMesh *dest,
- int source_index, int dest_index, int count)
+ int source_index, int dest_index, int count)
{
CustomData_copy_data(&source->faceData, &dest->faceData,
- source_index, dest_index, count);
+ source_index, dest_index, count);
}
void DM_free_vert_data(struct DerivedMesh *dm, int index, int count)
@@ -388,29 +389,29 @@ void DM_free_face_data(struct DerivedMesh *dm, int index, int count)
}
void DM_interp_vert_data(DerivedMesh *source, DerivedMesh *dest,
- int *src_indices, float *weights,
- int count, int dest_index)
+ int *src_indices, float *weights,
+ int count, int dest_index)
{
CustomData_interp(&source->vertData, &dest->vertData, src_indices,
- weights, NULL, count, dest_index);
+ weights, NULL, count, dest_index);
}
void DM_interp_edge_data(DerivedMesh *source, DerivedMesh *dest,
- int *src_indices,
- float *weights, EdgeVertWeight *vert_weights,
- int count, int dest_index)
+ int *src_indices,
+ float *weights, EdgeVertWeight *vert_weights,
+ int count, int dest_index)
{
CustomData_interp(&source->edgeData, &dest->edgeData, src_indices,
- weights, (float*)vert_weights, count, dest_index);
+ weights, (float*)vert_weights, count, dest_index);
}
void DM_interp_face_data(DerivedMesh *source, DerivedMesh *dest,
- int *src_indices,
- float *weights, FaceVertWeight *vert_weights,
- int count, int dest_index)
+ int *src_indices,
+ float *weights, FaceVertWeight *vert_weights,
+ int count, int dest_index)
{
CustomData_interp(&source->faceData, &dest->faceData, src_indices,
- weights, (float*)vert_weights, count, dest_index);
+ weights, (float*)vert_weights, count, dest_index);
}
void DM_swap_face_data(DerivedMesh *dm, int index, int *corner_indices)
@@ -509,7 +510,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
glEnd();
}
}
-static void emDM_drawEdges(DerivedMesh *dm, int drawLooseEdges)
+static void emDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges)
{
emDM_drawMappedEdges(dm, NULL, NULL);
}
@@ -635,8 +636,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, i, &drawSmooth);
if(draw) {
if (draw==2) { /* enabled with stipple */
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(stipple_quarttone);
+ glEnable(GL_POLYGON_STIPPLE);
+ glPolygonStipple(stipple_quarttone);
}
glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);
@@ -706,9 +707,9 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
}
static void emDM_drawFacesTex_common(DerivedMesh *dm,
- int (*drawParams)(MTFace *tface, MCol *mcol, int matnr),
- int (*drawParamsMapped)(void *userData, int index),
- void *userData)
+ int (*drawParams)(MTFace *tface, MCol *mcol, int matnr),
+ int (*drawParamsMapped)(void *userData, int index),
+ void *userData)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditMesh *em= emdm->em;
@@ -884,8 +885,8 @@ static void emDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void
}
static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
- int (*setMaterial)(int, void *attribs),
- int (*setDrawOptions)(void *userData, int index), void *userData)
+ int (*setMaterial)(int, void *attribs),
+ int (*setDrawOptions)(void *userData, int index), void *userData)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditMesh *em= emdm->em;
@@ -1034,7 +1035,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
static void emDM_drawFacesGLSL(DerivedMesh *dm,
- int (*setMaterial)(int, void *attribs))
+ int (*setMaterial)(int, void *attribs))
{
dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
}
@@ -1151,7 +1152,7 @@ static void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
if(!v4) face_r->v4 = 0;
for(i = 0, ev = em->verts.first; v1 || v2 || v3 || v4;
- i++, ev = ev->next) {
+ i++, ev = ev->next) {
if(ev == v1) {
face_r->v1 = i;
v1 = NULL;
@@ -1297,12 +1298,12 @@ static void emDM_release(DerivedMesh *dm)
}
static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
- float (*vertexCos)[3])
+ float (*vertexCos)[3])
{
EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm");
DM_init(&emdm->dm, DM_TYPE_EDITMESH, BLI_countlist(&em->verts),
- BLI_countlist(&em->edges), BLI_countlist(&em->faces));
+ BLI_countlist(&em->edges), BLI_countlist(&em->faces));
emdm->dm.getMinMax = emDM_getMinMax;
@@ -1345,7 +1346,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
for(eve = em->verts.first, i = 0; eve; eve = eve->next, ++i)
DM_set_vert_data(&emdm->dm, i, CD_MDEFORMVERT,
- CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT));
+ CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT));
}
if(vertexCos) {
@@ -1596,9 +1597,9 @@ static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm)
* - apply deform modifiers and input vertexco
*/
static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos)[3],
- DerivedMesh **deform_r, DerivedMesh **final_r,
- int useRenderParams, int useDeform,
- int needMapping, CustomDataMask dataMask, int index, int useCache)
+ DerivedMesh **deform_r, DerivedMesh **final_r,
+ int useRenderParams, int useDeform,
+ int needMapping, CustomDataMask dataMask, int index, int useCache)
{
Mesh *me = ob->data;
ModifierData *firstmd, *md;
@@ -1716,7 +1717,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
*/
numVerts = dm->getNumVerts(dm);
deformedVerts =
- MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
+ MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
dm->getVertCos(dm, deformedVerts);
} else {
deformedVerts = mesh_getVertexCos(me, &numVerts);
@@ -1891,8 +1892,8 @@ static int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedM
}
static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, DerivedMesh **cage_r,
- DerivedMesh **final_r,
- CustomDataMask dataMask)
+ DerivedMesh **final_r,
+ CustomDataMask dataMask)
{
ModifierData *md;
float (*deformedVerts)[3] = NULL;
@@ -1947,7 +1948,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
*/
numVerts = dm->getNumVerts(dm);
deformedVerts =
- MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
+ MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
dm->getVertCos(dm, deformedVerts);
} else {
deformedVerts = editmesh_getVertexCos(em, &numVerts);
@@ -2029,8 +2030,8 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
*cage_r = dm;
} else {
*cage_r =
- getEditMeshDerivedMesh(em, ob,
- deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
+ getEditMeshDerivedMesh(em, ob,
+ deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
}
}
}
@@ -2094,6 +2095,15 @@ static void clear_mesh_caches(Object *ob)
ob->derivedDeform->release(ob->derivedDeform);
ob->derivedDeform= NULL;
}
+ /* we free pbvh on changes, except during sculpt since it can't deal with
+ changing PVBH node organization, we hope topology does not change in
+ the meantime .. weak */
+ if(ob->sculpt && ob->sculpt->pbvh) {
+ if(!ob->sculpt->cache) {
+ BLI_pbvh_free(ob->sculpt->pbvh);
+ ob->sculpt->pbvh= NULL;
+ }
+ }
}
static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask)
@@ -2202,7 +2212,7 @@ DerivedMesh *mesh_create_derived_view(Scene *scene, Object *ob, CustomDataMask d
}
DerivedMesh *mesh_create_derived_no_deform(Scene *scene, Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask)
+ CustomDataMask dataMask)
{
DerivedMesh *final;
@@ -2212,7 +2222,7 @@ DerivedMesh *mesh_create_derived_no_deform(Scene *scene, Object *ob, float (*ver
}
DerivedMesh *mesh_create_derived_no_virtual(Scene *scene, Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask)
+ CustomDataMask dataMask)
{
DerivedMesh *final;
@@ -2222,8 +2232,8 @@ DerivedMesh *mesh_create_derived_no_virtual(Scene *scene, Object *ob, float (*ve
}
DerivedMesh *mesh_create_derived_no_deform_render(Scene *scene, Object *ob,
- float (*vertCos)[3],
- CustomDataMask dataMask)
+ float (*vertCos)[3],
+ CustomDataMask dataMask)
{
DerivedMesh *final;
@@ -2235,7 +2245,7 @@ DerivedMesh *mesh_create_derived_no_deform_render(Scene *scene, Object *ob,
/***/
DerivedMesh *editmesh_get_derived_cage_and_final(Scene *scene, Object *obedit, EditMesh *em, DerivedMesh **final_r,
- CustomDataMask dataMask)
+ CustomDataMask dataMask)
{
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index cf61de195e5..afd0b3a0f57 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -64,13 +64,13 @@
/* *********************** NOTE ON POSE AND ACTION **********************
- Pose is the local (object level) component of armature. The current
- object pose is saved in files, and (will be) is presorted for dependency
+ object pose is saved in files, and (will be) is presorted for dependency
- Actions have fewer (or other) channels, and write data to a Pose
- Currently ob->pose data is controlled in where_is_pose only. The (recalc)
- event system takes care of calling that
+ event system takes care of calling that
- The NLA system (here too) uses Poses as interpolation format for Actions
- Therefore we assume poses to be static, and duplicates of poses have channels in
- same order, for quick interpolation reasons
+ same order, for quick interpolation reasons
****************************** (ton) ************************************ */
@@ -1138,17 +1138,17 @@ static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mo
bone matching diagram, strips A and B
- .------------------------.
- | A |
- '------------------------'
+ .------------------------.
+ | A |
+ '------------------------'
. . b2
- . .-------------v----------.
- . | B . |
- . '------------------------'
- . . .
- . . .
+ . .-------------v----------.
+ . | B . |
+ . '------------------------'
+ . . .
+ . . .
offset: . 0 . A-B . A-b2+B
- . . .
+ . . .
*/
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 9eb6c3ad467..b2ac32da138 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -439,7 +439,7 @@ void calc_curvepath(Object *ob)
fp= dist+1;
maxdist= dist+tot;
fac= 1.0f/((float)path->len-1.0f);
- fac = fac * path->totdist;
+ fac = fac * path->totdist;
for(a=0; a<path->len; a++) {
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 584f31769ef..9fb442f8600 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -769,11 +769,11 @@ static short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
/* Write the given value to a setting using RNA, and return success */
static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
{
- // printf("%p %s %i %f\n", ptr, path, array_index, value);
-
PropertyRNA *prop;
PointerRNA new_ptr;
+ //printf("%p %s %i %f\n", ptr, path, array_index, value);
+
/* get property to write to */
if (RNA_path_resolve(ptr, path, &new_ptr, &prop))
{
@@ -781,7 +781,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
if (RNA_property_animateable(&new_ptr, prop))
{
int array_len= RNA_property_array_length(&new_ptr, prop);
-
+
if(array_len && array_index >= array_len)
{
if (G.f & G_DEBUG) {
@@ -789,10 +789,10 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
path, array_index, array_len-1);
}
-
+
return 0;
}
-
+
switch (RNA_property_type(prop))
{
case PROP_BOOLEAN:
@@ -1003,7 +1003,12 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime)
animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime);
}
- if (strip->flag & NLASTRIP_FLAG_USR_TIME && strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC)
+ /* if user can control the evaluation time (using F-Curves), consider the option which allows this time to be clamped
+ * to lie within extents of the action-clip, so that a steady changing rate of progress through several cycles of the clip
+ * can be achieved easily
+ */
+ // NOTE: if we add any more of these special cases, we better group them up nicely...
+ if ((strip->flag & NLASTRIP_FLAG_USR_TIME) && (strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC))
strip->strip_time= fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart);
}
@@ -1740,7 +1745,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re
*/
// TODO: need to double check that this all works correctly
if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM))
- {
+ {
/* evaluate NLA data */
if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF))
{
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 387b8a1d5b2..668ce9aadac 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -708,7 +708,7 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, int use_quaternion, int re
invert_m4_m4(b_bone_mats[0].mat, bone->arm_mat);
/* then we make the b_bone_mats:
- - first transform to local bone space
+ - first transform to local bone space
- translate over the curve to the bbone mat space
- transform with b_bone matrix
- transform back into global space */
@@ -905,7 +905,7 @@ static void pchan_bone_deform(bPoseChannel *pchan, float weight, float *vec, Dua
}
void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
- float (*vertexCos)[3], float (*defMats)[3][3],
+ float (*vertexCos)[3], float (*defMats)[3][3],
int numVerts, int deformflag,
float (*prevCos)[3], const char *defgrp_name)
{
@@ -983,9 +983,9 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
if(use_dverts) {
defnrToPC = MEM_callocN(sizeof(*defnrToPC) * numGroups,
- "defnrToBone");
+ "defnrToBone");
for(i = 0, dg = target->defbase.first; dg;
- i++, dg = dg->next) {
+ i++, dg = dg->next) {
defnrToPC[i] = get_pose_channel(armOb->pose, dg->name);
/* exclude non-deforming bones */
if(defnrToPC[i]) {
@@ -1070,10 +1070,10 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
if(bone && bone->flag & BONE_MULT_VG_ENV) {
weight *= distfactor_to_bone(co, bone->arm_head,
- bone->arm_tail,
- bone->rad_head,
- bone->rad_tail,
- bone->dist);
+ bone->arm_tail,
+ bone->rad_head,
+ bone->rad_tail,
+ bone->dist);
}
pchan_bone_deform(pchan, weight, vec, dq, smat, co, &contrib);
}
@@ -1083,7 +1083,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
*/
if(deformed == 0 && use_envelope) {
for(pchan = armOb->pose->chanbase.first; pchan;
- pchan = pchan->next) {
+ pchan = pchan->next) {
if(!(pchan->bone->flag & BONE_NO_DEFORM))
contrib += dist_bone_deform(pchan, vec, dq, smat, co);
}
@@ -1091,7 +1091,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
}
else if(use_envelope) {
for(pchan = armOb->pose->chanbase.first; pchan;
- pchan = pchan->next) {
+ pchan = pchan->next) {
if(!(pchan->bone->flag & BONE_NO_DEFORM))
contrib += dist_bone_deform(pchan, vec, dq, smat, co);
}
@@ -1293,10 +1293,10 @@ void pchan_apply_mat4(bPoseChannel *pchan, float mat[][4])
*/
void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4])
{
- float imat[4][4];
+ float imat[4][4];
- invert_m4_m4(imat, arm_mat);
- mul_m4_m4m4(delta_mat, pose_mat, imat);
+ invert_m4_m4(imat, arm_mat);
+ mul_m4_m4m4(delta_mat, pose_mat, imat);
}
/* **************** Rotation Mode Conversions ****************************** */
@@ -1369,21 +1369,21 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa
*************************************************************************** */
/* Computes vector and roll based on a rotation. "mat" must
- contain only a rotation, and no scaling. */
+ contain only a rotation, and no scaling. */
void mat3_to_vec_roll(float mat[][3], float *vec, float *roll)
{
- if (vec)
- copy_v3_v3(vec, mat[1]);
+ if (vec)
+ copy_v3_v3(vec, mat[1]);
- if (roll) {
- float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
+ if (roll) {
+ float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
- vec_roll_to_mat3(mat[1], 0.0f, vecmat);
- invert_m3_m3(vecmatinv, vecmat);
- mul_m3_m3m3(rollmat, vecmatinv, mat);
+ vec_roll_to_mat3(mat[1], 0.0f, vecmat);
+ invert_m3_m3(vecmatinv, vecmat);
+ mul_m3_m3m3(rollmat, vecmatinv, mat);
- *roll= (float)atan2(rollmat[2][0], rollmat[2][2]);
- }
+ *roll= (float)atan2(rollmat[2][0], rollmat[2][2]);
+ }
}
/* Calculates the rest matrix of a bone based
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 5f9b4f11850..5f6a4278549 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -179,7 +179,7 @@ void detectBitmapFont(ImBuf *ibuf)
int i;
if (ibuf != NULL) {
- // bitmap must have an x size that is a power of two
+ // bitmap must have an x size that is a power of two
if (is_power_of_two(ibuf->x)) {
rect = (unsigned char *) (ibuf->rect + (ibuf->x * (ibuf->y - 1)));
// printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]);
diff --git a/source/blender/blenkernel/intern/booleanops.c b/source/blender/blenkernel/intern/booleanops.c
index 710bbfaf12b..3e43dfbb4d5 100644
--- a/source/blender/blenkernel/intern/booleanops.c
+++ b/source/blender/blenkernel/intern/booleanops.c
@@ -137,7 +137,7 @@ static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, DerivedMesh
it->pos = 0;
- // assign iterator function pointers.
+ // assign iterator function pointers.
output->Step = VertexIt_Step;
output->Fill = VertexIt_Fill;
output->Done = VertexIt_Done;
@@ -353,9 +353,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
// create a new DerivedMesh
result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements);
CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
+ CD_DEFAULT, face_it->num_elements);
CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
+ CD_DEFAULT, face_it->num_elements);
// step through the vertex iterators:
for (i = 0; !vertex_it->Done(vertex_it->it); i++) {
@@ -422,7 +422,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
mface->mat_nr = 0;
InterpCSGFace(result, orig_dm, i, orig_index, csgface.vertex_number,
- (orig_me == me2)? mapmat: NULL);
+ (orig_me == me2)? mapmat: NULL);
test_index_face(mface, &result->faceData, i, csgface.vertex_number);
}
@@ -588,7 +588,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
}
DerivedMesh *NewBooleanDerivedMesh(DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select,
- int int_op_type)
+ int int_op_type)
{
return NewBooleanDerivedMesh_intern(dm, ob, dm_select, ob_select, int_op_type, NULL, NULL);
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 4aaf95e7037..4b8c3a2a0f4 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -678,7 +678,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
short flt;
if ((brush->size != cache->lastsize) || (brush->alpha != cache->lastalpha)
- || (brush->jitter != cache->lastjitter)) {
+ || (brush->jitter != cache->lastjitter)) {
if (cache->ibuf) {
IMB_freeImBuf(cache->ibuf);
cache->ibuf= NULL;
@@ -938,7 +938,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
*/
if(hasrgb & TEX_RGB)
texres.tin = (0.35 * texres.tr + 0.45 *
- texres.tg + 0.2 * texres.tb);
+ texres.tg + 0.2 * texres.tb);
texres.tin = texres.tin * 255.0;
((char*)texcache)[(iy*side+ix)*4] = (char)texres.tin;
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 65fda678ce0..1b7257519b1 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -210,7 +210,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
}
else // Region 0
{
- // Minimum at interior lv
+ // Minimum at interior lv
float invDet;
if(fabs(Det) > FLT_EPSILON)
invDet = 1.0f / Det;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 3a415d6564d..b3e702ceee9 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -39,12 +39,13 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
+#include "BKE_paint.h"
#include "BKE_utildefines.h"
-#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
+#include "BLI_math.h"
#include "BLI_pbvh.h"
#include "DNA_meshdata_types.h"
@@ -178,7 +179,7 @@ static ListBase *cdDM_getFaceMap(Object *ob, DerivedMesh *dm)
Mesh *me= ob->data;
create_vert_face_map(&cddm->fmap, &cddm->fmap_mem, me->mface,
- me->totvert, me->totface);
+ me->totvert, me->totface);
}
return cddm->fmap;
@@ -188,12 +189,22 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
+ if(!ob) {
+ cddm->pbvh= NULL;
+ return NULL;
+ }
+
+ if(!ob->sculpt)
+ return NULL;
+ if(ob->sculpt->pbvh)
+ cddm->pbvh= ob->sculpt->pbvh;
+
if(!cddm->pbvh && ob->type == OB_MESH) {
Mesh *me= ob->data;
cddm->pbvh = BLI_pbvh_new();
BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
- me->totface, me->totvert);
+ me->totface, me->totvert);
}
return cddm->pbvh;
@@ -290,7 +301,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
}
}
-static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges)
+static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mvert = cddm->mvert;
@@ -301,7 +312,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges)
DEBUG_VBO( "Using legacy code. cdDM_drawEdges\n" );
glBegin(GL_LINES);
for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if((medge->flag&ME_EDGEDRAW)
+ if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
&& (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
glVertex3fv(mvert[medge->v1].co);
glVertex3fv(mvert[medge->v2].co);
@@ -317,7 +328,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges)
GPU_edge_setup(dm);
if( !GPU_buffer_legacy(dm) ) {
for(i = 0; i < dm->numEdgeData; i++, medge++) {
- if((medge->flag&ME_EDGEDRAW)
+ if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
&& (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
draw = 1;
}
@@ -415,7 +426,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
return;
glShadeModel((mface->flag & ME_SMOOTH)? GL_SMOOTH: GL_FLAT);
- BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors);
+ BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, (mface->flag & ME_SMOOTH));
glShadeModel(GL_FLAT);
}
@@ -573,9 +584,9 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
}
static void cdDM_drawFacesTex_common(DerivedMesh *dm,
- int (*drawParams)(MTFace *tface, MCol *mcol, int matnr),
- int (*drawParamsMapped)(void *userData, int index),
- void *userData)
+ int (*drawParams)(MTFace *tface, MCol *mcol, int matnr),
+ int (*drawParamsMapped)(void *userData, int index),
+ void *userData)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -1272,10 +1283,10 @@ static void cdDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
}
static void cdDM_foreachMappedVert(
- DerivedMesh *dm,
- void (*func)(void *userData, int index, float *co,
- float *no_f, short *no_s),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index, float *co,
+ float *no_f, short *no_s),
+ void *userData)
{
MVert *mv = CDDM_get_verts(dm);
int i, orig, *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
@@ -1292,10 +1303,10 @@ static void cdDM_foreachMappedVert(
}
static void cdDM_foreachMappedEdge(
- DerivedMesh *dm,
- void (*func)(void *userData, int index,
- float *v0co, float *v1co),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index,
+ float *v0co, float *v1co),
+ void *userData)
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
@@ -1314,10 +1325,10 @@ static void cdDM_foreachMappedEdge(
}
static void cdDM_foreachMappedFaceCenter(
- DerivedMesh *dm,
- void (*func)(void *userData, int index,
- float *cent, float *no),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index,
+ float *cent, float *no),
+ void *userData)
{
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
MVert *mv = cddm->mvert;
@@ -1354,7 +1365,6 @@ static void cdDM_foreachMappedFaceCenter(
static void cdDM_free_internal(CDDerivedMesh *cddm)
{
- if(cddm->pbvh) BLI_pbvh_free(cddm->pbvh);
if(cddm->fmap) MEM_freeN(cddm->fmap);
if(cddm->fmap_mem) MEM_freeN(cddm->fmap_mem);
}
@@ -1466,11 +1476,11 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob)
alloctype= CD_REFERENCE;
CustomData_merge(&mesh->vdata, &dm->vertData, mask, alloctype,
- mesh->totvert);
+ mesh->totvert);
CustomData_merge(&mesh->edata, &dm->edgeData, mask, alloctype,
- mesh->totedge);
+ mesh->totedge);
CustomData_merge(&mesh->fdata, &dm->faceData, mask, alloctype,
- mesh->totface);
+ mesh->totface);
cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
@@ -1482,8 +1492,8 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob)
DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
{
DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts),
- BLI_countlist(&em->edges),
- BLI_countlist(&em->faces));
+ BLI_countlist(&em->edges),
+ BLI_countlist(&em->faces));
CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
EditVert *eve;
EditEdge *eed;
@@ -1496,11 +1506,11 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
dm->deformedOnly = 1;
CustomData_merge(&em->vdata, &dm->vertData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, dm->numVertData);
+ CD_CALLOC, dm->numVertData);
/* CustomData_merge(&em->edata, &dm->edgeData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, dm->numEdgeData); */
+ CD_CALLOC, dm->numEdgeData); */
CustomData_merge(&em->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, dm->numFaceData);
+ CD_CALLOC, dm->numFaceData);
/* set eve->hash to vert index */
for(i = 0, eve = em->verts.first; eve; eve = eve->next, ++i)
@@ -1519,7 +1529,7 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
index = dm->getVertDataArray(dm, CD_ORIGINDEX);
for(i = 0, eve = em->verts.first; i < dm->numVertData;
- i++, eve = eve->next, index++) {
+ i++, eve = eve->next, index++) {
MVert *mv = &mvert[i];
VECCOPY(mv->co, eve->co);
@@ -1539,7 +1549,7 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
index = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
for(i = 0, eed = em->edges.first; i < dm->numEdgeData;
- i++, eed = eed->next, index++) {
+ i++, eed = eed->next, index++) {
MEdge *med = &medge[i];
med->v1 = eed->v1->tmp.l;
@@ -1559,7 +1569,7 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me)
index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
for(i = 0, efa = em->faces.first; i < dm->numFaceData;
- i++, efa = efa->next, index++) {
+ i++, efa = efa->next, index++) {
MFace *mf = &mface[i];
mf->v1 = efa->v1->tmp.l;
@@ -1648,7 +1658,7 @@ DerivedMesh *CDDM_copy(DerivedMesh *source)
}
DerivedMesh *CDDM_from_template(DerivedMesh *source,
- int numVerts, int numEdges, int numFaces)
+ int numVerts, int numEdges, int numFaces)
{
CDDerivedMesh *cddm = cdDM_create("CDDM_from_template dest");
DerivedMesh *dm = &cddm->dm;
@@ -1718,7 +1728,7 @@ void CDDM_calc_normals(DerivedMesh *dm)
if(numVerts == 0) return;
temp_nors = MEM_callocN(numVerts * sizeof(*temp_nors),
- "CDDM_calc_normals temp_nors");
+ "CDDM_calc_normals temp_nors");
/* we don't want to overwrite any referenced layers */
mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT);
@@ -1728,7 +1738,7 @@ void CDDM_calc_normals(DerivedMesh *dm)
face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
if(!face_nors)
face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC,
- NULL, dm->numFaceData);
+ NULL, dm->numFaceData);
/* calculate face normals and add to vertex normals */
mf = CDDM_get_faces(dm);
@@ -1802,7 +1812,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
for(i = 0; !BLI_edgehashIterator_isDone(ehi);
- BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
+ BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2);
med->flag = ME_EDGEDRAW|ME_EDGERENDER;
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 7183a514225..33fe6212cd2 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -75,7 +75,7 @@ double tval()
static CM_SOLVER_DEF solvers [] =
{
{ "Implicit", CM_IMPLICIT, implicit_init, implicit_solver, implicit_free },
- // { "Implicit C++", CM_IMPLICITCPP, implicitcpp_init, implicitcpp_solver, implicitcpp_free },
+ // { "Implicit C++", CM_IMPLICITCPP, implicitcpp_init, implicitcpp_solver, implicitcpp_free },
};
/* ********** cloth engine ******* */
@@ -356,14 +356,12 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
/* initialize simulation data if it didn't exist already */
if(clmd->clothObject == NULL) {
if(!cloth_from_object(ob, clmd, result, framenr, 1)) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
+ BKE_ptcache_invalidate(cache);
return 0;
}
if(clmd->clothObject == NULL) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
+ BKE_ptcache_invalidate(cache);
return 0;
}
@@ -436,20 +434,17 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
clmd->sim_parms->timescale= timescale;
if(!result) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return dm;
}
if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll)))
{
clmd->sim_parms->reset = 0;
- cache->flag |= PTCACHE_REDO_NEEDED;
+ cache->flag |= PTCACHE_OUTDATED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
- cache->simframe= 0;
+ BKE_ptcache_validate(cache, 0);
cache->last_exact= 0;
- cache->flag |= PTCACHE_SIMULATION_VALID;
cache->flag &= ~PTCACHE_REDO_NEEDED;
return result;
}
@@ -460,9 +455,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
* happen because of object changes! */
if(clmd->clothObject) {
if(result->getNumVerts(result) != clmd->clothObject->numverts) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return result;
}
}
@@ -472,9 +465,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
/* handle continuous simulation with the play button */
if(BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
/* do simulation */
if(!do_init_cloth(ob, clmd, result, framenr))
@@ -488,9 +479,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
/* simulation is only active during a specific period */
if(framenr < startframe) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return result;
}
else if(framenr > endframe) {
@@ -509,8 +498,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
if((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
do_init_cloth(ob, clmd, result, framenr);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
return result;
}
@@ -522,8 +510,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
implicit_set_positions(clmd);
cloth_to_object (ob, clmd, result);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_write_cache(&pid, framenr);
@@ -532,13 +519,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
}
else if(cache_result==PTCACHE_READ_OLD) {
implicit_set_positions(clmd);
- cache->flag |= PTCACHE_SIMULATION_VALID;
}
else if( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
/* if baked and nothing in cache, do nothing */
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return result;
}
@@ -549,13 +533,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob,
clmd->sim_parms->timescale *= framenr - cache->simframe;
/* do simulation */
- cache->flag |= PTCACHE_SIMULATION_VALID;
- cache->simframe= framenr;
+ BKE_ptcache_validate(cache, framenr);
if(!do_step_cloth(ob, clmd, result, framenr)) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
}
else
BKE_ptcache_write_cache(&pid, framenr);
@@ -764,10 +745,10 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
verts = clothObj->verts;
if (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) ||
- (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) &&
- ((clmd->sim_parms->vgroup_mass>0) ||
- (clmd->sim_parms->vgroup_struct>0)||
- (clmd->sim_parms->vgroup_bend>0)))
+ (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) &&
+ ((clmd->sim_parms->vgroup_mass>0) ||
+ (clmd->sim_parms->vgroup_struct>0)||
+ (clmd->sim_parms->vgroup_bend>0)))
{
for ( i = 0; i < numverts; i++, verts++ )
{
@@ -789,7 +770,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
verts->goal = ( float ) pow ( verts->goal , 4.0f );
if ( verts->goal >=SOFTGOALSNAP )
{
- verts->flags |= CLOTH_VERT_FLAG_PINNED;
+ verts->flags |= CLOTH_VERT_FLAG_PINNED;
}
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 6410d02603d..4c0c10c127a 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -754,10 +754,10 @@ void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile)
cmsErrorAction(LCMS_ERROR_SHOW);
hTransform = cmsCreateProofingTransform(imageProfile, TYPE_RGBA_8, imageProfile, TYPE_RGBA_8,
- proofingProfile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
- cmsFLAGS_SOFTPROOFING);
+ proofingProfile,
+ INTENT_ABSOLUTE_COLORIMETRIC,
+ INTENT_ABSOLUTE_COLORIMETRIC,
+ cmsFLAGS_SOFTPROOFING);
cmsDoTransform(hTransform, ibuf->rect, ibuf->crect, ibuf->x * ibuf->y);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 78f1bb4e469..3ab5e9442b4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3054,7 +3054,7 @@ static void rbj_new_data (void *cdata)
bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint *)cdata;
// removed code which set target of this constraint
- data->type=1;
+ data->type=1;
}
static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 06921a0b9af..4fed662b6b4 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -569,7 +569,7 @@ static void calcknots(float *knots, short aantal, short order, short type)
float k;
int a, t;
- t = aantal+order;
+ t = aantal+order;
if(type==0) {
for(a=0;a<t;a++) {
@@ -624,7 +624,7 @@ static void makecyclicknots(float *knots, short pnts, short order)
}
b= order;
- c=pnts + order + order2;
+ c=pnts + order + order2;
for(a=pnts+order2; a<c; a++) {
knots[a]= knots[a-1]+ (knots[b]-knots[b-1]);
b--;
@@ -671,14 +671,14 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
int i, i1 = 0, i2 = 0 ,j, orderpluspnts, opp2, o2;
orderpluspnts= order+pnts;
- opp2 = orderpluspnts-1;
+ opp2 = orderpluspnts-1;
/* this is for float inaccuracy */
if(t < knots[0]) t= knots[0];
else if(t > knots[opp2]) t= knots[opp2];
/* this part is order '1' */
- o2 = order + 1;
+ o2 = order + 1;
for(i=0;i<opp2;i++) {
if(knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
basis[i]= 1.0;
@@ -1002,18 +1002,18 @@ void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int i
f*= it;
rt3= (q3-q0+3.0f*(q1-q2))/f;
- q0= rt0;
+ q0= rt0;
q1= rt1+rt2+rt3;
q2= 2*rt2+6*rt3;
q3= 6*rt3;
- for(a=0; a<=it; a++) {
+ for(a=0; a<=it; a++) {
*p= q0;
p = (float *)(((char *)p)+stride);
q0+= q1;
- q1+= q2;
- q2+= q3;
- }
+ q1+= q2;
+ q2+= q3;
+ }
}
static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float *p3, float *p, int it, int stride)
@@ -1023,7 +1023,7 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
*
* This could also be optimized like forward_diff_bezier */
int a;
- for(a=0; a<=it; a++) {
+ for(a=0; a<=it; a++) {
float t = (float)a / (float)it;
int i;
@@ -1032,7 +1032,7 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
}
normalize_v3(p);
p = (float *)(((char *)p)+stride);
- }
+ }
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
@@ -1061,7 +1061,7 @@ float *make_orco_surf(Object *ob)
sizev = nu->pntsv*nu->resolv;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
- if(nu->pntsv>1) tot+= sizeu * sizev;
+ if(nu->pntsv>1) tot+= sizeu * sizev;
nu= nu->next;
}
@@ -1464,7 +1464,7 @@ static short bevelinside(BevList *bl1,BevList *bl2)
/* there's a transition, calc intersection point */
mode= cu_isectLL(prevbevp->vec, bevp->vec, hvec1, hvec2, 0, 1, &lab, &mu, vec);
/* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition
- only allow for one situation: we choose lab= 1.0
+ only allow for one situation: we choose lab= 1.0
*/
if(mode>=0 && lab!=0.0) {
if(vec[0]<hvec1[0]) links++;
@@ -2578,13 +2578,13 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
void testhandlesNurb(Nurb *nu)
{
- /* use when something has changed with handles.
- it treats all BezTriples with the following rules:
- PHASE 1: do types have to be altered?
- Auto handles: become aligned when selection status is NOT(000 || 111)
- Vector handles: become 'nothing' when (one half selected AND other not)
- PHASE 2: recalculate handles
- */
+ /* use when something has changed with handles.
+ it treats all BezTriples with the following rules:
+ PHASE 1: do types have to be altered?
+ Auto handles: become aligned when selection status is NOT(000 || 111)
+ Vector handles: become 'nothing' when (one half selected AND other not)
+ PHASE 2: recalculate handles
+ */
BezTriple *bezt;
short flag, a;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index a0eef4d666e..a755170aae6 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -82,27 +82,27 @@ typedef struct LayerTypeInfo {
* count gives the number of elements in sources
*/
void (*interp)(void **sources, float *weights, float *sub_weights,
- int count, void *dest);
+ int count, void *dest);
- /* a function to swap the data in corners of the element */
+ /* a function to swap the data in corners of the element */
void (*swap)(void *data, int *corner_indices);
- /* a function to set a layer's data to default values. if NULL, the
+ /* a function to set a layer's data to default values. if NULL, the
default is assumed to be all zeros */
void (*set_default)(void *data, int count);
- /* a function to read data from a cdf file */
+ /* a function to read data from a cdf file */
int (*read)(CDataFile *cdf, void *data, int count);
- /* a function to write data to a cdf file */
+ /* a function to write data to a cdf file */
int (*write)(CDataFile *cdf, void *data, int count);
- /* a function to determine file size */
+ /* a function to determine file size */
size_t (*filesize)(CDataFile *cdf, void *data, int count);
} LayerTypeInfo;
static void layerCopy_mdeformvert(const void *source, void *dest,
- int count)
+ int count)
{
int i, size = sizeof(MDeformVert);
@@ -144,7 +144,7 @@ static void linklist_free_simple(void *link)
}
static void layerInterp_mdeformvert(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *sub_weights, int count, void *dest)
{
MDeformVert *dvert = dest;
LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */
@@ -174,7 +174,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
/* if this def_nr is not in the list, add it */
if(!node) {
MDeformWeight *tmp_dw = MEM_callocN(sizeof(*tmp_dw),
- "layerInterp_mdeformvert tmp_dw");
+ "layerInterp_mdeformvert tmp_dw");
tmp_dw->def_nr = dw->def_nr;
tmp_dw->weight = dw->weight * interp_weight;
BLI_linklist_prepend(&dest_dw, tmp_dw);
@@ -188,7 +188,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
if(totweight) {
dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight,
- "layerInterp_mdeformvert dvert->dw");
+ "layerInterp_mdeformvert dvert->dw");
dvert->totweight = totweight;
for(i = 0, node = dest_dw; node; node = node->next, ++i)
@@ -202,7 +202,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
static void layerInterp_msticky(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *sub_weights, int count, void *dest)
{
float co[2], w;
MSticky *mst;
@@ -234,7 +234,7 @@ static void layerCopy_tface(const void *source, void *dest, int count)
}
static void layerInterp_tface(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *sub_weights, int count, void *dest)
{
MTFace *tf = dest;
int i, j, k;
@@ -278,9 +278,9 @@ static void layerSwap_tface(void *data, int *corner_indices)
MTFace *tf = data;
float uv[4][2];
static const short pin_flags[4] =
- { TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
+ { TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
static const char sel_flags[4] =
- { TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
+ { TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
int j;
@@ -310,7 +310,7 @@ static void layerSwap_tface(void *data, int *corner_indices)
static void layerDefault_tface(void *data, int count)
{
static MTFace default_tf = {{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, NULL,
- 0, 0, TF_DYNAMIC, 0, 0};
+ 0, 0, TF_DYNAMIC, 0, 0};
MTFace *tf = (MTFace*)data;
int i;
@@ -466,7 +466,7 @@ static void layerSwap_mdisps(void *data, int *ci)
}
static void layerInterp_mdisps(void **sources, float *weights, float *sub_weights,
- int count, void *dest)
+ int count, void *dest)
{
// XXX
#if 0
@@ -680,7 +680,7 @@ static void layerInterp_mloopuv(void **sources, float *weights,
}
static void layerInterp_mcol(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+ float *sub_weights, int count, void *dest)
{
MCol *mc = dest;
int i, j, k;
@@ -843,7 +843,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
int type, int alloctype, void *layerdata, int totelem, const char *name);
void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
- CustomDataMask mask, int alloctype, int totelem)
+ CustomDataMask mask, int alloctype, int totelem)
{
const LayerTypeInfo *typeInfo;
CustomDataLayer *layer, *newlayer;
@@ -887,7 +887,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
}
void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
- CustomDataMask mask, int alloctype, int totelem)
+ CustomDataMask mask, int alloctype, int totelem)
{
memset(dest, 0, sizeof(*dest));
@@ -1142,7 +1142,7 @@ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
static int customData_resize(CustomData *data, int amount)
{
CustomDataLayer *tmp = MEM_callocN(sizeof(*tmp)*(data->maxlayer + amount),
- "CustomData->layers");
+ "CustomData->layers");
if(!tmp) return 0;
data->maxlayer += amount;
@@ -1230,13 +1230,13 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
}
void *CustomData_add_layer(CustomData *data, int type, int alloctype,
- void *layerdata, int totelem)
+ void *layerdata, int totelem)
{
CustomDataLayer *layer;
const LayerTypeInfo *typeInfo= layerType_getInfo(type);
layer = customData_add_layer__internal(data, type, alloctype, layerdata,
- totelem, typeInfo->defaultname);
+ totelem, typeInfo->defaultname);
if(layer)
return layer->data;
@@ -1246,12 +1246,12 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
/*same as above but accepts a name*/
void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
- void *layerdata, int totelem, char *name)
+ void *layerdata, int totelem, char *name)
{
CustomDataLayer *layer;
layer = customData_add_layer__internal(data, type, alloctype, layerdata,
- totelem, name);
+ totelem, name);
if(layer)
return layer->data;
@@ -1345,7 +1345,7 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type)
}
void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
- int type, char *name)
+ int type, char *name)
{
CustomDataLayer *layer;
int layer_index;
@@ -1390,7 +1390,7 @@ void CustomData_free_temporary(CustomData *data, int totelem)
}
void CustomData_set_only_copy(const struct CustomData *data,
- CustomDataMask mask)
+ CustomDataMask mask)
{
int i;
@@ -1400,7 +1400,7 @@ void CustomData_set_only_copy(const struct CustomData *data,
}
void CustomData_copy_data(const CustomData *source, CustomData *dest,
- int source_index, int dest_index, int count)
+ int source_index, int dest_index, int count)
{
const LayerTypeInfo *typeInfo;
int src_i, dest_i;
@@ -1415,7 +1415,7 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -1433,12 +1433,12 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
if(typeInfo->copy)
typeInfo->copy(src_data + src_offset,
- dest_data + dest_offset,
- count);
+ dest_data + dest_offset,
+ count);
else
memcpy(dest_data + dest_offset,
- src_data + src_offset,
- count * typeInfo->size);
+ src_data + src_offset,
+ count * typeInfo->size);
/* if there are multiple source & dest layers of the same type,
* we don't want to copy all source layers to the same dest, so
@@ -1462,7 +1462,7 @@ void CustomData_free_elem(CustomData *data, int index, int count)
int offset = typeInfo->size * index;
typeInfo->free((char *)data->layers[i].data + offset,
- count, typeInfo->size);
+ count, typeInfo->size);
}
}
}
@@ -1471,8 +1471,8 @@ void CustomData_free_elem(CustomData *data, int index, int count)
#define SOURCE_BUF_SIZE 100
void CustomData_interp(const CustomData *source, CustomData *dest,
- int *src_indices, float *weights, float *sub_weights,
- int count, int dest_index)
+ int *src_indices, float *weights, float *sub_weights,
+ int count, int dest_index)
{
int src_i, dest_i;
int dest_offset;
@@ -1485,7 +1485,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
*/
if(count > SOURCE_BUF_SIZE)
sources = MEM_callocN(sizeof(*sources) * count,
- "CustomData_interp sources");
+ "CustomData_interp sources");
/* interpolates a layer at a time */
dest_i = 0;
@@ -1497,7 +1497,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -1577,7 +1577,7 @@ void *CustomData_get_layer_n(const CustomData *data, int type, int n)
}
void *CustomData_get_layer_named(const struct CustomData *data, int type,
- char *name)
+ char *name)
{
int layer_index = CustomData_get_named_layer_index(data, type, name);
if(layer_index < 0) return NULL;
@@ -1625,21 +1625,21 @@ void CustomData_set(const CustomData *data, int index, int type, void *source)
void CustomData_em_free_block(CustomData *data, void **block)
{
- const LayerTypeInfo *typeInfo;
- int i;
+ const LayerTypeInfo *typeInfo;
+ int i;
if(!*block) return;
- for(i = 0; i < data->totlayer; ++i) {
- if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
- typeInfo = layerType_getInfo(data->layers[i].type);
+ for(i = 0; i < data->totlayer; ++i) {
+ if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+ typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->free) {
+ if(typeInfo->free) {
int offset = data->layers[i].offset;
- typeInfo->free((char*)*block + offset, 1, typeInfo->size);
+ typeInfo->free((char*)*block + offset, 1, typeInfo->size);
}
- }
- }
+ }
+ }
MEM_freeN(*block);
*block = NULL;
@@ -1659,7 +1659,7 @@ static void CustomData_em_alloc_block(CustomData *data, void **block)
}
void CustomData_em_copy_data(const CustomData *source, CustomData *dest,
- void *src_block, void **dest_block)
+ void *src_block, void **dest_block)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i;
@@ -1675,7 +1675,7 @@ void CustomData_em_copy_data(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -1752,7 +1752,7 @@ void CustomData_em_set_n(CustomData *data, void *block, int type, int n, void *s
}
void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights,
- float *sub_weights, int count, void *dest_block)
+ float *sub_weights, int count, void *dest_block)
{
int i, j;
void *source_buf[SOURCE_BUF_SIZE];
@@ -1763,7 +1763,7 @@ void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights,
*/
if(count > SOURCE_BUF_SIZE)
sources = MEM_callocN(sizeof(*sources) * count,
- "CustomData_interp sources");
+ "CustomData_interp sources");
/* interpolates a layer at a time */
for(i = 0; i < data->totlayer; ++i) {
@@ -1775,7 +1775,7 @@ void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights,
sources[j] = (char *)src_blocks[j] + layer->offset;
typeInfo->interp(sources, weights, sub_weights, count,
- (char *)dest_block + layer->offset);
+ (char *)dest_block + layer->offset);
}
}
@@ -1801,7 +1801,7 @@ void CustomData_em_set_default(CustomData *data, void **block)
}
void CustomData_to_em_block(const CustomData *source, CustomData *dest,
- int src_index, void **dest_block)
+ int src_index, void **dest_block)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i, src_offset;
@@ -1817,7 +1817,7 @@ void CustomData_to_em_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -1847,7 +1847,7 @@ void CustomData_to_em_block(const CustomData *source, CustomData *dest,
}
void CustomData_from_em_block(const CustomData *source, CustomData *dest,
- void *src_block, int dest_index)
+ void *src_block, int dest_index)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i, dest_offset;
@@ -1860,7 +1860,7 @@ void CustomData_from_em_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -1923,20 +1923,20 @@ void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
void CustomData_bmesh_free_block(CustomData *data, void **block)
{
- const LayerTypeInfo *typeInfo;
- int i;
+ const LayerTypeInfo *typeInfo;
+ int i;
if(!*block) return;
- for(i = 0; i < data->totlayer; ++i) {
- if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
- typeInfo = layerType_getInfo(data->layers[i].type);
+ for(i = 0; i < data->totlayer; ++i) {
+ if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+ typeInfo = layerType_getInfo(data->layers[i].type);
- if(typeInfo->free) {
+ if(typeInfo->free) {
int offset = data->layers[i].offset;
typeInfo->free((char*)*block + offset, 1, typeInfo->size);
}
- }
- }
+ }
+ }
BLI_mempool_free(data->pool, *block);
*block = NULL;
@@ -1955,7 +1955,7 @@ static void CustomData_bmesh_alloc_block(CustomData *data, void **block)
}
void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
- void *src_block, void **dest_block)
+ void *src_block, void **dest_block)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i;
@@ -1971,7 +1971,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -2049,7 +2049,7 @@ void CustomData_bmesh_set_n(CustomData *data, void *block, int type, int n, void
}
void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights,
- float *sub_weights, int count, void *dest_block)
+ float *sub_weights, int count, void *dest_block)
{
int i, j;
void *source_buf[SOURCE_BUF_SIZE];
@@ -2060,7 +2060,7 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
*/
if(count > SOURCE_BUF_SIZE)
sources = MEM_callocN(sizeof(*sources) * count,
- "CustomData_interp sources");
+ "CustomData_interp sources");
/* interpolates a layer at a time */
for(i = 0; i < data->totlayer; ++i) {
@@ -2071,7 +2071,7 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
sources[j] = (char *)src_blocks[j] + layer->offset;
typeInfo->interp(sources, weights, sub_weights, count,
- (char *)dest_block + layer->offset);
+ (char *)dest_block + layer->offset);
}
}
@@ -2097,7 +2097,7 @@ void CustomData_bmesh_set_default(CustomData *data, void **block)
}
void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
- int src_index, void **dest_block)
+ int src_index, void **dest_block)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i, src_offset;
@@ -2113,7 +2113,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -2143,7 +2143,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
}
void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
- void *src_block, int dest_index)
+ void *src_block, int dest_index)
{
const LayerTypeInfo *typeInfo;
int dest_i, src_i, dest_offset;
@@ -2156,7 +2156,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while(dest_i < dest->totlayer
- && dest->layers[dest_i].type < source->layers[src_i].type)
+ && dest->layers[dest_i].type < source->layers[src_i].type)
++dest_i;
/* if there are no more dest layers, we're done */
@@ -2296,8 +2296,8 @@ int CustomData_verify_versions(struct CustomData *data, int index)
}
if (!keeplayer) {
- for (i=index+1; i < data->totlayer; ++i)
- data->layers[i-1] = data->layers[i];
+ for (i=index+1; i < data->totlayer; ++i)
+ data->layers[i-1] = data->layers[i];
data->totlayer--;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 397a0526160..4e0270315ad 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -951,7 +951,7 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode,
{
DagNode *node;
- for(node = dag->DagNode.first; node; node= node->next)
+ for(node = dag->DagNode.first; node; node= node->next)
node->color= DAG_WHITE;
printf(" %s depends on %s through %s.\n", dag_node_name(endnode), dag_node_name(startnode), name);
@@ -1533,7 +1533,7 @@ int is_acyclic( DagForest *dag) {
void set_node_xy(DagNode *node, float x, float y)
{
- node->x = x;
+ node->x = x;
node->y = y;
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index ed7d11872c1..3480564e00e 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -490,7 +490,7 @@ static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, un
float *orco, *vnors, *nors, imat[3][3], mat[4][4], vec[3];
int a, i, need_orco, totface, totvert;
CustomDataMask dataMask = CD_MASK_BAREMESH | CD_MASK_MCOL
- | CD_MASK_MTFACE | CD_MASK_NORMAL;
+ | CD_MASK_MTFACE | CD_MASK_NORMAL;
init_fastshade_for_ob(re, ob, &need_orco, mat, imat);
@@ -1365,7 +1365,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
}
} else {
if (ELEM(ob->type, OB_CURVE, OB_FONT) && (cu->flag & CU_DEFORM_FILL)) {
- curve_to_filledpoly(cu, nurb, &cu->disp);
+ curve_to_filledpoly(cu, nurb, dispbase);
}
dm= CDDM_from_curve_customDB(ob, dispbase);
@@ -1784,9 +1784,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if(cu->flag & CU_PATH) calc_curvepath(ob);
- if (!forRender) {
- tex_space_curve(cu);
- }
+ if (!forRender) {
+ tex_space_curve(cu);
+ }
if(!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 14375c23d57..66e7f805f50 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -955,15 +955,15 @@ void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *
}
/* -------- pdDoEffectors() --------
- generic force/speed system, now used for particles and softbodies
- scene = scene where it runs in, for time and stuff
+ generic force/speed system, now used for particles and softbodies
+ scene = scene where it runs in, for time and stuff
lb = listbase with objects that take part in effecting
opco = global coord, as input
- force = force accumulator
- speed = actual current speed which can be altered
+ force = force accumulator
+ speed = actual current speed which can be altered
cur_time = "external" time in frames, is constant for static particles
loc_time = "local" time in frames, range <0-1> for the lifetime of particle
- par_layer = layer the caller is in
+ par_layer = layer the caller is in
flags = only used for softbody wind now
guide = old speed of particle
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index 772a589f520..91c5a633ff6 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -129,19 +129,19 @@ static int is_stl(char *str)
#define READSTLVERT { \
if (fread(mvert->co, sizeof(float), 3, fpSTL) != 3) { \
- char error_msg[255]; \
- MEM_freeN(vertdata); \
- MEM_freeN(facedata); \
- fclose(fpSTL); \
- sprintf(error_msg, "Problems reading face %d!", i); \
- return; \
+ char error_msg[255]; \
+ MEM_freeN(vertdata); \
+ MEM_freeN(facedata); \
+ fclose(fpSTL); \
+ sprintf(error_msg, "Problems reading face %d!", i); \
+ return; \
} \
else { \
- if (ENDIAN_ORDER==B_ENDIAN) { \
- SWITCH_INT(mvert->co[0]); \
- SWITCH_INT(mvert->co[1]); \
- SWITCH_INT(mvert->co[2]); \
- } \
+ if (ENDIAN_ORDER==B_ENDIAN) { \
+ SWITCH_INT(mvert->co[0]); \
+ SWITCH_INT(mvert->co[1]); \
+ SWITCH_INT(mvert->co[2]); \
+ } \
} \
}
@@ -267,9 +267,9 @@ static void read_stl_mesh_binary(Scene *scene, char *str)
me->totvert = totvert;
me->totface = totface;
me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN,
- vertdata, totvert);
+ vertdata, totvert);
me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN,
- facedata, totface);
+ facedata, totface);
mesh_add_normals_flags(me);
make_edges(me, 0);
@@ -410,9 +410,9 @@ static void read_stl_mesh_ascii(Scene *scene, char *str)
me->totface = totface;
me->totvert = totvert;
me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC,
- NULL, totvert);
+ NULL, totvert);
me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC,
- NULL, totface);
+ NULL, totface);
/* Copy vert coords and create topology */
mvert = me->mvert;
@@ -862,7 +862,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
/* count the nr of lines */
tot= 0;
index= iv->data[0];
- lll = iv->datalen[0]-1;
+ lll = iv->datalen[0]-1;
for(a=0; a<lll; a++) {
if(index[0]!= -1 && index[1]!= -1) tot++;
index++;
@@ -1009,7 +1009,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
}
/* indices */
- lll = index[0] - 2;
+ lll = index[0] - 2;
for(b=0; b<lll; b++) {
idata[0]= first;
idata[1]= first+1;
@@ -1045,7 +1045,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
/* count triangles */
face= 0;
index= iv->data[0];
- lll = iv->datalen[0]-2;
+ lll = iv->datalen[0]-2;
for(a=0; a<lll; a++) {
if(index[0]!= -1 && index[1]!= -1 && index[2]!= -1) face++;
index++;
@@ -1123,7 +1123,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
/* count triangles */
face= 0;
index= iv->data[0];
- lll=iv->datalen[0]-2;
+ lll=iv->datalen[0]-2;
for(a=0; a<lll; a++) {
if(index[0]!= -1 && index[1]!= -1 && index[2]!= -1) face++;
index++;
@@ -1155,7 +1155,7 @@ static void read_inventor(Scene *scene, char *str, struct ListBase *listb)
index= iv->data[0];
idata= dl->index;
- lll=iv->datalen[0]-2;
+ lll=iv->datalen[0]-2;
for(a=lll; a>0; a--) {
if(index[0]!= -1 && index[1]!= -1 && index[2]!= -1) {
@@ -1476,9 +1476,9 @@ static void displist_to_mesh(Scene *scene, DispList *dlfirst)
me->totvert= totvert;
me->totface= totface;
me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC,
- NULL, me->totvert);
+ NULL, me->totvert);
me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC,
- NULL, me->totface);
+ NULL, me->totface);
maxvertidx= totvert-1;
mvert= me->mvert;
@@ -1956,8 +1956,8 @@ void write_stl(Scene *scene, char *str)
fseek(fpSTL, 80, SEEK_SET);
if (ENDIAN_ORDER==B_ENDIAN) {
- SWITCH_INT(numfacets);
- }
+ SWITCH_INT(numfacets);
+ }
fwrite(&numfacets, 4*sizeof(char), 1, fpSTL);
fclose(fpSTL);
@@ -2574,13 +2574,13 @@ void write_dxf(struct Scene *scene, char *str)
/* The header part of the DXF */
write_group(0, "SECTION");
- write_group(2, "HEADER");
+ write_group(2, "HEADER");
write_group(0, "ENDSEC");
/* The blocks part of the DXF */
write_group(0, "SECTION");
- write_group(2, "BLOCKS");
+ write_group(2, "BLOCKS");
/* only write meshes we're using in this scene */
@@ -2604,7 +2604,7 @@ void write_dxf(struct Scene *scene, char *str)
/* The entities part of the DXF */
write_group(0, "SECTION");
- write_group(2, "ENTITIES");
+ write_group(2, "ENTITIES");
/* Write all the mesh objects */
base= scene->base.first;
@@ -3056,7 +3056,7 @@ static void dxf_read_line(Scene *scene, int noob) {
hasbumped=1;
}
- /* 2D Polyline state vars */
+ /* 2D Polyline state vars */
static Object *p2dhold=NULL;
static Mesh *p2dmhold=NULL;
static char oldplay[32];
@@ -3131,35 +3131,35 @@ static void dxf_read_ellipse(Scene *scene, int noob)
read_group(id, val);
while(id!=0) {
if (id==8) {
- BLI_strncpy(layname, val, sizeof(layname));
+ BLI_strncpy(layname, val, sizeof(layname));
} else if (id==10) {
- center[0]= (float) atof(val);
+ center[0]= (float) atof(val);
} else if (id==20) {
- center[1]= (float) atof(val);
+ center[1]= (float) atof(val);
} else if (id==30) {
- center[2]= (float) atof(val);
+ center[2]= (float) atof(val);
} else if (id==11) {
- axis_endpoint[0]= (float) atof(val);
+ axis_endpoint[0]= (float) atof(val);
} else if (id==21) {
- axis_endpoint[1]= (float) atof(val);
+ axis_endpoint[1]= (float) atof(val);
} else if (id==31) {
- axis_endpoint[2]= (float) atof(val);
+ axis_endpoint[2]= (float) atof(val);
} else if (id==40) {
- axis_ratio = (float) atof(val);
+ axis_ratio = (float) atof(val);
} else if (id==41) {
printf("dxf: start = %f", atof(val) * 180/M_PI);
- start_angle = -atof(val) + M_PI_2;
+ start_angle = -atof(val) + M_PI_2;
} else if (id==42) {
printf("dxf: end = %f", atof(val) * 180/M_PI);
end_angle = -atof(val) + M_PI_2;
} else if (id==62) {
- int colorid= atoi(val);
- CLAMP(colorid, 1, 255);
- dxf_col_to_rgb(colorid, &color[0], &color[1], &color[2]);
+ int colorid= atoi(val);
+ CLAMP(colorid, 1, 255);
+ dxf_col_to_rgb(colorid, &color[0], &color[1], &color[2]);
} else if (id==67) {
- vspace= atoi(val);
+ vspace= atoi(val);
} else if (id==100) {
- isArc = 1;
+ isArc = 1;
} else if (id==210) {
extrusion[0] = atof(val);
} else if (id==220) {
@@ -3290,28 +3290,28 @@ static void dxf_read_arc(Scene *scene, int noob)
read_group(id, val);
while(id!=0) {
if (id==8) {
- BLI_strncpy(layname, val, sizeof(layname));
+ BLI_strncpy(layname, val, sizeof(layname));
} else if (id==10) {
- center[0]= (float) atof(val);
+ center[0]= (float) atof(val);
} else if (id==20) {
- center[1]= (float) atof(val);
+ center[1]= (float) atof(val);
} else if (id==30) {
- center[2]= (float) atof(val);
+ center[2]= (float) atof(val);
} else if (id==40) {
- dia = (float) atof(val);
+ dia = (float) atof(val);
} else if (id==62) {
- int colorid= atoi(val);
+ int colorid= atoi(val);
- CLAMP(colorid, 1, 255);
- dxf_col_to_rgb(colorid, &color[0], &color[1], &color[2]);
+ CLAMP(colorid, 1, 255);
+ dxf_col_to_rgb(colorid, &color[0], &color[1], &color[2]);
} else if (id==67) {
- vspace= atoi(val);
+ vspace= atoi(val);
} else if (id==100) {
- isArc = 1;
+ isArc = 1;
} else if (id==50) {
- start_angle = (90 - atoi(val)) * M_PI/180.0;
+ start_angle = (90 - atoi(val)) * M_PI/180.0;
} else if (id==51) {
- end_angle = (90 - atoi(val)) * M_PI/180.0;
+ end_angle = (90 - atoi(val)) * M_PI/180.0;
} else if (id==210) {
extrusion[0] = atof(val);
} else if (id==220) {
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 22eb0578f72..118a44507c9 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -148,7 +148,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
fss->lastgoodframe = -1;
- fss->flag = 0;
+ fss->flag |= OB_FLUIDSIM_ACTIVE;
}
#endif
@@ -609,9 +609,9 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
//-------------------------------------------------------------------------------
void initElbeemMesh(struct Scene *scene, struct Object *ob,
- int *numVertices, float **vertices,
- int *numTriangles, int **triangles,
- int useGlobalCoords, int modifierIndex)
+ int *numVertices, float **vertices,
+ int *numTriangles, int **triangles,
+ int useGlobalCoords, int modifierIndex)
{
DerivedMesh *dm = NULL;
MVert *mvert;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 6c73a3ae64c..d4a5b5b2531 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -305,10 +305,10 @@ static void fcm_fn_generator_new_data (void *mdata)
*/
static double sinc (double x)
{
- if (fabs(x) < 0.0001)
- return 1.0;
- else
- return sin(M_PI * x) / (M_PI * x);
+ if (fabs(x) < 0.0001)
+ return 1.0;
+ else
+ return sin(M_PI * x) / (M_PI * x);
}
static void fcm_fn_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime)
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 1ca39bbaac4..9b8c05ac88c 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -160,7 +160,7 @@ According to RFC 3629 "UTF-8, a transformation format of ISO 10646"
(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are:
Char. number range | UTF-8 octet sequence
- (hexadecimal) | (binary)
+ (hexadecimal) | (binary)
--------------------+---------------------------------------------
0000 0000-0000 007F | 0xxxxxxx
0000 0080-0000 07FF | 110xxxxx 10xxxxxx
@@ -202,7 +202,7 @@ int utf8towchar(wchar_t *w, char *c)
*w = '?';
}
} else
- *w=(c[0] & 0x7f);
+ *w=(c[0] & 0x7f);
c++;
w++;
@@ -832,8 +832,8 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
linedata4[lnr]= wsnr;
if ( (tb->h != 0.0) &&
- ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize))) &&
- (cu->totbox > (curbox+1)) ) {
+ ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize))) &&
+ (cu->totbox > (curbox+1)) ) {
maxlen= 0;
tb++;
curbox++;
@@ -927,13 +927,13 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
ct++;
}
} else if((cu->spacemode==CU_FLUSH) &&
- (cu->tb[0].w != 0.0)) {
+ (cu->tb[0].w != 0.0)) {
for(i=0;i<lnr;i++)
if(linedata2[i]>1)
linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
for (i=0; i<=slen; i++) {
for (j=i; (mem[j]) && (mem[j]!='\n') &&
- (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
+ (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
// if ((mem[j]!='\r') && (mem[j]!='\n') && (mem[j])) {
ct->xof+= ct->charnr*linedata[ct->linenr];
// }
@@ -944,10 +944,10 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
float curofs= 0.0f;
for (i=0; i<=slen; i++) {
for (j=i; (mem[j]) && (mem[j]!='\n') &&
- (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
+ (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
if ((mem[j]!='\r') && (mem[j]!='\n') &&
- ((chartransdata[j].dobreak!=0))) {
- if (mem[i]==' ') curofs += (linedata3[ct->linenr]-linedata[ct->linenr])/linedata4[ct->linenr];
+ ((chartransdata[j].dobreak!=0))) {
+ if (mem[i]==' ') curofs += (linedata3[ct->linenr]-linedata[ct->linenr])/linedata4[ct->linenr];
ct->xof+= curofs;
}
if (mem[i]=='\n' || mem[i]=='\r' || chartransdata[i].dobreak) curofs= 0;
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 7981c66d2f6..98b3522059c 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -289,12 +289,12 @@ IDProperty *IDP_CopyArray(IDProperty *prop)
/*taken from readfile.c*/
#define SWITCH_LONGINT(a) { \
- char s_i, *p_i; \
- p_i= (char *)&(a); \
- s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \
- s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \
- s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \
- s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; }
+ char s_i, *p_i; \
+ p_i= (char *)&(a); \
+ s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \
+ s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \
+ s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \
+ s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; }
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 85f15094740..1a3c53e293f 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -446,16 +446,16 @@ static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, sho
strcpy(ibuf->name, "//Untitled");
ibuf->userflags |= IB_BITMAPDIRTY;
- switch(uvtestgrid) {
- case 1:
- BKE_image_buf_fill_checker(rect, rect_float, width, height);
- break;
- case 2:
- BKE_image_buf_fill_checker_color(rect, rect_float, width, height);
- break;
- default:
- BKE_image_buf_fill_color(rect, rect_float, width, height, color);
- }
+ switch(uvtestgrid) {
+ case 1:
+ BKE_image_buf_fill_checker(rect, rect_float, width, height);
+ break;
+ case 2:
+ BKE_image_buf_fill_checker_color(rect, rect_float, width, height);
+ break;
+ default:
+ BKE_image_buf_fill_color(rect, rect_float, width, height, color);
+ }
return ibuf;
}
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 2c4851b1835..eb256e3775b 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -73,8 +73,8 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
int checkerwidth= 32, dark= 1;
int x, y;
- unsigned char *rect_orig= rect;
- float *rect_float_orig= rect_float;
+ unsigned char *rect_orig= rect;
+ float *rect_float_orig= rect_float;
float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b;
@@ -109,8 +109,8 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
}
}
- rect= rect_orig;
- rect_float= rect_float_orig;
+ rect= rect_orig;
+ rect_float= rect_float_orig;
/* 2nd pass, colored + */
for(y= 0; y<height; y++) {
@@ -179,12 +179,12 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
sat= 1.0;
hue_step= larger_pow2(width / 8);
- if(hue_step < 8) hue_step= 8;
+ if(hue_step < 8) hue_step= 8;
for(y= 0; y < height; y++)
{
- val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
+ val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
for(x= 0; x < width; x++)
{
hue= (float)((double)(x/hue_step) * 1.0 / width * hue_step);
@@ -301,55 +301,55 @@ extern void stamp_font_begin(int size);
static void checker_board_text(unsigned char *rect, float *rect_float, int width, int height, int step, int outline)
{
- int x, y;
- int pen_x, pen_y;
- char text[3]= {'A', '1', '\0'};
+ int x, y;
+ int pen_x, pen_y;
+ char text[3]= {'A', '1', '\0'};
- /* hard coded size! */
+ /* hard coded size! */
stamp_font_begin(54);
- BLF_buffer(rect_float, rect, width, height, 4);
+ BLF_buffer(rect_float, rect, width, height, 4);
for(y= 0; y < height; y+=step)
{
- text[1]= '1';
+ text[1]= '1';
for(x= 0; x < width; x+=step)
{
- /* hard coded offset */
- pen_x = x + 33;
- pen_y = y + 44;
+ /* hard coded offset */
+ pen_x = x + 33;
+ pen_y = y + 44;
- /* terribly crappy outline font! */
- BLF_buffer_col(1.0, 1.0, 1.0, 1.0);
-
- BLF_position(pen_x-outline, pen_y, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x+outline, pen_y, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x, pen_y-outline, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x, pen_y+outline, 0.0);
- BLF_draw_buffer(text);
+ /* terribly crappy outline font! */
+ BLF_buffer_col(1.0, 1.0, 1.0, 1.0);
+
+ BLF_position(pen_x-outline, pen_y, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x+outline, pen_y, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x, pen_y-outline, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x, pen_y+outline, 0.0);
+ BLF_draw_buffer(text);
- BLF_position(pen_x-outline, pen_y-outline, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x+outline, pen_y+outline, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x-outline, pen_y+outline, 0.0);
- BLF_draw_buffer(text);
- BLF_position(pen_x+outline, pen_y-outline, 0.0);
- BLF_draw_buffer(text);
-
- BLF_buffer_col(0.0, 0.0, 0.0, 1.0);
- BLF_position(pen_x, pen_y, 0.0);
- BLF_draw_buffer(text);
+ BLF_position(pen_x-outline, pen_y-outline, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x+outline, pen_y+outline, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x-outline, pen_y+outline, 0.0);
+ BLF_draw_buffer(text);
+ BLF_position(pen_x+outline, pen_y-outline, 0.0);
+ BLF_draw_buffer(text);
+
+ BLF_buffer_col(0.0, 0.0, 0.0, 1.0);
+ BLF_position(pen_x, pen_y, 0.0);
+ BLF_draw_buffer(text);
- text[1]++;
+ text[1]++;
}
- text[0]++;
+ text[0]++;
}
- /* cleanup the buffer. */
+ /* cleanup the buffer. */
BLF_buffer(0, 0, 0, 0, 0);
}
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 2c0ca0f69f9..cd3326857c7 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1811,7 +1811,7 @@ void do_versions_ipos_to_animato(Main *main)
Sequence * seq;
for(seq = scene->ed->seqbasep->first;
- seq; seq = seq->next) {
+ seq; seq = seq->next) {
short adrcode = SEQ_FAC1;
if (G.f & G_DEBUG)
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 9c78742ada0..31b0a809ebe 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -178,11 +178,11 @@ Key *copy_key(Key *key)
void make_local_key(Key *key)
{
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
- if(key==0) return;
+ /* - only lib users: do nothing
+ * - only local users: set flag
+ * - mixed: make copy
+ */
+ if(key==0) return;
key->id.lib= 0;
new_id(0, (ID *)key, 0);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 347fd01299f..b7003f45626 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -714,7 +714,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, DerivedMesh
/* find the group (weak loop-in-loop) */
for(index = 0, curdef = target->defbase.first; curdef;
- curdef = curdef->next, index++)
+ curdef = curdef->next, index++)
if (!strcmp(curdef->name, vgroup))
break;
@@ -746,7 +746,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, DerivedMesh
VECCOPY(vec, vertexCos[a]);
calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
interp_v3_v3v3(vertexCos[a], vertexCos[a], vec,
- dvert->dw[j].weight);
+ dvert->dw[j].weight);
mul_m4_v3(cd.objectspace, vertexCos[a]);
break;
}
@@ -804,7 +804,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco
}
void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts, char *vgroup)
+ float (*vertexCos)[3], int numVerts, char *vgroup)
{
int a;
int use_vgroups;
@@ -834,7 +834,7 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
/* find the group (weak loop-in-loop) */
for(curdef = target->defbase.first; curdef;
- curdef = curdef->next, index++)
+ curdef = curdef->next, index++)
if(!strcmp(curdef->name, vgroup)) break;
if(curdef && (me->dvert || dm)) {
@@ -865,7 +865,7 @@ int object_deform_mball(Object *ob)
for (dl=ob->disp.first; dl; dl=dl->next) {
lattice_deform_verts(ob->parent, ob, NULL,
- (float(*)[3]) dl->verts, dl->nr, NULL);
+ (float(*)[3]) dl->verts, dl->nr, NULL);
}
return 1;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 91e53742fea..bea641d2140 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -598,10 +598,10 @@ static ID *alloc_libblock_notest(short type)
break;
case ID_PA:
id = MEM_callocN(sizeof(ParticleSettings), "ParticleSettings");
- break;
+ break;
case ID_WM:
id = MEM_callocN(sizeof(wmWindowManager), "Window manager");
- break;
+ break;
case ID_GD:
id = MEM_callocN(sizeof(bGPdata), "Grease Pencil");
break;
@@ -682,7 +682,7 @@ void *copy_libblock(void *rt)
static void free_library(Library *lib)
{
- /* no freeing needed for libraries yet */
+ /* no freeing needed for libraries yet */
}
static void (*free_windowmanager_cb)(bContext *, wmWindowManager *)= NULL;
@@ -1362,17 +1362,17 @@ void text_idbutton(struct ID *id, char *text)
if(id) {
if(GS(id->name)==ID_SCE)
strcpy(text, "SCE: ");
- else if(GS(id->name)==ID_SCE)
+ else if(GS(id->name)==ID_SCE)
strcpy(text, "SCR: ");
- else if(GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
+ else if(GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
strcpy(text, "NT: ");
- else {
+ else {
text[0]= id->name[0];
text[1]= id->name[1];
text[2]= ':';
text[3]= ' ';
text[4]= 0;
- }
+ }
}
else
strcpy(text, "");
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 9a1177f0f84..6d1f9d1d1bf 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -245,9 +245,9 @@ void make_local_material(Material *ma)
int a, local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(ma->id.lib==0) return;
if(ma->id.us==1) {
@@ -1065,15 +1065,15 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
}
break;
case MA_RAMP_DARK:
- tmp=col[0]+((1-col[0])*facm);
- if(tmp < *r) *r= tmp;
- if(g) {
- tmp=col[1]+((1-col[1])*facm);
- if(tmp < *g) *g= tmp;
- tmp=col[2]+((1-col[2])*facm);
- if(tmp < *b) *b= tmp;
- }
- break;
+ tmp=col[0]+((1-col[0])*facm);
+ if(tmp < *r) *r= tmp;
+ if(g) {
+ tmp=col[1]+((1-col[1])*facm);
+ if(tmp < *g) *g= tmp;
+ tmp=col[2]+((1-col[2])*facm);
+ if(tmp < *b) *b= tmp;
+ }
+ break;
case MA_RAMP_LIGHT:
tmp= fac*col[0];
if(tmp > *r) *r= tmp;
@@ -1125,7 +1125,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
if(tmp <= 0.0f)
*r = 0.0f;
else if (( tmp = (1.0f - (1.0f - (*r)) / tmp )) < 0.0f)
- *r = 0.0f;
+ *r = 0.0f;
else if (tmp > 1.0f)
*r=1.0f;
else
@@ -1136,17 +1136,17 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
if(tmp <= 0.0f)
*g = 0.0f;
else if (( tmp = (1.0f - (1.0f - (*g)) / tmp )) < 0.0f )
- *g = 0.0f;
+ *g = 0.0f;
else if(tmp >1.0f)
*g=1.0f;
else
*g = tmp;
- tmp = facm + fac*col[2];
- if(tmp <= 0.0f)
+ tmp = facm + fac*col[2];
+ if(tmp <= 0.0f)
*b = 0.0f;
else if (( tmp = (1.0f - (1.0f - (*b)) / tmp )) < 0.0f )
- *b = 0.0f;
+ *b = 0.0f;
else if(tmp >1.0f)
*b= 1.0f;
else
@@ -1203,36 +1203,36 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
}
}
break;
- case MA_RAMP_SOFT:
- if (g){
- float scr, scg, scb;
+ case MA_RAMP_SOFT:
+ if (g){
+ float scr, scg, scb;
- /* first calculate non-fac based Screen mix */
- scr = 1.0f - (1.0f - col[0]) * (1.0f - *r);
- scg = 1.0f - (1.0f - col[1]) * (1.0f - *g);
- scb = 1.0f - (1.0f - col[2]) * (1.0f - *b);
+ /* first calculate non-fac based Screen mix */
+ scr = 1.0f - (1.0f - col[0]) * (1.0f - *r);
+ scg = 1.0f - (1.0f - col[1]) * (1.0f - *g);
+ scb = 1.0f - (1.0f - col[2]) * (1.0f - *b);
- *r = facm*(*r) + fac*(((1.0f - *r) * col[0] * (*r)) + (*r * scr));
- *g = facm*(*g) + fac*(((1.0f - *g) * col[1] * (*g)) + (*g * scg));
- *b = facm*(*b) + fac*(((1.0f - *b) * col[2] * (*b)) + (*b * scb));
- }
- break;
- case MA_RAMP_LINEAR:
- if (col[0] > 0.5f)
- *r = *r + fac*(2.0f*(col[0]-0.5f));
- else
- *r = *r + fac*(2.0f*(col[0]) - 1.0f);
- if (g){
- if (col[1] > 0.5f)
- *g = *g + fac*(2.0f*(col[1]-0.5f));
- else
- *g = *g + fac*(2.0f*(col[1]) -1.0f);
- if (col[2] > 0.5f)
- *b = *b + fac*(2.0f*(col[2]-0.5f));
- else
- *b = *b + fac*(2.0f*(col[2]) - 1.0f);
- }
- break;
+ *r = facm*(*r) + fac*(((1.0f - *r) * col[0] * (*r)) + (*r * scr));
+ *g = facm*(*g) + fac*(((1.0f - *g) * col[1] * (*g)) + (*g * scg));
+ *b = facm*(*b) + fac*(((1.0f - *b) * col[2] * (*b)) + (*b * scb));
+ }
+ break;
+ case MA_RAMP_LINEAR:
+ if (col[0] > 0.5f)
+ *r = *r + fac*(2.0f*(col[0]-0.5f));
+ else
+ *r = *r + fac*(2.0f*(col[0]) - 1.0f);
+ if (g){
+ if (col[1] > 0.5f)
+ *g = *g + fac*(2.0f*(col[1]-0.5f));
+ else
+ *g = *g + fac*(2.0f*(col[1]) -1.0f);
+ if (col[2] > 0.5f)
+ *b = *b + fac*(2.0f*(col[2]-0.5f));
+ else
+ *b = *b + fac*(2.0f*(col[2]) - 1.0f);
+ }
+ break;
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index d65870b71ce..98578312766 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -686,7 +686,7 @@ void *new_pgn_element(int size)
if(cur) {
if(size+offs < blocksize) {
adr= (void *) (cur->data+offs);
- offs+= size;
+ offs+= size;
return adr;
}
}
@@ -1091,7 +1091,7 @@ int getedge (EDGELIST *table[],
q = table[HASH(i1, j1, k1)+HASH(i2, j2, k2)];
for (; q != NULL; q = q->next)
if (q->i1 == i1 && q->j1 == j1 && q->k1 == k1 &&
- q->i2 == i2 && q->j2 == j2 && q->k2 == k2)
+ q->i2 == i2 && q->j2 == j2 && q->k2 == k2)
return q->vid;
return -1;
}
@@ -1240,7 +1240,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
p->z = neg.z;
return;
}
- if((dx == 0.0f) && (dz == 0.0f)){
+ if((dx == 0.0f) && (dz == 0.0f)){
p->x = neg.x;
p->y = neg.y - negative*dy/(positive-negative);
p->z = neg.z;
@@ -1272,7 +1272,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
p->y = 0.5f*(pos.y + neg.y);
if ((function(p->x,p->y,p->z)) > 0.0) pos.y = p->y; else neg.y = p->y;
}
- }
+ }
if((dx == 0.0f) && (dy == 0.0f)){
p->x = neg.x;
@@ -1580,7 +1580,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
if(ml->s > 10.0) ml->s = 10.0;
/* Rotation of MetaElem is stored in quat */
- quat_to_mat4( temp3,ml->quat);
+ quat_to_mat4( temp3,ml->quat);
/* Translation of MetaElem */
unit_m4(temp2);
@@ -2120,8 +2120,8 @@ void metaball_polygonize(Scene *scene, Object *ob)
/* don't polygonize metaballs with too high resolution (base mball to small) */
if(metaball_tree) {
if(ob->size[0]<=0.0001f*(metaball_tree->first->x_max - metaball_tree->first->x_min) ||
- ob->size[1]<=0.0001f*(metaball_tree->first->y_max - metaball_tree->first->y_min) ||
- ob->size[2]<=0.0001f*(metaball_tree->first->z_max - metaball_tree->first->z_min))
+ ob->size[1]<=0.0001f*(metaball_tree->first->y_max - metaball_tree->first->y_min) ||
+ ob->size[2]<=0.0001f*(metaball_tree->first->z_max - metaball_tree->first->z_min))
{
MEM_freeN(mainb);
return;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 15f9fc4ac11..543895a5973 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -108,7 +108,7 @@ void unlink_mesh(Mesh *me)
}
if(me->key) {
- me->key->id.us--;
+ me->key->id.us--;
if (me->key->id.us == 0 && me->key->ipo )
me->key->ipo->id.us--;
}
@@ -274,9 +274,9 @@ void make_local_mesh(Mesh *me)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(me->id.lib==0) return;
if(me->id.us==1) {
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 4c4abf80db4..5cda09cad85 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -42,6 +42,7 @@
#include "BLI_kdtree.h"
#include "BLI_rand.h"
+#include "BLI_uvproject.h"
#include "MEM_guardedalloc.h"
@@ -68,6 +69,7 @@
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_scene.h"
@@ -204,7 +206,7 @@ static int curveModifier_isDisabled(ModifierData *md, int userRenderParams)
}
static void curveModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -215,7 +217,7 @@ static void curveModifier_foreachObjectLink(
static void curveModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene,
- Object *ob, DagNode *obNode)
+ Object *ob, DagNode *obNode)
{
CurveModifierData *cmd = (CurveModifierData*) md;
@@ -228,7 +230,7 @@ static void curveModifier_updateDepgraph(
}
static void curveModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
CurveModifierData *cmd = (CurveModifierData*) md;
@@ -239,7 +241,7 @@ static void curveModifier_deformVerts(
static void curveModifier_deformVertsEM(
ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
@@ -280,7 +282,7 @@ static int latticeModifier_isDisabled(ModifierData *md, int userRenderParams)
}
static void latticeModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -317,7 +319,7 @@ static void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
static void latticeModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
@@ -325,12 +327,12 @@ static void latticeModifier_deformVerts(
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ob, derivedData,
- vertexCos, numVerts, lmd->name);
+ vertexCos, numVerts, lmd->name);
}
static void latticeModifier_deformVertsEM(
ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
@@ -463,22 +465,22 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
maxVerts = dm->getNumVerts(dm);
vertMap = MEM_callocN(sizeof(*vertMap) * maxVerts,
- "build modifier vertMap");
+ "build modifier vertMap");
for(i = 0; i < maxVerts; ++i) vertMap[i] = i;
maxEdges = dm->getNumEdges(dm);
edgeMap = MEM_callocN(sizeof(*edgeMap) * maxEdges,
- "build modifier edgeMap");
+ "build modifier edgeMap");
for(i = 0; i < maxEdges; ++i) edgeMap[i] = i;
maxFaces = dm->getNumFaces(dm);
faceMap = MEM_callocN(sizeof(*faceMap) * maxFaces,
- "build modifier faceMap");
+ "build modifier faceMap");
for(i = 0; i < maxFaces; ++i) faceMap[i] = i;
if (ob) {
frac = bsystem_time(md->scene, ob, md->scene->r.cfra,
- bmd->start - 1.0f) / bmd->length;
+ bmd->start - 1.0f) / bmd->length;
} else {
frac = md->scene->r.cfra - bmd->start / bmd->length;
}
@@ -493,7 +495,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
if(bmd->randomize)
BLI_array_randomize(faceMap, sizeof(*faceMap),
- maxFaces, bmd->seed);
+ maxFaces, bmd->seed);
/* get the set of all vert indices that will be in the final mesh,
* mapped to the new indices
@@ -532,7 +534,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
} else if(numEdges) {
if(bmd->randomize)
BLI_array_randomize(edgeMap, sizeof(*edgeMap),
- maxEdges, bmd->seed);
+ maxEdges, bmd->seed);
/* get the set of all vert indices that will be in the final mesh,
* mapped to the new indices
@@ -563,7 +565,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
if(bmd->randomize)
BLI_array_randomize(vertMap, sizeof(*vertMap),
- maxVerts, bmd->seed);
+ maxVerts, bmd->seed);
/* get the set of all vert indices that will be in the final mesh,
* mapped to the new indices
@@ -576,7 +578,7 @@ static DerivedMesh *buildModifier_applyModifier(ModifierData *md, Object *ob,
* the mesh
*/
result = CDDM_from_template(dm, BLI_ghash_size(vertHash),
- BLI_ghash_size(edgeHash), numFaces);
+ BLI_ghash_size(edgeHash), numFaces);
/* copy the vertices across */
for(hashIter = BLI_ghashIterator_new(vertHash);
@@ -662,7 +664,7 @@ static CustomDataMask maskModifier_requiredDataMask(Object *ob, ModifierData *md
}
static void maskModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -1028,7 +1030,7 @@ static void arrayModifier_copyData(ModifierData *md, ModifierData *target)
}
static void arrayModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -1124,13 +1126,13 @@ static int calc_mapping(IndexMapEntry *indexMap, int oldIndex, int copyNum)
return indexMap[oldIndex].new;
else
return calc_mapping(indexMap, indexMap[oldIndex].merge,
- copyNum - 1);
+ copyNum - 1);
}
}
static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
Scene *scene, Object *ob, DerivedMesh *dm,
- int initFlags)
+ int initFlags)
{
int i, j;
/* offset matrix */
@@ -1160,7 +1162,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
unit_m4(offset);
indexMap = MEM_callocN(sizeof(*indexMap) * dm->getNumVerts(dm),
- "indexmap");
+ "indexmap");
src_mvert = dm->getVertArray(dm);
@@ -1185,7 +1187,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mul_serie_m4(result_mat, offset,
obinv, amd->offset_ob->obmat,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL);
copy_m4_m4(offset, result_mat);
}
@@ -1542,12 +1544,12 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
test_index_face(&mface[numFaces], &result->faceData,
- numFaces, 4);
+ numFaces, 4);
}
else
{
test_index_face(&mface[numFaces], &result->faceData,
- numFaces, 3);
+ numFaces, 3);
}
origindex[numFaces] = ORIGINDEX_NONE;
@@ -1643,12 +1645,12 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
test_index_face(&mface[numFaces], &result->faceData,
- numFaces, 4);
+ numFaces, 4);
}
else
{
test_index_face(&mface[numFaces], &result->faceData,
- numFaces, 3);
+ numFaces, 3);
}
origindex[numFaces] = ORIGINDEX_NONE;
@@ -1714,7 +1716,7 @@ static void mirrorModifier_copyData(ModifierData *md, ModifierData *target)
}
static void mirrorModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -1924,7 +1926,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
}
static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
- Object *ob, DerivedMesh *dm,
+ Object *ob, DerivedMesh *dm,
int initFlags)
{
DerivedMesh *result = dm;
@@ -2198,7 +2200,7 @@ static void smoothmesh_print(SmoothMesh *mesh)
dm->getVert(dm, vert->oldIndex, &mv);
printf("%3d: ind={%3d, %3d}, pos={% 5.1f, % 5.1f, % 5.1f}",
- i, vert->oldIndex, vert->newIndex,
+ i, vert->oldIndex, vert->newIndex,
mv.co[0], mv.co[1], mv.co[2]);
printf(", faces={");
for(node = vert->faces; node != NULL; node = node->next) {
@@ -2213,7 +2215,7 @@ static void smoothmesh_print(SmoothMesh *mesh)
LinkNode *node;
printf("%4d: indices={%4d, %4d}, verts={%4d, %4d}",
- i,
+ i,
edge->oldIndex, edge->newIndex,
edge->verts[0]->newIndex, edge->verts[1]->newIndex);
if(edge->verts[0] == edge->verts[1]) printf(" <- DUPLICATE VERTEX");
@@ -2229,7 +2231,7 @@ static void smoothmesh_print(SmoothMesh *mesh)
SmoothFace *face = &mesh->faces[i];
printf("%4d: indices={%4d, %4d}, edges={", i,
- face->oldIndex, face->newIndex);
+ face->oldIndex, face->newIndex);
for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
if(face->flip[j])
printf(" -%-2d", face->edges[j]->newIndex);
@@ -2257,7 +2259,7 @@ static SmoothMesh *smoothmesh_from_derivedmesh(DerivedMesh *dm)
totface = dm->getNumFaces(dm);
mesh = smoothmesh_new(totvert, totedge, totface,
- totvert, totedge, totface);
+ totvert, totedge, totface);
mesh->dm = dm;
@@ -2390,7 +2392,7 @@ static SmoothVert *other_vert(SmoothEdge *edge, SmoothVert *vert)
* (this should never happen)
*/
static SmoothEdge *other_edge(SmoothFace *face, SmoothVert *vert,
- SmoothEdge *edge)
+ SmoothEdge *edge)
{
int i,j;
for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++) {
@@ -2584,7 +2586,7 @@ static void edge_replace_vert(void *ptr, void *userdata)
#ifdef EDGESPLIT_DEBUG_3
printf("replacing vert %4d with %4d in edge %4d",
- find->newIndex, replace->newIndex, edge->newIndex);
+ find->newIndex, replace->newIndex, edge->newIndex);
printf(": {%4d, %4d}", edge->verts[0]->newIndex, edge->verts[1]->newIndex);
#endif
@@ -2620,14 +2622,14 @@ static void face_replace_edge(void *ptr, void *userdata)
#ifdef EDGESPLIT_DEBUG_3
printf("replacing edge %4d with %4d in face %4d",
- find->newIndex, replace->newIndex, face->newIndex);
+ find->newIndex, replace->newIndex, face->newIndex);
if(face->edges[3])
printf(": {%2d %2d %2d %2d}",
- face->edges[0]->newIndex, face->edges[1]->newIndex,
+ face->edges[0]->newIndex, face->edges[1]->newIndex,
face->edges[2]->newIndex, face->edges[3]->newIndex);
else
printf(": {%2d %2d %2d}",
- face->edges[0]->newIndex, face->edges[1]->newIndex,
+ face->edges[0]->newIndex, face->edges[1]->newIndex,
face->edges[2]->newIndex);
#endif
@@ -2642,11 +2644,11 @@ static void face_replace_edge(void *ptr, void *userdata)
#ifdef EDGESPLIT_DEBUG_3
if(face->edges[3])
printf(" -> {%2d %2d %2d %2d}\n",
- face->edges[0]->newIndex, face->edges[1]->newIndex,
+ face->edges[0]->newIndex, face->edges[1]->newIndex,
face->edges[2]->newIndex, face->edges[3]->newIndex);
else
printf(" -> {%2d %2d %2d}\n",
- face->edges[0]->newIndex, face->edges[1]->newIndex,
+ face->edges[0]->newIndex, face->edges[1]->newIndex,
face->edges[2]->newIndex);
#endif
}
@@ -2696,7 +2698,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge,
LinkNode *visited_edges = NULL;
#ifdef EDGESPLIT_DEBUG_1
printf("=== START === find_other_sharp_edge(edge = %4d, vert = %4d)\n",
- edge->newIndex, vert->newIndex);
+ edge->newIndex, vert->newIndex);
#endif
/* get a face on which to start */
@@ -2717,10 +2719,10 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge,
* seen before
*/
while(face && !edge_is_sharp(edge2, flags, threshold)
- && !linklist_contains(visited_edges, edge2)) {
+ && !linklist_contains(visited_edges, edge2)) {
#ifdef EDGESPLIT_DEBUG_3
printf("current face %4d; current edge %4d\n", face->newIndex,
- edge2->newIndex);
+ edge2->newIndex);
#endif
/* get the next face */
face = other_face(edge2, face);
@@ -2738,30 +2740,30 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge,
edge2 = other_edge(face, vert, edge2);
#ifdef EDGESPLIT_DEBUG_3
printf("next face %4d; next edge %4d\n",
- face->newIndex, edge2->newIndex);
+ face->newIndex, edge2->newIndex);
} else {
printf("loose edge: %4d\n", edge2->newIndex);
#endif
}
- }
+ }
- /* either we came back to the start edge or we found a sharp/loose edge */
- if(linklist_contains(visited_edges, edge2))
- /* we came back to the start edge */
- edge2 = NULL;
+ /* either we came back to the start edge or we found a sharp/loose edge */
+ if(linklist_contains(visited_edges, edge2))
+ /* we came back to the start edge */
+ edge2 = NULL;
- BLI_linklist_free(visited_edges, NULL);
+ BLI_linklist_free(visited_edges, NULL);
#ifdef EDGESPLIT_DEBUG_1
- printf("=== END === find_other_sharp_edge(edge = %4d, vert = %4d), "
- "returning edge %d\n",
+ printf("=== END === find_other_sharp_edge(edge = %4d, vert = %4d), "
+ "returning edge %d\n",
edge->newIndex, vert->newIndex, edge2 ? edge2->newIndex : -1);
#endif
- return edge2;
+ return edge2;
}
static void split_single_vert(SmoothVert *vert, SmoothFace *face,
- SmoothMesh *mesh)
+ SmoothMesh *mesh)
{
SmoothVert *copy_vert;
ReplaceData repdata;
@@ -2819,17 +2821,17 @@ static void pop_propagate_stack(SmoothEdge **edge, SmoothVert **vert, SmoothMesh
static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh);
static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
- SmoothMesh *mesh)
+ SmoothMesh *mesh)
{
SmoothEdge *edge2;
LinkNode *visited_faces = NULL;
#ifdef EDGESPLIT_DEBUG_1
printf("=== START === propagate_split(edge = %4d, vert = %4d)\n",
- edge->newIndex, vert->newIndex);
+ edge->newIndex, vert->newIndex);
#endif
edge2 = find_other_sharp_edge(vert, edge, &visited_faces,
- mesh->threshold, mesh->flags);
+ mesh->threshold, mesh->flags);
if(!edge2) {
/* didn't find a sharp or loose edge, so we've hit a dead end */
@@ -2871,7 +2873,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
BLI_linklist_free(visited_faces, NULL);
#ifdef EDGESPLIT_DEBUG_1
printf("=== END === propagate_split(edge = %4d, vert = %4d)\n",
- edge->newIndex, vert->newIndex);
+ edge->newIndex, vert->newIndex);
#endif
}
@@ -2884,11 +2886,11 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
LinkNode *visited_faces = NULL;
#ifdef EDGESPLIT_DEBUG_1
printf("=== START === split_edge(edge = %4d, vert = %4d)\n",
- edge->newIndex, vert->newIndex);
+ edge->newIndex, vert->newIndex);
#endif
edge2 = find_other_sharp_edge(vert, edge, &visited_faces,
- mesh->threshold, mesh->flags);
+ mesh->threshold, mesh->flags);
if(!edge2) {
/* didn't find a sharp or loose edge, so try the other vert */
@@ -2958,12 +2960,12 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
BLI_linklist_free(visited_faces, NULL);
#ifdef EDGESPLIT_DEBUG_1
printf("=== END === split_edge(edge = %4d, vert = %4d)\n",
- edge->newIndex, vert->newIndex);
+ edge->newIndex, vert->newIndex);
#endif
}
static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle,
- int flags, int *extra_edges)
+ int flags, int *extra_edges)
{
/* if normal1 dot normal2 < threshold, angle is greater, so split */
/* FIXME not sure if this always works */
@@ -3327,7 +3329,7 @@ static int displaceModifier_dependsOnTime(ModifierData *md)
}
static void displaceModifier_foreachObjectLink(ModifierData *md, Object *ob,
- ObjectWalkFunc walk, void *userData)
+ ObjectWalkFunc walk, void *userData)
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
@@ -3352,7 +3354,7 @@ static int displaceModifier_isDisabled(ModifierData *md, int useRenderParams)
}
static void displaceModifier_updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene,
+ ModifierData *md, DagForest *forest, Scene *scene,
Object *ob, DagNode *obNode)
{
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
@@ -3385,7 +3387,7 @@ static void validate_layer_name(const CustomData *data, int type, char *name, ch
}
static void get_texture_coords(DisplaceModifierData *dmd, Object *ob,
- DerivedMesh *dm,
+ DerivedMesh *dm,
float (*co)[3], float (*texco)[3],
int numVerts)
{
@@ -3492,7 +3494,7 @@ static void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
/* dm must be a CDDerivedMesh */
static void displaceModifier_do(
DisplaceModifierData *dmd, Object *ob,
- DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
+ DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
{
int i;
MVert *mvert;
@@ -3509,7 +3511,7 @@ static void displaceModifier_do(
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
- "displaceModifier_do tex_co");
+ "displaceModifier_do tex_co");
get_texture_coords(dmd, ob, dm, vertexCos, tex_co, numVerts);
for(i = 0; i < numVerts; ++i) {
@@ -3565,12 +3567,12 @@ static void displaceModifier_do(
static void displaceModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
DerivedMesh *dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos);
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
- vertexCos, numVerts);
+ vertexCos, numVerts);
if(dm != derivedData)
dm->release(dm);
@@ -3583,7 +3585,7 @@ static void displaceModifier_deformVertsEM(
DerivedMesh *dm= get_cddm(md->scene, ob, editData, derivedData, vertexCos);
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
- vertexCos, numVerts);
+ vertexCos, numVerts);
if(dm != derivedData)
dm->release(dm);
@@ -3642,18 +3644,18 @@ static void uvprojectModifier_foreachObjectLink(ModifierData *md, Object *ob,
}
static void uvprojectModifier_foreachIDLink(ModifierData *md, Object *ob,
- IDWalkFunc walk, void *userData)
+ IDWalkFunc walk, void *userData)
{
UVProjectModifierData *umd = (UVProjectModifierData*) md;
walk(userData, ob, (ID **)&umd->image);
uvprojectModifier_foreachObjectLink(md, ob, (ObjectWalkFunc)walk,
- userData);
+ userData);
}
static void uvprojectModifier_updateDepgraph(ModifierData *md,
- DagForest *forest, Scene *scene, Object *ob, DagNode *obNode)
+ DagForest *forest, Scene *scene, Object *ob, DagNode *obNode)
{
UVProjectModifierData *umd = (UVProjectModifierData*) md;
int i;
@@ -3672,6 +3674,7 @@ typedef struct Projector {
Object *ob; /* object this projector is derived from */
float projmat[4][4]; /* projection matrix */
float normal[3]; /* projector normal in world space */
+ void *uci; /* optional uv-project info (panorama projection) */
} Projector;
static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
@@ -3687,9 +3690,11 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
int num_projectors = 0;
float aspect;
char uvname[32];
+ float aspx= umd->aspectx ? umd->aspectx : 1.0f;
+ float aspy= umd->aspecty ? umd->aspecty : 1.0f;
+ int free_uci= 0;
- if(umd->aspecty != 0) aspect = umd->aspectx / umd->aspecty;
- else aspect = 1.0f;
+ aspect = aspx / aspy;
for(i = 0; i < umd->num_projectors; ++i)
if(umd->projectors[i])
@@ -3704,20 +3709,6 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
/* make sure we're using an existing layer */
validate_layer_name(&dm->faceData, CD_MTFACE, umd->uvlayer_name, uvname);
- /* make sure we are not modifying the original UV layer */
- tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
- CD_MTFACE, uvname);
-
- numVerts = dm->getNumVerts(dm);
-
- coords = MEM_callocN(sizeof(*coords) * numVerts,
- "uvprojectModifier_do coords");
- dm->getVertCos(dm, coords);
-
- /* convert coords to world space */
- for(i = 0, co = coords; i < numVerts; ++i, ++co)
- mul_m4_v3(ob->obmat, *co);
-
/* calculate a projection matrix and normal for each projector */
for(i = 0; i < num_projectors; ++i) {
float tmpmat[4][4];
@@ -3728,7 +3719,13 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
if(projectors[i].ob->type == OB_CAMERA) {
cam = (Camera *)projectors[i].ob->data;
- if(cam->type == CAM_PERSP) {
+ projectors[i].uci= NULL;
+
+ if(cam->flag & CAM_PANORAMA) {
+ projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy);
+ free_uci= 1;
+ }
+ else if(cam->type == CAM_PERSP) {
float perspmat[4][4];
float xmax;
float xmin;
@@ -3777,15 +3774,15 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
offsetmat[3][0] = offsetmat[3][1] = offsetmat[3][2] = 0.5;
if (cam) {
- if (umd->aspectx == umd->aspecty) {
+ if (aspx == aspy) {
offsetmat[3][0] -= cam->shiftx;
offsetmat[3][1] -= cam->shifty;
- } else if (umd->aspectx < umd->aspecty) {
- offsetmat[3][0] -=(cam->shiftx * umd->aspecty/umd->aspectx);
+ } else if (aspx < aspy) {
+ offsetmat[3][0] -=(cam->shiftx * aspy/aspx);
offsetmat[3][1] -= cam->shifty;
} else {
offsetmat[3][0] -= cam->shiftx;
- offsetmat[3][1] -=(cam->shifty * umd->aspectx/umd->aspecty);
+ offsetmat[3][1] -=(cam->shifty * aspx/aspy);
}
}
@@ -3798,8 +3795,23 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
}
+ /* make sure we are not modifying the original UV layer */
+ tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
+ CD_MTFACE, uvname);
+
+
+ numVerts = dm->getNumVerts(dm);
+
+ coords = MEM_callocN(sizeof(*coords) * numVerts,
+ "uvprojectModifier_do coords");
+ dm->getVertCos(dm, coords);
+
+ /* convert coords to world space */
+ for(i = 0, co = coords; i < numVerts; ++i, ++co)
+ mul_m4_v3(ob->obmat, *co);
+
/* if only one projector, project coords to UVs */
- if(num_projectors == 1)
+ if(num_projectors == 1 && projectors[0].uci==NULL)
for(i = 0, co = coords; i < numVerts; ++i, ++co)
mul_project_m4_v4(projectors[0].projmat, *co);
@@ -3809,17 +3821,26 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
/* apply coords as UVs, and apply image if tfaces are new */
for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tface) {
if(override_image || !image || tface->tpage == image) {
- if(num_projectors == 1) {
- /* apply transformed coords as UVs */
- tface->uv[0][0] = coords[mf->v1][0];
- tface->uv[0][1] = coords[mf->v1][1];
- tface->uv[1][0] = coords[mf->v2][0];
- tface->uv[1][1] = coords[mf->v2][1];
- tface->uv[2][0] = coords[mf->v3][0];
- tface->uv[2][1] = coords[mf->v3][1];
- if(mf->v4) {
- tface->uv[3][0] = coords[mf->v4][0];
- tface->uv[3][1] = coords[mf->v4][1];
+ if(num_projectors == 1) {
+ if(projectors[0].uci) {
+ project_from_camera(tface->uv[0], coords[mf->v1], projectors[0].uci);
+ project_from_camera(tface->uv[1], coords[mf->v2], projectors[0].uci);
+ project_from_camera(tface->uv[2], coords[mf->v3], projectors[0].uci);
+ if(mf->v3)
+ project_from_camera(tface->uv[3], coords[mf->v4], projectors[0].uci);
+ }
+ else {
+ /* apply transformed coords as UVs */
+ tface->uv[0][0] = coords[mf->v1][0];
+ tface->uv[0][1] = coords[mf->v1][1];
+ tface->uv[1][0] = coords[mf->v2][0];
+ tface->uv[1][1] = coords[mf->v2][1];
+ tface->uv[2][0] = coords[mf->v3][0];
+ tface->uv[2][1] = coords[mf->v3][1];
+ if(mf->v4) {
+ tface->uv[3][0] = coords[mf->v4][0];
+ tface->uv[3][1] = coords[mf->v4][1];
+ }
}
} else {
/* multiple projectors, select the closest to face normal
@@ -3857,23 +3878,32 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
best_projector = &projectors[j];
}
}
-
- mul_project_m4_v4(best_projector->projmat, co1);
- mul_project_m4_v4(best_projector->projmat, co2);
- mul_project_m4_v4(best_projector->projmat, co3);
- if(mf->v4)
- mul_project_m4_v4(best_projector->projmat, co4);
-
- /* apply transformed coords as UVs */
- tface->uv[0][0] = co1[0];
- tface->uv[0][1] = co1[1];
- tface->uv[1][0] = co2[0];
- tface->uv[1][1] = co2[1];
- tface->uv[2][0] = co3[0];
- tface->uv[2][1] = co3[1];
- if(mf->v4) {
- tface->uv[3][0] = co4[0];
- tface->uv[3][1] = co4[1];
+
+ if(best_projector->uci) {
+ project_from_camera(tface->uv[0], coords[mf->v1], best_projector->uci);
+ project_from_camera(tface->uv[1], coords[mf->v2], best_projector->uci);
+ project_from_camera(tface->uv[2], coords[mf->v3], best_projector->uci);
+ if(mf->v3)
+ project_from_camera(tface->uv[3], coords[mf->v4], best_projector->uci);
+ }
+ else {
+ mul_project_m4_v4(best_projector->projmat, co1);
+ mul_project_m4_v4(best_projector->projmat, co2);
+ mul_project_m4_v4(best_projector->projmat, co3);
+ if(mf->v4)
+ mul_project_m4_v4(best_projector->projmat, co4);
+
+ /* apply transformed coords as UVs */
+ tface->uv[0][0] = co1[0];
+ tface->uv[0][1] = co1[1];
+ tface->uv[1][0] = co2[0];
+ tface->uv[1][1] = co2[1];
+ tface->uv[2][0] = co3[0];
+ tface->uv[2][1] = co3[1];
+ if(mf->v4) {
+ tface->uv[3][0] = co4[0];
+ tface->uv[3][1] = co4[1];
+ }
}
}
}
@@ -3885,7 +3915,15 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
}
MEM_freeN(coords);
-
+
+ if(free_uci) {
+ int j;
+ for(j = 0; j < num_projectors; ++j) {
+ if(projectors[j].uci) {
+ MEM_freeN(projectors[j].uci);
+ }
+ }
+ }
return dm;
}
@@ -4092,7 +4130,7 @@ static CustomDataMask smoothModifier_requiredDataMask(Object *ob, ModifierData *
}
static void smoothModifier_do(
- SmoothModifierData *smd, Object *ob, DerivedMesh *dm,
+ SmoothModifierData *smd, Object *ob, DerivedMesh *dm,
float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
@@ -4220,7 +4258,7 @@ static void smoothModifier_do(
}
static void smoothModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);
@@ -4234,7 +4272,7 @@ static void smoothModifier_deformVerts(
static void smoothModifier_deformVertsEM(
ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm= get_dm(md->scene, ob, editData, derivedData, NULL, 0);
@@ -4302,7 +4340,7 @@ static CustomDataMask castModifier_requiredDataMask(Object *ob, ModifierData *md
static void castModifier_foreachObjectLink(
ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
- void *userData)
+ void *userData)
{
CastModifierData *cmd = (CastModifierData*) md;
@@ -4311,7 +4349,7 @@ static void castModifier_foreachObjectLink(
static void castModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
- DagNode *obNode)
+ DagNode *obNode)
{
CastModifierData *cmd = (CastModifierData*) md;
@@ -4325,7 +4363,7 @@ static void castModifier_updateDepgraph(
static void castModifier_sphere_do(
CastModifierData *cmd, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
@@ -4502,7 +4540,7 @@ static void castModifier_sphere_do(
static void castModifier_cuboid_do(
CastModifierData *cmd, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
Object *ctrl_ob = NULL;
@@ -4772,17 +4810,13 @@ static void castModifier_cuboid_do(
}
static void castModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
DerivedMesh *dm = NULL;
CastModifierData *cmd = (CastModifierData *)md;
- if (ob->type == OB_MESH) {
- /* DerivedMesh is used only in case object is MESH */
- /* so we could optimize modifier applying by skipping DM creation */
- dm = get_dm(md->scene, ob, NULL, derivedData, NULL, 0);
- }
+ dm = get_dm(md->scene, ob, NULL, derivedData, NULL, 0);
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
castModifier_cuboid_do(cmd, ob, dm, vertexCos, numVerts);
@@ -4795,7 +4829,7 @@ static void castModifier_deformVerts(
}
static void castModifier_deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = get_dm(md->scene, ob, editData, derivedData, NULL, 0);
@@ -4873,7 +4907,7 @@ static void waveModifier_foreachObjectLink(
}
static void waveModifier_foreachIDLink(ModifierData *md, Object *ob,
- IDWalkFunc walk, void *userData)
+ IDWalkFunc walk, void *userData)
{
WaveModifierData *wmd = (WaveModifierData*) md;
@@ -4884,7 +4918,7 @@ static void waveModifier_foreachIDLink(ModifierData *md, Object *ob,
static void waveModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
- DagNode *obNode)
+ DagNode *obNode)
{
WaveModifierData *wmd = (WaveModifierData*) md;
@@ -4921,7 +4955,7 @@ static CustomDataMask waveModifier_requiredDataMask(Object *ob, ModifierData *md
}
static void wavemod_get_texture_coords(WaveModifierData *wmd, Object *ob,
- DerivedMesh *dm,
+ DerivedMesh *dm,
float (*co)[3], float (*texco)[3],
int numVerts)
{
@@ -5009,7 +5043,7 @@ static void wavemod_get_texture_coords(WaveModifierData *wmd, Object *ob,
static void waveModifier_do(WaveModifierData *md,
Scene *scene, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ float (*vertexCos)[3], int numVerts)
{
WaveModifierData *wmd = (WaveModifierData*) md;
MVert *mvert = NULL;
@@ -5057,7 +5091,7 @@ static void waveModifier_do(WaveModifierData *md,
if(wmd->texture) {
tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts,
- "waveModifier_do tex_co");
+ "waveModifier_do tex_co");
wavemod_get_texture_coords(wmd, ob, dm, vertexCos, tex_co, numVerts);
}
@@ -5165,7 +5199,7 @@ static void waveModifier_do(WaveModifierData *md,
}
static void waveModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
DerivedMesh *dm= derivedData;
@@ -5183,7 +5217,7 @@ static void waveModifier_deformVerts(
}
static void waveModifier_deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm= derivedData;
@@ -5237,8 +5271,8 @@ static int armatureModifier_isDisabled(ModifierData *md, int useRenderParams)
}
static void armatureModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
- void (*walk)(void *userData, Object *ob, Object **obpoin),
+ ModifierData *md, Object *ob,
+ void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
@@ -5247,7 +5281,7 @@ static void armatureModifier_foreachObjectLink(
}
static void armatureModifier_updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
+ ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
DagNode *obNode)
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
@@ -5262,14 +5296,14 @@ static void armatureModifier_updateDepgraph(
static void armatureModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
armature_deform_verts(amd->object, ob, derivedData, vertexCos, NULL,
- numVerts, amd->deformflag,
+ numVerts, amd->deformflag,
(float(*)[3])amd->prevCos, amd->defgrp_name);
/* free cache */
if(amd->prevCos) {
@@ -5288,15 +5322,15 @@ static void armatureModifier_deformVertsEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
armature_deform_verts(amd->object, ob, dm, vertexCos, NULL, numVerts,
- amd->deformflag, NULL, amd->defgrp_name);
+ amd->deformflag, NULL, amd->defgrp_name);
if(!derivedData) dm->release(dm);
}
static void armatureModifier_deformMatricesEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3],
- float (*defMats)[3][3], int numVerts)
+ float (*defMats)[3][3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
DerivedMesh *dm = derivedData;
@@ -5304,7 +5338,7 @@ static void armatureModifier_deformMatricesEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
- amd->deformflag, NULL, amd->defgrp_name);
+ amd->deformflag, NULL, amd->defgrp_name);
if(!derivedData) dm->release(dm);
}
@@ -5362,7 +5396,7 @@ static int hookModifier_isDisabled(ModifierData *md, int useRenderParams)
static void hookModifier_foreachObjectLink(
ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
- void *userData)
+ void *userData)
{
HookModifierData *hmd = (HookModifierData*) md;
@@ -5385,7 +5419,7 @@ static void hookModifier_updateDepgraph(ModifierData *md, DagForest *forest, Sce
}
static void hookModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
HookModifierData *hmd = (HookModifierData*) md;
@@ -5405,7 +5439,7 @@ static void hookModifier_deformVerts(
}
invert_m4_m4(ob->imat, ob->obmat);
mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL);
/* vertex indices? */
if(hmd->indexar) {
@@ -5507,7 +5541,7 @@ static void hookModifier_deformVerts(
}
static void hookModifier_deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
@@ -5523,7 +5557,7 @@ static void hookModifier_deformVertsEM(
static void softbodyModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
sbObjectStep(md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts);
}
@@ -5984,13 +6018,826 @@ static DerivedMesh *solidifyModifier_applyModifier(ModifierData *md,
}
static DerivedMesh *solidifyModifier_applyModifierEM(ModifierData *md,
- Object *ob,
- EditMesh *editData,
- DerivedMesh *derivedData)
+ Object *ob,
+ EditMesh *editData,
+ DerivedMesh *derivedData)
{
return solidifyModifier_applyModifier(md, ob, derivedData, 0, 1);
}
+/* Screw */
+
+/* Screw modifier: revolves the edges about an axis
+*/
+
+/* used for gathering edge connectivity */
+typedef struct ScrewVertConnect {
+ float dist; /* distance from the center axis */
+ float co[3]; /* loaction relative to the transformed axis */
+ float no[3]; /* calc normal of the vertex */
+ int v[2]; /* 2 verts on either side of this one */
+ MEdge *e[2]; /* edges on either side, a bit of a waste since each edge ref's 2 edges */
+ char flag;
+} ScrewVertConnect;
+
+typedef struct ScrewVertIter {
+ ScrewVertConnect * v_array;
+ ScrewVertConnect * v_poin;
+ int v;
+ int v_other;
+ MEdge *e;
+} ScrewVertIter;
+
+#define ScrewVertIter_INIT(iter, array, v_init, dir)\
+ iter.v_array = array;\
+ iter.v = v_init;\
+ if (v_init>=0) {\
+ iter.v_poin = &array[v_init];\
+ iter.v_other = iter.v_poin->v[dir];\
+ if (dir)\
+ iter.e = iter.v_poin->e[0];\
+ else\
+ iter.e = iter.v_poin->e[1];\
+ } else {\
+ iter.v_poin= NULL;\
+ iter.e= NULL;\
+ }
+
+
+#define ScrewVertIter_NEXT(iter)\
+ if (iter.v_poin->v[0] == iter.v_other) {\
+ iter.v_other= iter.v;\
+ iter.v= iter.v_poin->v[1];\
+ } else if (iter.v_poin->v[1] == iter.v_other) {\
+ iter.v_other= iter.v;\
+ iter.v= iter.v_poin->v[0];\
+ }\
+ if (iter.v >=0) {\
+ iter.v_poin= &iter.v_array[iter.v];\
+ if ( iter.v_poin->e[0] != iter.e ) iter.e= iter.v_poin->e[0];\
+ else iter.e= iter.v_poin->e[1];\
+ } else {\
+ iter.e= NULL;\
+ iter.v_poin= NULL;\
+ }
+
+static void screwModifier_initData(ModifierData *md)
+{
+ ScrewModifierData *ltmd= (ScrewModifierData*) md;
+ ltmd->ob_axis= NULL;
+ ltmd->angle= M_PI * 2.0;
+ ltmd->axis= 2;
+ ltmd->flag= 0;
+ ltmd->steps= 16;
+ ltmd->render_steps= 16;
+ ltmd->iter= 1;
+}
+
+static void screwModifier_copyData(ModifierData *md, ModifierData *target)
+{
+ ScrewModifierData *sltmd= (ScrewModifierData*) md;
+ ScrewModifierData *tltmd= (ScrewModifierData*) target;
+
+ tltmd->ob_axis= sltmd->ob_axis;
+ tltmd->angle= sltmd->angle;
+ tltmd->axis= sltmd->axis;
+ tltmd->flag= sltmd->flag;
+ tltmd->steps= sltmd->steps;
+ tltmd->render_steps= sltmd->render_steps;
+ tltmd->screw_ofs= sltmd->screw_ofs;
+ tltmd->iter= sltmd->iter;
+}
+
+static DerivedMesh *screwModifier_applyModifier(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int useRenderParams, int isFinalCalc)
+{
+ DerivedMesh *dm= derivedData;
+ DerivedMesh *result;
+ ScrewModifierData *ltmd= (ScrewModifierData*) md;
+
+ int *origindex;
+ int mface_index=0;
+ int i, j;
+ int i1,i2;
+ int steps= ltmd->steps;
+ int maxVerts=0, maxEdges=0, maxFaces=0;
+ int totvert= dm->getNumVerts(dm);
+ int totedge= dm->getNumEdges(dm);
+
+ char axis_char, close;
+ float angle= ltmd->angle;
+ float screw_ofs= ltmd->screw_ofs;
+ float axis_vec[3]= {0.0f, 0.0f, 0.0f};
+ float tmp_vec1[3], tmp_vec2[3];
+ float mat3[3][3];
+ float mtx_tx[4][4]; /* transform the coords by an object relative to this objects transformation */
+ float mtx_tx_inv[4][4]; /* inverted */
+ float mtx_tmp_a[4][4];
+
+ int vc_tot_linked= 0;
+ short other_axis_1, other_axis_2;
+ float *tmpf1, *tmpf2;
+
+ MFace *mface_new, *mf_new;
+ MEdge *medge_orig, *med_orig, *med_new, *med_new_firstloop, *medge_new;
+ MVert *mvert_new, *mvert_orig, *mv_orig, *mv_new, *mv_new_base;
+
+ ScrewVertConnect *vc, *vc_tmp, *vert_connect= NULL;
+
+ float mat[4][4] = {{0.0f, 0.0f, 0.0f, 0.0f},
+ {0.0f, 0.0f, 0.0f, 0.0f},
+ {0.0f, 0.0f, 0.0f, 0.0f},
+ {0.0f, 0.0f, 0.0f, 1.0f}};
+
+ /* dont do anything? */
+ if (!totvert)
+ return CDDM_from_template(dm, 0, 0, 0);
+
+ steps= useRenderParams ? ltmd->render_steps : ltmd->steps;
+
+ switch(ltmd->axis) {
+ case 0:
+ other_axis_1=1;
+ other_axis_2=2;
+ break;
+ case 1:
+ other_axis_1=0;
+ other_axis_2=2;
+ break;
+ case 2:
+ other_axis_1=0;
+ other_axis_2=1;
+ break;
+ }
+
+ axis_vec[ltmd->axis]= 1.0f;
+
+ if (ltmd->ob_axis) {
+ float mtx3_tx[3][3];
+ /* calc the matrix relative to the axis object */
+ invert_m4_m4(mtx_tmp_a, ob->obmat);
+ copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat);
+ mul_m4_m4m4(mtx_tx, mtx_tx_inv, mtx_tmp_a);
+
+ copy_m3_m4(mtx3_tx, mtx_tx);
+
+ /* calc the axis vec */
+ mul_m3_v3(mtx3_tx, axis_vec);
+ normalize_v3(axis_vec);
+
+ /* screw */
+ if(ltmd->flag & MOD_SCREW_OBJECT_OFFSET) {
+ /* find the offset along this axis relative to this objects matrix */
+ float totlen = len_v3(mtx_tx[3]);
+
+ if(totlen != 0.0f) {
+ float zero[3]={0.0f, 0.0f, 0.0f};
+ float cp[3];
+ screw_ofs= closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
+ }
+ else {
+ screw_ofs= 0.0f;
+ }
+ }
+
+ /* angle */
+
+#if 0 // cant incluide this, not pradictable enough, though quite fun,.
+ if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
+
+
+ float vec[3] = {0,1,0};
+ float cross1[3];
+ float cross2[3];
+ cross_v3_v3v3(cross1, vec, axis_vec);
+
+ mul_v3_m3v3(cross2, mtx3_tx, cross1);
+ {
+ float c1[3];
+ float c2[3];
+ float axis_tmp[3];
+
+ cross_v3_v3v3(c1, cross2, axis_vec);
+ cross_v3_v3v3(c2, axis_vec, c1);
+
+
+ angle= angle_v3v3(cross1, c2);
+
+ cross_v3_v3v3(axis_tmp, cross1, c2);
+ normalize_v3(axis_tmp);
+
+ if(len_v3v3(axis_tmp, axis_vec) > 1.0f)
+ angle= -angle;
+
+ }
+ }
+#endif
+ }
+ else {
+ /* exis char is used by i_rotate*/
+ axis_char= 'X' + ltmd->axis;
+
+ /* useful to be able to use the axis vec in some cases still */
+ zero_v3(axis_vec);
+ axis_vec[ltmd->axis]= 1.0f;
+ }
+
+ /* apply the multiplier */
+ angle *= ltmd->iter;
+ screw_ofs *= ltmd->iter;
+
+ /* multiplying the steps is a bit tricky, this works best */
+ steps = ((steps + 1) * ltmd->iter) - (ltmd->iter - 1);
+
+ /* will the screw be closed?
+ * Note! smaller then FLT_EPSILON*100 gives problems with float precission so its never closed. */
+ if (fabs(screw_ofs) <= (FLT_EPSILON*100) && fabs(fabs(angle) - (M_PI * 2)) <= (FLT_EPSILON*100)) {
+ close= 1;
+ steps--;
+ if(steps < 2) steps= 2;
+
+ maxVerts = totvert * steps; /* -1 because we're joining back up */
+ maxEdges = (totvert * steps) + /* these are the edges between new verts */
+ (totedge * steps); /* -1 because vert edges join */
+ maxFaces = totedge * steps;
+
+ screw_ofs= 0.0f;
+ }
+ else {
+ close= 0;
+ if(steps < 2) steps= 2;
+
+ maxVerts = totvert * steps; /* -1 because we're joining back up */
+ maxEdges = (totvert * (steps-1)) + /* these are the edges between new verts */
+ (totedge * steps); /* -1 because vert edges join */
+ maxFaces = totedge * (steps-1);
+ }
+
+ result= CDDM_from_template(dm, maxVerts, maxEdges, maxFaces);
+
+ /* copy verts from mesh */
+ mvert_orig = dm->getVertArray(dm);
+ medge_orig = dm->getEdgeArray(dm);
+
+ mvert_new = result->getVertArray(result);
+ mface_new = result->getFaceArray(result);
+ medge_new = result->getEdgeArray(result);
+
+ origindex= result->getFaceDataArray(result, CD_ORIGINDEX);
+
+ /* Set the locations of the first set of verts */
+
+ mv_new= mvert_new;
+ mv_orig= mvert_orig;
+
+ /* Copy the first set of edges */
+ med_orig= medge_orig;
+ med_new= medge_new;
+ for (i=0; i < totedge; i++, med_orig++, med_new++) {
+ med_new->v1= med_orig->v1;
+ med_new->v2= med_orig->v2;
+ med_new->crease= med_orig->crease;
+ med_new->flag= med_orig->flag & ~ME_LOOSEEDGE;
+ }
+
+ if(ltmd->flag & MOD_SCREW_NORMAL_CALC) {
+ /*
+ * Normal Calculation (for face flipping)
+ * Sort edge verts for correct face flipping
+ * NOT REALLY NEEDED but face flipping is nice.
+ *
+ * */
+
+
+ /* Notice!
+ *
+ * Since we are only ordering the edges here it can avoid mallocing the
+ * extra space by abusing the vert array berfore its filled with new verts.
+ * The new array for vert_connect must be at least sizeof(ScrewVertConnect) * totvert
+ * and the size of our resulting meshes array is sizeof(MVert) * totvert * 3
+ * so its safe to use the second 2 thrids of MVert the array for vert_connect,
+ * just make sure ScrewVertConnect struct is no more then twice as big as MVert,
+ * at the moment there is no chance of that being a problem,
+ * unless MVert becomes half its current size.
+ *
+ * once the edges are ordered, vert_connect is not needed and it can be used for verts
+ *
+ * This makes the modifier faster with one less alloc.
+ */
+
+ vert_connect= MEM_mallocN(sizeof(ScrewVertConnect) * totvert, "ScrewVertConnect");
+ //vert_connect= (ScrewVertConnect *) &medge_new[totvert]; /* skip the first slice of verts */
+ vc= vert_connect;
+
+ /* Copy Vert Locations */
+ /* - We can do this in a later loop - only do here if no normal calc */
+ if (!totedge) {
+ for (i=0; i < totvert; i++, mv_orig++, mv_new++) {
+ copy_v3_v3(mv_new->co, mv_orig->co);
+ normalize_v3_v3(vc->no, mv_new->co); /* no edges- this is realy a dummy normal */
+ }
+ }
+ else {
+ /*printf("\n\n\n\n\nStarting Modifier\n");*/
+ /* set edge users */
+ med_new= medge_new;
+ mv_new= mvert_new;
+
+ if (ltmd->ob_axis) {
+ /*mtx_tx is initialized early on */
+ for (i=0; i < totvert; i++, mv_new++, mv_orig++, vc++) {
+ vc->co[0]= mv_new->co[0]= mv_orig->co[0];
+ vc->co[1]= mv_new->co[1]= mv_orig->co[1];
+ vc->co[2]= mv_new->co[2]= mv_orig->co[2];
+
+ vc->flag= 0;
+ vc->e[0]= vc->e[1]= NULL;
+ vc->v[0]= vc->v[1]= -1;
+
+ mul_m4_v3(mtx_tx, vc->co);
+ /* length in 2d, dont sqrt because this is only for comparison */
+ vc->dist = vc->co[other_axis_1]*vc->co[other_axis_1] +
+ vc->co[other_axis_2]*vc->co[other_axis_2];
+
+ /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/
+ }
+ }
+ else {
+ for (i=0; i < totvert; i++, mv_new++, mv_orig++, vc++) {
+ vc->co[0]= mv_new->co[0]= mv_orig->co[0];
+ vc->co[1]= mv_new->co[1]= mv_orig->co[1];
+ vc->co[2]= mv_new->co[2]= mv_orig->co[2];
+
+ vc->flag= 0;
+ vc->e[0]= vc->e[1]= NULL;
+ vc->v[0]= vc->v[1]= -1;
+
+ /* length in 2d, dont sqrt because this is only for comparison */
+ vc->dist = vc->co[other_axis_1]*vc->co[other_axis_1] +
+ vc->co[other_axis_2]*vc->co[other_axis_2];
+
+ /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/
+ }
+ }
+
+ /* this loop builds connectivity info for verts */
+ for (i=0; i<totedge; i++, med_new++) {
+ vc= &vert_connect[med_new->v1];
+
+ if (vc->v[0]==-1) { /* unused */
+ vc->v[0]= med_new->v2;
+ vc->e[0]= med_new;
+ }
+ else if (vc->v[1]==-1) {
+ vc->v[1]= med_new->v2;
+ vc->e[1]= med_new;
+ }
+ else {
+ vc->v[0]= vc->v[1]= -2; /* erro value - dont use, 3 edges on vert */
+ }
+
+ vc= &vert_connect[med_new->v2];
+
+ /* same as above but swap v1/2 */
+ if (vc->v[0]==-1) { /* unused */
+ vc->v[0]= med_new->v1;
+ vc->e[0]= med_new;
+ }
+ else if (vc->v[1]==-1) {
+ vc->v[1]= med_new->v1;
+ vc->e[1]= med_new;
+ }
+ else {
+ vc->v[0]= vc->v[1]= -2; /* erro value - dont use, 3 edges on vert */
+ }
+ }
+
+ /* find the first vert */
+ vc= vert_connect;
+ for (i=0; i < totvert; i++, vc++) {
+ int VBEST=-1, ed_loop_closed=0; /* vert and vert new */
+ int ed_loop_flip;
+ float fl= -1.0f;
+ ScrewVertIter lt_iter;
+
+ /* Now do search for connected verts, order all edges and flip them
+ * so resulting faces are flipped the right way */
+ vc_tot_linked= 0; /* count the number of linked verts for this loop */
+ if (vc->flag==0) {
+ /*printf("Loop on connected vert: %i\n", i);*/
+
+ for(j=0; j<2; j++) {
+ /*printf("\tSide: %i\n", j);*/
+ ScrewVertIter_INIT(lt_iter, vert_connect, i, j);
+ if (j==1) {
+ ScrewVertIter_NEXT(lt_iter);
+ }
+ while (lt_iter.v_poin) {
+ /*printf("\t\tVERT: %i\n", lt_iter.v);*/
+ if (lt_iter.v_poin->flag) {
+ /*printf("\t\t\tBreaking Found end\n");*/
+ //endpoints[0]= endpoints[1]= -1;
+ ed_loop_closed= 1; /* circle */
+ break;
+ }
+ lt_iter.v_poin->flag= 1;
+ vc_tot_linked++;
+ /*printf("Testing 2 floats %f : %f\n", fl, lt_iter.v_poin->dist);*/
+ if (fl <= lt_iter.v_poin->dist) {
+ fl= lt_iter.v_poin->dist;
+ VBEST= lt_iter.v;
+ /*printf("\t\t\tVERT BEST: %i\n", VBEST);*/
+ }
+ ScrewVertIter_NEXT(lt_iter);
+ if (!lt_iter.v_poin) {
+ /*printf("\t\t\tFound End Also Num %i\n", j);*/
+ /*endpoints[j]= lt_iter.v_other;*/ /* other is still valid */
+ break;
+ }
+ }
+ }
+
+ /* now we have a collection of used edges. flip their edges the right way*/
+ /*if (VBEST !=-1) - */
+
+ /*printf("Done Looking - vc_tot_linked: %i\n", vc_tot_linked);*/
+
+ if (vc_tot_linked>1) {
+ float vf_1, vf_2, vf_best;
+
+ vc_tmp= &vert_connect[VBEST];
+
+ tmpf1= vert_connect[vc_tmp->v[0]].co;
+ tmpf2= vert_connect[vc_tmp->v[1]].co;
+
+
+ /* edge connects on each side! */
+ if ((vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1)) {
+ /*printf("Verts on each side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]);*/
+ /* find out which is higher */
+
+ vf_1= tmpf1[ltmd->axis];
+ vf_2= tmpf2[ltmd->axis];
+ vf_best= vc_tmp->co[ltmd->axis];
+
+ if (vf_1 < vf_best && vf_best < vf_2) {
+ ed_loop_flip= 0;
+ }
+ else if (vf_1 > vf_best && vf_best > vf_2) {
+ ed_loop_flip= 1;
+ }
+ else {
+ /* not so simple to work out wich edge is higher */
+ sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co);
+ sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co);
+ normalize_v3(tmp_vec1);
+ normalize_v3(tmp_vec2);
+
+ if (tmp_vec1[ltmd->axis] < tmp_vec2[ltmd->axis]) {
+ ed_loop_flip= 1;
+ }
+ else {
+ ed_loop_flip= 0;
+ }
+ }
+ }
+ else if (vc_tmp->v[0] >= 0) { /*vertex only connected on 1 side */
+ /*printf("Verts on ONE side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]);*/
+ if (tmpf1[ltmd->axis] < vc_tmp->co[ltmd->axis]) { /* best is above */
+ ed_loop_flip= 1;
+ }
+ else { /* best is below or even... in even case we cant know whet to do. */
+ ed_loop_flip= 0;
+ }
+
+ }/* else {
+ printf("No Connected ___\n");
+ }*/
+
+ /*printf("flip direction %i\n", ed_loop_flip);*/
+
+
+ /* switch the flip option if set */
+ if (ltmd->flag & MOD_SCREW_NORMAL_FLIP)
+ ed_loop_flip= !ed_loop_flip;
+
+ if (angle < 0.0f)
+ ed_loop_flip= !ed_loop_flip;
+
+ /* if its closed, we only need 1 loop */
+ for(j=ed_loop_closed; j<2; j++) {
+ /*printf("Ordering Side J %i\n", j);*/
+
+ ScrewVertIter_INIT(lt_iter, vert_connect, VBEST, j);
+ /*printf("\n\nStarting - Loop\n");*/
+ lt_iter.v_poin->flag= 1; /* so a non loop will traverse the other side */
+
+
+ /* If this is the vert off the best vert and
+ * the best vert has 2 edges connected too it
+ * then swap the flip direction */
+ if (j==1 && (vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1))
+ ed_loop_flip= !ed_loop_flip;
+
+ while (lt_iter.v_poin && lt_iter.v_poin->flag != 2) {
+ /*printf("\tOrdering Vert V %i\n", lt_iter.v);*/
+
+ lt_iter.v_poin->flag= 2;
+ if (lt_iter.e) {
+ if (lt_iter.v == lt_iter.e->v1) {
+ if (ed_loop_flip==0) {
+ /*printf("\t\t\tFlipping 0\n");*/
+ SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+ }/* else {
+ printf("\t\t\tFlipping Not 0\n");
+ }*/
+ }
+ else if (lt_iter.v == lt_iter.e->v2) {
+ if (ed_loop_flip==1) {
+ /*printf("\t\t\tFlipping 1\n");*/
+ SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+ }/* else {
+ printf("\t\t\tFlipping Not 1\n");
+ }*/
+ }/* else {
+ printf("\t\tIncorrect edge topology");
+ }*/
+ }/* else {
+ printf("\t\tNo Edge at this point\n");
+ }*/
+ ScrewVertIter_NEXT(lt_iter);
+ }
+ }
+ }
+ }
+
+ /* *VERTEX NORMALS*
+ * we know the surrounding edges are ordered correctly now
+ * so its safe to create vertex normals.
+ *
+ * calculate vertex normals that can be propodated on lathing
+ * use edge connectivity work this out */
+ if (vc->v[0]>=0) {
+ if (vc->v[1]>=0) {
+ /* 2 edges connedted */
+ /* make 2 connecting vert locations relative to the middle vert */
+ sub_v3_v3v3(tmp_vec1, mvert_new[vc->v[0]].co, mvert_new[i].co);
+ sub_v3_v3v3(tmp_vec2, mvert_new[vc->v[1]].co, mvert_new[i].co);
+ /* normalize so both edges have the same influence, no matter their length */
+ normalize_v3(tmp_vec1);
+ normalize_v3(tmp_vec2);
+
+ /* vc_no_tmp1 - this line is the average direction of both connecting edges
+ *
+ * Use the edge order to make the subtraction, flip the normal the right way
+ * edge should be there but check just in case... */
+ if (vc->e && vc->e[0]->v1 == i) {
+ sub_v3_v3v3(tmp_vec1, tmp_vec1, tmp_vec2);
+ }
+ else {
+ sub_v3_v3v3(tmp_vec1, tmp_vec2, tmp_vec1);
+ }
+ }
+ else {
+ /* only 1 edge connected - same as above except
+ * dont need to average edge direction */
+ if (vc->e && vc->e[0]->v2 == i) {
+ sub_v3_v3v3(tmp_vec1, mvert_new[i].co, mvert_new[vc->v[0]].co);
+ }
+ else {
+ sub_v3_v3v3(tmp_vec1, mvert_new[vc->v[0]].co, mvert_new[i].co);
+ }
+ }
+
+ /* vc_no_tmp2 - is a line 90d from the pivot to the vec
+ * This is used so the resulting normal points directly away from the middle */
+ cross_v3_v3v3(tmp_vec2, axis_vec, vc->co);
+
+ /* edge average vector and right angle to the pivot make the normal */
+ cross_v3_v3v3(vc->no, tmp_vec1, tmp_vec2);
+
+ }
+ else {
+ copy_v3_v3(vc->no, vc->co);
+ }
+
+ /* we wont be looping on this data again so copy normals here */
+ if (angle < 0.0f)
+ negate_v3(vc->no);
+
+ normalize_v3(vc->no);
+ normal_float_to_short_v3(mvert_new[i].no, vc->no);
+
+ /* Done with normals */
+ }
+ }
+ }
+ else {
+
+ if (ltmd->flag & MOD_SCREW_NORMAL_FLIP) {
+ mv_orig= mvert_orig;
+ mv_new= mvert_new + (totvert-1);
+
+ for (i=0; i < totvert; i++, mv_new--, mv_orig++) {
+ copy_v3_v3(mv_new->co, mv_orig->co);
+ }
+ }
+ else {
+ mv_orig= mvert_orig;
+ mv_new= mvert_new;
+
+ for (i=0; i < totvert; i++, mv_new++, mv_orig++) {
+ copy_v3_v3(mv_new->co, mv_orig->co);
+ }
+ }
+ }
+ /* done with edge connectivity based normal flipping */
+
+
+ /* Add Faces */
+ for (i=1; i < steps; i++) {
+ float step_angle;
+ float no_tx[3];
+ /* Rotation Matrix */
+ if (close) step_angle= (angle / steps) * i;
+ else step_angle= (angle / (steps-1)) * i;
+
+ if (ltmd->ob_axis) {
+ axis_angle_to_mat3(mat3, axis_vec, step_angle);
+ copy_m4_m3(mat, mat3);
+ }
+ else {
+ unit_m4(mat);
+ rotate_m4(mat, axis_char, step_angle);
+ copy_m3_m4(mat3, mat);
+ }
+
+ if(screw_ofs)
+ madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)i / (float)(steps-1)));
+
+ mv_new_base= mvert_new;
+ mv_new= &mvert_new[totvert*i]; /* advance to the next slice */
+
+ for (j=0; j<totvert; j++, mv_new_base++, mv_new++) {
+ /* set normal */
+ if(vert_connect) {
+ mul_v3_m3v3(no_tx, mat3, vert_connect[j].no);
+
+ /* set the normal now its transformed */
+ normal_float_to_short_v3(mv_new->no, no_tx);
+ }
+
+ /* set location */
+ copy_v3_v3(mv_new->co, mv_new_base->co);
+
+ /* only need to set these if using non cleared memory */
+ /*mv_new->mat_nr= mv_new->flag= 0;*/
+
+ if (ltmd->ob_axis) {
+ sub_v3_v3(mv_new->co, mtx_tx[3]);
+
+ mul_m4_v3(mat, mv_new->co);
+
+ add_v3_v3(mv_new->co, mtx_tx[3]);
+ }
+ else {
+ mul_m4_v3(mat, mv_new->co);
+ }
+
+ /* add the new edge */
+ med_new->v1= j+(i*totvert);
+ med_new->v2= med_new->v1 - totvert;
+ med_new->flag= ME_EDGEDRAW|ME_EDGERENDER;
+ med_new++;
+ }
+ }
+
+ /* we can avoid if using vert alloc trick */
+ if(vert_connect) {
+ MEM_freeN(vert_connect);
+ vert_connect= NULL;
+ }
+
+ if (close) {
+ /* last loop of edges, previous loop dosnt account for the last set of edges */
+ for (i=0; i<totvert; i++) {
+ med_new->v1= i;
+ med_new->v2= i+((steps-1)*totvert);
+ med_new->flag= ME_EDGEDRAW|ME_EDGERENDER;
+ med_new++;
+ }
+ }
+
+ mf_new= mface_new;
+ med_new_firstloop= medge_new;
+
+ for (i=0; i < totedge; i++, med_new_firstloop++) {
+ /* for each edge, make a cylinder of quads */
+ i1= med_new_firstloop->v1;
+ i2= med_new_firstloop->v2;
+
+ for (j=0; j < steps-1; j++) {
+
+ /* new face */
+ mf_new->v1= i1;
+ mf_new->v2= i2;
+ mf_new->v3= i2 + totvert;
+ mf_new->v4= i1 + totvert;
+
+ if( !mf_new->v3 || !mf_new->v4 ) {
+ SWAP(int, mf_new->v1, mf_new->v3);
+ SWAP(int, mf_new->v2, mf_new->v4);
+ }
+ mf_new->flag= ME_SMOOTH;
+ origindex[mface_index]= ORIGINDEX_NONE;
+ mf_new++;
+ mface_index++;
+
+ /* new vertical edge */
+ if (j) { /* The first set is alredy dome */
+ med_new->v1= i1;
+ med_new->v2= i2;
+ med_new->flag= med_new_firstloop->flag;
+ med_new->crease= med_new_firstloop->crease;
+ med_new++;
+ }
+ i1 += totvert;
+ i2 += totvert;
+ }
+
+ /* close the loop*/
+ if (close) {
+ mf_new->v1= i1;
+ mf_new->v2= i2;
+ mf_new->v3= med_new_firstloop->v2;
+ mf_new->v4= med_new_firstloop->v1;
+
+ if( !mf_new->v3 || !mf_new->v4 ) {
+ SWAP(int, mf_new->v1, mf_new->v3);
+ SWAP(int, mf_new->v2, mf_new->v4);
+ }
+ mf_new->flag= ME_SMOOTH;
+ origindex[mface_index]= ORIGINDEX_NONE;
+ mf_new++;
+ mface_index++;
+ }
+
+ /* new vertical edge */
+ med_new->v1= i1;
+ med_new->v2= i2;
+ med_new->flag= med_new_firstloop->flag & ~ME_LOOSEEDGE;
+ med_new->crease= med_new_firstloop->crease;
+ med_new++;
+ }
+
+ if((ltmd->flag & MOD_SCREW_NORMAL_CALC)==0) {
+ CDDM_calc_normals(result);
+ }
+
+ return result;
+}
+
+
+static void screwModifier_updateDepgraph(
+ ModifierData *md, DagForest *forest,
+ Scene *scene, Object *ob, DagNode *obNode)
+{
+ ScrewModifierData *ltmd= (ScrewModifierData*) md;
+
+ if(ltmd->ob_axis) {
+ DagNode *curNode= dag_get_node(forest, ltmd->ob_axis);
+
+ dag_add_relation(forest, curNode, obNode,
+ DAG_RL_DATA_DATA | DAG_RL_OB_DATA,
+ "Screw Modifier");
+ }
+}
+
+static void screwModifier_foreachObjectLink(
+ ModifierData *md, Object *ob,
+ void (*walk)(void *userData, Object *ob, Object **obpoin),
+ void *userData)
+{
+ ScrewModifierData *ltmd= (ScrewModifierData*) md;
+
+ walk(userData, ob, &ltmd->ob_axis);
+}
+
+/* This dosnt work with material*/
+static DerivedMesh *screwModifier_applyModifierEM(
+ ModifierData *md, Object *ob, EditMesh *editData,
+ DerivedMesh *derivedData)
+{
+ return screwModifier_applyModifier(md, ob, derivedData, 0, 1);
+}
+
+static int screwModifier_dependsOnTime(ModifierData *md)
+{
+ return 0;
+}
+
+
/* Smoke */
static void smokeModifier_initData(ModifierData *md)
@@ -6013,7 +6860,7 @@ static void smokeModifier_freeData(ModifierData *md)
static void smokeModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
SmokeModifierData *smd = (SmokeModifierData*) md;
DerivedMesh *dm = dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos);
@@ -6031,7 +6878,7 @@ static int smokeModifier_dependsOnTime(ModifierData *md)
static void smokeModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
- DagNode *obNode)
+ DagNode *obNode)
{
/*SmokeModifierData *smd = (SmokeModifierData *) md;
if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
@@ -6103,7 +6950,7 @@ static DerivedMesh *clothModifier_applyModifier(ModifierData *md, Object *ob,
static void clothModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
- DagNode *obNode)
+ DagNode *obNode)
{
ClothModifierData *clmd = (ClothModifierData*) md;
@@ -6243,7 +7090,7 @@ static int collisionModifier_dependsOnTime(ModifierData *md)
static void collisionModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
CollisionModifierData *collmd = (CollisionModifierData*) md;
DerivedMesh *dm = NULL;
@@ -6412,7 +7259,7 @@ static int surfaceModifier_dependsOnTime(ModifierData *md)
static void surfaceModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
SurfaceModifierData *surmd = (SurfaceModifierData*) md;
unsigned int numverts = 0, i = 0;
@@ -6506,7 +7353,7 @@ static int booleanModifier_isDisabled(ModifierData *md, int useRenderParams)
}
static void booleanModifier_foreachObjectLink(
- ModifierData *md, Object *ob,
+ ModifierData *md, Object *ob,
void (*walk)(void *userData, Object *ob, Object **obpoin),
void *userData)
{
@@ -6538,7 +7385,7 @@ static DerivedMesh *booleanModifier_applyModifier(
/* we do a quick sanity check */
if(dm && (derivedData->getNumFaces(derivedData) > 3)
- && bmd->object && dm->getNumFaces(dm) > 3) {
+ && bmd->object && dm->getNumFaces(dm) > 3) {
DerivedMesh *result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
1 + bmd->operation);
@@ -6641,8 +7488,8 @@ static CustomDataMask particleSystemModifier_requiredDataMask(Object *ob, Modifi
/* saves the current emitter state for a particle system and calculates particles */
static void particleSystemModifier_deformVerts(
- ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
DerivedMesh *dm = derivedData;
ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md;
@@ -6711,8 +7558,8 @@ static void particleSystemModifier_deformVerts(
* updates is coded */
#if 0
static void particleSystemModifier_deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ ModifierData *md, Object *ob, EditMesh *editData,
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
@@ -7031,7 +7878,7 @@ static CustomDataMask explodeModifier_requiredDataMask(Object *ob, ModifierData
static void explodeModifier_createFacepa(ExplodeModifierData *emd,
ParticleSystemModifierData *psmd,
- Object *ob, DerivedMesh *dm)
+ Object *ob, DerivedMesh *dm)
{
ParticleSystem *psys=psmd->psys;
MFace *fa=0, *mface=0;
@@ -7870,7 +8717,7 @@ static DerivedMesh * fluidsimModifier_applyModifier(
static void fluidsimModifier_updateDepgraph(
ModifierData *md, DagForest *forest, Scene *scene,
- Object *ob, DagNode *obNode)
+ Object *ob, DagNode *obNode)
{
FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
Base *base;
@@ -7961,7 +8808,7 @@ static void meshdeformModifier_foreachObjectLink(
}
static void meshdeformModifier_updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
+ ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
DagNode *obNode)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
@@ -8029,7 +8876,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
static void meshdeformModifier_do(
ModifierData *md, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ float (*vertexCos)[3], int numVerts)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
Mesh *me= (mmd->object)? mmd->object->data: NULL;
@@ -8197,7 +9044,7 @@ static void meshdeformModifier_deformVerts(
}
static void meshdeformModifier_deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm;
@@ -8251,10 +9098,10 @@ static DerivedMesh *multiresModifier_applyModifier(ModifierData *md, Object *ob,
result->release(result);
result= cddm;
}
- else if(ob->mode & OB_MODE_SCULPT) {
+ else if((ob->mode & OB_MODE_SCULPT) && ob->sculpt) {
/* would be created on the fly too, just nicer this
way on first stroke after e.g. switching levels */
- result->getPBVH(ob, result);
+ ob->sculpt->pbvh= result->getPBVH(ob, result);
}
return result;
@@ -8450,7 +9297,7 @@ static void simpledeformModifier_deformVertsEM(ModifierData *md, Object *ob, Edi
static void shapekeyModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
- float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
{
KeyBlock *kb= ob_get_keyblock(ob);
float (*deformedVerts)[3];
@@ -8475,9 +9322,9 @@ static void shapekeyModifier_deformVertsEM(
}
static void shapekeyModifier_deformMatricesEM(
- ModifierData *md, Object *ob, EditMesh *editData,
+ ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3],
- float (*defMats)[3][3], int numVerts)
+ float (*defMats)[3][3], int numVerts)
{
Key *key= ob_get_key(ob);
KeyBlock *kb= ob_get_keyblock(ob);
@@ -8921,6 +9768,22 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
mti->applyModifier = solidifyModifier_applyModifier;
mti->applyModifierEM = solidifyModifier_applyModifierEM;
typeArrInit = 0;
+
+ mti = INIT_TYPE(Screw);
+ mti->type = eModifierTypeType_Constructive;
+ mti->flags = eModifierTypeFlag_AcceptsMesh
+ | eModifierTypeFlag_SupportsEditmode
+ | eModifierTypeFlag_EnableInEditmode
+ | eModifierTypeFlag_AcceptsCVs;
+
+ mti->initData = screwModifier_initData;
+ mti->copyData = screwModifier_copyData;
+ mti->foreachObjectLink = screwModifier_foreachObjectLink;
+ mti->dependsOnTime = screwModifier_dependsOnTime;
+ mti->updateDepgraph = screwModifier_updateDepgraph;
+ mti->applyModifier = screwModifier_applyModifier;
+ mti->applyModifierEM = screwModifier_applyModifierEM;
+
#undef INIT_TYPE
}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 248b7ed407d..c70d12bcb75 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -34,14 +34,15 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "BLI_pbvh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
+#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_utildefines.h"
@@ -109,11 +110,16 @@ void multires_mark_as_modified(Object *ob)
void multires_force_update(Object *ob)
{
-
- if(ob && ob->derivedFinal) {
- ob->derivedFinal->needsFree =1;
- ob->derivedFinal->release(ob->derivedFinal);
- ob->derivedFinal = NULL;
+ if(ob) {
+ if(ob->derivedFinal) {
+ ob->derivedFinal->needsFree =1;
+ ob->derivedFinal->release(ob->derivedFinal);
+ ob->derivedFinal = NULL;
+ }
+ if(ob->sculpt && ob->sculpt->pbvh) {
+ BLI_pbvh_free(ob->sculpt->pbvh);
+ ob->sculpt->pbvh= NULL;
+ }
}
}
@@ -650,7 +656,7 @@ void multires_stitch_grids(Object *ob)
}
DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob,
- int useRenderParams, int isFinalCalc)
+ int useRenderParams, int isFinalCalc)
{
Mesh *me= ob->data;
DerivedMesh *result;
@@ -840,7 +846,7 @@ void multires_free(Multires *mr)
}
static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const MultiresFace *mface,
- const int totvert, const int totface)
+ const int totvert, const int totface)
{
int i,j;
IndexNode *node = NULL;
@@ -859,7 +865,7 @@ static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const Mult
}
static void create_old_vert_edge_map(ListBase **map, IndexNode **mem, const MultiresEdge *medge,
- const int totvert, const int totedge)
+ const int totvert, const int totedge)
{
int i,j;
IndexNode *node = NULL;
@@ -925,7 +931,7 @@ static void multires_load_old_edges(ListBase **emap, MultiresLevel *lvl, int *vv
}
static void multires_load_old_faces(ListBase **fmap, ListBase **emap, MultiresLevel *lvl, int *vvmap, int dst,
- int v1, int v2, int v3, int v4, int st2, int st3)
+ int v1, int v2, int v3, int v4, int st2, int st3)
{
int fmid;
int emid13, emid14, emid23, emid24;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 56da45ed19a..4af007a5f91 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -44,6 +44,7 @@
#include "BKE_fcurve.h"
#include "BKE_nla.h"
#include "BKE_library.h"
+#include "BKE_utildefines.h"
#include "RNA_access.h"
#include "nla_private.h"
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 10da12753e7..5bd9694e768 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1048,11 +1048,11 @@ bNodeTree *ntreeAddTree(int type)
ntree->alltypes.last = NULL;
/* this helps RNA identify ID pointers as nodetree */
- if(ntree->type==NTREE_SHADER)
+ if(ntree->type==NTREE_SHADER)
BLI_strncpy(ntree->id.name, "NTShader Nodetree", sizeof(ntree->id.name));
- else if(ntree->type==NTREE_COMPOSIT)
+ else if(ntree->type==NTREE_COMPOSIT)
BLI_strncpy(ntree->id.name, "NTCompositing Nodetree", sizeof(ntree->id.name));
- else if(ntree->type==NTREE_TEXTURE)
+ else if(ntree->type==NTREE_TEXTURE)
BLI_strncpy(ntree->id.name, "NTTexture Nodetree", sizeof(ntree->id.name));
ntreeInitTypes(ntree);
@@ -1354,9 +1354,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(ntree->id.lib==NULL) return;
if(ntree->id.us==1) {
@@ -1547,7 +1547,7 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
if(ntree==NULL) return NULL;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
+ for(node= ntree->nodes.first; node; node= node->next)
if(node->flag & NODE_GROUP_EDIT)
break;
@@ -1571,7 +1571,7 @@ int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
if(ntree==NULL) return ok;
/* check for group edit */
- for(node= ntree->nodes.first; node; node= node->next)
+ for(node= ntree->nodes.first; node; node= node->next)
if(node->flag & NODE_GROUP_EDIT)
break;
@@ -2519,10 +2519,39 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* local tree then owns all compbufs */
bNodeTree *ntreeLocalize(bNodeTree *ntree)
{
- bNodeTree *ltree= ntreeCopyTree(ntree, 0);
+ bNodeTree *ltree;
bNode *node;
bNodeSocket *sock;
+ bAction *action_backup= NULL, *tmpact_backup= NULL;
+
+ /* Workaround for copying an action on each render!
+ * set action to NULL so animdata actions dont get copied */
+ AnimData *adt= BKE_animdata_from_id(&ntree->id);
+
+ if(adt) {
+ action_backup= adt->action;
+ tmpact_backup= adt->tmpact;
+
+ adt->action= NULL;
+ adt->tmpact= NULL;
+ }
+
+ /* node copy func */
+ ltree= ntreeCopyTree(ntree, 0);
+
+ if(adt) {
+ AnimData *ladt= BKE_animdata_from_id(&ltree->id);
+
+ adt->action= ladt->action= action_backup;
+ adt->tmpact= ladt->tmpact= tmpact_backup;
+
+ if(action_backup) action_backup->id.us++;
+ if(tmpact_backup) tmpact_backup->id.us++;
+
+ }
+ /* end animdata uglyness */
+
/* move over the compbufs */
/* right after ntreeCopyTree() oldsock pointers are valid */
for(node= ntree->nodes.first; node; node= node->next) {
@@ -2641,7 +2670,7 @@ static void gpu_from_node_stack(ListBase *sockets, bNodeStack **ns, GPUNodeStack
for (sock=sockets->first, i=0; sock; sock=sock->next, i++) {
memset(&gs[i], 0, sizeof(gs[i]));
- QUATCOPY(gs[i].vec, ns[i]->vec);
+ QUATCOPY(gs[i].vec, ns[i]->vec);
gs[i].link= ns[i]->data;
if (sock->type == SOCK_VALUE)
@@ -2734,7 +2763,7 @@ void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat)
if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
data_from_gpu_stack(&node->outputs, nsout, gpuout);
}
- else if(node->type==NODE_GROUP && node->id) {
+ else if(node->type==NODE_GROUP && node->id) {
node_get_stack(node, stack, nsin, nsout);
gpu_node_group_execute(stack, mat, node, nsin, nsout);
}
@@ -2994,7 +3023,7 @@ void nodeRegisterType(ListBase *typelist, const bNodeType *ntype)
bNodeType *ntypen= MEM_callocN(sizeof(bNodeType), "node type");
*ntypen= *ntype;
BLI_addtail(typelist, ntypen);
- }
+ }
}
static void registerCompositNodes(ListBase *ntypelist)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b08754a7a3f..e4350cfde7f 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -58,8 +58,9 @@
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
-#include "BLI_math.h"
#include "BLI_editVert.h"
+#include "BLI_math.h"
+#include "BLI_pbvh.h"
#include "BKE_utildefines.h"
@@ -231,23 +232,26 @@ void object_free_display(Object *ob)
freedisplist(&ob->disp);
}
-void free_sculptsession(SculptSession **ssp)
+void free_sculptsession(Object *ob)
{
- if(ssp && *ssp) {
- SculptSession *ss = *ssp;
+ if(ob && ob->sculpt) {
+ SculptSession *ss = ob->sculpt;
+ DerivedMesh *dm= ob->derivedFinal;
+
+ if(ss->pbvh)
+ BLI_pbvh_free(ss->pbvh);
+ if(dm && dm->getPBVH)
+ dm->getPBVH(NULL, dm); /* signal to clear */
if(ss->texcache)
MEM_freeN(ss->texcache);
- if(ss->layer_disps)
- MEM_freeN(ss->layer_disps);
-
if(ss->layer_co)
MEM_freeN(ss->layer_co);
MEM_freeN(ss);
- *ssp = NULL;
+ ob->sculpt = NULL;
}
}
@@ -306,7 +310,7 @@ void free_object(Object *ob)
if(ob->bsoft) bsbFree(ob->bsoft);
if(ob->gpulamp.first) GPU_lamp_free(ob);
- free_sculptsession(&ob->sculpt);
+ free_sculptsession(ob);
if(ob->pc_ids.first) BLI_freelistN(&ob->pc_ids);
}
@@ -710,9 +714,9 @@ void make_local_camera(Camera *cam)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(cam->id.lib==0) return;
if(cam->id.us==1) {
@@ -858,9 +862,9 @@ void make_local_lamp(Lamp *la)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(la->id.lib==0) return;
if(la->id.us==1) {
@@ -1356,9 +1360,9 @@ void make_local_object(Object *ob)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(ob->id.lib==NULL) return;
@@ -1766,7 +1770,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
/* vec: 4 items! */
- if( where_on_path(par, ctime, vec, dir, NULL, &radius) ) {
+ if( where_on_path(par, ctime, vec, dir, NULL, &radius) ) {
if(cu->flag & CU_FOLLOW) {
vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
@@ -2301,6 +2305,44 @@ void object_boundbox_flag(Object *ob, int flag, int set)
}
}
+void object_get_dimensions(Object *ob, float *value)
+{
+ BoundBox *bb = NULL;
+
+ bb= object_get_boundbox(ob);
+ if (bb) {
+ float scale[3];
+
+ mat4_to_size( scale,ob->obmat);
+
+ value[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
+ value[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
+ value[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
+ } else {
+ value[0] = value[1] = value[2] = 0.f;
+ }
+}
+
+void object_set_dimensions(Object *ob, const float *value)
+{
+ BoundBox *bb = NULL;
+
+ bb= object_get_boundbox(ob);
+ if (bb) {
+ float scale[3], len[3];
+
+ mat4_to_size( scale,ob->obmat);
+
+ len[0] = bb->vec[4][0] - bb->vec[0][0];
+ len[1] = bb->vec[2][1] - bb->vec[0][1];
+ len[2] = bb->vec[1][2] - bb->vec[0][2];
+
+ if (len[0] > 0.f) ob->size[0] = value[0] / len[0];
+ if (len[1] > 0.f) ob->size[1] = value[1] / len[1];
+ if (len[2] > 0.f) ob->size[2] = value[2] / len[2];
+ }
+}
+
void minmax_object(Object *ob, float *min, float *max)
{
BoundBox bb;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index f228dc5002e..bd9e041dab4 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2926,7 +2926,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleCacheKey *ca, **cache= edit->pathcache;
ParticleEditSettings *pset = &scene->toolsettings->particle;
- PTCacheEditPoint *point = edit->points;
+ PTCacheEditPoint *point = NULL;
PTCacheEditKey *ekey = NULL;
ParticleSystem *psys = edit->psys;
@@ -2941,7 +2941,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
float hairmat[4][4], rotmat[3][3], prev_tangent[3];
int k,i;
int steps = (int)pow(2.0, (double)pset->draw_step);
- int totpart = edit->totpoint;
+ int totpart = edit->totpoint, recalc_set=0;
float sel_col[3];
float nosel_col[3];
@@ -2951,6 +2951,11 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* clear out old and create new empty path cache */
psys_free_path_cache(edit->psys, edit);
cache= edit->pathcache= psys_alloc_path_cache_buffers(&edit->pathcachebufs, totpart, steps+1);
+
+ /* set flag for update (child particles check this too) */
+ for(i=0, point=edit->points; i<totpart; i++, point++)
+ point->flag |= PEP_EDIT_RECALC;
+ recalc_set = 1;
}
frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f;
@@ -2972,7 +2977,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
}
/*---first main loop: create all actual particles' paths---*/
- for(i=0; i<totpart; i++, pa+=pa?1:0, point++){
+ for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++){
if(edit->totcached && !(point->flag & PEP_EDIT_RECALC))
continue;
@@ -3124,6 +3129,12 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleSimulationData sim = {scene, ob, psys, psys_get_modifier(ob, psys), NULL};
psys_cache_child_paths(&sim, cfra, 1);
}
+
+ /* clear recalc flag if set here */
+ if(recalc_set) {
+ for(i=0, point=edit->points; i<totpart; i++, point++)
+ point->flag &= ~PEP_EDIT_RECALC;
+ }
}
/************************************************/
/* Particle Key handling */
@@ -3466,9 +3477,9 @@ void make_local_particlesettings(ParticleSettings *part)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(part->id.lib==0) return;
if(part->id.us==1) {
@@ -4238,7 +4249,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
normalize_v3(side);
cross_v3_v3v3(nor, vec, side);
- unit_m4(mat);
+ unit_m4(mat);
VECCOPY(mat[0], vec);
VECCOPY(mat[1], side);
VECCOPY(mat[2], nor);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 38808131f92..a99a8affbd3 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -159,8 +159,7 @@ void psys_reset(ParticleSystem *psys, int mode)
psys_free_path_cache(psys, psys->edit);
/* reset point cache */
- psys->pointcache->flag &= ~PTCACHE_SIMULATION_VALID;
- psys->pointcache->simframe= 0;
+ BKE_ptcache_invalidate(psys->pointcache);
}
static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
@@ -287,7 +286,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
node: the allocated links - total derived mesh element count
nodearray: the array of nodes aligned with the base mesh's elements, so
- each original elements can reference its derived elements
+ each original elements can reference its derived elements
*/
Mesh *me= (Mesh*)ob->data;
PARTICLE_P;
@@ -512,18 +511,18 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys)
static void hammersley_create(float *out, int n, int seed, float amount)
{
RNG *rng;
- double p, t, offs[2];
- int k, kk;
+ double p, t, offs[2];
+ int k, kk;
rng = rng_new(31415926 + n + seed);
offs[0]= rng_getDouble(rng) + amount;
offs[1]= rng_getDouble(rng) + amount;
rng_free(rng);
- for (k = 0; k < n; k++) {
- t = 0;
- for (p = 0.5, kk = k; kk; p *= 0.5, kk >>= 1)
- if (kk & 1) /* kk mod 2 = 1 */
+ for (k = 0; k < n; k++) {
+ t = 0;
+ for (p = 0.5, kk = k; kk; p *= 0.5, kk >>= 1)
+ if (kk & 1) /* kk mod 2 = 1 */
t += p;
out[2*k + 0]= fmod((double)k/(double)n + offs[0], 1.0);
@@ -546,7 +545,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
rng = rng_new(31415926 + num + seed2);
x= 0;
- num2 = 2 * num;
+ num2 = 2 * num;
for(i=0; i<num2; i+=2) {
jit[i]= x + amount*rad1*(0.5f - rng_getFloat(rng));
@@ -2215,21 +2214,17 @@ static void set_keyed_keys(ParticleSimulationData *sim)
void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
{
PointCache *cache = psys->pointcache;
- PTCacheID pid;
-
- if((cache->flag & PTCACHE_DISK_CACHE)==0 || cache->mem_cache.first)
- return;
- BKE_ptcache_id_from_particles(&pid, ob, psys);
-
- BKE_ptcache_disk_to_mem(&pid);
+ if(cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
+ PTCacheID pid;
+ BKE_ptcache_id_from_particles(&pid, ob, psys);
+ BKE_ptcache_disk_to_mem(&pid);
+ }
}
static void psys_clear_temp_pointcache(ParticleSystem *psys)
{
- if((psys->pointcache->flag & PTCACHE_DISK_CACHE)==0)
- return;
-
- BKE_ptcache_free_mem(&psys->pointcache->mem_cache);
+ if(psys->pointcache->flag & PTCACHE_DISK_CACHE)
+ BKE_ptcache_free_mem(&psys->pointcache->mem_cache);
}
void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
{
@@ -3202,15 +3197,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part=psys->part;
- KDTree *tree=0;
- //IpoCurve *icu_esize=find_ipocurve(part->ipo,PART_EMIT_SIZE); // XXX old animation system
-/* Material *ma=give_current_material(sim->ob, part->omat); */
BoidBrainData bbd;
PARTICLE_P;
float timestep;
- int totpart;
/* current time */
- float ctime, ipotime; // XXX old animation system
+ float ctime;
/* frame & time changes */
float dfra, dtime, pa_dtime, pa_dfra=0.0;
float birthtime, dietime;
@@ -3218,200 +3209,157 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
/* where have we gone in time since last time */
dfra= cfra - psys->cfra;
- totpart=psys->totpart;
-
timestep = psys_get_timestep(sim);
dtime= dfra*timestep;
ctime= cfra*timestep;
- ipotime= cfra; // XXX old animation system
-
-#if 0 // XXX old animation system
- if(part->flag&PART_ABS_TIME && part->ipo){
- calc_ipo(part->ipo, cfra);
- execute_ipo((ID *)part, part->ipo);
- }
-#endif // XXX old animation system
if(dfra<0.0){
- float *vg_size=0;
- //if(part->type==PART_REACTOR)
- // vg_size=psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_SIZE);
-
LOOP_EXISTING_PARTICLES {
- /* set correct ipo timing */
-#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- ipotime=100.0f*(cfra-pa->time)/pa->lifetime;
- calc_ipo(part->ipo, ipotime);
- execute_ipo((ID *)part, part->ipo);
- }
-#endif // XXX old animation system
pa->size = part->size;
if(part->randsize > 0.0)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
reset_particle(sim, pa, dtime, cfra);
}
-
- if(vg_size)
- MEM_freeN(vg_size);
+ return;
}
- else{
- BLI_srandom(31415926 + (int)cfra + psys->seed);
- psys_update_effectors(sim);
+ BLI_srandom(31415926 + (int)cfra + psys->seed);
- if(part->type != PART_HAIR)
- sim->colliders = get_collider_cache(sim->scene, NULL);
+ psys_update_effectors(sim);
- if(part->phystype==PART_PHYS_BOIDS){
- ParticleTarget *pt = psys->targets.first;
- bbd.sim = sim;
- bbd.part = part;
- bbd.cfra = cfra;
- bbd.dfra = dfra;
- bbd.timestep = timestep;
+ if(part->type != PART_HAIR)
+ sim->colliders = get_collider_cache(sim->scene, NULL);
- psys_update_particle_tree(psys, cfra);
+ if(part->phystype==PART_PHYS_BOIDS){
+ ParticleTarget *pt = psys->targets.first;
+ bbd.sim = sim;
+ bbd.part = part;
+ bbd.cfra = cfra;
+ bbd.dfra = dfra;
+ bbd.timestep = timestep;
- boids_precalc_rules(part, cfra);
+ psys_update_particle_tree(psys, cfra);
- for(; pt; pt=pt->next) {
- if(pt->ob)
- psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
- }
+ boids_precalc_rules(part, cfra);
+
+ for(; pt; pt=pt->next) {
+ if(pt->ob)
+ psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
}
+ }
- /* main loop: calculate physics for all particles */
- LOOP_SHOWN_PARTICLES {
- copy_particle_key(&pa->prev_state,&pa->state,1);
-
- /* set correct ipo timing */
-#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- ipotime=100.0f*(cfra-pa->time)/pa->lifetime;
- calc_ipo(part->ipo, ipotime);
- execute_ipo((ID *)part, part->ipo);
- }
-#endif // XXX old animation system
- //update_particle_settings(psys, part, &tpart, pa);
+ /* main loop: calculate physics for all particles */
+ LOOP_SHOWN_PARTICLES {
+ copy_particle_key(&pa->prev_state,&pa->state,1);
- pa->size = part->size;
- if(part->randsize > 0.0)
- pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
+ pa->size = part->size;
+ if(part->randsize > 0.0)
+ pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
- ///* reactions can change birth time so they need to be checked first */
- //if(psys->reactevents.first && ELEM(pa->alive,PARS_DEAD,PARS_KILLED)==0)
- // react_to_events(psys,p);
+ ///* reactions can change birth time so they need to be checked first */
+ //if(psys->reactevents.first && ELEM(pa->alive,PARS_DEAD,PARS_KILLED)==0)
+ // react_to_events(psys,p);
- birthtime = pa->time;
- dietime = birthtime + pa->lifetime;
+ birthtime = pa->time;
+ dietime = birthtime + pa->lifetime;
- pa_dfra = dfra;
- pa_dtime = dtime;
+ pa_dfra = dfra;
+ pa_dtime = dtime;
- if(dietime <= cfra && psys->cfra < dietime){
- /* particle dies some time between this and last step */
- pa_dfra = dietime - ((birthtime > psys->cfra) ? birthtime : psys->cfra);
- pa_dtime = pa_dfra * timestep;
- pa->alive = PARS_DYING;
- }
- else if(birthtime <= cfra && birthtime >= psys->cfra){
- /* particle is born some time between this and last step*/
- reset_particle(sim, pa, dtime, cfra);
- pa->alive = PARS_ALIVE;
- pa_dfra = cfra - birthtime;
- pa_dtime = pa_dfra*timestep;
- }
- else if(dietime < cfra){
- /* nothing to be done when particle is dead */
- }
+ if(dietime <= cfra && psys->cfra < dietime){
+ /* particle dies some time between this and last step */
+ pa_dfra = dietime - ((birthtime > psys->cfra) ? birthtime : psys->cfra);
+ pa_dtime = pa_dfra * timestep;
+ pa->alive = PARS_DYING;
+ }
+ else if(birthtime <= cfra && birthtime >= psys->cfra){
+ /* particle is born some time between this and last step*/
+ reset_particle(sim, pa, dtime, cfra);
+ pa->alive = PARS_ALIVE;
+ pa_dfra = cfra - birthtime;
+ pa_dtime = pa_dfra*timestep;
+ }
+ else if(dietime < cfra){
+ /* nothing to be done when particle is dead */
+ }
+
+ /* only reset unborn particles if they're shown or if the particle is born soon*/
+ if(pa->alive==PARS_UNBORN
+ && (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
+ reset_particle(sim, pa, dtime, cfra);
+ else if(part->phystype == PART_PHYS_NO)
+ reset_particle(sim, pa, dtime, cfra);
+
+ if(dfra>0.0 && ELEM(pa->alive,PARS_ALIVE,PARS_DYING)){
+ switch(part->phystype){
+ case PART_PHYS_NEWTON:
+ /* do global forces & effectors */
+ apply_particle_forces(sim, p, pa_dfra, cfra);
+
+ /* deflection */
+ if(sim->colliders)
+ deflect_particle(sim, p, pa_dfra, cfra);
+
+ /* rotations */
+ rotate_particle(part, pa, pa_dfra, timestep);
+ break;
+ case PART_PHYS_BOIDS:
+ {
+ bbd.goal_ob = NULL;
+ boid_brain(&bbd, p, pa);
+ if(pa->alive != PARS_DYING) {
+ boid_body(&bbd, pa);
- /* only reset unborn particles if they're shown or if the particle is born soon*/
- if(pa->alive==PARS_UNBORN
- && (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
- reset_particle(sim, pa, dtime, cfra);
- else if(part->phystype == PART_PHYS_NO)
- reset_particle(sim, pa, dtime, cfra);
-
- if(dfra>0.0 && ELEM(pa->alive,PARS_ALIVE,PARS_DYING)){
- switch(part->phystype){
- case PART_PHYS_NEWTON:
- /* do global forces & effectors */
- apply_particle_forces(sim, p, pa_dfra, cfra);
-
/* deflection */
if(sim->colliders)
deflect_particle(sim, p, pa_dfra, cfra);
-
- /* rotations */
- rotate_particle(part, pa, pa_dfra, timestep);
- break;
- case PART_PHYS_BOIDS:
- {
- bbd.goal_ob = NULL;
- boid_brain(&bbd, p, pa);
- if(pa->alive != PARS_DYING) {
- boid_body(&bbd, pa);
-
- /* deflection */
- if(sim->colliders)
- deflect_particle(sim, p, pa_dfra, cfra);
- }
- break;
}
+ break;
}
+ }
- if(pa->alive == PARS_DYING){
- //push_reaction(ob,psys,p,PART_EVENT_DEATH,&pa->state);
+ if(pa->alive == PARS_DYING){
+ //push_reaction(ob,psys,p,PART_EVENT_DEATH,&pa->state);
- pa->alive=PARS_DEAD;
- pa->state.time=pa->dietime;
- }
- else
- pa->state.time=cfra;
-
- //push_reaction(ob,psys,p,PART_EVENT_NEAR,&pa->state);
+ pa->alive=PARS_DEAD;
+ pa->state.time=pa->dietime;
}
- }
+ else
+ pa->state.time=cfra;
- free_collider_cache(&sim->colliders);
+ //push_reaction(ob,psys,p,PART_EVENT_NEAR,&pa->state);
+ }
}
- if(tree)
- BLI_kdtree_free(tree);
+ free_collider_cache(&sim->colliders);
+}
+static void update_children(ParticleSimulationData *sim)
+{
+ if((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
+ /* don't generate children while growing hair - waste of time */
+ psys_free_children(sim->psys);
+ else if(sim->psys->part->childtype && sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
+ distribute_particles(sim, PART_FROM_CHILD);
+ else
+ psys_free_children(sim->psys);
}
-
/* updates cached particles' alive & other flags etc..*/
static void cached_step(ParticleSimulationData *sim, float cfra)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
- //IpoCurve *icu_esize = NULL; //=find_ipocurve(part->ipo,PART_EMIT_SIZE); // XXX old animation system
-/* Material *ma = give_current_material(sim->ob,part->omat); */
PARTICLE_P;
- float disp, birthtime, dietime, *vg_size= NULL; // XXX ipotime=cfra
+ float disp, birthtime, dietime;
BLI_srandom(psys->seed);
- if(part->from!=PART_FROM_PARTICLE)
- vg_size= psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_SIZE);
-
psys_update_effectors(sim);
disp= (float)get_current_display_percentage(psys)/100.0f;
LOOP_PARTICLES {
-#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- ipotime=100.0f*(cfra-pa->time)/pa->lifetime;
- calc_ipo(part->ipo, ipotime);
- execute_ipo((ID *)part, part->ipo);
- }
-#endif // XXX old animation system
- //update_settings_with_particle(psys, part, pa);
-
pa->size = part->size;
if(part->randsize > 0.0)
pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
@@ -3427,12 +3375,10 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
if(part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
reset_particle(sim, pa, 0.0f, cfra);
}
- else if(dietime <= cfra){
+ else if(dietime <= cfra)
pa->alive = PARS_DEAD;
- }
- else{
+ else
pa->alive = PARS_ALIVE;
- }
if(psys->lattice){
end_latt_deform(psys->lattice);
@@ -3444,114 +3390,8 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
else
pa->flag &= ~PARS_NO_DISP;
}
-
- /* make sure that children are up to date */
- if(psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) {
- realloc_particles(sim, psys->totpart);
- distribute_particles(sim, PART_FROM_CHILD);
- }
-
- psys_update_path_cache(sim, cfra);
-
- if(vg_size)
- MEM_freeN(vg_size);
}
-static void psys_changed_type(ParticleSimulationData *sim)
-{
- ParticleSettings *part = sim->psys->part;
- PTCacheID pid;
-
- BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
-
- /* system type has changed so set sensible defaults and clear non applicable flags */
- if(part->from == PART_FROM_PARTICLE) {
- //if(part->type != PART_REACTOR)
- part->from = PART_FROM_FACE;
- if(part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT)
- part->distr = PART_DISTR_JIT;
- }
-
- if(part->phystype != PART_PHYS_KEYED)
- sim->psys->flag &= ~PSYS_KEYED;
-
- if(part->type == PART_HAIR) {
- if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
- part->ren_as = PART_DRAW_PATH;
-
- if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
- part->draw_as = PART_DRAW_REND;
-
- CLAMP(part->path_start, 0.0f, 100.0f);
- CLAMP(part->path_end, 0.0f, 100.0f);
-
- BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
- }
- else {
- free_hair(sim->ob, sim->psys, 1);
-
- CLAMP(part->path_start, 0.0f, MAX2(100.0f, part->end + part->lifetime));
- CLAMP(part->path_end, 0.0f, MAX2(100.0f, part->end + part->lifetime));
- }
-
- psys_reset(sim->psys, PSYS_RESET_ALL);
-}
-void psys_check_boid_data(ParticleSystem *psys)
-{
- BoidParticle *bpa;
- PARTICLE_P;
-
- pa = psys->particles;
-
- if(!pa)
- return;
-
- if(psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
- if(!pa->boid) {
- bpa = MEM_callocN(psys->totpart * sizeof(BoidParticle), "Boid Data");
-
- LOOP_PARTICLES
- pa->boid = bpa++;
- }
- }
- else if(pa->boid){
- MEM_freeN(pa->boid);
- LOOP_PARTICLES
- pa->boid = NULL;
- }
-}
-static void psys_changed_physics(ParticleSimulationData *sim)
-{
- ParticleSettings *part = sim->psys->part;
-
- if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
- PTCacheID pid;
- BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
- BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
- }
- else {
- free_keyed_keys(sim->psys);
- sim->psys->flag &= ~PSYS_KEYED;
- }
-
- if(part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
- BoidState *state;
-
- part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
- boid_default_settings(part->boids);
-
- state = boid_new_state(part->boids);
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
-
- ((BoidRule*)state->rules.first)->flag |= BOIDRULE_CURRENT;
-
- state->flag |= BOIDSTATE_CURRENT;
- BLI_addtail(&part->boids->states, state);
- }
-
- psys_check_boid_data(sim->psys);
-}
static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
{
ParticleSystem *psys = sim->psys;
@@ -3660,200 +3500,127 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra)
#endif // DISABLE_ELBEEM
}
-/* Calculates the next state for all particles of the system */
-/* In particles code most fra-ending are frames, time-ending are fra*timestep (seconds)*/
+static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float cfra)
+{
+ ParticleSystem *psys = sim->psys;
+ ParticleSettings *part = psys->part;
+ int oldtotpart = psys->totpart;
+ int totpart = oldtotpart;
+
+ if(pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
+ totpart = pid->cache->totpoint;
+ else if(part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT)
+ totpart = part->grid_res*part->grid_res*part->grid_res;
+ else
+ totpart = psys->part->totpart;
+
+ if(totpart != oldtotpart)
+ realloc_particles(sim, totpart);
+
+ return totpart - oldtotpart;
+}
+/* Calculates the next state for all particles of the system
+ * In particles code most fra-ending are frames, time-ending are fra*timestep (seconds)
+ * 1. Emit particles
+ * 2. Check cache (if used) and return if frame is cached
+ * 3. Do dynamics
+ * 4. Save to cache */
static void system_step(ParticleSimulationData *sim, float cfra)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
PointCache *cache = psys->pointcache;
- PTCacheID pid;
+ PTCacheID pid, *use_cache = NULL;
PARTICLE_P;
- int totpart, oldtotpart, totchild, oldtotchild;
+ int oldtotpart;
float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0;
- int init= 0, distr= 0, alloc= 0, usecache= 0, only_children_changed= 0;
- int framenr, framedelta, startframe, endframe;
+ int init= 0, emit= 0, only_children_changed= 0;
+ int framenr, framedelta, startframe = 0, endframe = 100;
framenr= (int)sim->scene->r.cfra;
framedelta= framenr - cache->simframe;
- /* set suitable cache range automatically */
- if((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0 && !(psys->flag & PSYS_HAIR_DYNAMICS))
- psys_get_pointcache_start_end(sim->scene, sim->psys, &cache->startframe, &cache->endframe);
-
- BKE_ptcache_id_from_particles(&pid, sim->ob, psys);
- BKE_ptcache_id_time(&pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
-
- psys_clear_temp_pointcache(sim->psys);
-
- /* update ipo's */
-#if 0 // XXX old animation system
- if((part->flag & PART_ABS_TIME) && part->ipo) {
- calc_ipo(part->ipo, cfra);
- execute_ipo((ID *)part, part->ipo);
+ /* cache shouldn't be used for hair or "continue physics" */
+ if(part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) {
+ BKE_ptcache_id_from_particles(&pid, sim->ob, psys);
+ use_cache = &pid;
}
-#endif // XXX old animation system
- /* hair if it's already done is handled separate */
- if(part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)) {
- hair_step(sim, cfra);
- psys->cfra = cfra;
- psys->recalc = 0;
- return;
- }
- /* fluid is also handled separate */
- else if(part->type == PART_FLUID) {
- particles_fluid_step(sim, framenr);
- psys->cfra = cfra;
- psys->recalc = 0;
- return;
- }
+ if(use_cache) {
+ psys_clear_temp_pointcache(sim->psys);
- /* cache shouldn't be used for hair or "none" or "keyed" physics */
- if(part->type == PART_HAIR || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
- usecache= 0;
- else if(BKE_ptcache_get_continue_physics())
- usecache= 0;
- else
- usecache= 1;
+ /* set suitable cache range automatically */
+ if((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
+ psys_get_pointcache_start_end(sim->scene, sim->psys, &cache->startframe, &cache->endframe);
+
+ BKE_ptcache_id_time(&pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
- if(usecache) {
- /* frame clamping */
+ /* simulation is only active during a specific period */
if(framenr < startframe) {
psys_reset(psys, PSYS_RESET_CACHE_MISS);
- psys->cfra = cfra;
- psys->recalc = 0;
return;
}
else if(framenr > endframe) {
framenr= endframe;
}
-
+
if(framenr == startframe) {
- BKE_ptcache_id_reset(sim->scene, &pid, PTCACHE_RESET_OUTDATED);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_id_reset(sim->scene, use_cache, PTCACHE_RESET_OUTDATED);
+ BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
}
}
+/* 1. emit particles */
+
/* verify if we need to reallocate */
oldtotpart = psys->totpart;
- oldtotchild = psys->totchild;
-
- if(psys->pointcache->flag & PTCACHE_EXTERNAL)
- totpart = pid.cache->totpoint;
- else if(part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT)
- totpart = part->grid_res*part->grid_res*part->grid_res;
- else
- totpart = psys->part->totpart;
- totchild = get_psys_tot_child(sim->scene, psys);
-
- if(oldtotpart != totpart || oldtotchild != totchild) {
- only_children_changed = (oldtotpart == totpart);
- alloc = 1;
- distr= 1;
- init= 1;
- }
- if(psys->recalc & PSYS_RECALC_RESET) {
- distr= 1;
- init= 1;
- }
+ emit = emit_particles(sim, use_cache, cfra);
+ init = emit*emit + (psys->recalc & PSYS_RECALC_RESET);
if(init) {
- if(distr) {
- if(alloc) {
- realloc_particles(sim, totpart);
-
- if(oldtotpart && usecache && !only_children_changed) {
- BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
- BKE_ptcache_id_from_particles(&pid, sim->ob, psys);
- }
- }
-
- if(!only_children_changed)
- distribute_particles(sim, part->from);
-
- if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
- /* don't generate children while growing hair - waste of time */
- psys_free_children(psys);
- else if(get_psys_tot_child(sim->scene, psys))
- distribute_particles(sim, PART_FROM_CHILD);
- }
-
- if(!only_children_changed) {
- free_keyed_keys(psys);
-
- initialize_all_particles(sim);
-
-
- if(alloc) {
- reset_all_particles(sim, 0.0, cfra, oldtotpart);
- }
- }
+ distribute_particles(sim, part->from);
+ initialize_all_particles(sim);
+ reset_all_particles(sim, 0.0, cfra, oldtotpart);
/* flag for possible explode modifiers after this system */
sim->psmd->flag |= eParticleSystemFlag_Pars;
}
- /* try to read from the cache */
- if(usecache) {
- int result = BKE_ptcache_read_cache(&pid, cfra, sim->scene->r.frs_sec);
+/* 2. try to read from the cache */
+ if(use_cache) {
+ int cache_result = BKE_ptcache_read_cache(use_cache, cfra, sim->scene->r.frs_sec);
- if(result == PTCACHE_READ_EXACT || result == PTCACHE_READ_INTERPOLATED) {
+ if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
cached_step(sim, cfra);
- psys->cfra=cfra;
- psys->recalc = 0;
+ update_children(sim);
+ psys_update_path_cache(sim, cfra);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
- if(result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
- BKE_ptcache_write_cache(&pid, (int)cfra);
+ if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+ BKE_ptcache_write_cache(use_cache, framenr);
return;
}
- else if(result==PTCACHE_READ_OLD) {
+ else if(cache_result == PTCACHE_READ_OLD) {
psys->cfra = (float)cache->simframe;
- LOOP_PARTICLES {
- /* update alive status */
- if(pa->time > psys->cfra)
- pa->alive = PARS_UNBORN;
- else if(pa->dietime <= psys->cfra)
- pa->alive = PARS_DEAD;
- else
- pa->alive = PARS_ALIVE;
- }
+ cached_step(sim, psys->cfra);
}
else if(cfra != startframe && ( /*sim->ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED))) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
psys_reset(psys, PSYS_RESET_CACHE_MISS);
- psys->cfra=cfra;
- psys->recalc = 0;
return;
}
- }
- else {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
- }
- /* if on second frame, write cache for first frame */
- if(usecache && psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
- BKE_ptcache_write_cache(&pid, startframe);
-
- if(part->phystype==PART_PHYS_KEYED)
- psys_count_keyed_targets(sim);
-
- /* initialize vertex groups */
- if(part->from!=PART_FROM_PARTICLE) {
- vg_vel= psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_VEL);
- vg_tan= psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_TAN);
- vg_rot= psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_ROT);
- vg_size= psys_cache_vgroup(sim->psmd->dm,psys,PSYS_VG_SIZE);
+ /* if on second frame, write cache for first frame */
+ if(psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+ BKE_ptcache_write_cache(use_cache, startframe);
}
+ else
+ BKE_ptcache_invalidate(cache);
+/* 3. do dynamics */
/* set particles to be not calculated TODO: can't work with pointcache */
disp= (float)get_current_display_percentage(psys)/100.0f;
@@ -3880,36 +3647,118 @@ static void system_step(ParticleSimulationData *sim, float cfra)
}
}
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
-
- psys->recalc = 0;
- psys->cfra = cfra;
-
- /* only write cache starting from second frame */
- if(usecache && framenr != startframe)
- BKE_ptcache_write_cache(&pid, (int)cfra);
-
- /* for keyed particles the path is allways known so it can be drawn */
- if(part->phystype==PART_PHYS_KEYED) {
- set_keyed_keys(sim);
- psys_update_path_cache(sim,(int)cfra);
+/* 4. only write cache starting from second frame */
+ if(use_cache) {
+ BKE_ptcache_validate(cache, framenr);
+ if(framenr != startframe)
+ BKE_ptcache_write_cache(use_cache, framenr);
}
- else if(psys->pathcache)
- psys_free_path_cache(psys, NULL);
- /* cleanup */
- if(vg_vel) MEM_freeN(vg_vel);
- if(vg_tan) MEM_freeN(vg_tan);
- if(vg_rot) MEM_freeN(vg_rot);
- if(vg_size) MEM_freeN(vg_size);
+ if(init)
+ update_children(sim);
+/* cleanup */
if(psys->lattice){
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
}
+/* system type has changed so set sensible defaults and clear non applicable flags */
+static void psys_changed_type(ParticleSimulationData *sim)
+{
+ ParticleSettings *part = sim->psys->part;
+ PTCacheID pid;
+
+ BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
+
+ if(part->from == PART_FROM_PARTICLE) {
+ //if(part->type != PART_REACTOR)
+ part->from = PART_FROM_FACE;
+ if(part->distr == PART_DISTR_GRID && part->from != PART_FROM_VERT)
+ part->distr = PART_DISTR_JIT;
+ }
+
+ if(part->phystype != PART_PHYS_KEYED)
+ sim->psys->flag &= ~PSYS_KEYED;
+
+ if(part->type == PART_HAIR) {
+ if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
+ part->ren_as = PART_DRAW_PATH;
+
+ if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
+ part->draw_as = PART_DRAW_REND;
+
+ CLAMP(part->path_start, 0.0f, 100.0f);
+ CLAMP(part->path_end, 0.0f, 100.0f);
+
+ BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
+ }
+ else {
+ free_hair(sim->ob, sim->psys, 1);
+
+ CLAMP(part->path_start, 0.0f, MAX2(100.0f, part->end + part->lifetime));
+ CLAMP(part->path_end, 0.0f, MAX2(100.0f, part->end + part->lifetime));
+ }
+
+ psys_reset(sim->psys, PSYS_RESET_ALL);
+}
+void psys_check_boid_data(ParticleSystem *psys)
+{
+ BoidParticle *bpa;
+ PARTICLE_P;
+
+ pa = psys->particles;
+
+ if(!pa)
+ return;
+
+ if(psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
+ if(!pa->boid) {
+ bpa = MEM_callocN(psys->totpart * sizeof(BoidParticle), "Boid Data");
+
+ LOOP_PARTICLES
+ pa->boid = bpa++;
+ }
+ }
+ else if(pa->boid){
+ MEM_freeN(pa->boid);
+ LOOP_PARTICLES
+ pa->boid = NULL;
+ }
+}
+static void psys_changed_physics(ParticleSimulationData *sim)
+{
+ ParticleSettings *part = sim->psys->part;
+
+ if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
+ PTCacheID pid;
+ BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
+ BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
+ }
+ else {
+ free_keyed_keys(sim->psys);
+ sim->psys->flag &= ~PSYS_KEYED;
+ }
+
+ if(part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
+ BoidState *state;
+
+ part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
+ boid_default_settings(part->boids);
+
+ state = boid_new_state(part->boids);
+ BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
+ BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
+
+ ((BoidRule*)state->rules.first)->flag |= BOIDRULE_CURRENT;
+
+ state->flag |= BOIDSTATE_CURRENT;
+ BLI_addtail(&part->boids->states, state);
+ }
+
+ psys_check_boid_data(sim->psys);
+}
static int hair_needs_recalc(ParticleSystem *psys)
{
if(!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
@@ -3920,10 +3769,12 @@ static int hair_needs_recalc(ParticleSystem *psys)
return 0;
}
-/* main particle update call, checks that things are ok on the large scale before actual particle calculations */
+/* main particle update call, checks that things are ok on the large scale and
+ * then advances in to actual particle calculations depending on particle type */
void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
{
ParticleSimulationData sim = {scene, ob, psys, NULL, NULL};
+ ParticleSettings *part = psys->part;
float cfra;
/* drawdata is outdated after ANY change */
@@ -3947,35 +3798,81 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
return;
/* execute drivers only, as animation has already been done */
- BKE_animsys_evaluate_animdata(&psys->part->id, psys->part->adt, cfra, ADT_RECALC_DRIVERS);
+ BKE_animsys_evaluate_animdata(&part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
if(psys->recalc & PSYS_RECALC_TYPE)
psys_changed_type(&sim);
else if(psys->recalc & PSYS_RECALC_PHYS)
psys_changed_physics(&sim);
- /* (re-)create hair */
- if(psys->part->type==PART_HAIR && hair_needs_recalc(psys)) {
- float hcfra=0.0f;
- int i;
-
- free_hair(ob, psys, 0);
+ switch(part->type) {
+ case PART_HAIR:
+ {
+ /* (re-)create hair */
+ if(hair_needs_recalc(psys)) {
+ float hcfra=0.0f;
+ int i, recalc = psys->recalc;
+
+ free_hair(ob, psys, 0);
+
+ /* first step is negative so particles get killed and reset */
+ psys->cfra= 1.0f;
+
+ for(i=0; i<=part->hair_step; i++){
+ hcfra=100.0f*(float)i/(float)psys->part->hair_step;
+ BKE_animsys_evaluate_animdata(&part->id, part->adt, hcfra, ADT_RECALC_ANIM);
+ system_step(&sim, hcfra);
+ psys->cfra = hcfra;
+ psys->recalc = 0;
+ save_hair(&sim, hcfra);
+ }
- /* first step is negative so particles get killed and reset */
- psys->cfra= 1.0f;
+ psys->flag |= PSYS_HAIR_DONE;
+ psys->recalc = recalc;
+ }
- for(i=0; i<=psys->part->hair_step; i++){
- hcfra=100.0f*(float)i/(float)psys->part->hair_step;
- BKE_animsys_evaluate_animdata(&psys->part->id, psys->part->adt, hcfra, ADT_RECALC_ANIM);
- system_step(&sim, hcfra);
- save_hair(&sim, hcfra);
+ if(psys->flag & PSYS_HAIR_DONE)
+ hair_step(&sim, cfra);
+ break;
+ }
+ case PART_FLUID:
+ {
+ particles_fluid_step(&sim, (int)cfra);
+ break;
}
+ default:
+ {
+ switch(part->phystype) {
+ case PART_PHYS_NO:
+ case PART_PHYS_KEYED:
+ {
+ if(emit_particles(&sim, NULL, cfra)) {
+ free_keyed_keys(psys);
+ distribute_particles(&sim, part->from);
+ initialize_all_particles(&sim);
+ }
+ reset_all_particles(&sim, 0.0, cfra, 0);
- psys->flag |= PSYS_HAIR_DONE;
+ if(part->phystype == PART_PHYS_KEYED) {
+ psys_count_keyed_targets(&sim);
+ set_keyed_keys(&sim);
+ psys_update_path_cache(&sim,(int)cfra);
+ }
+ break;
+ }
+ default:
+ {
+ /* the main dynamic particle system step */
+ system_step(&sim, cfra);
+ break;
+ }
+ }
+ break;
+ }
}
- /* the main particle system step */
- system_step(&sim, cfra);
+ psys->cfra = cfra;
+ psys->recalc = 0;
/* save matrix for duplicators */
invert_m4_m4(psys->imat, ob->obmat);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 7e73f9b23e7..9f0c7289350 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1144,7 +1144,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
if (!BLI_exists(filename)) {
return NULL;
}
- fp = fopen(filename, "rb");
+ fp = fopen(filename, "rb");
} else if (mode==PTCACHE_FILE_WRITE) {
BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */
fp = fopen(filename, "wb");
@@ -1153,13 +1153,13 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
fp = fopen(filename, "rb+");
}
- if (!fp)
- return NULL;
+ if (!fp)
+ return NULL;
pf= MEM_mallocN(sizeof(PTCacheFile), "PTCacheFile");
pf->fp= fp;
- return pf;
+ return pf;
}
static void ptcache_file_close(PTCacheFile *pf)
@@ -2081,9 +2081,8 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
}
if(reset) {
- cache->flag &= ~(PTCACHE_REDO_NEEDED|PTCACHE_SIMULATION_VALID);
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
+ cache->flag &= ~PTCACHE_REDO_NEEDED;
if(pid->type == PTCACHE_TYPE_CLOTH)
cloth_free_modifier(pid->ob, pid->calldata);
@@ -2861,3 +2860,15 @@ void BKE_ptcache_update_info(PTCacheID *pid)
else
sprintf(cache->info, "%s.", mem_info);
}
+
+void BKE_ptcache_validate(PointCache *cache, int framenr)
+{
+ cache->flag |= PTCACHE_SIMULATION_VALID;
+ cache->simframe = framenr;
+}
+void BKE_ptcache_invalidate(PointCache *cache)
+{
+ cache->flag &= ~PTCACHE_SIMULATION_VALID;
+ cache->simframe = 0;
+ cache->last_exact = 0;
+} \ No newline at end of file
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index bc66f4d52d3..e32f5aac517 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -446,18 +446,18 @@ void init_actuator(bActuator *act)
case ACT_VISIBILITY:
act->data= MEM_callocN(sizeof(bVisibilityActuator), "visibility act");
break;
- case ACT_2DFILTER:
- act->data = MEM_callocN(sizeof( bTwoDFilterActuator ), "2d filter act");
- break;
- case ACT_PARENT:
- act->data = MEM_callocN(sizeof( bParentActuator ), "parent act");
- break;
+ case ACT_2DFILTER:
+ act->data = MEM_callocN(sizeof( bTwoDFilterActuator ), "2d filter act");
+ break;
+ case ACT_PARENT:
+ act->data = MEM_callocN(sizeof( bParentActuator ), "parent act");
+ break;
case ACT_STATE:
- act->data = MEM_callocN(sizeof( bStateActuator ), "state act");
- break;
+ act->data = MEM_callocN(sizeof( bStateActuator ), "state act");
+ break;
case ACT_ARMATURE:
- act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act");
- break;
+ act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act");
+ break;
default:
; /* this is very severe... I cannot make any memory for this */
/* logic brick... */
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index df6e0c78661..8f8241baa8e 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -205,17 +205,17 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
/* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations
* are done outside of blenkernel with ED_objects_single_users! */
- /* camera */
+ /* camera */
if(type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) {
- ID_NEW(scen->camera);
+ ID_NEW(scen->camera);
}
/* world */
if(type == SCE_COPY_FULL) {
- if(scen->world) {
- id_us_plus((ID *)scen->world);
- scen->world= copy_world(scen->world);
- }
+ if(scen->world) {
+ id_us_plus((ID *)scen->world);
+ scen->world= copy_world(scen->world);
+ }
}
sound_create_scene(scen);
@@ -238,9 +238,9 @@ void free_scene(Scene *sce)
if(sce->gpd) {
#if 0 // removed since this can be invalid memory when freeing everything
- // since the grease pencil data is free'd before the scene.
- // since grease pencil data is not (yet?), shared between objects
- // its probably safe not to do this, some save and reload will free this.
+ // since the grease pencil data is free'd before the scene.
+ // since grease pencil data is not (yet?), shared between objects
+ // its probably safe not to do this, some save and reload will free this.
sce->gpd->id.us--;
#endif
sce->gpd= NULL;
@@ -431,9 +431,10 @@ Scene *add_scene(char *name)
pset->fade_frames= 2;
pset->selectmode= SCE_SELECT_PATH;
for(a=0; a<PE_TOT_BRUSH; a++) {
- pset->brush[a].strength= 50;
+ pset->brush[a].strength= 0.5;
pset->brush[a].size= 50;
pset->brush[a].step= 10;
+ pset->brush[a].count= 10;
}
pset->brush[PE_BRUSH_CUT].strength= 100;
@@ -627,7 +628,7 @@ int next_object(Scene *scene, int val, Base **base, Object **ob)
fase= F_SCENE;
}
else {
- /* exception: empty scene */
+ /* exception: empty scene */
if(scene->set && scene->set->base.first) {
*base= scene->set->base.first;
*ob= (*base)->object;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 7cabb620085..33c90d1a94e 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -230,9 +230,9 @@ static ImBuf * IMB_cast_away_list(ImBuf * i)
}
static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
+ float facf0, float facf1, int x, int y,
+ struct ImBuf *ibuf1, struct ImBuf *ibuf2,
+ struct ImBuf *ibuf3, struct ImBuf *out)
{
char *cp;
int float_rendering;
@@ -323,7 +323,7 @@ static void do_plugin_effect(Scene *scene, Sequence *seq, int cfra,
}
static int do_plugin_early_out(struct Sequence *seq,
- float facf0, float facf1)
+ float facf0, float facf1)
{
return 0;
}
@@ -348,7 +348,7 @@ static void init_alpha_over_or_under(Sequence * seq)
}
static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
- char * rect1, char *rect2, char *out)
+ char * rect1, char *rect2, char *out)
{
int fac2, mfac, fac, fac4;
int xo, tempc;
@@ -414,7 +414,7 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
}
static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
- float * rect1, float *rect2, float *out)
+ float * rect1, float *rect2, float *out)
{
float fac2, mfac, fac, fac4;
int xo;
@@ -568,8 +568,8 @@ void do_alphaunder_effect_byte(
static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+ float *rect1, float *rect2,
+ float *out)
{
float fac2, mfac, fac, fac4;
int xo;
@@ -763,9 +763,9 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y,
/* carefull: also used by speed effect! */
static void do_cross_effect(Scene *scene, Sequence *seq, int cfra,
- float facf0, float facf1, int x, int y,
- struct ImBuf *ibuf1, struct ImBuf *ibuf2,
- struct ImBuf *ibuf3, struct ImBuf *out)
+ float facf0, float facf1, int x, int y,
+ struct ImBuf *ibuf1, struct ImBuf *ibuf2,
+ struct ImBuf *ibuf3, struct ImBuf *out)
{
if (out->rect_float) {
do_cross_effect_float(
@@ -854,7 +854,7 @@ static float gammaCorrect(float c)
if (i < 0) res = -pow(abs(c), valid_gamma);
else if (i >= RE_GAMMA_TABLE_SIZE ) res = pow(c, valid_gamma);
else res = gamma_range_table[i] +
- ( (c - color_domain_table[i]) * gamfactor_table[i]);
+ ( (c - color_domain_table[i]) * gamfactor_table[i]);
return res;
} /* end of float gammaCorrect(float col) */
@@ -871,7 +871,7 @@ static float invGammaCorrect(float col)
if (i < 0) res = -pow(abs(col), valid_inv_gamma);
else if (i >= RE_GAMMA_TABLE_SIZE) res = pow(col, valid_inv_gamma);
else res = inv_gamma_range_table[i] +
- ( (col - color_domain_table[i]) * inv_gamfactor_table[i]);
+ ( (col - color_domain_table[i]) * inv_gamfactor_table[i]);
return res;
} /* end of float invGammaCorrect(float col) */
@@ -926,10 +926,10 @@ static void free_gammacross(Sequence * seq)
}
static void do_gammacross_effect_byte(float facf0, float facf1,
- int x, int y,
- unsigned char *rect1,
- unsigned char *rect2,
- unsigned char *out)
+ int x, int y,
+ unsigned char *rect1,
+ unsigned char *rect2,
+ unsigned char *out)
{
int fac1, fac2, col;
int xo;
@@ -982,9 +982,9 @@ static void do_gammacross_effect_byte(float facf0, float facf1,
}
static void do_gammacross_effect_float(float facf0, float facf1,
- int x, int y,
- float *rect1, float *rect2,
- float *out)
+ int x, int y,
+ float *rect1, float *rect2,
+ float *out)
{
float fac1, fac2;
int xo;
@@ -1050,8 +1050,8 @@ static void do_gammacross_effect(Scene *scene, Sequence *seq, int cfra,
********************************************************************** */
static void do_add_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
- unsigned char *out)
+ unsigned char *rect1, unsigned char *rect2,
+ unsigned char *out)
{
int col, xo, fac1, fac3;
char *rt1, *rt2, *rt;
@@ -1162,8 +1162,8 @@ static void do_add_effect(Scene *scene, Sequence *seq, int cfra,
********************************************************************** */
static void do_sub_effect_byte(float facf0, float facf1,
- int x, int y,
- char *rect1, char *rect2, char *out)
+ int x, int y,
+ char *rect1, char *rect2, char *out)
{
int col, xo, fac1, fac3;
char *rt1, *rt2, *rt;
@@ -1382,8 +1382,8 @@ static void do_drop_effect(Scene *scene, Sequence *seq, int cfra,
********************************************************************** */
static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
- unsigned char *rect1, unsigned char *rect2,
- unsigned char *out)
+ unsigned char *rect1, unsigned char *rect2,
+ unsigned char *out)
{
int xo, fac1, fac3;
char *rt1, *rt2, *rt;
@@ -1431,8 +1431,8 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
}
static void do_mul_effect_float(float facf0, float facf1, int x, int y,
- float *rect1, float *rect2,
- float *out)
+ float *rect1, float *rect2,
+ float *out)
{
int xo;
float fac1, fac3;
@@ -1611,13 +1611,13 @@ float hyp3,hyp4,b4,b5
output = in_band(wipezone,width,hyp,facf0,1,1);
else
output = in_band(wipezone,width,hyp,facf0,0,1);
- }
+ }
else {
if(b1 < b2)
output = in_band(wipezone,width,hyp,facf0,0,1);
else
output = in_band(wipezone,width,hyp,facf0,1,1);
- }
+ }
break;
case DO_DOUBLE_WIPE:
@@ -1657,50 +1657,50 @@ float hyp3,hyp4,b4,b5
if( hyp < hwidth && hyp2 > hwidth )
output = in_band(wipezone,hwidth,hyp,facf0,1,1);
else if( hyp > hwidth && hyp2 < hwidth )
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
+ output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
else
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
}
if(!wipe->forward)output = 1-output;
- break;
- case DO_CLOCK_WIPE:
- /*
- temp1: angle of effect center in rads
- temp2: angle of line through (halfx,halfy) and (x,y) in rads
- temp3: angle of low side of blur
- temp4: angle of high side of blur
- */
- output = 1.0f - facf0;
- widthf = wipe->edgeWidth*2.0f*(float)M_PI;
- temp1 = 2.0f * (float)M_PI * facf0;
+ break;
+ case DO_CLOCK_WIPE:
+ /*
+ temp1: angle of effect center in rads
+ temp2: angle of line through (halfx,halfy) and (x,y) in rads
+ temp3: angle of low side of blur
+ temp4: angle of high side of blur
+ */
+ output = 1.0f - facf0;
+ widthf = wipe->edgeWidth*2.0f*(float)M_PI;
+ temp1 = 2.0f * (float)M_PI * facf0;
- if(wipe->forward){
- temp1 = 2.0f*(float)M_PI - temp1;
- }
+ if(wipe->forward){
+ temp1 = 2.0f*(float)M_PI - temp1;
+ }
- x = x - halfx;
- y = y - halfy;
-
- temp2 = asin(abs(y)/sqrt(x*x + y*y));
- if(x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
- else if(x<=0 && y <= 0) temp2 += (float)M_PI;
- else if(x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
-
- if(wipe->forward){
- temp3 = temp1-(widthf*0.5f)*facf0;
- temp4 = temp1+(widthf*0.5f)*(1-facf0);
- } else{
- temp3 = temp1-(widthf*0.5f)*(1-facf0);
- temp4 = temp1+(widthf*0.5f)*facf0;
+ x = x - halfx;
+ y = y - halfy;
+
+ temp2 = asin(abs(y)/sqrt(x*x + y*y));
+ if(x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
+ else if(x<=0 && y <= 0) temp2 += (float)M_PI;
+ else if(x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
+
+ if(wipe->forward){
+ temp3 = temp1-(widthf*0.5f)*facf0;
+ temp4 = temp1+(widthf*0.5f)*(1-facf0);
+ } else{
+ temp3 = temp1-(widthf*0.5f)*(1-facf0);
+ temp4 = temp1+(widthf*0.5f)*facf0;
}
- if (temp3 < 0) temp3 = 0;
- if (temp4 > 2.0f*(float)M_PI) temp4 = 2.0f*(float)M_PI;
+ if (temp3 < 0) temp3 = 0;
+ if (temp4 > 2.0f*(float)M_PI) temp4 = 2.0f*(float)M_PI;
- if(temp2 < temp3) output = 0;
- else if (temp2 > temp4) output = 1;
- else output = (temp2-temp3)/(temp4-temp3);
- if(x == 0 && y == 0) output = 1;
+ if(temp2 < temp3) output = 0;
+ else if (temp2 > temp4) output = 1;
+ else output = (temp2-temp3)/(temp4-temp3);
+ if(x == 0 && y == 0) output = 1;
if(output != output) output = 1;
if(wipe->forward) output = 1 - output;
break;
@@ -1735,9 +1735,9 @@ float hyp3,hyp4,b4,b5
if( hyp < hwidth && hyp2 > hwidth )
output = in_band(wipezone,hwidth,hyp,facf0,1,1);
else if( hyp > hwidth && hyp2 < hwidth )
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
+ output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
else
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
}
if(invert)facf0 = 1-facf0;
@@ -1776,11 +1776,11 @@ float hyp3,hyp4,b4,b5
hwidth = width*0.5f;
temp1 = (halfx-(halfx)*facf0);
- pointdist = sqrt(temp1*temp1 + temp1*temp1);
+ pointdist = sqrt(temp1*temp1 + temp1*temp1);
- temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
- if(temp2 > pointdist) output = in_band(wipezone,hwidth,fabs(temp2-pointdist),facf0,0,1);
- else output = in_band(wipezone,hwidth,fabs(temp2-pointdist),facf0,1,1);
+ temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
+ if(temp2 > pointdist) output = in_band(wipezone,hwidth,fabs(temp2-pointdist),facf0,0,1);
+ else output = in_band(wipezone,hwidth,fabs(temp2-pointdist),facf0,1,1);
if(!wipe->forward) output = 1-output;
@@ -1936,14 +1936,14 @@ static void do_wipe_effect(Scene *scene, Sequence *seq, int cfra,
{
if (out->rect_float) {
do_wipe_effect_float(seq,
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ facf0, facf1, x, y,
+ ibuf1->rect_float, ibuf2->rect_float,
+ out->rect_float);
} else {
do_wipe_effect_byte(seq,
- facf0, facf1, x, y,
- (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
- (unsigned char*) out->rect);
+ facf0, facf1, x, y,
+ (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
+ (unsigned char*) out->rect);
}
}
/* **********************************************************************
@@ -2466,8 +2466,8 @@ static void RVAddBitmaps_float (float* a, float* b, float* c,
/* For each pixel whose total luminance exceeds the threshold, */
/* Multiply it's value by BOOST and add it to the output map */
static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
- int width, int height, int threshold,
- float boost, float clamp)
+ int width, int height, int threshold,
+ float boost, float clamp)
{
int x,y,index;
int intensity;
@@ -2475,7 +2475,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
for(y=0;y< height;y++) {
for (x=0;x< width;x++) {
- index= (x+y*width)*4;
+ index= (x+y*width)*4;
/* Isolate the intensity */
intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
@@ -2495,8 +2495,8 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
}
static void RVIsolateHighlights_float (float* in, float* out,
- int width, int height, float threshold,
- float boost, float clamp)
+ int width, int height, float threshold,
+ float boost, float clamp)
{
int x,y,index;
float intensity;
@@ -2504,7 +2504,7 @@ static void RVIsolateHighlights_float (float* in, float* out,
for(y=0;y< height;y++) {
for (x=0;x< width;x++) {
- index= (x+y*width)*4;
+ index= (x+y*width)*4;
/* Isolate the intensity */
intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
@@ -2593,14 +2593,14 @@ static void do_glow_effect(Scene *scene, Sequence *seq, int cfra,
{
if (out->rect_float) {
do_glow_effect_float(seq,
- facf0, facf1, x, y,
- ibuf1->rect_float, ibuf2->rect_float,
- out->rect_float);
+ facf0, facf1, x, y,
+ ibuf1->rect_float, ibuf2->rect_float,
+ out->rect_float);
} else {
do_glow_effect_byte(seq,
- facf0, facf1, x, y,
- (char*) ibuf1->rect, (char*) ibuf2->rect,
- (char*) out->rect);
+ facf0, facf1, x, y,
+ (char*) ibuf1->rect, (char*) ibuf2->rect,
+ (char*) out->rect);
}
}
@@ -2726,7 +2726,7 @@ static void init_speed_effect(Sequence *seq)
if(seq->effectdata) MEM_freeN(seq->effectdata);
seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars),
- "speedcontrolvars");
+ "speedcontrolvars");
v = (SpeedControlVars *)seq->effectdata;
v->globalSpeed = 1.0;
@@ -2807,7 +2807,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
return;
}
if (!seq->seq1) { /* make coverity happy and check for (CID 598)
- input strip ... */
+ input strip ... */
return;
}
@@ -2854,16 +2854,16 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
for (cfra = 1; cfra < v->length; cfra++) {
if(fcu) {
- if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- ctime = seq->startdisp + cfra;
- div = 1.0;
- } else {
- ctime= cfra;
- div= v->length / 100.0f;
- if(div==0.0) return;
- }
+ if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
+ ctime = seq->startdisp + cfra;
+ div = 1.0;
+ } else {
+ ctime= cfra;
+ div= v->length / 100.0f;
+ if(div==0.0) return;
+ }
- facf = evaluate_fcurve(fcu, ctime/div);
+ facf = evaluate_fcurve(fcu, ctime/div);
} else {
facf = fallback_fac;
}
@@ -2885,19 +2885,19 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
for (cfra = 0; cfra < v->length; cfra++) {
if(fcu) {
- if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
- ctime = seq->startdisp + cfra;
- div = 1.0;
- } else {
- ctime= cfra;
- div= v->length / 100.0f;
- if(div==0.0) return;
- }
+ if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) {
+ ctime = seq->startdisp + cfra;
+ div = 1.0;
+ } else {
+ ctime= cfra;
+ div= v->length / 100.0f;
+ if(div==0.0) return;
+ }
- facf = evaluate_fcurve(fcu, ctime / div);
- if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
- facf *= v->length;
- }
+ facf = evaluate_fcurve(fcu, ctime / div);
+ if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
+ facf *= v->length;
+ }
}
if (!fcu) {
@@ -3005,16 +3005,16 @@ static void get_default_fac_fade(struct Sequence *seq, int cfra,
}
static void do_overdrop_effect(Scene *scene, Sequence *seq, int cfra,
- float fac, float facf,
- int x, int y, struct ImBuf * ibuf1,
- struct ImBuf * ibuf2,
- struct ImBuf * ibuf3,
- struct ImBuf * out)
+ float fac, float facf,
+ int x, int y, struct ImBuf * ibuf1,
+ struct ImBuf * ibuf2,
+ struct ImBuf * ibuf3,
+ struct ImBuf * out)
{
do_drop_effect(scene, seq, cfra, fac, facf, x, y,
- ibuf1, ibuf2, ibuf3, out);
+ ibuf1, ibuf2, ibuf3, out);
do_alphaover_effect(scene, seq, cfra, fac, facf, x, y,
- ibuf1, ibuf2, ibuf3, out);
+ ibuf1, ibuf2, ibuf3, out);
}
static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 1309bdf465b..17f6bd10859 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -426,7 +426,7 @@ void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq)
}
static void do_seq_count_cb(ListBase *seqbase, int *totseq,
- int (*test_func)(Sequence * seq))
+ int (*test_func)(Sequence * seq))
{
Sequence *seq;
@@ -444,7 +444,7 @@ static void do_seq_count_cb(ListBase *seqbase, int *totseq,
}
static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
- int (*test_func)(Sequence * seq))
+ int (*test_func)(Sequence * seq))
{
Sequence *seq;
@@ -466,7 +466,7 @@ static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
}
void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
- int (*test_func)(Sequence * seq))
+ int (*test_func)(Sequence * seq))
{
Sequence **tseqar;
@@ -581,7 +581,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq)
new_tstripdata(seq);
if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
- seq->type != SEQ_IMAGE) {
+ seq->type != SEQ_IMAGE) {
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(str, G.sce);
}
@@ -939,7 +939,7 @@ static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se)
se3= se->se3;
if ( (se1==0 || se2==0 || se3==0)
- || (se1->ibuf==0 || se2->ibuf==0 || se3->ibuf==0)) {
+ || (se1->ibuf==0 || se2->ibuf==0 || se3->ibuf==0)) {
make_black_ibuf(se->ibuf);
return;
}
@@ -1056,7 +1056,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra)
se = seq->strip->tstripdata;
if (se == 0 && seq->len > 0) {
se = seq->strip->tstripdata = alloc_tstripdata(seq->len,
- "tstripelems");
+ "tstripelems");
}
nr = give_stripelem_index(seq, cfra);
@@ -1074,7 +1074,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra)
alpha over mode...
*/
if (seq->blend_mode != SEQ_BLEND_REPLACE ||
- (/*seq->ipo && seq->ipo->curve.first &&*/
+ (/*seq->ipo && seq->ipo->curve.first &&*/
(!(seq->type & SEQ_EFFECT) || !seq->seq1))) {
Strip * s = seq->strip;
if (cfra < seq->start) {
@@ -1325,7 +1325,7 @@ static struct ImBuf * seq_proxy_fetch(Scene *scene, Sequence * seq, int cfra, in
#if 0
static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int cfra,
- int build_proxy_run, int render_size);
+ int build_proxy_run, int render_size);
static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int render_size)
{
@@ -1348,7 +1348,7 @@ static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int re
/* that's why it is called custom... */
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
return;
- }
+ }
if (!seq_proxy_get_fname(scene, seq, cfra, name, render_size)) {
return;
@@ -1425,7 +1425,7 @@ static void seq_proxy_rebuild(Scene *scene, Sequence * seq)
sequential order */
if (seq->flag & SEQ_REVERSE_FRAMES) {
for (cfra = seq->enddisp-seq->endstill-1;
- cfra >= seq->startdisp + seq->startstill; cfra--) {
+ cfra >= seq->startdisp + seq->startstill; cfra--) {
TStripElem * tse = give_tstripelem(seq, cfra);
if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
@@ -1439,7 +1439,7 @@ static void seq_proxy_rebuild(Scene *scene, Sequence * seq)
}
} else {
for (cfra = seq->startdisp + seq->startstill;
- cfra < seq->enddisp - seq->endstill; cfra++) {
+ cfra < seq->enddisp - seq->endstill; cfra++) {
TStripElem * tse = give_tstripelem(seq, cfra);
if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
@@ -1499,12 +1499,12 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
}
static void make_cb_table_byte(float lift, float gain, float gamma,
- unsigned char * table, float mul)
+ unsigned char * table, float mul)
{
int y;
for (y = 0; y < 256; y++) {
- float v = 1.0 * y / 255;
+ float v = 1.0 * y / 255;
v *= gain;
v += lift;
v = pow(v, gamma);
@@ -1525,7 +1525,7 @@ static void make_cb_table_float(float lift, float gain, float gamma,
int y;
for (y = 0; y < 256; y++) {
- float v = (float) y * 1.0 / 255.0;
+ float v = (float) y * 1.0 / 255.0;
v *= gain;
v += lift;
v = pow(v, gamma);
@@ -1574,7 +1574,7 @@ static void color_balance_byte_float(Sequence * seq, TStripElem* se, float mul)
for (c = 0; c < 3; c++) {
make_cb_table_float(cb.lift[c], cb.gain[c], cb.gamma[c],
- cb_tab[c], mul);
+ cb_tab[c], mul);
}
for (i = 0; i < 256; i++) {
@@ -1631,8 +1631,8 @@ static void color_balance(Sequence * seq, TStripElem* se, float mul)
- Flip X + Flip Y (could be done afterwards, backward compatibility)
- Promote image to float data (affects pipeline operations afterwards)
- Color balance (is most efficient in the byte -> float
- (future: half -> float should also work fine!)
- case, if done on load, since we can use lookup tables)
+ (future: half -> float should also work fine!)
+ case, if done on load, since we can use lookup tables)
- Premultiply
*/
@@ -1642,13 +1642,13 @@ static int input_have_to_preprocess(Scene *scene, Sequence * seq, TStripElem* se
float mul;
if ((seq->flag & SEQ_FILTERY) ||
- (seq->flag & SEQ_USE_CROP) ||
- (seq->flag & SEQ_USE_TRANSFORM) ||
- (seq->flag & SEQ_FLIPX) ||
- (seq->flag & SEQ_FLIPY) ||
- (seq->flag & SEQ_USE_COLOR_BALANCE) ||
- (seq->flag & SEQ_MAKE_PREMUL) ||
- (se->ibuf->x != seqrectx || se->ibuf->y != seqrecty)) {
+ (seq->flag & SEQ_USE_CROP) ||
+ (seq->flag & SEQ_USE_TRANSFORM) ||
+ (seq->flag & SEQ_FLIPX) ||
+ (seq->flag & SEQ_FLIPY) ||
+ (seq->flag & SEQ_USE_COLOR_BALANCE) ||
+ (seq->flag & SEQ_MAKE_PREMUL) ||
+ (se->ibuf->x != seqrectx || se->ibuf->y != seqrecty)) {
return TRUE;
}
@@ -1703,8 +1703,8 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
}
if (c.top + c.bottom >= se->ibuf->y ||
- c.left + c.right >= se->ibuf->x ||
- t.xofs >= dx || t.yofs >= dy) {
+ c.left + c.right >= se->ibuf->x ||
+ t.xofs >= dx || t.yofs >= dy) {
make_black_ibuf(se->ibuf);
} else {
ImBuf * i;
@@ -1716,9 +1716,9 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
}
IMB_rectcpy(i, se->ibuf,
- t.xofs, t.yofs,
- c.left, c.bottom,
- sx, sy);
+ t.xofs, t.yofs,
+ c.left, c.bottom,
+ sx, sy);
IMB_freeImBuf(se->ibuf);
@@ -1783,7 +1783,7 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
if(se->ibuf->x != seqrectx || se->ibuf->y != seqrecty ) {
if(scene->r.mode & R_OSA) {
IMB_scaleImBuf(se->ibuf,
- (short)seqrectx, (short)seqrecty);
+ (short)seqrectx, (short)seqrecty);
} else {
IMB_scalefastImBuf(se->ibuf,
(short)seqrectx, (short)seqrecty);
@@ -1818,14 +1818,14 @@ static void test_and_auto_discard_ibuf_stills(Strip * strip)
{
if (strip->ibuf_startstill) {
if (!strip->ibuf_startstill->rect &&
- !strip->ibuf_startstill->rect_float) {
+ !strip->ibuf_startstill->rect_float) {
IMB_freeImBuf(strip->ibuf_startstill);
strip->ibuf_startstill = 0;
}
}
if (strip->ibuf_endstill) {
if (!strip->ibuf_endstill->rect &&
- !strip->ibuf_endstill->rect_float) {
+ !strip->ibuf_endstill->rect_float) {
IMB_freeImBuf(strip->ibuf_endstill);
strip->ibuf_endstill = 0;
}
@@ -1841,8 +1841,8 @@ static void copy_from_ibuf_still(Sequence * seq, TStripElem * se)
se->ibuf = IMB_dupImBuf(seq->strip->ibuf_startstill);
}
if (se->nr == seq->len - 1
- && (seq->len != 1)
- && seq->strip->ibuf_endstill) {
+ && (seq->len != 1)
+ && seq->strip->ibuf_endstill) {
IMB_cache_limiter_touch(seq->strip->ibuf_endstill);
se->ibuf = IMB_dupImBuf(seq->strip->ibuf_endstill);
@@ -1938,7 +1938,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
ListBase *seqbasep, int cfra, int chanshown, int render_size);
static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int cfra,
- int build_proxy_run, int render_size)
+ int build_proxy_run, int render_size)
{
char name[FILE_MAXDIR+FILE_MAXFILE];
int use_limiter = TRUE;
@@ -1973,7 +1973,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
se->ibuf = meta_se->ibuf_comp;
if(se->ibuf &&
(!input_have_to_preprocess(scene, seq, se, cfra) ||
- build_proxy_run)) {
+ build_proxy_run)) {
IMB_refImBuf(se->ibuf);
if (build_proxy_run) {
IMB_cache_limiter_unref(se->ibuf);
@@ -2021,9 +2021,9 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
do_effect(scene, cfra, seq, se);
if (input_have_to_preprocess(scene, seq, se, cfra) &&
- !build_proxy_run) {
+ !build_proxy_run) {
if ((se->se1 && (se->ibuf == se->se1->ibuf)) ||
- (se->se2 && (se->ibuf == se->se2->ibuf))) {
+ (se->se2 && (se->ibuf == se->se2->ibuf))) {
struct ImBuf * i
= IMB_dupImBuf(se->ibuf);
@@ -2087,8 +2087,8 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
se->ibuf = IMB_anim_absolute(seq->anim, se->nr + seq->anim_startofs);
/* we don't need both (speed reasons)! */
if (se->ibuf
- && se->ibuf->rect_float
- && se->ibuf->rect) {
+ && se->ibuf->rect_float
+ && se->ibuf->rect) {
imb_freerectImBuf(se->ibuf);
}
@@ -2347,7 +2347,7 @@ static TStripElem* do_handle_speed_effect(Scene *scene, Sequence * seq, int cfra
}
if (cfra_left == cfra_right ||
- (s->flags & SEQ_SPEED_BLEND) == 0) {
+ (s->flags & SEQ_SPEED_BLEND) == 0) {
test_and_auto_discard_ibuf(se);
if (se->ibuf == NULL) {
@@ -2458,8 +2458,8 @@ static int seq_must_swap_input_in_blend_mode(Sequence * seq)
those two effects */
if (seq->blend_mode == SEQ_ALPHAOVER ||
- seq->blend_mode == SEQ_ALPHAUNDER ||
- seq->blend_mode == SEQ_OVERDROP) {
+ seq->blend_mode == SEQ_ALPHAUNDER ||
+ seq->blend_mode == SEQ_OVERDROP) {
swap_input = TRUE;
}
@@ -2495,7 +2495,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
TStripElem* se = 0;
count = get_shown_sequences(seqbasep, cfra, chanshown,
- (Sequence **)&seq_arr);
+ (Sequence **)&seq_arr);
if (!count) {
return 0;
@@ -2519,7 +2519,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
if(count == 1) {
se = do_build_seq_recursively(scene, seq_arr[0],
- cfra, render_size);
+ cfra, render_size);
if (se->ibuf) {
se->ibuf_comp = se->ibuf;
IMB_refImBuf(se->ibuf_comp);
@@ -2632,7 +2632,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
continue;
if (se1->ibuf_comp->rect_float ||
- se2->ibuf->rect_float) {
+ se2->ibuf->rect_float) {
se2->ibuf_comp = IMB_allocImBuf(
(short)seqrectx, (short)seqrecty,
32, IB_rectfloat, 0);
@@ -2644,20 +2644,20 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene,
if (!se1->ibuf_comp->rect_float &&
- se2->ibuf_comp->rect_float) {
+ se2->ibuf_comp->rect_float) {
IMB_float_from_rect(se1->ibuf_comp);
}
if (!se2->ibuf->rect_float &&
- se2->ibuf_comp->rect_float) {
+ se2->ibuf_comp->rect_float) {
IMB_float_from_rect(se2->ibuf);
}
if (!se1->ibuf_comp->rect &&
- !se2->ibuf_comp->rect_float) {
+ !se2->ibuf_comp->rect_float) {
IMB_rect_from_float(se1->ibuf_comp);
}
if (!se2->ibuf->rect &&
- !se2->ibuf_comp->rect_float) {
+ !se2->ibuf_comp->rect_float) {
IMB_rect_from_float(se2->ibuf);
}
@@ -2944,8 +2944,8 @@ static void seq_stop_threads()
seq_thread_shutdown = TRUE;
- pthread_cond_broadcast(&wakeup_cond);
- pthread_mutex_unlock(&wakeup_lock);
+ pthread_cond_broadcast(&wakeup_cond);
+ pthread_mutex_unlock(&wakeup_lock);
for(tslot = running_threads.first; tslot; tslot= tslot->next) {
pthread_join(tslot->pthread, NULL);
@@ -3043,10 +3043,10 @@ ImBuf *give_ibuf_seq_threaded(Scene *scene, int rectx, int recty, int cfra, int
for (e = prefetch_done.first; e; e = e->next) {
if (cfra == e->cfra &&
- chanshown == e->chanshown &&
- rectx == e->rectx &&
- recty == e->recty &&
- render_size == e->render_size) {
+ chanshown == e->chanshown &&
+ rectx == e->rectx &&
+ recty == e->recty &&
+ render_size == e->render_size) {
success = TRUE;
found_something = TRUE;
break;
@@ -3056,10 +3056,10 @@ ImBuf *give_ibuf_seq_threaded(Scene *scene, int rectx, int recty, int cfra, int
if (!e) {
for (e = prefetch_wait.first; e; e = e->next) {
if (cfra == e->cfra &&
- chanshown == e->chanshown &&
- rectx == e->rectx &&
- recty == e->recty &&
- render_size == e->render_size) {
+ chanshown == e->chanshown &&
+ rectx == e->rectx &&
+ recty == e->recty &&
+ render_size == e->render_size) {
found_something = TRUE;
break;
}
@@ -3070,13 +3070,13 @@ ImBuf *give_ibuf_seq_threaded(Scene *scene, int rectx, int recty, int cfra, int
PrefetchThread *tslot;
for(tslot = running_threads.first;
- tslot; tslot= tslot->next) {
+ tslot; tslot= tslot->next) {
if (tslot->current &&
- cfra == tslot->current->cfra &&
- chanshown == tslot->current->chanshown &&
- rectx == tslot->current->rectx &&
- recty == tslot->current->recty &&
- render_size== tslot->current->render_size){
+ cfra == tslot->current->cfra &&
+ chanshown == tslot->current->chanshown &&
+ rectx == tslot->current->rectx &&
+ recty == tslot->current->recty &&
+ render_size== tslot->current->render_size){
found_something = TRUE;
break;
}
@@ -3148,19 +3148,19 @@ static void free_imbuf_seq_except(Scene *scene, int cfra)
TStripElem * curelem = give_tstripelem(seq, cfra);
for(a = 0, se = seq->strip->tstripdata;
- a < seq->strip->len && se; a++, se++) {
+ a < seq->strip->len && se; a++, se++) {
if(se != curelem) {
free_imbuf_strip_elem(se);
}
}
for(a = 0, se = seq->strip->tstripdata_startstill;
- a < seq->strip->startstill && se; a++, se++) {
+ a < seq->strip->startstill && se; a++, se++) {
if(se != curelem) {
free_imbuf_strip_elem(se);
}
}
for(a = 0, se = seq->strip->tstripdata_endstill;
- a < seq->strip->endstill && se; a++, se++) {
+ a < seq->strip->endstill && se; a++, se++) {
if(se != curelem) {
free_imbuf_strip_elem(se);
}
@@ -3219,15 +3219,15 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage)
for(seq= seqbase->first; seq; seq= seq->next) {
if(seq->strip) {
for(a = 0, se = seq->strip->tstripdata;
- a < seq->strip->len && se; a++, se++) {
+ a < seq->strip->len && se; a++, se++) {
free_imbuf_strip_elem(se);
}
for(a = 0, se = seq->strip->tstripdata_startstill;
- a < seq->strip->startstill && se; a++, se++) {
+ a < seq->strip->startstill && se; a++, se++) {
free_imbuf_strip_elem(se);
}
for(a = 0, se = seq->strip->tstripdata_endstill;
- a < seq->strip->endstill && se; a++, se++) {
+ a < seq->strip->endstill && se; a++, se++) {
free_imbuf_strip_elem(se);
}
if(seq->strip->ibuf_startstill) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 69209699a69..00e81063760 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1197,8 +1197,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(cache_result == PTCACHE_READ_EXACT)
{
- cache->flag |= PTCACHE_SIMULATION_VALID;
- cache->simframe= framenr;
+ BKE_ptcache_validate(cache, framenr);
if(sds->wt)
{
@@ -1206,8 +1205,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(cache_result_wt == PTCACHE_READ_EXACT)
{
- cache_wt->flag |= PTCACHE_SIMULATION_VALID;
- cache_wt->simframe= framenr;
+ BKE_ptcache_validate(cache_wt, framenr);
}
}
return;
@@ -1223,8 +1221,6 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
/* do simulation */
// low res
- cache->flag |= PTCACHE_SIMULATION_VALID;
- cache->simframe= framenr;
// simulate the actual smoke (c++ code in intern/smoke)
// DG: interesting commenting this line + deactivating loading of noise files
@@ -1239,6 +1235,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(get_lamp(scene, light))
smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
+ BKE_ptcache_validate(cache, framenr);
BKE_ptcache_write_cache(&pid, framenr);
if(sds->wt)
@@ -1250,8 +1247,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
smoke_turbulence_step(sds->wt, sds->fluid);
}
- cache_wt->flag |= PTCACHE_SIMULATION_VALID;
- cache_wt->simframe= framenr;
+ BKE_ptcache_validate(cache_wt, framenr);
BKE_ptcache_write_cache(&pid_wt, framenr);
}
@@ -1283,11 +1279,11 @@ long long smoke_get_mem_req(int xres, int yres, int zres, int amplify)
// print out memory requirements
long long int coarseSize = sizeof(float) * totalCells * 22 +
- sizeof(unsigned char) * totalCells;
+ sizeof(unsigned char) * totalCells;
long long int fineSize = sizeof(float) * amplifiedCells * 7 + // big grids
- sizeof(float) * totalCells * 8 + // small grids
- sizeof(float) * 128 * 128 * 128; // noise tile
+ sizeof(float) * totalCells * 8 + // small grids
+ sizeof(float) * 128 * 128 * 128; // noise tile
long long int totalMB = (coarseSize + fineSize) / (1024 * 1024);
@@ -1296,83 +1292,83 @@ long long smoke_get_mem_req(int xres, int yres, int zres, int amplify)
static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, float *tRay, bresenham_callback cb, float *result, float *input, int res[3], float correct)
{
- int dx, dy, dz, i, l, m, n, x_inc, y_inc, z_inc, err_1, err_2, dx2, dy2, dz2;
- int pixel[3];
-
- pixel[0] = x1;
- pixel[1] = y1;
- pixel[2] = z1;
-
- dx = x2 - x1;
- dy = y2 - y1;
- dz = z2 - z1;
-
- x_inc = (dx < 0) ? -1 : 1;
- l = abs(dx);
- y_inc = (dy < 0) ? -1 : 1;
- m = abs(dy);
- z_inc = (dz < 0) ? -1 : 1;
- n = abs(dz);
- dx2 = l << 1;
- dy2 = m << 1;
- dz2 = n << 1;
-
- if ((l >= m) && (l >= n)) {
- err_1 = dy2 - l;
- err_2 = dz2 - l;
- for (i = 0; i < l; i++) {
- if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
- break;
- if (err_1 > 0) {
- pixel[1] += y_inc;
- err_1 -= dx2;
- }
- if (err_2 > 0) {
- pixel[2] += z_inc;
- err_2 -= dx2;
- }
- err_1 += dy2;
- err_2 += dz2;
- pixel[0] += x_inc;
- }
- } else if ((m >= l) && (m >= n)) {
- err_1 = dx2 - m;
- err_2 = dz2 - m;
- for (i = 0; i < m; i++) {
- if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
- break;
- if (err_1 > 0) {
- pixel[0] += x_inc;
- err_1 -= dy2;
- }
- if (err_2 > 0) {
- pixel[2] += z_inc;
- err_2 -= dy2;
- }
- err_1 += dx2;
- err_2 += dz2;
- pixel[1] += y_inc;
- }
- } else {
- err_1 = dy2 - n;
- err_2 = dx2 - n;
- for (i = 0; i < n; i++) {
- if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
- break;
- if (err_1 > 0) {
- pixel[1] += y_inc;
- err_1 -= dz2;
- }
- if (err_2 > 0) {
- pixel[0] += x_inc;
- err_2 -= dz2;
- }
- err_1 += dy2;
- err_2 += dx2;
- pixel[2] += z_inc;
- }
- }
- cb(result, input, res, pixel, tRay, correct);
+ int dx, dy, dz, i, l, m, n, x_inc, y_inc, z_inc, err_1, err_2, dx2, dy2, dz2;
+ int pixel[3];
+
+ pixel[0] = x1;
+ pixel[1] = y1;
+ pixel[2] = z1;
+
+ dx = x2 - x1;
+ dy = y2 - y1;
+ dz = z2 - z1;
+
+ x_inc = (dx < 0) ? -1 : 1;
+ l = abs(dx);
+ y_inc = (dy < 0) ? -1 : 1;
+ m = abs(dy);
+ z_inc = (dz < 0) ? -1 : 1;
+ n = abs(dz);
+ dx2 = l << 1;
+ dy2 = m << 1;
+ dz2 = n << 1;
+
+ if ((l >= m) && (l >= n)) {
+ err_1 = dy2 - l;
+ err_2 = dz2 - l;
+ for (i = 0; i < l; i++) {
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ break;
+ if (err_1 > 0) {
+ pixel[1] += y_inc;
+ err_1 -= dx2;
+ }
+ if (err_2 > 0) {
+ pixel[2] += z_inc;
+ err_2 -= dx2;
+ }
+ err_1 += dy2;
+ err_2 += dz2;
+ pixel[0] += x_inc;
+ }
+ } else if ((m >= l) && (m >= n)) {
+ err_1 = dx2 - m;
+ err_2 = dz2 - m;
+ for (i = 0; i < m; i++) {
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ break;
+ if (err_1 > 0) {
+ pixel[0] += x_inc;
+ err_1 -= dy2;
+ }
+ if (err_2 > 0) {
+ pixel[2] += z_inc;
+ err_2 -= dy2;
+ }
+ err_1 += dx2;
+ err_2 += dz2;
+ pixel[1] += y_inc;
+ }
+ } else {
+ err_1 = dy2 - n;
+ err_2 = dx2 - n;
+ for (i = 0; i < n; i++) {
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ break;
+ if (err_1 > 0) {
+ pixel[1] += y_inc;
+ err_1 -= dz2;
+ }
+ if (err_2 > 0) {
+ pixel[0] += x_inc;
+ err_2 -= dz2;
+ }
+ err_1 += dy2;
+ err_2 += dx2;
+ pixel[2] += z_inc;
+ }
+ }
+ cb(result, input, res, pixel, tRay, correct);
}
static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct)
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index af40d9be643..e6f500aab15 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -123,7 +123,7 @@ typedef struct SBScratch {
typedef struct SB_thread_context {
Scene *scene;
- Object *ob;
+ Object *ob;
float forcetime;
float timenow;
int ifirst;
@@ -191,7 +191,7 @@ static float sb_time_scale(Object *ob)
/*hrms .. this could be IPO as well :)
estimated range [0.001 sluggish slug - 100.0 very fast (i hope ODE solver can handle that)]
1 approx = a unit 1 pendulum at g = 9.8 [earth conditions] has period 65 frames
- theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM)
+ theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM)
*/
}
return (1.0f);
@@ -280,7 +280,7 @@ typedef struct ccd_Mesh {
static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
{
- ccd_Mesh *pccd_M = NULL;
+ ccd_Mesh *pccd_M = NULL;
ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
@@ -299,17 +299,17 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
pccd_M->mprevvert=NULL;
- /* blow it up with forcefield ranges */
+ /* blow it up with forcefield ranges */
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
/* alloc and copy verts*/
pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
+ /* ah yeah, put the verices to global coords once */
/* and determine the ortho BB on the fly */
for(i=0; i < pccd_M->totvert; i++){
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -321,10 +321,10 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
}
/* alloc and copy faces*/
- pccd_M->mface = dm->dupFaceArray(dm);
+ pccd_M->mface = dm->dupFaceArray(dm);
/* OBBs for idea1 */
- pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
+ pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
mima = pccd_M->mima;
mface = pccd_M->mface;
@@ -334,7 +334,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- VECCOPY(v,pccd_M->mvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -342,7 +342,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -377,7 +377,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob, DerivedMesh *dm)
}
static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
{
- ccdf_minmax *mima =NULL;
+ ccdf_minmax *mima =NULL;
MFace *mface=NULL;
float v[3],hull;
int i;
@@ -393,20 +393,20 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
- /* blow it up with forcefield ranges */
+ /* blow it up with forcefield ranges */
hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
/* rotate current to previous */
if(pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
- pccd_M->mprevvert = pccd_M->mvert;
+ pccd_M->mprevvert = pccd_M->mvert;
/* alloc and copy verts*/
- pccd_M->mvert = dm->dupVertArray(dm);
- /* ah yeah, put the verices to global coords once */
+ pccd_M->mvert = dm->dupVertArray(dm);
+ /* ah yeah, put the verices to global coords once */
/* and determine the ortho BB on the fly */
for(i=0; i < pccd_M->totvert; i++){
mul_m4_v3(ob->obmat, pccd_M->mvert[i].co);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -416,7 +416,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
- /* evaluate limits */
+ /* evaluate limits */
VECCOPY(v,pccd_M->mprevvert[i].co);
pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
@@ -437,7 +437,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- VECCOPY(v,pccd_M->mvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -445,7 +445,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -472,7 +472,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
}
- VECCOPY(v,pccd_M->mprevvert[mface->v1].co);
+ VECCOPY(v,pccd_M->mprevvert[mface->v1].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -480,7 +480,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M, DerivedMesh *dm)
mima->maxy = MAX2(mima->maxy,v[1]+hull);
mima->maxz = MAX2(mima->maxz,v[2]+hull);
- VECCOPY(v,pccd_M->mprevvert[mface->v2].co);
+ VECCOPY(v,pccd_M->mprevvert[mface->v2].co);
mima->minx = MIN2(mima->minx,v[0]-hull);
mima->miny = MIN2(mima->miny,v[1]-hull);
mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -667,7 +667,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
}
}
- /* now we can announce new springs */
+ /* now we can announce new springs */
ob->soft->totspring += nofquads *2;
}
}
@@ -703,7 +703,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
}
else {printf("oops we should not get here - add_2nd_order_springs");}
}
- if (bpo){/* so now we have a 2nd order humpdidump */
+ if (bpo){/* so now we have a 2nd order humpdidump */
for(c=bpo->nofsprings;c>0;c--){
bs2 = sb->bspring + bpo->springs[c-1];
if ((bs2->v1 != notthis) && (bs2->v1 > v0)){
@@ -711,7 +711,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
if (addsprings){
bs3->v1= v0;
bs3->v2= bs2->v1;
- bs3->springtype =SB_BEND;
+ bs3->springtype =SB_BEND;
bs3++;
}
}
@@ -720,7 +720,7 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
if (addsprings){
bs3->v1= v0;
bs3->v2= bs2->v2;
- bs3->springtype =SB_BEND;
+ bs3->springtype =SB_BEND;
bs3++;
}
@@ -1039,7 +1039,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1068,7 +1068,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye
}
/* so now we have the 2 boxes overlapping */
- /* forces actually not used */
+ /* forces actually not used */
deflected = 2;
}
@@ -1114,7 +1114,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1205,7 +1205,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1396,11 +1396,11 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
for(a=0; a<sb->scratch->totface; a++, bf++) {
if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT))
{
- sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
- sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
+ sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
+ sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
if (bf->v4){
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
}
}
}
@@ -1433,7 +1433,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1583,7 +1583,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
add_v3_v3v3(bs->ext_force,bs->ext_force,feedback);
bs->flag |= BSF_INTERSECT;
//bs->cf=damp;
- bs->cf=sb->choke*0.01f;
+ bs->cf=sb->choke*0.01f;
}
}
@@ -1690,8 +1690,8 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
- sb_threads[i].do_deflector = 0;// not used here
+ sb_threads[i].do_effector = do_effector;
+ sb_threads[i].do_deflector = 0;// not used here
sb_threads[i].fieldfactor = 0.0f;// not used here
sb_threads[i].windfactor = 0.0f;// not used here
sb_threads[i].nr= i;
@@ -1707,7 +1707,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
}
else
exec_scan_for_ext_spring_forces(&sb_threads[0]);
- /* clean up */
+ /* clean up */
MEM_freeN(sb_threads);
pdEndEffectors(&do_effector);
@@ -1722,7 +1722,7 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
int winner =1;
mindist = ABS(dot_v3v3(pos,a));
- cp = ABS(dot_v3v3(pos,b));
+ cp = ABS(dot_v3v3(pos,b));
if ( mindist < cp ){
mindist = cp;
winner =2;
@@ -1751,7 +1751,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
GHash *hash;
GHashIterator *ihash;
float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3],d_nvect[3], dv1[3],ve[3],avel[3]={0.0,0.0,0.0},
- vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
+ vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
outerforceaccu[3],innerforceaccu[3],
facedist,n_mag,force_mag_norm,minx,miny,minz,maxx,maxy,maxz,
innerfacethickness = -0.5f, outerfacethickness = 0.2f,
@@ -1764,7 +1764,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
outerforceaccu[0]=outerforceaccu[1]=outerforceaccu[2]=0.0f;
innerforceaccu[0]=innerforceaccu[1]=innerforceaccu[2]=0.0f;
/* go */
- while (!BLI_ghashIterator_isDone(ihash) ) {
+ while (!BLI_ghashIterator_isDone(ihash) ) {
ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash);
ob = BLI_ghashIterator_getKey (ihash);
@@ -1815,7 +1815,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
fa = (ff*outerfacethickness-outerfacethickness);
fa *= fa;
fa = 1.0f/fa;
- avel[0]=avel[1]=avel[2]=0.0f;
+ avel[0]=avel[1]=avel[2]=0.0f;
/* use mesh*/
while (a--) {
if (
@@ -1938,7 +1938,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
VECADD(avel,avel,ve);
cavel ++;
}
- *intrusion += facedist;
+ *intrusion += facedist;
ci++;
}
@@ -1948,7 +1948,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
float dist;
closest_to_line_segment_v3(ve, opco, nv1, nv2);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -1957,7 +1957,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
closest_to_line_segment_v3(ve, opco, nv2, nv3);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -1966,7 +1966,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
closest_to_line_segment_v3(ve, opco, nv3, nv1);
- VECSUB(ve,opco,ve);
+ VECSUB(ve,opco,ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )){
VECCOPY(coledge,ve);
@@ -2181,11 +2181,11 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* intitialize */
if (sb) {
/* check conditions for various options */
- /* +++ could be done on object level to squeeze out the last bits of it */
+ /* +++ could be done on object level to squeeze out the last bits of it */
do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL);
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
- /* --- could be done on object level to squeeze out the last bits of it */
+ /* --- could be done on object level to squeeze out the last bits of it */
}
else {
printf("Error expected a SB here \n");
@@ -2207,14 +2207,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* naive ball self collision */
/* needs to be done if goal snaps or not */
if(do_selfcollision){
- int attached;
+ int attached;
BodyPoint *obp;
BodySpring *bs;
int c,b;
float velcenter[3],dvel[3],def[3];
float distance;
float compare;
- float bstune = sb->ballstiff;
+ float bstune = sb->ballstiff;
for(c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
compare = (obp->colball + bp->colball);
@@ -2222,7 +2222,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* rather check the AABBoxes before ever calulating the real distance */
/* mathematically it is completly nuts, but performace is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
- distance = normalize_v3(def);
+ distance = normalize_v3(def);
if (distance < compare ){
/* exclude body points attached with a spring */
attached = 0;
@@ -2363,7 +2363,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->choke = bs->cf;
}
- // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
+ // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
sb_spring_force(ob,ilast-bb,bs,iks,forcetime,0);
}/* loop springs */
}/* existing spring list */
@@ -2377,7 +2377,7 @@ return 0; /*done fine*/
static void *exec_softbody_calc_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
- _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
+ _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
return 0;
}
@@ -2398,7 +2398,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
totthread--;
}
- /* printf("sb_cf_threads_run spawning %d threads \n",totthread); */
+ /* printf("sb_cf_threads_run spawning %d threads \n",totthread); */
sb_threads= MEM_callocN(sizeof(SB_thread_context)*totthread, "SBThread");
memset(sb_threads, 0, sizeof(SB_thread_context)*totthread);
@@ -2416,8 +2416,8 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
- sb_threads[i].do_deflector = do_deflector;
+ sb_threads[i].do_effector = do_effector;
+ sb_threads[i].do_deflector = do_deflector;
sb_threads[i].fieldfactor = fieldfactor;
sb_threads[i].windfactor = windfactor;
sb_threads[i].nr= i;
@@ -2435,7 +2435,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
}
else
exec_softbody_calc_forces(&sb_threads[0]);
- /* clean up */
+ /* clean up */
MEM_freeN(sb_threads);
}
@@ -2904,12 +2904,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
float maxerrpos= 0.0f,maxerrvel = 0.0f;
int a,fuzzy=0;
- forcetime *= sb_time_scale(ob);
+ forcetime *= sb_time_scale(ob);
- aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
- aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
+ aabbmin[0]=aabbmin[1]=aabbmin[2] = 1e20f;
+ aabbmax[0]=aabbmax[1]=aabbmax[2] = -1e20f;
- /* old one with homogenous masses */
+ /* old one with homogenous masses */
/* claim a minimum mass for vertex */
/*
if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass;
@@ -2920,11 +2920,11 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* now we have individual masses */
/* claim a minimum mass for vertex */
if (_final_mass(ob,bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob,bp);
- else timeovermass = forcetime/0.009999f;
+ else timeovermass = forcetime/0.009999f;
if(_final_goal(ob,bp) < SOFTGOALSNAP){
- /* this makes t~ = t */
+ /* this makes t~ = t */
if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec);
/* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces + more forces*/
@@ -2952,7 +2952,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
}
else {VECADD(bp->vec, bp->vec, bp->force);}
- /* this makes t~ = t+dt */
+ /* this makes t~ = t+dt */
if(!(mid_flags & MID_PRESERVE)) VECCOPY(dx,bp->vec);
/* so here is (x)'= v(elocity) */
@@ -2969,7 +2969,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
bp->frozen =MIN2(bp->frozen*1.05f,1.0f);
}
mul_v3_fl(dx,bp->frozen);
- */
+ */
/* again some nasty if's to have heun in here too */
if (mode ==1){
VECCOPY(bp->prevpos,bp->pos);
@@ -3102,12 +3102,12 @@ static void softbody_swap_state(Object *ob,float *ppos,float *pvel)
VECCOPY(temp, bp->vec);
VECCOPY(bp->vec,pv);
- VECCOPY(pv,temp);
+ VECCOPY(pv,temp);
pv+=3;
VECCOPY(temp, bp->pos);
VECCOPY(bp->pos,pp);
- VECCOPY(pp,temp);
+ VECCOPY(pp,temp);
pp+=3;
}
}
@@ -3185,7 +3185,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
/* ************ convertors ********** */
/* for each object type we need;
- - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry
+ - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry
*/
static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex, float *target)
@@ -3294,7 +3294,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* this is where '2.5 every thing is animateable' goes wrong in the first place jow_go_for2_5 */
/* 1st coding action to take : move this to frame level */
/* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */
- /* should be fixed for meshes */
+ /* should be fixed for meshes */
// bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */
}
else{
@@ -3358,7 +3358,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
build_bps_springlist(ob); /* yes we need to do it again*/
}
springs_from_mesh(ob); /* write the 'rest'-lenght of the springs */
- if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
+ if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
}
@@ -3515,7 +3515,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
if (ob->softflag & OB_SB_EDGES){
totspring = ((lt->pntsu -1) * lt->pntsv
- + (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+ + (lt->pntsv -1) * lt->pntsu) * lt->pntsw
+lt->pntsu*lt->pntsv*(lt->pntsw -1);
if (ob->softflag & OB_SB_QUADS){
totspring += 4*(lt->pntsu -1) * (lt->pntsv -1) * (lt->pntsw-1);
@@ -4058,17 +4058,13 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
/* check for changes in mesh, should only happen in case the mesh
* structure changes during an animation */
if(sb->bpoint && numVerts != sb->totpoint) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return;
}
/* clamp frame ranges */
if(framenr < startframe) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- //cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return;
}
else if(framenr > endframe) {
@@ -4101,8 +4097,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
/* continue physics special case */
if(BKE_ptcache_get_continue_physics()) {
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
+ BKE_ptcache_invalidate(cache);
/* do simulation */
dtime = timescale;
softbody_update_positions(ob, sb, vertexCos, numVerts);
@@ -4115,14 +4110,13 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
if(sb->totpoint==0) {
return;
}
- if(framenr == startframe) {
+ if(framenr == startframe) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
/* first frame, no simulation to do, just set the positions */
softbody_update_positions(ob, sb, vertexCos, numVerts);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
return;
}
@@ -4133,8 +4127,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
softbody_to_object(ob, vertexCos, numVerts, sb->local);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_write_cache(&pid, framenr);
@@ -4142,13 +4135,11 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
return;
}
else if(cache_result==PTCACHE_READ_OLD) {
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ ; /* do nothing */
}
else if(ob->id.lib || (cache->flag & PTCACHE_BAKED)) {
/* if baked and nothing in cache, do nothing */
- cache->flag &= ~PTCACHE_SIMULATION_VALID;
- cache->simframe= 0;
- cache->last_exact= 0;
+ BKE_ptcache_invalidate(cache);
return;
}
@@ -4166,8 +4157,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
softbody_to_object(ob, vertexCos, numVerts, 0);
- cache->simframe= framenr;
- cache->flag |= PTCACHE_SIMULATION_VALID;
+ BKE_ptcache_validate(cache, framenr);
BKE_ptcache_write_cache(&pid, framenr);
}
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index c5c3ae0f022..9078566f109 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -42,11 +42,12 @@
#include "DNA_scene_types.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
+#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
+#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
@@ -374,7 +375,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
/* face weighting */
static void calc_ss_weights(int gridFaces,
- FaceVertWeight **qweight, FaceVertWeight **tweight)
+ FaceVertWeight **qweight, FaceVertWeight **tweight)
{
FaceVertWeight *qw, *tw;
int x, y, j;
@@ -417,7 +418,7 @@ static void calc_ss_weights(int gridFaces,
}
static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
- float (*vertexCos)[3], int useFlatSubdiv)
+ float (*vertexCos)[3], int useFlatSubdiv)
{
float creaseFactor = (float) ccgSubSurf_getSubdivisionLevels(ss);
CCGVertHDL fVerts[4];
@@ -456,10 +457,10 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
float crease;
crease = useFlatSubdiv ? creaseFactor :
- me->crease * creaseFactor / 255.0f;
+ me->crease * creaseFactor / 255.0f;
ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(me->v1),
- SET_INT_IN_POINTER(me->v2), crease, &e);
+ SET_INT_IN_POINTER(me->v2), crease, &e);
((int*)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index)? *index++: i;
}
@@ -479,7 +480,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
// other parts of code significantly to handle missing faces.
// since this really shouldn't even be possible we just bail.
if(ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), fVerts[3] ? 4 : 3,
- fVerts, &f) == eCCGError_InvalidValue) {
+ fVerts, &f) == eCCGError_InvalidValue) {
static int hasGivenError = 0;
if(!hasGivenError) {
@@ -852,7 +853,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
MEdge *med = &medge[i];
if(ccgdm->drawInteriorEdges)
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize);
i++;
@@ -864,20 +865,20 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
med = &medge[i];
if(ccgdm->drawInteriorEdges)
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, x, y,
- edgeSize, gridSize);
+ edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, S, x, y + 1,
- edgeSize, gridSize);
+ edgeSize, gridSize);
i++;
med = &medge[i];
if(ccgdm->drawInteriorEdges)
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ med->flag = ME_EDGEDRAW | ME_EDGERENDER;
med->v1 = getFaceIndex(ss, f, S, y, x,
- edgeSize, gridSize);
+ edgeSize, gridSize);
med->v2 = getFaceIndex(ss, f, S, y + 1, x,
- edgeSize, gridSize);
+ edgeSize, gridSize);
i++;
}
}
@@ -896,7 +897,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
if(edgeFlags) {
if(edgeIdx != -1) {
flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP))
- | ME_EDGEDRAW | ME_EDGERENDER;
+ | ME_EDGEDRAW | ME_EDGERENDER;
}
} else {
flags |= ME_EDGEDRAW | ME_EDGERENDER;
@@ -935,13 +936,13 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
for(x = 0; x < gridSize - 1; x++) {
MFace *mf = &mface[i];
mf->v1 = getFaceIndex(ss, f, S, x + 0, y + 0,
- edgeSize, gridSize);
+ edgeSize, gridSize);
mf->v2 = getFaceIndex(ss, f, S, x + 0, y + 1,
- edgeSize, gridSize);
+ edgeSize, gridSize);
mf->v3 = getFaceIndex(ss, f, S, x + 1, y + 1,
- edgeSize, gridSize);
+ edgeSize, gridSize);
mf->v4 = getFaceIndex(ss, f, S, x + 1, y + 0,
- edgeSize, gridSize);
+ edgeSize, gridSize);
mf->mat_nr = mat_nr;
mf->flag = flag;
@@ -1114,7 +1115,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
ccgFaceIterator_free(fi);
glEnd();
}
-static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) {
+static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
@@ -1219,7 +1220,7 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
{
- if(ccgdm->pbvh) {
+ if(ccgdm->pbvh && ccgdm->multires.mmd) {
CCGFace **faces;
int totface;
@@ -1250,7 +1251,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
return;
glShadeModel((faceFlags[0] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT);
- BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL);
+ BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, (faceFlags[0] & ME_SMOOTH));
glShadeModel(GL_FLAT);
}
@@ -1767,8 +1768,8 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u
if (draw) {
if (draw==2) {
- glEnable(GL_POLYGON_STIPPLE);
- glPolygonStipple(stipple_quarttone);
+ glEnable(GL_POLYGON_STIPPLE);
+ glPolygonStipple(stipple_quarttone);
}
for (S=0; S<numVerts; S++) {
@@ -1935,12 +1936,13 @@ static void ccgDM_release(DerivedMesh *dm) {
ccgdm->multires.update(dm);
}
- if(ccgdm->pbvh) BLI_pbvh_free(ccgdm->pbvh);
if(ccgdm->gridFaces) MEM_freeN(ccgdm->gridFaces);
if(ccgdm->gridData) MEM_freeN(ccgdm->gridData);
if(ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency);
if(ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset);
if(ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss);
+ if(ccgdm->fmap) MEM_freeN(ccgdm->fmap);
+ if(ccgdm->fmap_mem) MEM_freeN(ccgdm->fmap_mem);
MEM_freeN(ccgdm->edgeFlags);
MEM_freeN(ccgdm->faceFlags);
MEM_freeN(ccgdm->vertMap);
@@ -2185,11 +2187,35 @@ static int *ccgDM_getGridOffset(DerivedMesh *dm)
return ccgdm->gridOffset;
}
+static ListBase *ccgDM_getFaceMap(Object *ob, DerivedMesh *dm)
+{
+ CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+
+ if(!ccgdm->multires.mmd && !ccgdm->fmap && ob->type == OB_MESH) {
+ Mesh *me= ob->data;
+
+ create_vert_face_map(&ccgdm->fmap, &ccgdm->fmap_mem, me->mface,
+ me->totvert, me->totface);
+ }
+
+ return ccgdm->fmap;
+}
+
static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
int gridSize, numGrids;
+ if(!ob) {
+ ccgdm->pbvh= NULL;
+ return NULL;
+ }
+
+ if(!ob->sculpt)
+ return NULL;
+ if(ob->sculpt->pbvh)
+ ccgdm->pbvh= ob->sculpt->pbvh;
+
if(ccgdm->pbvh)
return ccgdm->pbvh;
@@ -2199,25 +2225,25 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
gridSize = ccgDM_getGridSize(dm);
numGrids = ccgDM_getNumGrids(dm);
- ccgdm->pbvh = BLI_pbvh_new();
+ ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
numGrids, gridSize, (void**)ccgdm->gridFaces);
}
else if(ob->type == OB_MESH) {
Mesh *me= ob->data;
- ccgdm->pbvh = BLI_pbvh_new();
+ ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
BLI_pbvh_build_mesh(ccgdm->pbvh, me->mface, me->mvert,
- me->totface, me->totvert);
+ me->totface, me->totvert);
}
return ccgdm->pbvh;
}
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
- int drawInteriorEdges,
- int useSubsurfUv,
- DerivedMesh *dm)
+ int drawInteriorEdges,
+ int useSubsurfUv,
+ DerivedMesh *dm)
{
CCGDerivedMesh *ccgdm = MEM_callocN(sizeof(*ccgdm), "ccgdm");
CCGVertIterator *vi;
@@ -2265,6 +2291,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
ccgdm->dm.getGridData = ccgDM_getGridData;
ccgdm->dm.getGridAdjacency = ccgDM_getGridAdjacency;
ccgdm->dm.getGridOffset = ccgDM_getGridOffset;
+ ccgdm->dm.getFaceMap = ccgDM_getFaceMap;
ccgdm->dm.getPBVH = ccgDM_getPBVH;
ccgdm->dm.getVertCos = ccgdm_getVertCos;
@@ -2365,7 +2392,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
}
DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, weight[0][0],
- numVerts, vertNum);
+ numVerts, vertNum);
++vertNum;
for(S = 0; S < numVerts; S++) {
@@ -2379,7 +2406,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
w[nextS] = weight[x][0][2];
w[otherS] = weight[x][0][3];
DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w,
- numVerts, vertNum);
+ numVerts, vertNum);
++vertNum;
}
}
@@ -2396,7 +2423,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
w[nextS] = weight[y * gridFaces + x][0][2];
w[otherS] = weight[y * gridFaces + x][0][3];
DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w,
- numVerts, vertNum);
+ numVerts, vertNum);
++vertNum;
}
}
@@ -2422,7 +2449,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
}
DM_interp_face_data(dm, &ccgdm->dm, &origIndex, NULL,
- &w, 1, faceNum);
+ &w, 1, faceNum);
weight++;
++faceNum;
@@ -2505,10 +2532,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
/***/
struct DerivedMesh *subsurf_make_derived_from_derived(
- struct DerivedMesh *dm,
- struct SubsurfModifierData *smd,
- int useRenderParams, float (*vertCos)[3],
- int isFinalCalc, int editMode)
+ struct DerivedMesh *dm,
+ struct SubsurfModifierData *smd,
+ int useRenderParams, float (*vertCos)[3],
+ int isFinalCalc, int editMode)
{
int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF;
int useAging = smd->flags & eSubsurfModifierFlag_DebugIncr;
@@ -2520,12 +2547,12 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
smd->emCache = _getSubSurf(smd->emCache, levels, useAging, 0,
- useSimple);
+ useSimple);
ss_sync_from_derivedmesh(smd->emCache, dm, vertCos, useSimple);
result = getCCGDerivedMesh(smd->emCache,
- drawInteriorEdges,
- useSubsurfUv, dm);
+ drawInteriorEdges,
+ useSubsurfUv, dm);
} else if(useRenderParams) {
/* Do not use cache in render mode. */
CCGSubSurf *ss;
@@ -2563,13 +2590,13 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if(useIncremental && isFinalCalc) {
smd->mCache = ss = _getSubSurf(smd->mCache, levels,
- useAging, 0, useSimple);
+ useAging, 0, useSimple);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
result = getCCGDerivedMesh(smd->mCache,
- drawInteriorEdges,
- useSubsurfUv, dm);
+ drawInteriorEdges,
+ useSubsurfUv, dm);
} else {
if (smd->mCache && isFinalCalc) {
ccgSubSurf_free(smd->mCache);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index a0908529a3a..98ff0b2da1a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -184,7 +184,7 @@ Text *add_empty_text(char *name)
ta->name= NULL;
- init_undo_text(ta);
+ init_undo_text(ta);
ta->nlines=1;
ta->flags= TXT_ISDIRTY | TXT_ISMEM;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 0a3f46b617e..48f819a7091 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -643,9 +643,9 @@ void make_local_texture(Tex *tex)
int a, local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(tex->id.lib==0) return;
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 0ac8b14166d..1e1e41a07e7 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -135,9 +135,9 @@ void make_local_world(World *wrld)
int local=0, lib=0;
/* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
+ * - only local users: set flag
+ * - mixed: make copy
+ */
if(wrld->id.lib==0) return;
if(wrld->id.us==1) {
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index ccef6832be8..ff6ebcc487f 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -206,7 +206,7 @@ static const char** get_file_extensions(int format)
}
case FFMPEG_MPEG2: {
static const char * rv[] = { ".dvd", ".vob", ".mpg", ".mpeg",
- NULL };
+ NULL };
return rv;
}
case FFMPEG_MPEG4: {
@@ -271,7 +271,7 @@ static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports
}
outsize = avcodec_encode_video(c, video_buffer, video_buffersize,
- frame);
+ frame);
if (outsize != 0) {
AVPacket packet;
av_init_packet(&packet);
@@ -446,7 +446,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
/* prepare a video stream for the output file */
static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContext* of,
- int rectx, int recty)
+ int rectx, int recty)
{
AVStream* st;
AVCodecContext* c;
@@ -552,7 +552,7 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
video_buffersize = 2000000;
video_buffer = (uint8_t*)MEM_mallocN(video_buffersize,
- "FFMPEG video buffer");
+ "FFMPEG video buffer");
current_frame = alloc_picture(c->pix_fmt, c->width, c->height);
@@ -1053,7 +1053,7 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int
/* not all versions of ffmpeg include that, so here we go ... */
static const AVOption *my_av_find_opt(void *v, const char *name,
- const char *unit, int mask, int flags){
+ const char *unit, int mask, int flags){
AVClass *c= *(AVClass**)v;
const AVOption *o= c->option;
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index d715d18877d..cf3a36419b4 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -201,7 +201,7 @@ static int handle_request(RenderData *rd, char * req)
*p = 0;
if (strcmp(path, "/index.html") == 0
- || strcmp(path, "/") == 0) {
+ || strcmp(path, "/") == 0) {
safe_puts(index_page);
return -1;
}
@@ -287,7 +287,7 @@ int frameserver_loop(RenderData *rd, ReportList *reports)
tv.tv_sec = 10;
tv.tv_usec = 0;
- rval = select(connsock + 1, &readfds, NULL, NULL, &tv);
+ rval = select(connsock + 1, &readfds, NULL, NULL, &tv);
if (rval > 0) {
break;
} else if (rval == 0) {